accelerometer jitter
I wrote a short shell script to repeatedly take the raw output from one of the accelerometers (/sys/devices/platform/spi_s3c24xx_gpio.1/spi0.1/dump) and massage the data to output X,Y,and Z-axis readings in decimal, -128 to 128. With my Freerunner sitting flat, face up, on the concrete slab of my house, the 'Z' reading (positive Z is toward the back of the handset, BTW) fluctuates between 51 and 56. (X and Y range from -1 to 2) That's a variance of +/- 5%, and I'm fairly confident gravity isn't fluctuating significantly... ;) Is that to be expected, is my Freerunner defective, or am I doing something wrong? I'm trying to develop a simple tool that will determine 'down' based on output from the accelerometer, and indicate deviations from various 90-degree orientations - will I need to massage the data further to ignore variations, should I be averaging several readings, or what? j ___ Openmoko community mailing list community@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/community
Re: accelerometer jitter
On Sat, Sep 20, 2008 at 4:07 PM, Joel Newkirk <[EMAIL PROTECTED]> wrote: > I wrote a short shell script to repeatedly take the raw output from one of > the accelerometers (/sys/devices/platform/spi_s3c24xx_gpio.1/spi0.1/dump) > and massage the data to output X,Y,and Z-axis readings in decimal, -128 to > 128. > > With my Freerunner sitting flat, face up, on the concrete slab of my house, > the 'Z' reading (positive Z is toward the back of the handset, BTW) > fluctuates between 51 and 56. (X and Y range from -1 to 2) That's a > variance of +/- 5%, and I'm fairly confident gravity isn't fluctuating > significantly... ;) > > Is that to be expected, is my Freerunner defective, or am I doing something > wrong? > > I'm trying to develop a simple tool that will determine 'down' based on > output from the accelerometer, and indicate deviations from various > 90-degree orientations - will I need to massage the data further to ignore > variations, should I be averaging several readings, or what? > > j > > > > ___ > Openmoko community mailing list > community@lists.openmoko.org > http://lists.openmoko.org/mailman/listinfo/community > j As a bit OT but since you have gone to the trouble of developing the script, could you run a test while driving/riding in the car and post what the readings might be? I was thinking of the possibility of having the FR determine if it was in a moving car or not. Mike -- Michael Fisher [EMAIL PROTECTED] ___ Openmoko community mailing list community@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/community
Re: accelerometer jitter
On Saturday 20 September 2008, Joel Newkirk wrote: > I wrote a short shell script to repeatedly take the raw output from one of > the accelerometers (/sys/devices/platform/spi_s3c24xx_gpio.1/spi0.1/dump) > and massage the data to output X,Y,and Z-axis readings in decimal, -128 to > 128. > > With my Freerunner sitting flat, face up, on the concrete slab of my house, > the 'Z' reading (positive Z is toward the back of the handset, BTW) > fluctuates between 51 and 56. (X and Y range from -1 to 2) That's a > variance of +/- 5%, and I'm fairly confident gravity isn't fluctuating > significantly... ;) > > Is that to be expected, is my Freerunner defective, or am I doing something > wrong? What does the datasheet say about noise levels? You're looking at +/-5% of reading but +/-1% of full scale which isn't implausible for a cheap accelerometer. > I'm trying to develop a simple tool that will determine 'down' based on > output from the accelerometer, and indicate deviations from various > 90-degree orientations - will I need to massage the data further to ignore > variations, should I be averaging several readings, or what? Underspecified ;-) How accurate does it need to be? Is the phone expected to be stationary or moving? Is power consumption important? ___ Openmoko community mailing list community@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/community
Re: accelerometer jitter
On Sat, 20 Sep 2008 17:36:00 -0400, "Michael Fisher" <[EMAIL PROTECTED]> wrote: > On Sat, Sep 20, 2008 at 4:07 PM, Joel Newkirk <[EMAIL PROTECTED]> > wrote: > >> I wrote a short shell script to repeatedly take the raw output from one > of >> the accelerometers > (/sys/devices/platform/spi_s3c24xx_gpio.1/spi0.1/dump) >> and massage the data to output X,Y,and Z-axis readings in decimal, -128 > to >> 128. > As a bit OT but since you have gone to the trouble of developing the > script, > could you run a test while driving/riding in the car and post what the > readings might be? I was thinking of the possibility of having the FR > determine if it was in a moving car or not. > > Mike > > -- > Michael Fisher > [EMAIL PROTECTED] No problem, I'll alter the script to intersperse timestamps and take it for a ride tomorrow. It's dumping samples about once per second ATM - I'd initially included a 'sleep 1' command then commented it out since the loop execution ended up taking about 1 sec anyway. (chains of cat/grep/sed/cut piped) The one caveat is that I don't have a good mount for it in the car - for the requested test I'll just lay it on the floor on the passenger side and note the physical orientation. (more OT than this request, I found out that the rubberized surface on the back of the Freerunner is essentially non-stick if you try to lay the Freerunner on a Handstands StickyPad - I've had one of those on my dashboard for years, always kept my cellphone and Zaurus there even on a sloped dashboard, but the Freerunner won't stick to it even on the flat dash in my new car) j ___ Openmoko community mailing list community@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/community
Re: accelerometer jitter
On Sat, 20 Sep 2008 23:08:42 +0100, Al Johnson <[EMAIL PROTECTED]> wrote: > On Saturday 20 September 2008, Joel Newkirk wrote: >> With my Freerunner sitting flat, face up, on the concrete slab of my > house, >> the 'Z' reading (positive Z is toward the back of the handset, BTW) >> fluctuates between 51 and 56. (X and Y range from -1 to 2) That's a >> variance of +/- 5%, and I'm fairly confident gravity isn't fluctuating >> significantly... ;) >> >> Is that to be expected, is my Freerunner defective, or am I doing > something >> wrong? > > What does the datasheet say about noise levels? You're looking at +/-5% of > reading but +/-1% of full scale which isn't implausible for a cheap > accelerometer. I can't find the relevant answer on the datasheet. It has some bar charts of "percent of parts" vs "sensitivity [mg/digits]" at 2.5v on page 37, but I can't understand what exactly they're plotting. :( >> I'm trying to develop a simple tool that will determine 'down' based on >> output from the accelerometer, and indicate deviations from various >> 90-degree orientations - will I need to massage the data further to > ignore >> variations, should I be averaging several readings, or what? > > Underspecified ;-) How accurate does it need to be? Is the phone expected > to > be stationary or moving? Is power consumption important? Sorry. ;) Near-stationary, power consumption immaterial, as accurate as possible. As a project to get my feet wet doing ground-up development (probably Python, which I need to learn) for the Freerunner (instead of just cross-compiling and fixing issues therein) I wanted to write a software 'bubble-level' tool. Laid flat on a surface you see a bubble, off-centered as a 'real' bubble-level would be to indicate pitch. More generally, held with the side or back against a vertical or horizontal surface to display an indication of how close to level (or vertical) the surface is. Lots of incremental additions and changes possible, like adding audio indication when level is achieved, interacting with DBus or what-have-you instead of reading sysfs, etc, making it an educational process on the specific environment of the Freerunner. So for the initial basic functionality averaging several samples over the course of a couple seconds works fine, but later refinements would benefit from more accuracy. (also actual implementation could attend to all three axes, not just look at one, which might help or hinder in this application, not sure) j ___ Openmoko community mailing list community@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/community
Re: accelerometer jitter
since low cost accelerometers are somewhat noisy, I'd suspect that first. http://wiki.openmoko.org/wiki/Technical:Accelerometer_Fundamentals Not sure what kind of filter you should use. There should be some guys On the list who can chime in better than I can. Joel Newkirk wrote: > I wrote a short shell script to repeatedly take the raw output from one of > the accelerometers (/sys/devices/platform/spi_s3c24xx_gpio.1/spi0.1/dump) > and massage the data to output X,Y,and Z-axis readings in decimal, -128 to > 128. > > With my Freerunner sitting flat, face up, on the concrete slab of my house, > the 'Z' reading (positive Z is toward the back of the handset, BTW) > fluctuates between 51 and 56. (X and Y range from -1 to 2) That's a > variance of +/- 5%, and I'm fairly confident gravity isn't fluctuating > significantly... ;) > > Is that to be expected, is my Freerunner defective, or am I doing something > wrong? > > I'm trying to develop a simple tool that will determine 'down' based on > output from the accelerometer, and indicate deviations from various > 90-degree orientations - will I need to massage the data further to ignore > variations, should I be averaging several readings, or what? > > j > > > > ___ > Openmoko community mailing list > community@lists.openmoko.org > http://lists.openmoko.org/mailman/listinfo/community ___ Openmoko community mailing list community@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/community
Re: accelerometer jitter
Have a look at this might help. Note, we dont use a freescale accel, so some things may be different but you'll get the basic idea. http://www.freescale.com/files/sensors/doc/app_note/AN3397.pdf?fpsp=1&WT_TYPE=Application%20Notes&WT_VENDOR=FREESCALE&WT_FILE_FORMAT=pdf&WT_ASSET=Documentation Joel Newkirk wrote: > On Sat, 20 Sep 2008 17:36:00 -0400, "Michael Fisher" <[EMAIL PROTECTED]> > wrote: >> On Sat, Sep 20, 2008 at 4:07 PM, Joel Newkirk <[EMAIL PROTECTED]> >> wrote: >> >>> I wrote a short shell script to repeatedly take the raw output from one >> of >>> the accelerometers >> (/sys/devices/platform/spi_s3c24xx_gpio.1/spi0.1/dump) >>> and massage the data to output X,Y,and Z-axis readings in decimal, -128 >> to >>> 128. > >> As a bit OT but since you have gone to the trouble of developing the >> script, >> could you run a test while driving/riding in the car and post what the >> readings might be? I was thinking of the possibility of having the FR >> determine if it was in a moving car or not. >> >> Mike >> >> -- >> Michael Fisher >> [EMAIL PROTECTED] > > No problem, I'll alter the script to intersperse timestamps and take it for > a ride tomorrow. It's dumping samples about once per second ATM - I'd > initially included a 'sleep 1' command then commented it out since the loop > execution ended up taking about 1 sec anyway. (chains of cat/grep/sed/cut > piped) > > The one caveat is that I don't have a good mount for it in the car - for > the requested test I'll just lay it on the floor on the passenger side and > note the physical orientation. (more OT than this request, I found out > that the rubberized surface on the back of the Freerunner is essentially > non-stick if you try to lay the Freerunner on a Handstands StickyPad - I've > had one of those on my dashboard for years, always kept my cellphone and > Zaurus there even on a sloped dashboard, but the Freerunner won't stick to > it even on the flat dash in my new car) > > j > > > ___ > Openmoko community mailing list > community@lists.openmoko.org > http://lists.openmoko.org/mailman/listinfo/community ___ Openmoko community mailing list community@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/community
Re: accelerometer jitter
Thanks - I was just reading through http://www.freescale.com/files/sensors/doc/app_note/AN3107.pdf about tilt measurements, which is linked from the wiki. (I'd missed it before) The one you linked is mostly about position calculations, double integration of the acceleration data, although it discusses noise and some management thereof. (which is much more important with the double-integral) In this usage, any decrease on one axis should be accompanied by a matching increase on a second axis, since I'm dealing specifically with vertical or horizontal orientations. The third axis only becomes significant in the "lying flat, face up" scenario, where decreases in 'z' will have matching increases in 'x+y' - noisier summing them, but probably workable. (since the common use-cases wouldn't demand as frequent updates) Which is actually the one that got me thinking about this in the first place - I was leveling my clothes washer and while looking for one of my levels my eyes drifted toward the Freerunner, and my brain said "hm - if I just laid it on top..." Which doesn't even consider the second sensor - I'm just looking at the one with all three axes aligned with the housing, not the one rotated 45 degrees about the Z-axis. Utilizing both would let me be more certain of small orientation changes. (I'm assuming noise isn't induced from outside, and so they wouldn't be in sync) This is turning out more calculationally involved than I'd first anticipated, but still looks workable. j On Sat, 20 Sep 2008 20:05:19 -0700, Steve Mosher <[EMAIL PROTECTED]> wrote: > Have a look at this might help. > > Note, we dont use a freescale accel, so some things may be different but > you'll get the basic idea. > > http://www.freescale.com/files/sensors/doc/app_note/AN3397.pdf?fpsp=1&WT_TYPE=Application%20Notes&WT_VENDOR=FREESCALE&WT_FILE_FORMAT=pdf&WT_ASSET=Documentation > > > Joel Newkirk wrote: >> On Sat, 20 Sep 2008 17:36:00 -0400, "Michael Fisher" > <[EMAIL PROTECTED]> >> wrote: >>> On Sat, Sep 20, 2008 at 4:07 PM, Joel Newkirk <[EMAIL PROTECTED]> >>> wrote: >>> I wrote a short shell script to repeatedly take the raw output from > one >>> of the accelerometers >>> (/sys/devices/platform/spi_s3c24xx_gpio.1/spi0.1/dump) and massage the data to output X,Y,and Z-axis readings in decimal, > -128 >>> to 128. >> >>> As a bit OT but since you have gone to the trouble of developing the >>> script, >>> could you run a test while driving/riding in the car and post what the >>> readings might be? I was thinking of the possibility of having the FR >>> determine if it was in a moving car or not. >>> >>> Mike >>> >>> -- >>> Michael Fisher >>> [EMAIL PROTECTED] >> >> No problem, I'll alter the script to intersperse timestamps and take it > for >> a ride tomorrow. It's dumping samples about once per second ATM - I'd >> initially included a 'sleep 1' command then commented it out since the > loop >> execution ended up taking about 1 sec anyway. (chains of > cat/grep/sed/cut >> piped) >> >> The one caveat is that I don't have a good mount for it in the car - for >> the requested test I'll just lay it on the floor on the passenger side > and >> note the physical orientation. (more OT than this request, I found out >> that the rubberized surface on the back of the Freerunner is essentially >> non-stick if you try to lay the Freerunner on a Handstands StickyPad - > I've >> had one of those on my dashboard for years, always kept my cellphone and >> Zaurus there even on a sloped dashboard, but the Freerunner won't stick > to >> it even on the flat dash in my new car) >> >> j >> >> >> ___ >> Openmoko community mailing list >> community@lists.openmoko.org >> http://lists.openmoko.org/mailman/listinfo/community > > ___ > Openmoko community mailing list > community@lists.openmoko.org > http://lists.openmoko.org/mailman/listinfo/community ___ Openmoko community mailing list community@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/community
Re: accelerometer jitter
Joel Newkirk wrote: > Sorry. ;) Near-stationary, power consumption immaterial, as accurate as > possible. As a project to get my feet wet doing ground-up development > (probably Python, which I need to learn) for the Freerunner (instead of > just cross-compiling and fixing issues therein) I wanted to write a > software 'bubble-level' tool. Laid flat on a surface you see a bubble, > off-centered as a 'real' bubble-level would be to indicate pitch. More > generally, held with the side or back against a vertical or horizontal > surface to display an indication of how close to level (or vertical) the > surface is. Lots of incremental additions and changes possible, like > Have you looked at the "Accelerometer Game"? It would maybe give you a good jump start. http://projects.openmoko.org/plugins/scmsvn/viewcvs.php/?root=accelgame I have the first version installed and it pretty much covers the basic functionality of a bubble-level, but has momentum and bouncing. Vasco. ___ Openmoko community mailing list community@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/community
Re: accelerometer jitter
On Sat, 20 Sep 2008 17:36:00 -0400, "Michael Fisher" <[EMAIL PROTECTED]> wrote: > On Sat, Sep 20, 2008 at 4:07 PM, Joel Newkirk <[EMAIL PROTECTED]> > wrote: > >> I wrote a short shell script to repeatedly take the raw output from one > of >> the accelerometers > (/sys/devices/platform/spi_s3c24xx_gpio.1/spi0.1/dump) >> and massage the data to output X,Y,and Z-axis readings in decimal, -128 > to >> 128. > As a bit OT but since you have gone to the trouble of developing the > script, > could you run a test while driving/riding in the car and post what the > readings might be? I was thinking of the possibility of having the FR > determine if it was in a moving car or not. > > Mike OK, I started in the street near my house. Turned a 270 degree left turn (around a ~30-ft circle) then 90 degrees right and went down the street to a stop sign, left turn and on a couple hundred feet to a larger circle, which I circled 1.25 times at a near-steady 20mph, then went on to the convenience store. The entire trip was about 4 minutes, about 1.5 miles. Top speed was just over 30 mph (25mph limit throughout - don't send my GPS log to the cops ;) The Freerunner was sitting on the floor on the passenger side of the car, about 10" right of centerline, with the Y axis (top to bottom of screen in portrait mode) aligned to the direction of travel. So Positive-Y indicates vehicle deceleration, Positive-X indicates left turn, Negative-Z means the car probably bounced upward. Below is the output at roughly 1-second intervals from the accelerometer (#1, not #0, so axes aligned to housing) followed by the trip log from TangoGPS for the same time period. Top speed was just over 30 mph (25mph limit throughout - don't send my GPS log to the cops ;) There is at most a 5-second difference between start and stop points of the two datasets, and the right-hand turn off the small circle in front of my house should provide a good sync point (accel data goes negative first time), as will the ~30 second stop at a traffic light, ~20 seconds before data stops. j atest.sh output: X:14 - Y:-6 - Z:40 X:1 - Y:6 - Z:53 X:2 - Y:2 - Z:50 X:11 - Y:1 - Z:51 X:9 - Y:4 - Z:48 X:14 - Y:7 - Z:58 X:15 - Y:12 - Z:50 X:21 - Y:5 - Z:53 X:23 - Y:13 - Z:51 X:17 - Y:9 - Z:56 X:-8 - Y:5 - Z:52 X:-6 - Y:5 - Z:46 X:-4 - Y:5 - Z:49 X:3 - Y:1 - Z:54 X:6 - Y:6 - Z:56 X:6 - Y:7 - Z:54 X:6 - Y:6 - Z:58 X:4 - Y:5 - Z:59 X:5 - Y:8 - Z:49 X:6 - Y:6 - Z:53 X:8 - Y:5 - Z:50 X:13 - Y:3 - Z:57 X:15 - Y:10 - Z:52 X:8 - Y:9 - Z:49 X:9 - Y:14 - Z:47 X:4 - Y:17 - Z:53 X:5 - Y:6 - Z:53 X:5 - Y:2 - Z:55 X:9 - Y:-5 - Z:58 X:18 - Y:-6 - Z:53 X:15 - Y:-6 - Z:51 X:5 - Y:-2 - Z:56 X:1 - Y:7 - Z:49 X:6 - Y:5 - Z:52 X:4 - Y:8 - Z:54 X:2 - Y:11 - Z:54 X:-4 - Y:7 - Z:54 X:-1 - Y:7 - Z:51 X:7 - Y:-4 - Z:57 X:22 - Y:-1 - Z:53 X:25 - Y:7 - Z:53 X:18 - Y:4 - Z:47 X:19 - Y:7 - Z:53 X:15 - Y:5 - Z:51 X:19 - Y:9 - Z:48 X:17 - Y:8 - Z:52 X:21 - Y:8 - Z:48 X:27 - Y:9 - Z:53 X:27 - Y:12 - Z:50 X:24 - Y:9 - Z:47 X:20 - Y:8 - Z:52 X:7 - Y:7 - Z:52 X:-9 - Y:6 - Z:54 X:-9 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