Description:

This SW-520D basic tilt switch can easily be used to detect orientation. Inside the can is a ball that make contact with the pins when the case is upright. Tilt the case over and the balls don’t touch, thus not making a connection.

There are numerous uses for these basic sensors, but keep in mind you might need to use some debouncing code, as the sensor isn’t immune to small vibrations and such.

Tilt sensors are essential components in security alarm systems today. Standalone tilt sensors sense tilt angle or movement. Tilt sensors can be implemented using mercury and roller ball technology, and can be mounted using mechanical threading, magnets, or adhesives, depending on what type of surface they are being mounted to.

Feature

Recent technological advancements in the manufacturing of tilt sensors have improved accuracy, reduced cost, and increased lifetime. The type SW-520D is a commonly available roller-ball type tilt sensor consists of two conductive elements (poles) and a conductive free mass (rolling ball), encapsulated in the same case. When the tilt sensor is oriented so that that end is downwards, the mass rolls onto the poles and shorts them, acting as a switch stroke. Microcontroller-compatible tilt sensor modules based on SW-520D are also available at affordable costs.

Electronics circuitry behind this tiny module is usually centered around the dual- comparator chip LM393. The module features a tilt sensor, a signal amplifier, a standard 4-pin header, a power indicator that signals that the module is correctly powered, and a status indicator that lights up when a tilt is detected by the tilt sensor.

This module will output logic LOW when the sensor is tilted below the threshold angle; logic HIGH when it is tilted above the threshold angle. The threshold angle ranges from 45 degree to 130 degree. Aside from threshold angle, angular velocity also affect the tilt module. It can also be used as a vibration sensor!

Example

Example for Arduino:https://www.arduino.cc/en/Tutorial/TiltSensor

Tilt Sensor & MQTT:https://osoyoo.com/2017/05/16/nodemcu-lesson-13-tilt-sensor-mqtt/