Simple Vibration Sensor
An alarm that sounds when something is shaken: a door knocked, a bicycle moved, a box touched. The sensor is a spring that touches a wire when it vibrates; a capacitor stretches the warning for a few seconds even if the shake is brief.
Bill of materials
Everything you need to build it, with the reference you will see on the schematic.
| Qty | Part | Ref. |
|---|---|---|
| 1 | Spring vibration switch (normally open, closes when shaken) | SW1 |
| 1 | 2.2 kΩ resistor (red-red-red) | R4 |
| 1 | 100 µF electrolytic capacitor | C1 |
| 1 | 10 kΩ resistor (brown-black-orange) | R1 |
| 1 | 100 kΩ resistor (brown-black-yellow) | R2 |
| 1 | BC547 NPN transistor | Q1 |
| 1 | Active buzzer (3 to 24 V) | BZ1 |
| 1 | 470 Ω resistor (yellow-violet-brown) | R3 |
| 1 | red LED | D1 |
| 1 | 9 V battery with snap clip | BT1 |
| 1 | Breadboard (400 tie-points or more) | |
| 9 | Jumper wires |
Missing parts? The kits recommended by Impeca Tech include almost all of them. See the kits
Schematic & wiring
On the left, the circuit diagram; on the right, the same circuit built on a breadboard. Both connect exactly the same things.
Wire it step by step
-
Place the components
- Vibration switch SW1: one leg in 3f and the other in 5f (either way round), with the spring standing upright.
- 2.2 kΩ resistor R4 (bands: red, red, red, gold): one leg in 5i and the other in 8i (either way round).
- 100 µF electrolytic capacitor C1: the leg marked with the stripe and the − sign in 7f and the other leg (+) in 8f. Reversed, it can be damaged.
- 10 kΩ resistor R1 (bands: brown, black, orange, gold): one leg in 9f and the other in 12f (either way round).
- 100 kΩ resistor R2 (bands: brown, black, yellow, gold): one leg in 12g and the other in 15g (either way round).
- BC547 transistor Q1 with the flat face (the one with the text) towards you, left to right: collector (C) in 20f, base (B) in 21f, emitter (E) in 22f.
- Active buzzer BZ1: the long leg (marked +) in 26f and the other leg in 23f. Reversed, it will not sound.
- 470 Ω resistor R3 (bands: yellow, violet, brown, gold): one leg in 16f and the other in 19f (either way round).
- red LED D1: the long leg (+, anode) in 19h and the short leg (−, cathode, flat side) in 20h.
-
Add the jumper wires
- Red wire: from 3j to the + (red) rail.
- Red wire: from 16j to the + (red) rail.
- Red wire: from 26j to the + (red) rail.
- Orange wire: from 8j to 9j.
- Black wire: from 7j to the − (blue) rail.
- Black wire: from 15j to the − (blue) rail.
- Black wire: from 22j to the − (blue) rail.
- Turquoise wire: from 12j to 21j.
- Purple wire: from 20j to 23j.
-
Connect the battery
- Connect the 9 V battery to its clip: the clip’s red lead to the + (red) rail and the black one to the − (blue) rail. Do this last, once everything else is in place.
-
Test the circuit
- Without touching it the buzzer should be silent. Shake the sensor by hand or tap the table: the buzzer sounds and the LED lights. When you stop moving it, the alarm carries on for 2 to 5 seconds and switches off by itself. If it sounds too briefly, shake harder and longer. The capacitor has polarity: the long leg (+) goes towards R4.
How to read the holes: the letter is the row and the number is the column of the breadboard (for example 7f). The red (+) and blue (−) rails are the two long lines along the edge.
How does it work?
- 1At rest the sensor’s spring does not touch the wire: no current flows and all is quiet
- 2When shaken, the spring touches the wire for an instant and charges capacitor C1
- 3C1 hands its charge to the base of Q1, which conducts and turns on the buzzer and LED
- 4The capacitor slowly drains and, after a few seconds, the alarm stops by itself
Sensor SW1 is a vibration switch: a metal wire surrounded by a spring; when shaken, spring and wire touch for instants. Those contacts are extremely brief, so they cannot sound anything on their own: their energy is collected in capacitor C1 (100 µF). R4 (2.2 kΩ) limits the charging current so the sensor’s delicate contacts are not abused (about 4 mA at most). Once charged, C1 drains slowly through R1 (10 kΩ) into the base of Q1 (a BC547), which saturates and lets current flow through the 9 V buzzer and the red LED with its 470 Ω resistor. R2 (100 kΩ) makes sure the base returns to 0 V at the end, so the alarm switches off completely. With a shake of a tenth of a second, the warning lasts 2 to 5 seconds depending on the parts; a longer shake or several in a row stretch it. If you want more time, use a bigger capacitor (for example 220 µF); for less, a smaller one.
Testing & troubleshooting
What you should see
- At rest: no vibration, no sound
- Buzzer currentunder 0.1 mA
- One 0.2 s shake: it sounds for a while, then stops by itself
- Buzzer right after the shake≈ 28 mA
- LED right after the shake≈ 15 mA
- Buzzer 12 s laterunder 0.1 mA
Approximate values, calculated with typical parts. With real parts they can vary by 10 % or more.
If something does not work
It sounds with nobody touching it
The sensor’s spring touches the wire permanently: gently bend the spring a little away, or turn the sensor so it stands almost vertical. It could also be that R2 (100 kΩ) is badly connected and the base “floats”.
It does not sound even when I shake it
Try harder and longer shakes. Check that C1 faces the right way (+ towards R4) and that the 10 kΩ R1 (brown-black-orange) joins C1 to the base of Q1. Change the battery if it is worn.
It sounds but stops too soon
The 100 µF capacitor drains quickly. Fit a 220 µF one (mind the polarity) to stretch the warning, or shake for longer to charge it more.
Want to automate this circuit with code?
Learn how to program sensors and custom schedules in our e-book “Arduino from Scratch”.