[Gta04-owner] Advance OpenStreetMap surveying with GTA04? / camera & heading

mayeul.kauffmann at free.fr mayeul.kauffmann at free.fr
Mon Mar 19 13:44:14 CET 2012

Thanks Christoph. Comments below:
> There exists a simple hack that reads the raw
> acceleration values from the chip and delivers them to userspace using
> a sysfs file

I've read [0] but could not find it description of this hack. Any pointer and sample strings?

The LSM303DLH combines both 3D compass and accelerometer, so is the HMC5883L usefull for this application?

So one idea is to put some tilt logic in the code here:
Or write a piece of code that takes the raw data and output tilt-corrected magnetic heading.
I found out some math and code (for Arduino) that could be re-used. Most interesting are [3] to [5]:

[1] Has nice geometric discussion and code, but cannot correct for tilt over 40 degrees. Saysthere are other (more complex) algorithms for tilt > 40°.
[2] Give some pointers to scientific articles, including I believe for 360 degrees correction.
Note that typical use is keeping the device vertical, so code in [1] is not OK
[3] Discusses the LSM303DLH chip included in the GTA04, and gives 2 links for code computing the tilt-corrected heading:
[4] Arduino code for LSM303DLH 
[5] In "Ressources" tab: "library for the ARM mbed development board that interfaces with the LSM303DLH 3D compass and accelerometer carrier and provides the tilt-compensated magnetic heading"

Isn't [5] the closest to what would be needed? Could it serve as a basis?


[0] http://projects.goldelico.com/p/gta04-kernel/page/Mainline-Status/#wikititle_27
[1] https://www.loveelectronics.co.uk/Tutorials/13/tilt-compensated-compass-arduino-tutorial
[2] http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1267295038/15
[3] http://www.pololu.com/catalog/product/1250
[4] https://github.com/pololu/LSM303/blob/master/LSM303/LSM303.cpp#L226
[5] http://mbed.org/users/shimniok/libraries/LSM303DLH/lpk7s5

----- Mail original -----
De: "Christoph Mair" <christoph.mair at gmail.com>
À: "List for communicating with real GTA04 owners" <gta04-owner at goldelico.com>
Cc: "List for Openmoko community discussion" <community at lists.openmoko.org>
Envoyé: Lundi 19 Mars 2012 08:35:52
Objet: Re: [Gta04-owner] Advance OpenStreetMap surveying with GTA04? / camera & heading

On Sun, Mar 18, 2012 at 7:11 PM, Dr. H. Nikolaus Schaller
<hns at goldelico.com> wrote:
> Am 18.03.2012 um 19:01 schrieb Mayeul Kauffmann:
>> Thanks!
>> So for the moment camera does not work. 8-(
>> What about the heading? (including when device is in vertical position)
> There is a HMC5883L 3D compass chip inside. Maybe someone else
> can comment on the status of the kernel drivers.

AFAIK the driver is not yet includet in the gta04 kernel, but this is
a minor problem and can be fixed quite easily. The driver for the
accelerometer is also not yet included. You will need it to get
tilt-compensation. There exists a simple hack that reads the raw
acceleration values from the chip and delivers them to userspace using
a sysfs file, but it's not a real driver with a standardized
With these two chips working, you need a piece of software to
calculate the tilt compensated heading from the raw compass and
accelerometer readings. Maybe "valacompass"
(http://wiki.openmoko.org/wiki/ValaCompass) can be modified in order
to get the desired results.

Gta04-owner mailing list
Gta04-owner at goldelico.com

More information about the community mailing list