This project was intended as a prank; when I was thinking about the uses of a knock sensor I thought it would be funny to use it to make a doorbell. The thing you see is a small box that produces a funny chirping noise when you knock or shake it. It is intended to be attached to a door, or some other moving object. Not really an Arduino project since it uses only basic electronic components, but still it was quite entertaining to make and it’s a chance to have fun with analog electronics!
- a 6x4cm PCB (2.36″ x 1.578″) (obtained by cutting a bigger PCB)
- one CR2032 coin cell battery
- a ghetto coin cell battery holder… made out of a binder clip and some insulating tape
- a KY031 knock sensor
- a 470uF capacitor (the bigger the better, basically)
- an active 5V buzzer
- a very small project box I couldn’t find another use for (8x5x2cm, or 3.1x2x0.8″)
- wire and soldering iron
The circuit itself is very simple. When you bump the knock sensor, the circuit closes; the capacitor is charged (very quickly) and then slowly discharges thru the buzzer. Note that the knock sensor usually has a digital output/pull-up pin which I’m not using: the 10k resistor it has attached would make the capacitor charge too slowly.
The assembly is quite straightforward or in other words I forgot to take pictures of the process.
This is the final circuit. As you can see I used a binder clip for lack of a better coin cell holder… I stole the idea from here. Then I soldered the clip to the PCB. I tried to leave some room in front of the battery to make replacement easier. The cables go from the battery to the back.
The wires on the back make the soldering quite easy. Just solder the knock sensor in series to everything else (green wire – going to ground on the other side), and the capacitor and buzzer (bottom left) together in parallel. Double check the capacitor polarity (red wire goes to Vcc on the other side). I used velcro to attach the PCB to the box; very handy if you, like me, never have available screws of the right size.
The box is just of the right size for the half PCB.
They couldn’t fit any better.
As I mentioned, the box is very small, almost matchbox-sized. The idea is to glue it (maybe with velcro, I like that stuff) to a door or another moving object you want to produce a “pew” sound when you knock or move it.
Some things I learned today:
- Maybe I should buy a proper coin cell holder.
- If nothing else, I should have mounted the ghetto holder the other way around.
- Wires are best cut at the exact length you need them.
- The KY031 is REALLY poorly sensitive, you have to shake it really hard. They should call it the car crash sensor or the ground-reached-after-freefall sensor or the shake-as-hard-as-you-can sensor or something. It has a very very precise impact angle at which it is somewhat sensitive. I should get a more sensitive vibration sensor, I’ve been looking around and afaik you have these alternatives:
- a SW-18010; yes I should point to the datasheet but according to this YouTube video it doesn’t look significantly more sensitive than the KY031. (the SW-18030 should be even less sensitive, and I couldn’t find much about the SW-58010).
- a KY002, but it looks to be a PCB with a sw-18015 mounted on it.
- a 801S, but it looks somewhat more costly and not usable as a switch.
- a HDX2 (also called SW-420 or HDX1 (??)), it looks very sensible according to YouTube but it’s “normally closed”; this would require some signal conditioning and more power consumption.
Anyway, the final result for this article is this weird bleeping thing! I hope you enjoyed it!