PinoutSearch

Tilt Sensor (Ball Switch)

A switch that opens or closes depending on its angle.

How it works

A tilt sensor is a small can with a rolling conductive ball inside. When upright the ball bridges two contacts; tip it past an angle and the ball rolls away, breaking the connection. It's a cheap way to detect orientation, knocks, or shaking.

Read it like a button with INPUT_PULLUP. It's bouncy, so debounce in code (a short delay or check twice).

Pins

Leg 1
To a digital pin (INPUT_PULLUP).
Leg 2
To GND.

Ratings

Output
Digital open/closed
Read
INPUT_PULLUP

Tips

  • It chatters when moved — add a small debounce.
  • Behavior is orientation-dependent; test which way is 'triggered'.