Requirements
- AtMega 16 IC /development board
- 2. 3-Axis accelerometer
- 3. LCD screen 16X2 (for displaying X, Y and Z data)
Description
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.
Accelerometer
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
Analog/Digital Converter
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).
You may also like:
Project Source Code
###
#include
#include
#include
#include
void main()
{
int adc0;
ADCinit();
LCDinit();
LCDclr();
LCDcursorOFF();
char ch[16];
while(1)
{
adc0=read_adc(0); //reading X axis data
sprintf(ch,"X: %d",adc0); //converting int to char
LCDGotoXY(0,0);
LCDdisplay(ch);
LCDsendChar(' ');
adc0=read_adc(1); //reading Y axis data
sprintf(ch,"Y: %d",adc0);
LCDGotoXY(0,10);
LCDdisplay(ch);
LCDsendChar(' ');
adc0=read_adc(2); //reading Z axis data
sprintf(ch,"Z: %d",adc0);
LCDGotoXY(1,5);
LCDdisplay(ch);
LCDsendChar(' ');
_delay_ms(500); //a half-second delay
}
}
###
Circuit Diagrams
Project Video
Filed Under: Electronic Projects
Filed Under: Electronic Projects
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.