Pages

Saturday, May 26, 2018

Vibration detection

For an index of all of my stories click this text

I found this neat vibration detector called SW-18010P which just costs a few cents.



As you can see it is a very small sensor almost the height of a paperclip.
This makes it possible to build in secretly in all kinds of objects.

What does it do. Well exactly what the name indicates: it detects vibration. And it is very sensitive. Let's have a look at the inside.


As you can see the interior is very simple. It is a wire that as a matter of speak floats in a coil. So as soon as there is some vibration the wire will touch the coil and current can flow.

When I first received these sensors I thought they were broken. I tried to measure the contacts with a multimeter. However the vibration has such a short timespan that the multimeter is to slow to react on it.

So I decided to set up a test with a Wemos ESP8266 on a breadboard.



As far as I know there is no Fritzing part for this sensor so I used a reed-contact part for the schematics. As you can see the setup is simple.

The sw18010p is connected with a pull-up resistor to pin D2 of the Wemos.


Next I wrote a short program in ESP-Basic to test it.
It is very simple and straightforward and could easily be ported to Arduino code or Lua or whatever your favorite devellopment language is.

interrupt d2, [vibrated]
wait

[vibrated]
print "it moved"
delay 500
wait

Testing the IO port for a change from 1 to 0 could work. I intentionally say could as the vibration can easily be missed as it has a short timespan. Therefore an interrupt works best.


You can easily adapt this for use with an Arduino, Attiny or Raspberry PI or any other microcontroller of your liking.

I have a really good idea for a project with this, so keep coming back. In the mean time here are some ideas for which you could use this sensor:

- a box that reacts on knockin on it
- is the drawer being opened
- is the door being opened
- has my bike moved
- is somebody trying to steal my cookies

I am sure you can think of a few projects yourself. Basically anything that moves can be spied upon.

Till next time
Have fun

Luc Volders