TINKER PiEDESIGN IN INDIA

Tilt switch SW-520D with TinkerPie

A ball inside a tube: fall alarms, tilt toys.

TypeDigital sensors
Connect toany accessory pin (switch to GND)
Givestrue when tipped over
SimulatorYes: a control appears under the simulated board

How it works

The SW-520D has a small metal ball inside a tube. When the switch tilts, the ball rolls and opens or closes the contacts. It is a simple, cheap way to notice tipping or falling.

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.tiltSwitch(Pin.S1)

// Arduino C++
sensors::tiltSwitch(Pin::S1)

Good to know

Try it in TinkerPie Studio

Similar modules

More projects to try

Questions

Can I try the Tilt switch SW-520D 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 a tilt switch measure the angle?

No, it is only on or off. To measure angles, use the accelerometer on the TinkerPie board or the MPU6050.