How do you have it wired up? what does your code look like? i would really need to see a schematic of how you have it connected and attatch your code to your post to be of any help.
The wires are simple MEMS Xout to Zin pin, 5V and GND. Battery power supply on MMC carrier board with capacitors. No vibration and stable room temperatures. Output is +/- 2 brads when level. Is that the expected performance of the MEMS?
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
An Accelerometer outputs in terms of g's, not degrees.
Jim
Sunflower said...
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?
I left out the "8" factors for g force as I only need the SIN(angle) for relative tilt. From Memsic2125Demo.zip below. MEMS resolution is discussed in detail in small parts of a degree tilt, but are the actual measurements only good to a couple of degrees on each axis?
Using ATN from two pins (X&Y) does smooth out the data to +/- 1 degree. I am running out of pins and would like the Z axis from one additional MEMS to one Stamp pin to measure dish tilt +/- 45 degrees, well within MEMS capability. But the Binary SIN rapidly fluctuates +/- 5 (a couple degrees) on just one axis. I guess I can accept that and still love the MEMS.
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