[Gta04-owner] Making sense of the sensors.
neilb at suse.de
Sat Aug 4 14:34:39 CEST 2012
(sorry, subject line doesn't really mean anything, but I just cannot seem to
say 'no' to lame puns).
I've been playing with the various sensors and have pushed out a few changes
to my 3.2, 3.4, and 3.5 branches[*].
- bmp180 (ambient pressure) now uses the interrupt line to detect when data
- hmc5843 (magnetometer/compass) now compiles in the main image (not in
module) and doesn't crash if you write to 'meas_conf'.
- itg3200 (gyroscope) now has a newly written 'iio' driver. You can set the
sample rate (it auto-chooses a low-pass filter) and can enable/disable
each axis independently (it auto-chooses the clock source).
It seems that the itg3200 powers-on in fully active mode, so if you don't
talk to it (i.e. don't have a driver) it will use approximately 6mA (at 2.8V).
So by simply adding a driver that will turn it off in suspend we save some
current - about 2-3 mA at battery voltage. I've now seen suspend-current
down at 21mA occasionally!!
The compass seems to have a strong bias on all axes. Presumably some magnet
in the GTA04 (speaker?) needs to be compensated for. Has anyone played with
this at all? Figured out how to calibrate, then how to convert the 3 numbers
into a compass direction?
I think I'll probably eventually write an IIO driver for the bmp180 and the
accelerometer. IIO feels a bit clumsy but it is growing on me and seems to
be the way of the future. And consistency is a good thing.
Once I figure out what IIO triggers are all about I'll get them to deliver
streams of data, and maybe even send events on interesting changes like
"rotation rate faster than X". That would then actually be useful I think.
IIO devices appear in /sys/bus/iio/devices/iio:deviceNN
This directory contains various files from which you can read different value
and set different config.
You cannot depend on the 'NN' being stable. For now, check the 'name' file
to see what device you are looking at.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 828 bytes
Desc: not available
More information about the Gta04-owner