Tilt sensor (ball switch, SW-520D)
Tiny ball switch that opens or closes when tilted.
MeasuresTilt (on or off)
InterfaceSwitch contact
Watch out forLow voltage, low current only
SensorsReviewedMPN SW-520DUsed in 7 projects
In short
What is the Tilt sensor (ball switch, SW-520D) and what is it used for?
Tiny ball switch that opens or closes when tilted. Makers use it for tilt alarms, toys.
How it works
A metal ball rolls inside a small tube and bridges two contacts when level.
Key specifications
| Sensor spec | Value |
|---|---|
| Measures | Tilt (on or off) |
| Interface | Switch contact |
| Watch out for | Low voltage, low current only |
Pinout
Lead 1Switch contact
Lead 2Switch contact
How to use it
Wire it like a button with INPUT_PULLUP. It bounces, so debounce in software. It tells only tilted or level, not the angle.
Applications
Tilt alarmstoys
Builds that use it
Alternatives
- ADXL345 accelerometerMeasures the actual tilt angle
Common questions
What is the Tilt sensor (ball switch, SW-520D) used for?
In maker projects: tilt alarms, toys.
How does the Tilt sensor (ball switch, SW-520D) work?
A metal ball rolls inside a small tube and bridges two contacts when level.
How do I connect the Tilt sensor (ball switch, SW-520D) to an Arduino or ESP32?
Switch contact. Pins: Lead 1 (Switch contact), Lead 2 (Switch contact).
What can I use instead of the Tilt sensor (ball switch, SW-520D)?
ADXL345 accelerometer.
