m0jec
Posts: 6
Joined: Fri Sep 25, 2015 1:36 pm

Do I have a 'faulty' Sense Hat?

Sat Feb 20, 2016 10:42 pm

I have been developing a rotator using the raspberry Pi, and was hoping to use the Sense Hat as a compass/Tilt Sensor.

However I have an issue that seems to be more than just a calibration issue.

I have done an RTIMULibCal of the Sense Hat, but it still seems to be inaccurate/drifting,

Even if I keep the sense hat still the reading of Yaw seems to move back and forth, (I'd expect some but not as much as I'm seeing) and if I move the sense hat through all 3 axis and then back to the original position, the reading can be wildly different, also moving the sense hat 90 degrees can produce a reading change of more or less than 90 degrees.

I have even tried using just the magnetometer part for reading the bearing (ignoring the Accelerometer etc) but the issue is still there.

Obviously a rotator that is pointing in the wrong direction is not much use?

Anyone able to give me advice? Any tests I can do to prove if it is just 'finger trouble' or a faulty Sense Hat?

Thanks in advance.

Norman

scotty101
Posts: 3750
Joined: Fri Jun 08, 2012 6:03 pm

Re: Do I have a 'faulty' Sense Hat?

Sat Feb 20, 2016 11:55 pm

You need to understand the mathematics of what the RTIMU library does.
The signals for the accelerometers are double integrated to give you position so a small inaccuracy will be made larger over time. Even with the magnetometer to aid it.

If you want accurate positioning on a rotating platform, consider rotational encoders instead.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

User avatar
experix
Posts: 204
Joined: Mon Nov 10, 2014 7:39 pm
Location: Coquille OR
Contact: Website

Re: Do I have a 'faulty' Sense Hat?

Mon Feb 22, 2016 5:28 pm

scotty101 wrote:You need to understand the mathematics of what the RTIMU library does.
Can you help us dummies by providing a reference to the relevant docs? Or source files with illuminating comments?

m0jec
Posts: 6
Joined: Fri Sep 25, 2015 1:36 pm

Re: Do I have a 'faulty' Sense Hat?

Tue Feb 23, 2016 12:04 pm

I guess I'm missing something, as the above post maybe you can explain the Maths behind it?

I do understand the concept of drift using inertial navigation, if that helps.

I'm not sure what timescales you are talking about but I would expect the drift to take a significant amount of time to cause significant errors.

I run the calibration, I then try to use the device and get a reference for where 'north' is, I then move the sense hat through 90 degrees and the reading i get is not 90 degrees different to the 'north' reading (can be upto 20 degrees out? Maybe I have something metal influncing it?) I then move the sense hat through 3 additional 90 degree turns and check the readings, sometimes they are close and sometimes they are not. It does seem that the 180 degree readings are closer but still not as good as I'd hoped.

I then turn the sense hat through 360 degrees in all 3 axis and return it to its original position (my 'north' reference) and the reading more often than not has moved significantly. (I'll admit that my project will not move it in all 3 axis but I wanted to test 'worst case') so my sense hat is physically back to its original position but the reading is not the same.

Finally I power off the whole setup reboot and run the tests again, the 'absolute' reference I get for my 'North' is different, maybe I'm expecting too much of a 'cheap' sensor? I would hope that even such a sensor would always find 'north' in the same place (within a small tolerance) my hope was that with this sense hat I could setup 'in the field' and rely on it to at least be roughly right without me needing to show it where north is.

I'd be happy with +/- 5 Degrees but was hoping to have better.

I have a system that is as good as a rotary encoder currently but wanted to make the feedback more 'inteligent'

Thanks for any help that I can get.

I'm hoping there is something (simple?) I'm overlooking, could the GPIO extension cable be having an influence? Its a proper 40 pin cable designed for this puropse and not a repurposed IDE cable.

User avatar
Davespice
Forum Moderator
Forum Moderator
Posts: 1662
Joined: Fri Oct 14, 2011 8:06 pm
Location: The Netherlands
Contact: Twitter

Re: Do I have a 'faulty' Sense Hat?

Tue Feb 23, 2016 5:10 pm

Hi there, if you're using the get_orientation or compass functions then something called a Kalman filter is being employed by the underlying Python code. This keeps three Euler angles (pitch, roll and yaw) and uses input data from the Gyro, Accelerometer and Mag to continually update them.

If your Mag is off or not calibrated correctly then you'll get problems. But you can configure which sensors contribute to the Kalman filter by using the set_imu_config function. You might get better results if you say turn off the Mag and only use the Gyro and Accelerometer.

Part of the problem with the Mag is that it's being perturbed by the metal in the USB and Ethernet ports, you can mitigate this somewhat by using the Ellipsoid calibration step.

m0jec
Posts: 6
Joined: Fri Sep 25, 2015 1:36 pm

Re: Do I have a 'faulty' Sense Hat?

Thu Feb 25, 2016 9:50 pm

Thanks for that I will do some more experimentation.

The USB and Ethernet metal won't be an issue as the Sense Hat is on a 1m Extension lead.

I'm hoping once I have these issues sorted I can do some 'portable' working from a local hill.

Return to “Astro Pi”