- AtMega 16 IC /development board
- 2. 3-Axis accelerometer
- 3. LCD screen 16X2 (for displaying X, Y and Z data)
This project makes use of three out of eight ADCs present in AtMega16 IC to display the corresponding digital data of X, Y and Z outputs of an accelerometer on 16X2 LCD.
First let’s talk about the Accelerometer IC; here I have used ADXL-335 which is a 3-axis accelerometer module.
Fig. 1: Image of ADXL335 Accelerometer Module
There are 8 independent ADCs which share their pins with that of PORTA. These ADCs are 10 bit which simply means that they can convert a given analog value into its corresponding 10-bit digital data.
Before moving ahead we should first discuss what ADCs are. ADC stands for Analog to Digital Converter. We all know that microcontrollers work only on digital values, but what if we need to interact with analog devices or values. In such situations we need a device which can work as communicator between the analog part and digital part. ADCs (analog to digital converter) play the same game; they convert the analog values to digital one by some means of reference (Vref).
Project Source Code
adc0=read_adc(0); //reading X axis data
sprintf(ch,"X: %d",adc0); //converting int to char
adc0=read_adc(1); //reading Y axis data
adc0=read_adc(2); //reading Z axis data
_delay_ms(500); //a half-second delay