Pages: [1]   Go Down
Author Topic: ADXL355 Lilypad Calculating Acceleration - Help  (Read 1284 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I have a Lilypad Accelerometer ADXL355 and a Lilypad ATmega 328.  I have written some code to get LEDs to fade in and out according to tilt on the x and y axis.

My next challenge is go calculate acceleration.  I want to create an outfit for a dancer and when they move fast I want red lights to come on. When they are going at a medium speed, I want green lights to come on.  When they are moving slowly I want blue lights to come on. 

I am a real newbie and don't really know where to start in order to calculate the acceleration.  I figure I need a formula for translating the analog values into g force and another for calculating the difference in g force between stationary and movement at different speeds.

Help Please!!!
Logged

0
Offline Offline
Shannon Member
****
Karma: 117
Posts: 10102
:(){:|:&};: TOX id: fcb8e918bef08581e23f6ddf9d4dba77697c25b217bf372736ed959a95fde36df5b8c5b90fbb
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

you know when accelerometer are stationary it will output only 1G on the Y axes..
so read the G for every axes, look if it is enought linear (put x, y at 45° respect ground and see if sqrt(x*x+y*y) are similar to the "free" reading)
then you know the G value smiley
Logged

my Arduino code: https://github.com/lestofante/arduinoSketch
sei nuovo? non sai da dove partire? leggi qui: http://playground.arduino.cc/Italiano/Newbie

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

Thanks Lesto.

I'm sorry, I'm still pretty confused I am very new to this.  When the accelerometer is stationary shouldn't the output be 0g? 

At the moment when I read the data from the sensor when it is stationary and flat I am getting readings of about:  x: 512, y: 512, z: 612.

I want to know how to convert this analog data to g's. It seems so simple, however after much hunting I am still unsure.


Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24298
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I'm sorry, I'm still pretty confused I am very new to this.  When the accelerometer is stationary shouldn't the output be 0g? 

No, because some part of it will be racing towards the centre of the Earth.
Or it would be, if the Earth weren't in the way.

If your accelerometer is not exactly at right angles to the perpendicular (which came after Norman, IIRC), then there will be a component of acceleration due to gravity.

Presumably, dangling an accelerometer arbitrarily on a frock, it is going to be difficult to keep it level at all times, so you need to work out which way is down.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

0
Offline Offline
Shannon Member
****
Karma: 117
Posts: 10102
:(){:|:&};: TOX id: fcb8e918bef08581e23f6ddf9d4dba77697c25b217bf372736ed959a95fde36df5b8c5b90fbb
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Lesto.

I'm sorry, I'm still pretty confused I am very new to this.  When the accelerometer is stationary shouldn't the output be 0g?  

At the moment when I read the data from the sensor when it is stationary and flat I am getting readings of about:  x: 512, y: 512, z: 612.

I want to know how to convert this analog data to g's. It seems so simple, however after much hunting I am still unsure.

as you can see, on the Z axis you're reading the G (gravity). Your accelerometer seem better than mine, because X==Y, that's a very good output, just try to read G on the X and Y axes to see if the value are the same...
if so:
we can say the zero offset is 512
and we can say 612-512 = 100 = 1G

it was easy, no? smiley-grin
« Last Edit: April 05, 2011, 04:00:11 am by lesto » Logged

my Arduino code: https://github.com/lestofante/arduinoSketch
sei nuovo? non sai da dove partire? leggi qui: http://playground.arduino.cc/Italiano/Newbie

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

Perhaps a diagram will help explain why an acceleromter can give a non 0 value along a axis. Refer to the attached pic.

as for how to convert the accelerometer analog value to g's i refer you to the datasheet, I beleive the idea is to
1) get the digital value from the ADC
2) remove the zero g bias voltage (this is the output voltage for an axis that is not subject to a foce)
3) convert the voltage into g's (use the sensitivity parameter)
NOTE: the sensitivity and zero g bias values is ratiometric therefore it is dependant on the supply voltage to the accelerometer


* force diagram.png (14.83 KB, 819x460 - viewed 17 times.)
Logged

Pages: [1]   Go Up
Jump to: