

A tilt switch is a type of sensor designed to detect the orientation or angle of an object. It operates by using a conductive element, such as a ball or mercury, inside a sealed container. When the switch is tilted beyond a specific angle, the conductive element moves, either closing or opening the circuit. This simple yet effective mechanism makes tilt switches ideal for applications requiring motion or position detection.








Below are the general technical specifications for a tilt switch (Manufacturer Part ID: 999):
| Parameter | Value | 
|---|---|
| Operating Voltage | 3.3V to 5V | 
| Maximum Current | 20mA | 
| Contact Resistance | < 10Ω (when closed) | 
| Insulation Resistance | > 10MΩ (when open) | 
| Operating Angle | Typically 15° to 45° | 
| Response Time | Instantaneous | 
| Operating Temperature | -20°C to 70°C | 
| Dimensions | Varies by model (e.g., 10mm x 5mm) | 
The tilt switch typically has two pins, as described below:
| Pin | Description | 
|---|---|
| Pin 1 | Connected to the positive voltage (VCC) or input signal | 
| Pin 2 | Connected to ground (GND) or output signal | 
Basic Connection:
Debouncing:
Example Circuit:
Below is an example of how to use a tilt switch with an Arduino UNO:
// Tilt Switch Example Code for Arduino UNO
// This code reads the state of a tilt switch and turns on an LED when tilted.
const int tiltSwitchPin = 2; // Pin connected to the tilt switch
const int ledPin = 13;       // Pin connected to the onboard LED
void setup() {
  pinMode(tiltSwitchPin, INPUT); // Set tilt switch pin as input
  pinMode(ledPin, OUTPUT);       // Set LED pin as output
  digitalWrite(ledPin, LOW);     // Ensure LED is off initially
}
void loop() {
  int tiltState = digitalRead(tiltSwitchPin); // Read the tilt switch state
  if (tiltState == HIGH) {
    // If the tilt switch is tilted, turn on the LED
    digitalWrite(ledPin, HIGH);
  } else {
    // If the tilt switch is not tilted, turn off the LED
    digitalWrite(ledPin, LOW);
  }
}
Tilt Switch Not Responding:
Unstable or Noisy Readings:
Switch Always Reads as Closed or Open:
Microcontroller Not Detecting State Changes:
Q: Can I use a tilt switch with a 3.3V system?
A: Yes, most tilt switches operate within a range of 3.3V to 5V. Check the specific model's datasheet for confirmation.
Q: How do I know the operating angle of my tilt switch?
A: The operating angle is typically specified in the datasheet. For most switches, it ranges between 15° and 45°.
Q: Can I use a tilt switch in high-vibration environments?
A: Tilt switches are not ideal for high-vibration environments, as vibrations can cause false triggering. Consider using a gyroscope or accelerometer for such applications.
Q: Is a mercury-based tilt switch safe to use?
A: Mercury-based tilt switches are less common due to safety and environmental concerns. If using one, handle it carefully and dispose of it properly if damaged.