Accelerometer help
Sunflower
Posts: 48
I bought a Memsic 2125 from Parallax and can not resolve accuracy better than +/- several degrees. Is this normal or am I doing something wrong?
Comments
Zin PIN 11 ' Tilt Z Accelerometer MEMSIC 2125
work4 = 0
FOR work.HIGHBYTE = 1 TO 64
PULSIN Zin, HiPulse, zRaw
zRaw = (zRaw */ Scale) '$0C0=Scale pulse to uSeconds 0.75 BS2p
zRaw = zRaw/10
work4 = work4 + zRaw
NEXT
zRaw = ((work4 / 64) - 500) 'Binary SIN -127 to 127
DEBUG SDEC zraw," "
NEXT
Jim
http://www.parallax.com/Portals/0/Downloads/src/prod/3rd/Memsic2125Demo.zip
GOSUB Read_G_Force ' read X and Y
brads = (xmG / 8) ATN (ymG / 8) ' calculate angle
degrees = brads */ 360 ' convert to degrees
Read_G_Force:
PULSIN Xin, HiPulse, pulse ' read pulse output
pulse = pulse */ Scale ' convert to uSecs
xmG = ((pulse / 10) - 500) * 8 ' calc 1/1000 g
RETURN
I stand corrected. I have not followed the Basic Stamp software for this unit. I'm more familiar with the interface on the Propeller Chip.
The demo software does indeed report back degrees of tilt.
I will have to load up my BOE and try this out.
Jim