Saturday, 21 December 2013

Sound Sensor with Relay

Creating a "clap on" "clap off" light switch


Because we are using mains power i feel i should give a little warning, the picture below shows cut wires with masking tape covering them, masking tape is not enough protective insulation! This was a quick test done in the middle of the night, as you can probably tell from both wires being cut!


A strange sound sensor i found on amazon code HOT UK05, couldn't find a data sheet for this and hardly any information.

A Cheap version of a SainSmart relay module (4 channel).

An LED for debugging.

And a lamp you can cut the wires to.

Sound sensor

I set the sound sensor as a digital input and adjusted the sensitivity using the onboard potentiometer. That way when sound was detected above a certain threshold the pin was set low and this lit the LED up.

Relay module

Heres a really good website with lots of information about relays.

The Circuit


Using the sensor as a digital input it only has two states, on or off, if i wanted more accurate readings and control i would have to use it as an analoge input.

After programming this i feel alot more confident about checking states, last states then toggling a switch.

No comments:

Post a Comment