An accelerometer, which is an electromechanical device, can be used for various applications like tilt detection, obstacle detection, motion inputs, earthquake sensing, etc. Tilt detection is a simple application of an accelerometer where a change in angular position of the system in any direction is detected and indicated through four LEDs. An Arduino Uno board is used to process the data received from the accelerometer and switch on the corresponding LED to indicate the direction of tilt. Fig. 1 shows the author’s prototype and Fig. 2 shows the detector’s block diagram.
Fig. 1: Author’s prototype
Circuit and working
Fig. 3 shows the circuit for the tilt detector. It only requires an Arduino Uno board (Board1), an accelerometer module and few other components.
An accelerometer measures acceleration of anything that it is mounted on. The accelerometer module used here is based on ADXL335 triple-axis accelerometer from Analog Devices. The sensor has a full sensing range of ±3 g.
Fig. 2: Block diagram
Arduino Uno board
Arduino is an open source electronics prototyping platform based on flexible, easy-to-use hardware and software. It is intended for artists, designers, hobbyists and anyone interested in creating interactive objects or environments. Arduino Uno is a board based on ATmega328 microcontroller. It consists of 14 digital input/output pins, six analogue inputs, a USB connection for programming the on-board microcontroller, power jack, an ICSP header and a reset button. It is operated with a 16MHz crystal oscillator and contains everything needed to support the microcontroller. It is very easy to use as the user simply needs to connect it to a computer with a USB cable, or power it with an AC-to-DC adaptor or battery to get started. The microcontroller on the board is programmed in Arduino programming language using Arduino development environment.
Fig. 3: Circuit of tilt detector
Pins A0 through A5 of Board1 are connected to pins ST, Z-axis, Y-axis, X-axis, GND and Vcc of the accelerometer module, respectively. The Vcc and GND to the accelerometer module are provided by logic levels at pins A5 and A4. The microcontroller of Board1 receives data for X, Y and Z axes from the accelerometer at pins A3, A2 and A1, respectively. This data is continuously compared with predefined values for each axis. If the received value for any axis crosses the predefined value, a corresponding LED is lit. If the angular tilt is within the threshold limit for each direction, the central LED (red) will glow. Pins 8 through 12 of Board1 are connected to LEDs as shown in Fig. 3.