
1. Product Introduction #
The Tilt Sensor, also known as the inclination sensor or level gauge, is an instrument used to measure the angle of an object’s inclination relative to the horizontal plane or the direction of gravity. It is based on the principle of inertial measurement and calculates the inclination angle by sensing changes in the component of gravitational acceleration. It can achieve high-precision angle measurement.
It is widely used in various fields such as industrial automation, construction machinery, structural health monitoring, robot navigation, and smart cities, for angle monitoring, safety warning, and automatic control.
2. Parameter Specification #
| Parameters | Value/Description |
|---|---|
| Operating voltage | 3.3V~5V |
| Operating temperature | -20°C~+70°C |
| Output signal | Digital signal |
| Size | 3.16cm*2.38cm |

3. Wiring Diagram #
Note:Expansion board is attached to esp32 controller board.

| Tilt Sensor | ESP32 |
|---|---|
| VCC | 5V |
| GND | GND |
| Sign | Pin 5 |
4. Sample Code #
void loop() {
int state = digitalRead(TILT_PIN); Serial.println(state); // Sensor is triggered delay(300);
}
#define TILT_PIN 5 // Digital pin connected to tilt sensor void setup() {
pinMode(TILT_PIN, INPUT_PULLUP); // Enable pull-up; LOW when triggered (depending on wiring)
Serial.begin(115200); // Start serial monitor
}
5. Test Results #
After uploading the code to the controller board, open the serial port monitor of the Arduino IDE, set the baud rate to 115200, and switch to the scroll mode.
When we tilt the sensor, it returns data 1; when we place it flat, it returns data 0.When the sensor is tilted, the value is 1.
When the sensor is placed flat, the value is 0.

