Monday 22 August 2016

The clap detector circuit

My DAVE robots have a breadboard attached to the top deck by velcro tape. Electronic circuits for sensors are built on this breadboard and these give the robot its sense of the world around it.

The circuit below is a sound sensor that reacts to loud noises like a handclap by producing an electronic pulse. An electret microphone picks up the sound and an LM386 amplifier boosts the signal. This signal triggers a 555 timer which turns the messy analogue signal into a single clean digital pulse.

The circuit runs off a 9V PP3 battery so it gets a clean voltage without the electrical noise created by the motors, which would ruin the amplification. 

The micro:bit buttons are pull-down switches, which makes interfacing to circuits of higher voltages very simple. Our BC337 transistor does the same job as the switch, pulling down to the 0V rail. You do need to be careful that your breadboard to BTN_A wire does not connect to the 9V supply of the breadboard! This could damage your micro:bit. 

The pulses from this circuit are counted by MicroPython code which carries out different actions depending on the number of command claps it hears. You can find the code here:

https://www.microbit.co.uk/pvlxqg