Clap detection (or any other loud sound?) #6164
Replies: 1 comment
-
Posted at 2019-06-24 by @gfwilliams Hi! Yes, totally - there are various ways to do it, but by far the easiest would be to buy a microphone module that does it for you. Something like: https://www.ebay.co.uk/itm/Sound-Detection-Sensor-Module-Electret-Condenser-Microphone-Arduino-PIC-Pi-LM393/273149595283 The blue potentiometer on there can be tweaked to choose how sensitive it is, then all you need to do is use Posted at 2019-06-24 by BootySnorkeler Is the potentiometer the only way to set the trigger volume threshold(the volume needed to trigger a function)? Or can I edit it in software? I really want to use only the mic without any other components. Posted at 2019-06-24 by Robin Mon 2019.06.24
Without an op-amp of some kind, I don't believe there will be sufficient amplification (est micro-volts) from the tiny mic output, and possibly an impedance mismatch also. Trying to capture without that or a latch circuit, will hamper success. Even the A-D requires 700uv for a single digit. http://www.espruino.com/ADC Do you have access to a scope to look at the mic output? If so, what is the range? If not, a spec/datasheet? Posted at 2019-06-24 by maze1980 Do you want the uC to detect the clap (sampling the audio all time) or do you want the sleeping uC be woken up by an interrupt triggered by the microphone? Posted at 2019-06-24 by BootySnorkeler
@robin I don't have a scope.
@maze1980 I want the sleeping uC to be triggered by the mic interrupt. Posted at 2019-06-25 by @allObjects @barry_b_benson, take a look at this pub https://pub.tik.ee.ethz.ch/students/2013-FS/GA-2013-03.pdf - also attached as pdf. What I notice is that many clap switches need two claps for one toggle. All switches use some kind of amplifier to create a sufficient voltage top get digital electronics triggered... (as @robin points out). Attached schema seems quite simple - 3 resistors, 1 capacitor and a single transistor. The reference is found in the initial pub in the literature summary, and is http://embedded-lab.com/blog/making-a-simple-clap-switch/ Attachments: Posted at 2019-06-25 by Robin Nice find @allObjects, Hum along . . . Clap On, . . . Clap Off and they are still sold, forty years later!!
Quite a simple circuit, isn't it. 1985
Posted at 2019-06-25 by @gfwilliams We'd really need to know just how much voltage you get from the microphone when there's a clap before we know if it can be connected directly. @allObjects solution looks great if you can't connect direct though. You could keep checking the analog value, but that's going to use a whole bunch of power - so using a battery won't then be a very viable option. Bluetooth Espruinos do have a 'low power comparator' which can work to 1/16th of the supply voltage (or can compare to the voltage on pins D2 or D3): http://www.espruino.com/NRF52LL So you could set that up - although the current solution in Espruino will require you to use two pins connected together so that you can then use Posted at 2019-06-25 by maze1980
https://www.espruino.com/Reference#l_ESP8266_deepSleep says you must pull down the RST pin, i.e. the mic alone will not work, and the clap detector circuit above doesn't work (0V output, with 5V peaks during claps), the signal is inverted. Posted at 2019-06-25 by Robin Tue 2019.06.25
Solve by adding an additional transitor inverter at the tail end. See 'Digital Logic' half way down page:
Posted at 2019-06-26 by @gfwilliams @maze1980, @barry_b_benson was asking about how to do this with an Espruino MDBT42Q - these have significantly better sleep/wake arrangements than the ESP8266 does (which effectively just shuts itself down losing the contents of RAM and then has to be rebooted) . |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2019-06-24 by BootySnorkeler
Hey y'all,
Is it possible to connect a simple two-pin electret microphone to an Espruino microcontroller and program the uC to wake on a loud sound, like a clap or snapping of a finger? I can't find any resources regarding microphones in the Espruino website, or anywhere else. I don't think it would be hard at all, I'm just not sure if there's a way yet. I'm using an MDBT42Q module, if it helps.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions