Memsic 2125 Dual Axis Accelerometer
noobmuncher
Posts: 124
Hello,
I am just starting with the propeller chip (coming from BS2's) and I am trying to find a object that I can use to show the ouput of the Accelerometer on my screen. I found one program, but it outputs to a TV and that won't work for my purposes.
The link for the one that outputs to video is
obex.parallax.com/objects/140/
Thanks for the help!
Post Edited (noobmuncher) : 12/18/2009 3:54:24 AM GMT
I am just starting with the propeller chip (coming from BS2's) and I am trying to find a object that I can use to show the ouput of the Accelerometer on my screen. I found one program, but it outputs to a TV and that won't work for my purposes.
The link for the one that outputs to video is
obex.parallax.com/objects/140/
Thanks for the help!
Post Edited (noobmuncher) : 12/18/2009 3:54:24 AM GMT
Comments
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Try this... I don't have a Memsic 2125 at the moment, so I couldn't test this code for sure, but it should return the RAW x and y values from a Memsic Accelerometer to a serial terminal set for 9600 Baud. Please let me know if this works for you.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 12/16/2009 7:07:28 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out the Propeller Wiki·and contribute if you can.
Thanks! - I appreciate that.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Which pins am I inputting the accelerometer too? Is it 13 and 9?
Pins 0 and 1
The 9 and 13 are for the debug .... 9 indicates a TAB Space, while a 13 indicates a Return
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Since it takes at least two vectors to determine a degree, you can't really display a deg for each axis.
Only by combining the x and y axis can you determine a degree.
The memsic2125 object does this for you by using a routine to convert the Cartesian X and Y coordinates into Polar coordinates ro and theta.
In order to get these values so that they are 'human readable' there are a few conversions that you need to apply to the raw values.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
So I tested this program and I must say it is pretty cool, but is there any way that it can be outputted in a style similar to the BS2 program MEMSIC2125-Dual.BS2?
www.parallax.com/Portals/0/Downloads/src/prod/3rd/Memsic2125Demo.zip
It would just be nice to be able to see
x axis: (degree)
y axis: (degree)
Sorry for being a pain, thanks for the help though [noparse]:)[/noparse]
Ahhh, I see.... Tilt verses rotational Deg.
Tilt is basically the rotational deg with respect to the horizon (A fixed vector), where the way the Memsic2125 object returns a Deg now is the rotational deg with respect to the X vector and Y vector.
I'll update the current object, I can see how this would be very useful. I don't know why I didn't think to incorporate that into the Propeller Memsic2125 object before.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Thanks alot Beau!
Try this code and see if that works for you and I will update the OBEX.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Compiles fine here. Maybe download the .zip again. May have gotten corupted.
@ Beau
Are you running a 6MHz xtal? I'm going to try it with a 5 and 6.25
Jim
Ohh yeah... sorry, yes I am running on a 6MHz crystal. All of my demo boards are tied up at the moment, and I was using an older board with a different crystal....
Just change the header at the top of the Spin program to match your crystal setup.
Change this...
CON ''General Constants for Propeller Setup
_CLKMODE = XTAL1 + PLL16X
_XINFREQ = 6_000_000
...so that it reads...
CON ''General Constants for Propeller Setup
_CLKMODE = XTAL1 + PLL16X
_XINFREQ = 5_000_000
... I will update the OBEX early next week with the default 5MHz setup.
"I guess I won't be trying it out. I only have Hitachi Tri-Axis modules." - suppose the object for that should be updated as well, so that Tilt can also be displayed in addition to Rotational Deg.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 12/19/2009 8:43:56 PM GMT
The 'PK' indicates that it is a zipped file using the standard "PKzip" format... you need to unzip the file before loading it into the Propeller.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Here is an example of what I think might be more like what you are looking for...
http://forums.parallax.com/showthread.php?p=866419
...again, I'm not exactly sure why I didn't do something like that right off the bat.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Beau, just tried the code you wrote and it worked great, it was exactly what I needed so thank you very much. I think i will give this graphic one a whirl now too.
Thanks!