Page 1 of 1

Calibrating SenseHAT

Posted: Tue Sep 01, 2015 5:58 pm
by mattmiller
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?

Re: Calibrating SenseHAT

Posted: Wed Sep 02, 2015 6:14 am
by ShiftPlusOne
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.

Re: Calibrating SenseHAT

Posted: Wed Sep 02, 2015 7:58 am
by mattmiller
Ta - I had thought all these type sensors needed the compass calibrating for the local enviroment?

Re: Calibrating SenseHAT

Posted: Wed Sep 02, 2015 8:04 am
by ShiftPlusOne
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.

Re: Calibrating SenseHAT

Posted: Wed Sep 02, 2015 8:56 am
by mattmiller
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

Re: Calibrating SenseHAT

Posted: Wed Sep 02, 2015 9:27 am
by mattmiller
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

Re: Calibrating SenseHAT

Posted: Wed Sep 02, 2015 11:52 am
by ShiftPlusOne
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

Re: Calibrating SenseHAT

Posted: Wed Sep 02, 2015 12:12 pm
by ShiftPlusOne
Added a note at the top of that post.
viewtopic.php?f=104&t=109064&p=750616#p810193

Re: Calibrating SenseHAT

Posted: Wed Sep 02, 2015 1:59 pm
by mattmiller
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

Re: Calibrating SenseHAT

Posted: Wed Sep 02, 2015 2:05 pm
by ShiftPlusOne
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?

Re: Calibrating SenseHAT

Posted: Wed Sep 02, 2015 2:51 pm
by mattmiller
Yep

Re: Calibrating SenseHAT

Posted: Wed Sep 02, 2015 3:03 pm
by ShiftPlusOne
Thanks. Good to have confirmation that the instructions worked for other people too.

Re: Calibrating SenseHAT

Posted: Sun Sep 06, 2015 3:34 pm
by AndersM
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!