Shares

Guide for the Tilt Sensor (inclinometer) with Arduino

Shares

This post shows how to use the tilt sensor module with the Arduino. The tilt sensor is many times referred to as inclinometer, tilt switch or rolling ball sensor. Using a tilt sensor is a simple way to detect orientation or inclination.

Introducing the Tilt Sensor Module

The tilt sensor module is the one in the following figure.

dsc09409

The tilt sensor allows to detect orientation or inclination. It detects if the sensor is completely upright or if it is tilted.

This makes it very useful to be used, for example, in toys, robots and other appliances whose working methodology depends on inclination.

How does it work?

The tilt sensor is cylindrical and contains a free conductive rolling ball inside with two conductive elements (poles) beneath.

tilt-sensor-how-it-works

Here’s how it works:

  • When the sensor is completely upright, the ball falls to the bottom of the sensor and connects the poles, allowing the current to flow.
  • When the sensor is tilted, the ball doesn’t touch the poles, the circuit is open, and the current doesn’t flow.

This way, the tilt sensor acts like a switch that is turned on or off depending on its inclination. So, it will give digital information to the Arduino, either an HIGH or a LOW signal.

Where to buy?

Tilt sensors are very simple and cheap modules. You can buy one on eBay for less than $2 (View on eBay).

Pin wiring

Wiring the tilt sensor to you Arduino is pretty straightforward. You just need to connect one pin to an Arduino digital pin and GND to GND.

If you connect the sensor like so, you need to activate the arduino internal pull-up resistor for the digital pin to which your sensor is connected to. Otherwise, you should use a 10kOhm pull up resistor in your circuit.

pin-wiring_bb

Example: Tilt sensitive LED

This is just a simple example for you to start put hands on your tilt sensor.

In this example, an LED will be turned off if the sensor is upright, and will be turned on if the sensor is tilted.

Parts required

Schematics

For this example, you just need to add an LED to the schematics in the “Pin Wiring” section.

tilt-sensitive-led_bb

Code

To complete this example, upload the following code to your Arduino board.

Demonstration

In the end, this is what you’ll have.

tilt-sensor-gif

Wrapping up

I hope you’ve found this post useful.

If you would like to know more about Arduino sensors, make sure you check some of the following guides:

Thanks for reading,

Rui and Sara

Leave a Comment: