This is an arduino tilt sensor. It is used to detect orientation. Inside the sensor, there is a ball that make contact with the pins when the case is upright. Tilt the sensor over and the balls don’t touch, thus not making a connection.
Here is the principle of tilt sensor to illustrate how it works:
Simple plug to our Arduino IO Sensor Expansion Shield, you can make amazing interactive projects.
As this sensor is now woking under 3.3V, it is now able to be compatible with Raspberry Pi. An Arduino Shield for Raspberry Pi B+/2B/3B will make it easy to use.