Hi all,

I'm currently working with the Arduino Uno and the ADXL335 Lilypad accelerometer. I've managed to get read the values from the analogue ports for the X/Y/X axis. I'm assuming these values are in millivolts however I'm trying to convert them into G's. I have no idea on what calculations to carry out from this point and how to implement that into my code.

Urgent

The device data sheet lists a "sensitivity factor" that converts output into g's.

I've found this data sheet for it but in all honesty I have no idea on what I have to do. I'm currently getting values such as 350 400 270 for the X Y Z ports. I'm not sure what I should do after finding the sensitivity factor (which I can't find).

I'm not being lazy. Sorry for sounding stupid but I absolutely have no idea.

In the ADXL335 data sheet, under "Specifications" you find:

Parameter Conditions Min Typ Max Unit
Sensitivity at XOUT, YOUT, ZOUT VS = 3 V 270 300 330 mV/g

This means that when the acceleration is 1 g along some axis, the output is typically 300 mV.

Okay thank you I understand that part

So if I'm trying to print the values collected simply in G's, I would have to convert a value of say 400 mV from the X axis to G's, then would I simply subtract 300 from the value? That would give me 100 surely which is incorrect?

Why are you subtracting 300mv? 300mv =1g, another 100 mv = 1/3g, so 400mv= 1.333g, 600mv= 2g and so on.

Actually, the voltage output of the ADXL335 is about Vcc/2 or 1.5V (if powered by 3V) when there is no acceleration (you must determine that value experimentally) and it varies from that by about +/- 300 mV per g, depending on the direction of the acceleration.

A few moments with Google will be well spent, as that will direct you to several tutorials, like this one from Adafruit.

jremington:
Actually, the voltage output of the ADXL335 is about Vcc/2 or 1.5V (if powered by 3V) when there is no acceleration (you must determine that value experimentally) and it varies from that by about +/- 300 mV per g, depending on the direction of the acceleration.

A few moments with Google will be well spent, as that will direct you to several tutorials, like this one from Adafruit.

jajajajajja your last sentences remind me to Yoda from Star Wars

Esta Web esta muy bien pero al puntuar siempre me marca que el 85% estan correctas cuando en realidad estan bien.
Le pediria al equipo de dessarolladores de eweb de repararlo, como Henry Porche a un Tanque de su propia marca en la segunda guerra mundial.
Destacar tambien otro personaje como seria As de tanques alemanes Michel Witman.
Hitler, Winston Churchill, Benito Musssolini, Iosif Stalin, Franklin Roosevelt. Como datos de interes decir que los espa帽oles inventaron inventos tales como Submarinos, helicopteros, la fregona, i el control remoto entre otros. El de la fregona seria el que ha triunfado mas ya que como sabr谩n todo el mundo tiene en su casa una de ellas, asi que suponemos que si consiguio en su epoca patentarla, se enriquecio increiblemente i acabo su vida de la manera mas lujosa posible. Ya que no todo el mundo puede inventar un instrumento de tanto ingenio y complejidad como es un palo con arapos enganchados.
Con la colaboraci贸n de Roy y la real academia de la lengua espa帽ola (RAE)
Gracias por su atenci贸n.
Commandante de la Luftvafe y la Raf; Alfonso Kurtafen Caveman

Arduino:1.8.3 (Windows 10), Tarjeta:"Arduino/Genuino Uno"

C:\Users\Toshiba-Portatil\Documents\Arduino\sketch_jul19a\sketch_jul19a.ino: In function 'void loop()':

sketch_jul19a:19: error: 'xmv' was not declared in this scope

^

sketch_jul19a:20: error: 'xg' was not declared in this scope

xg=(xmv-1650)*330;

^

sketch_jul19a:25: error: 'ymv' was not declared in this scope

^

sketch_jul19a:26: error: 'yg' was not declared in this scope

yg=(ymv-1650)*330;

^

sketch_jul19a:31: error: 'zmv' was not declared in this scope

^

sketch_jul19a:32: error: 'zg' was not declared in this scope

zg=(zmv-1650)*330;

^

exit status 1
'xmv' was not declared in this scope

Este reporte podr铆a tener m谩s informaci贸n con
"Mostrar salida detallada durante la compilaci贸n"
opci贸n habilitada en Archivo -> Preferencias.