mattmiller
Posts: 2106
Joined: Thu Feb 05, 2015 11:25 pm

Calibrating SenseHAT

Tue Sep 01, 2015 5:58 pm

I know that the sensors need calibrating and I'm wondering if
viewtopic.php?f=104&t=109064&hilit=calibration
is the method to still use?

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5964
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Calibrating SenseHAT

Wed Sep 02, 2015 6:14 am

A pre-calibrated RTIMULib.ini is included in /etc/. The sense-hat python library is aware of it and will copy it to the user's home directory if it's not there already. However, for the most part, those instructions are okay for a basic calibration without an ellipsoid fit.

mattmiller
Posts: 2106
Joined: Thu Feb 05, 2015 11:25 pm

Re: Calibrating SenseHAT

Wed Sep 02, 2015 7:58 am

Ta - I had thought all these type sensors needed the compass calibrating for the local enviroment?

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5964
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Calibrating SenseHAT

Wed Sep 02, 2015 8:04 am

If you want to get it as accurate as possible, perhaps. But for the basic things, it seems to be enough to take into account the affect of the metal bits on the pi itself and the rough min/max values. I'll post the full and updated calibration instructions today, since this question has come up a few times.

mattmiller
Posts: 2106
Joined: Thu Feb 05, 2015 11:25 pm

Re: Calibrating SenseHAT

Wed Sep 02, 2015 8:56 am

I seem to be the one person that's getting all the problems - sorry!
When I run this code

Code: Select all

#!/usr/bin/python
import time
from sense_hat import SenseHat

sense = SenseHat()

while True:
    compass = sense.get_compass()
    print "compass", compass
    print
    time.sleep(0.1)
the compass only changes between about 125 to 157 degrees when I turn it thru 360

mattmiller
Posts: 2106
Joined: Thu Feb 05, 2015 11:25 pm

Re: Calibrating SenseHAT

Wed Sep 02, 2015 9:27 am

The sense-hat python library is aware of it and will copy it to the user's home directory if it's not there already
I've just checked and there is no RTIMULib.ini in my home/pi folder - just the one in /etc

I tried copying /etc/RTIMULib.ini to /home/pi/RTIMULib.ini but it hasn't made any difference to compass readings

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5964
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Calibrating SenseHAT

Wed Sep 02, 2015 11:52 am

It doesn't just go in the home directory, but a subdirectory within there (~/.config/sense_hat/)

https://github.com/RPi-Distro/python-se ... at.py#L135

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5964
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Calibrating SenseHAT

Wed Sep 02, 2015 12:12 pm

Added a note at the top of that post.
viewtopic.php?f=104&t=109064&p=750616#p810193

mattmiller
Posts: 2106
Joined: Thu Feb 05, 2015 11:25 pm

Re: Calibrating SenseHAT

Wed Sep 02, 2015 1:59 pm

That's seems to have improved things no end :) - getting full 360 deg readings and within 10 deg repeatability

I also deleted ./root/.config/sense_hat/RTPIMULib.ini as I sometimes run sudo python

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5964
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Calibrating SenseHAT

Wed Sep 02, 2015 2:05 pm

Ah, I guess there's not much of a point of the pre-calibrated file then. :oops:

Did you do the ellipsoid fit as well?

mattmiller
Posts: 2106
Joined: Thu Feb 05, 2015 11:25 pm

Re: Calibrating SenseHAT

Wed Sep 02, 2015 2:51 pm

Yep

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5964
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Calibrating SenseHAT

Wed Sep 02, 2015 3:03 pm

Thanks. Good to have confirmation that the instructions worked for other people too.

AndersM
Posts: 33
Joined: Sun Sep 06, 2015 1:18 pm

Re: Calibrating SenseHAT

Sun Sep 06, 2015 3:34 pm

Even after I followed the calibration instructions above I got strange results in my test programs.
But then I found this topic about polling and the IMU sensor:
viewtopic.php?f=104&t=110594

Using the polling tread solution everything works! :) Thanks ShiftPlusOne!

Return to “Astro Pi”