Professional Documents
Culture Documents
er
Accelerometer
An accelerometer is a device
that measures the proper
acceleration of the device.
It is an electromechanical device
that will measure acceleration
forces.
These forces may be static, like
the constant force of gravity
pulling at your feet, or they could
be dynamic - caused by moving
or vibrating the accelerometer.
Conti..
An accelerometer measuresweight per unit of
(test) mass, a quantity also known asspecific
force, org-force.
Most accelerometers do not display the value
they measure, but supply it to other devices.
Conceptually, an accelerometer behaves as a
damped mass on a spring. When the
accelerometer experiences an acceleration, the
mass is displaced to the point that the spring is
able to accelerate the mass at the same rate as
the casing. The displacement is then measured to
give the acceleration.
Conti..
In the computing world, IBM and Apple have
recently started using accelerometers in their
laptops to protect hard drives from damage.
If you accidentally drop the laptop, the
accelerometer detects the sudden freefall, and
switches the hard drive off so the heads don't
crash on the platters.
In a similar fashion, high g accelerometers are the
industry standard way of detecting car crashes
and deploying airbags at just the right time.
Applications
Engineering
Biology
Industry
Building and structural monitoring
Medical applications
Navigation
Transport
And more
Types of Accelerometers
2-Axis Accelerometers
3-Axis Accelerometers
2-Axis Accelerometers
Memsic 2125 Dual-axis
Accelerometer
The Memsic 2125 is a low cost, dualaxis thermal
accelerometer capable of measuring
tilt,
acceleration, rotation, and vibration
with a range
of 3 g. For integration into existing
applications,
the Memsic 2125 is electrically
compatible with
Conti..
Features:
- Measures 3 g on each axis
- Simple pulse output of g-force for each axis
- Convenient 6-pin 0.1" spacing DIP module
- Analog output fo temperature (Tout pin)
- Low current at 3.3 or 5 V operation: less than
4 mA at 5
VDC .
Sample Applications:
-Dual-axis tilt sensing for autonomous robotics
applications
- Single-axis rotational position sensing
- Movement/Lack-of-movement sensing for
alarm
systems
- R/C hobby projects such as autopilots
Key Specifications:
- Power requirements: +3.3 to +5 VDC
- Communication: TTL/CMOS compatible 100
Hz PWM - output signal with duty cycle
proportional to
acceleration
- Dimensions: 0.42 x 0.42 x 0.45 in (10.7 x
10.7 x 11.8
mm)
- Operating temp range: 32 to +158 F (0 to
+70 C)
3-axis accelerometer
Triple-axis accelerometer
with 3 analog outputs for X,
Y and Z axis measurements
on a 0.75"x0.75" breakout
board.
MMA7260 is 3-axis
accelerometer and measure
the accelerations in X Y and
Z axis with range +-1.5 g to
6 g.
Conti..
Features
-Selectable Sensitivity (1.5g/2g/4g/6g)
Typical Applications
-HDD MP3 Player: Freefall Detection
-Laptop PC: Freefall Detection, Anti-Theft
-Cell Phone: Image Stability, Text Scroll, Motion Dialing,
E-Compass
-Pedometer: Motion Sensing
-PDA: Text Scroll
-Navigation and Dead Reckoning: E-Compass Tilt
Compensation
-Gaming: Tilt and Motion Sensing, Event Recorder
-Robotics: Motion Sensing
How to use
In Accelerometer we can read the change in
output values corresponding to the change in Xaxis, Y-axis and Z-axis.
Connect these PINS to the ADC pins of Atmega8.
The varying output at the pins is reflected to ADC
and the converted digital values can be displayed
on LCD display.
Calibration of the accelerometer can be done by
giving the reference values in programs
char buffer[5];
int ReadADC(uint8_t ch)
{
ADC=0;
//Select ADC Channel ch must be 0-7
ADMUX = ADMUX & 0b11100000;
ch=ch&0b00000111;
ADMUX|=ch;
//Start Single conversion
ADCSRA |= (1<<ADSC);
//Wait for conversion to complete
while(!(ADCSRA&(1<<ADIF)));
//Clear ADIF by writing one to it
ADCSRA|=(1<<ADIF);
return(ADC);
}
void initADC()
{
ADMUX=(1<<REFS0); // For Aref=AVcc;
ADCSRA=(1<<ADEN)|(1<<ADIE)|(1<<ADPS2)|(1<<ADPS1)
|(1<<ADPS1); //Prescalar div factor =128
}
void wait(float x)
{
int i;
for(i=0;i<(int)(61*x);i++)
_delay_loop_2(0);
}
int main()
{
//DDRC=0x00;
DDRB=0xFF;
lcd_init(LCD_DISP_ON);
lcd_clrscr();
initADC();
int x=0,y=0,z=0, range=30;
while(1)
{
x=ReadADC(0);
y=ReadADC(1);
z=ReadADC(2);
lcd_gotoxy(0,0);
sprintf(buffer,"x=%4d, y=%4d,\nz=%4d
lcd_puts(buffer);
",x,y,z);
if((x>(X_STOP-range))&&(x<(X_STOP+range))&&(y>(Y_STOPrange))&&(y<(Y_STOP+range))&&(z>(Z_STOPrange))&&(z<(Z_STOP+range)))
{
PORTB=0b00000000;// stop
lcd_gotoxy(8,1);
lcd_puts("STOP");
}
if((x>(X_FORWARDrange))&&(x<(X_FORWARD+range))&&(y>(Y_FORWARDrange))&&(y<(Y_FORWARD+range))&&(z>(Z_FORWARDrange))&&(z<(Z_FORWARD+range)))
{
PORTB=0b00100100; //forward
lcd_gotoxy(8,1);
lcd_puts("FRWD");
}
if((x>(X_BACKWARDrange))&&(x<(X_BACKWARD+range))&&(y>(Y_BACKWARDrange))&&(y<(Y_BACKWARD+range))&&(z>(Z_BACKWARDrange))&&(z<(Z_BACKWARD+range)))
{
PORTB=0b00011000; // back
lcd_gotoxy(8,1);
lcd_puts("BACK");
}
if((x>(X_LEFT-range))&&(x<(X_LEFT+range))&&(y>(Y_LEFTrange))&&(y<(Y_LEFT+range))&&(z>(Z_LEFTrange))&&(z<(Z_LEFT+range)))
{
PORTB=0b00000100; // left
lcd_gotoxy(8,1);
lcd_puts("LEFT");
}
if((x>(X_RIGHTrange))&&(x<(X_RIGHT+range))&&(y>(Y_RIGHTrange))&&(y<(Y_RIGHT+range))&&(z>(Z_RIGHTrange))&&(z<(Z_RIGHT+range)))
{
PORTB=0b00100000; // right
lcd_gotoxy(8,1);
lcd_puts("RIGHT");
}
wait(.1);
lcd_clrscr();
}
return 0;
}
Thank you