Pages: [1]   Go Down
Author Topic: Single Axis Accelerometer Breakout Board - ADXL193 +/-250g  (Read 219 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I need some help with this sensor. I can't seem to find any sample code and also am not an experienced programmer. If anyone has some sample code for this sensor your help would be appreciated.
Logged

Narvik, Norway
Offline Offline
God Member
*****
Karma: 23
Posts: 974
electronics engineer, teacher.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sensor output goes to an anlog input.
Read the datasheet..: It says ouput is 8mV/g
Code:
float a;

void setup()
{
Serial.begin(9600);
}

void loop()
{
 a = (analogRead(A0)-511) * 4.8875855 ; //millivolt
 // 5/1023=0,0048875855 V/step
 a = a / 8; // 8mV/g
 // all calc can be done in one calculation
 Serial.println(a,2); // G-value
 // shoud be 0 when not moving
 // expect small values when 'shaking'
}
« Last Edit: February 16, 2014, 02:31:06 pm by knut_ny » Logged

Ny

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you have code that I could try to use?
Logged

Narvik, Norway
Offline Offline
God Member
*****
Karma: 23
Posts: 974
electronics engineer, teacher.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Read datasheet to find if ST shoud be wired hi og low.
Data out to A0 to match example..
Logged

Ny

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks, I am still getting negative values. Im not sure as to why this is happening
Logged

Narvik, Norway
Offline Offline
God Member
*****
Karma: 23
Posts: 974
electronics engineer, teacher.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

small nes is OK .
Change the numer 511 up/down a litte till you get 0 out when still.
Logged

Ny

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks it works now. It moves about 1-2 everytime I shake it. Is this expected? thanks for your help.
Logged

Narvik, Norway
Offline Offline
God Member
*****
Karma: 23
Posts: 974
electronics engineer, teacher.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK... you mangage to shake it with 2G..
Tap it on the table.. you'll reach 10G+ (if program reads at the right momemt)

This sensor is best used to measure akseleration in rockets at launch..
..or inn collision tests
Logged

Ny

Pages: [1]   Go Up
Jump to: