+ All Categories
Home > Technology > Accelerometer 1

Accelerometer 1

Date post: 06-Jul-2015
Category:
Upload: er-sumit-balguvhar
View: 454 times
Download: 2 times
Share this document with a friend
27
Learn about Accelerometer The Indian Way - Low Cost and Quick
Transcript
Page 1: Accelerometer 1

Learn about Accelerometer• The Indian Way - Low Cost and Quick

Page 2: Accelerometer 1

Accelerometer

Page 3: Accelerometer 1

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.

Page 4: Accelerometer 1

Conti..

• An accelerometer measures weight per unit of (test) mass, a quantity also known as specific force, or g-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.

Page 5: Accelerometer 1

What are accelerometers useful for?• By measuring the amount of static acceleration due to gravity,

you can find out the angle the device is tilted at with respect to the earth.

• By sensing the amount of dynamic acceleration, you can analyze the way the device is moving.

• An accelerometer can help your project understand its surroundings better.

Page 6: Accelerometer 1

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.

Page 7: Accelerometer 1

Applications

• Engineering

• Biology

• Industry

• Building and structural monitoring

• Medical applications

• Navigation

• Transport

• And more…

Page 8: Accelerometer 1

Types of Accelerometers• 2-Axis Accelerometers

• 3-Axis Accelerometers

Page 9: Accelerometer 1

2-Axis Accelerometers• Memsic 2125 Dual-axis Accelerometer

The Memsic 2125 is a low cost, dual-axis 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

other popular accelerometers.

Page 10: Accelerometer 1

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 .

Page 11: Accelerometer 1

• 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

Page 12: Accelerometer 1

• 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)

Page 13: Accelerometer 1

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.

Page 14: Accelerometer 1

Conti..

• Features-Selectable Sensitivity (1.5g/2g/4g/6g)-Low Current Consumption: 500 μA-Sleep Mode: 3 μA-Low Voltage Operation: 2.2 V – 3.6 V-6mm x 6mm x 1.45mm QFN-High Sensitivity (800 mV/g @ 1.5g)-Fast Turn On Time-Integral Signal Conditioning with Low Pass Filter-Robust Design, High Shocks Survivability-Pb-Free Terminations-Low Cost

Page 15: Accelerometer 1

• 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

Page 16: Accelerometer 1

How to use

• In Accelerometer we can read the change in output values corresponding to the change in X-axis, 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

Page 17: Accelerometer 1

Interfacing Accelerometer with AVR Microcontrollers

#define F_CPU 8000000UL

#include <avr/io.h>

#include <avr/interrupt.h>

#include<util/delay.h>

#include"lcd.h"

#include"lcd.c"

#define X_FORWARD 450

#define Y_FORWARD 380

#define Z_FORWARD 430

#define X_BACKWARD 320

#define Y_BACKWARD 380

#define Z_BACKWARD 440

Page 18: Accelerometer 1

#define X_RIGHT 380

#define Y_RIGHT 330

#define Z_RIGHT 440

#define X_LEFT 380

#define Y_LEFT 450

#define Z_LEFT 430

#define X_STOP 380

#define Y_STOP 382

#define Z_STOP 460

Page 19: Accelerometer 1

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);

}

Page 20: Accelerometer 1

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);

}

Page 21: Accelerometer 1

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 ",x,y,z);

lcd_puts(buffer);

Page 22: Accelerometer 1

if((x>(X_STOP-range))&&(x<(X_STOP+range))&&(y>(Y_STOP-

range))&&(y<(Y_STOP+range))&&(z>(Z_STOP-

range))&&(z<(Z_STOP+range)))

{

PORTB=0b00000000;// stop

lcd_gotoxy(8,1);

lcd_puts("STOP");

}

if((x>(X_FORWARD-

range))&&(x<(X_FORWARD+range))&&(y>(Y_FORWARD-

range))&&(y<(Y_FORWARD+range))&&(z>(Z_FORWARD-

range))&&(z<(Z_FORWARD+range)))

{

PORTB=0b00100100; //forward

lcd_gotoxy(8,1);

lcd_puts("FRWD");

}

Page 23: Accelerometer 1

if((x>(X_BACKWARD-

range))&&(x<(X_BACKWARD+range))&&(y>(Y_BACKWARD-

range))&&(y<(Y_BACKWARD+range))&&(z>(Z_BACKWARD-

range))&&(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_LEFT-

range))&&(y<(Y_LEFT+range))&&(z>(Z_LEFT-

range))&&(z<(Z_LEFT+range)))

{

PORTB=0b00000100; // left

lcd_gotoxy(8,1);

lcd_puts("LEFT");

}

Page 24: Accelerometer 1

if((x>(X_RIGHT-

range))&&(x<(X_RIGHT+range))&&(y>(Y_RIGHT-

range))&&(y<(Y_RIGHT+range))&&(z>(Z_RIGHT-

range))&&(z<(Z_RIGHT+range)))

{

PORTB=0b00100000; // right

lcd_gotoxy(8,1);

lcd_puts("RIGHT");

}

wait(.1);

lcd_clrscr();

}

return 0;

}

Page 25: Accelerometer 1

Thank you…

Page 26: Accelerometer 1

About Open.Embedded

This is an initiative of group of professionals, students and hobbyists to share their knowledge among others using low cost open source software.

We think it criminal when students are taught 8085 and 8051 in college when world is moving forward and technology changes are happening every where in the world.

Join us at facebook.com/open.embedded

Buy low cost kits at stores.ebay.in/openembedded

Page 27: Accelerometer 1

MADE BY

SUMIT BALGUVHARM.TECH-EMBEDDED SYSTEM TECHNOLOGY


Recommended