Hi
When my accelerometer doesn’t move, I get on the LCD X = 359
Why I dont have X = 0 ?
volts var word
main
adin 0,volts
serout 1,i9600,[254,1, "x = ", DEC volts]
pause 100
goto main
Thanks
Pierre
Hi
When my accelerometer doesn’t move, I get on the LCD X = 359
Why I dont have X = 0 ?
volts var word
main
adin 0,volts
serout 1,i9600,[254,1, "x = ", DEC volts]
pause 100
goto main
Thanks
Pierre
Hi Pierre,
It might help if there was additional information. Things like, what accelerometer? How is it wired?
Thanks
Kurt
also remember that gravity is always going to give you an offset in one axis… if that happens to be how you have the sensor oriented.
Here, I high lighted the mistakes I spotted.
volts var word
main
adin 0,volts
serout 1,i9600,[254,1, "x = ", DEC volts]
pause 100
goto main
Change that to:
volts var word
main
adin AX0,ad_ron,volts
serout 1,i9600,[254,1, "x = ", DEC volts]
pause 100
goto main
That should work.
Actually the syntax depends on the processor. From this I assumed he was using an Atom Pro. I believe the syntax you are showing is for the standard Atom.
By chance I looked over at the Basic Micro forum and I think that you have asked this question over there as well. From that I think you are using the Dimension Engineering accelerometer: rcc.ryerson.ca/media/2008hclDE-ACCM3DBuffered3gTri-axisAccelerometerDataSheet.pdf
So assuming that everything is hooked up properly to the 10 bit AtoD, we have: 359/1024 * 5v = 1.7529296875 volts. This is not that far off of the voltages shown in the PDF file(1.33, 1.66, 1.99) for different orientations. Again my calculation was assuming a 5v reference to the Basic Atom Pros AtoD converter. If you have a different voltage, you will need to change the equation.
Kurt
Hi
Actually I have an DE-ACCM3D +/- 3g tri-axis accelerometer. With that, I have an Atom pro 24 and the LCD is SerLCD V2.5
For X axis, the output I get is 1.67 volt.
I dont understand why 1.67 volt gives 359. What should I do to have on the LCD the gravity instead of X = 359
I am sorry my English is not good.
Thanks
Pierre
Hi again,
There are probably other people here with more experience with this device and using AtoD in general.
But the basics are that the Analog to Digital converter an analog voltage into a digital value. The converters on the Atom Pro are 10 bit values or have a maximum range of 0-1023 or 1024 discrete values. By default the analog range is 0v to +5v unless there is a reference voltage (which again has a maximum of 5v).
So by default the conversion if you pass in a voltage of “v”, this would convert to a digital value by doing the math: (v*1024)/5
The spec sheet has a pretty good explanation of how then to convert the read in voltage into the actual gravity values. It also recommends that you have your software should recalculate its zero points as each of these devices may differ by maybe 10%.
Good Luck
Kurt
I think I know.
Since your Accelerometer has a max output of 2v and the basic atom has a max of 5v, it might be reading it wrong. Try this:
5 / 2 = 2.5
359 * 2.5 / 5 = 179.5 which should be in degrees.
For example, if you do 180 - 179.5 = .5, thats the amount of degrees it’s rotated. If you had it turned all the way right, then the value should be 720…
720 * 2.5 / 5 = 360
360 - 180 = 180
Which basically means that its rotated at a 180deg angle
Any thoughts?
Hi
Now, I get on the LCD x = 0.0286. It’s very good
But for Z axis, I get 0.9845. should it be 9.8 ???
It’s like if the point is not at the right place.
volts var word
fresultat var float
fvolt var float
main
adin 0,volts
fvolt = TOFLOAT volts
fvolt = fvolt * 5 /1023
fresultat = (fvolt - 1.75)/0.333
serout 1,i9600,[254,1, "x = ", real fresultat]
pause 1000
goto main
What do you thing about it ?
Pierre
are the units in g or m/s^2 ?
Depending on where you are located in the world you may not have 1g locally.