Vibration sensor SW-420 with TinkerPie
Feels knocks and shaking: earthquake detectors, knock locks.
| Type | Digital sensors |
|---|---|
| Connect to | any accessory pin |
| Gives | true while shaking |
| Simulator | Yes: a control appears under the simulated board |
How it works
The SW-420 has a tiny spring contact that opens and closes when it is shaken. A comparator chip and a blue knob turn those flickers into a clean signal while it vibrates.
How to wire it
Signal (DO / OUT / S) to any accessory pin: S1-S4, P10-P13, P43 or P44. Power from 3.3 V where the module allows it.
Code
In blocks: Accessories category in TinkerPie Studio. As code:
// JavaScript
sensors.vibration(Pin.S1)
// Arduino C++
sensors::vibration(Pin::S1) Good to know
- Turn the blue knob to set how strong a shake is needed.
- Fix it firmly to the surface you want to watch.
- Count pulses to measure how long or how strong a shake is.
Projects with the Vibration sensor SW-420
Similar modules
- PIR motion sensor HC-SR501
- IR obstacle sensor
- Touch sensor TTP223
- Push button module
- Tilt switch SW-520D
- Reed switch (magnet)
- Hall effect sensor A3144
- Line tracker TCRT5000
More projects to try
Questions
Can I try the Vibration sensor SW-420 without buying one?
Yes. In TinkerPie Studio the simulator shows a control for it under the board, so you can test your program before you build it.
Can it detect real earthquakes?
It detects shaking near it, which is great for learning how seismometers work. Real earthquake stations use very sensitive, calibrated instruments.