Navigation pyskin - Board Design RFC

Showroom for MicroPython related hardware projects.
Target audience: Users wanting to show off their project!
blmorris
Posts: 348
Joined: Fri May 02, 2014 3:43 pm
Location: Massachusetts, USA

Re: Navigation pyskin - Board Design RFC

Post by blmorris » Tue Jan 06, 2015 3:31 am

First two navigation boards have been built and partially tested - I apologize for the poor lighting:
IMG_1329.jpg
IMG_1329.jpg (195.36 KiB) Viewed 8026 times
IMG_1330.jpg
IMG_1330.jpg (145.2 KiB) Viewed 8026 times
Thanks to the libraries provided by @Turbinenreiter I can confirm that the BMP180 barometric altimeter and MPU-9150 IMU appear to work as they should. The GPS unit can receive a signal from either its own patch antenna or from an external antenna via the SMA connector. I do not have a lithium battery pack or appropriate high-current load so I have not yet fully tested the battery voltage and current monitoring circuits; I intend to get to that soon.

On issue that i discovered today (and probably should have thought to check sooner) is that the GPS module contains a fairly large amount of ferromagnetic material, presumably in the RF shielding. The IMU with its magnetometer is extremely close to the GPS unit, and magnetic measurements may be adversely impacted by this proximity. I have some idea how to determine whether this will actually be a problem, but I would also welcome any suggestions on how I might check this.

-Bryan

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Navigation pyskin - Board Design RFC

Post by pythoncoder » Wed Jan 07, 2015 9:03 am

The MPU9150 and its driver produce calibrated magnetometer readings. These can be checked against the expected values for the Earth's magnetic field at your geographic location. Maps of intensity, inclination and declination can be found at https://en.wikipedia.org/wiki/Earth%27s_magnetic_field
To do this testing you need to be sure you're free of local magnetic fields caused by electrical equipment or ferrous objects. Ideally do the testing outdoors. Failing that a check with a compass will show if there are any major local influences.

If the GPS module is causing problems I wonder if it would be feasible to degauss them before assembly onto the PCB?
Peter Hinch
Index to my micropython libraries.

blmorris
Posts: 348
Joined: Fri May 02, 2014 3:43 pm
Location: Massachusetts, USA

Re: Navigation pyskin - Board Design RFC

Post by blmorris » Wed Jan 07, 2015 5:45 pm

pythoncoder wrote:The MPU9150 and its driver produce calibrated magnetometer readings.
This is the assumption that I had started with. After discovering that the GPS modules had a substantial amount of ferromagnetic shielding, (which I might have noticed before doing the layout…) I assembled the first two units with the GPS module and had a period of minor panic / disappointment when I found that the magnetic readings were not centered on zero. I expected that turning the unit 180 degrees around any axis would simply reverse the sign of 2 out of 3 magnetic components; in actual testing the measured values would reverse, but the mean value had some offset from zero on each axis. I attributed this to the field contributed by the GPS module, but then I built a board with just the MPU9150 to check. Without the influence of the GPS module, x and y are reasonably well balanced, but there is still a large offset on the z-axis.
To do this testing you need to be sure you're free of local magnetic fields caused by electrical equipment or ferrous objects. Ideally do the testing outdoors. Failing that a check with a compass will show if there are any major local influences.
For now I am doing my testing inside; I don't plan to spend much time sitting in an open field with my laptop until average temperatures return to well above freezing ;)
If the GPS module is causing problems I wonder if it would be feasible to degauss them before assembly onto the PCB?
I expect that this would be pretty challenging; I'm certainly not equipped to do it for a desktop assembly. Actually I anticipate that the offset will need to be compensated through a calibration procedure, which could also help to mitigate any contribution from a lithium battery pack (which tend to be somewhat ferromagnetic as well).

I did a quick search for quaternion sensor fusion routines written in Python; while I didn't find exactly that, I did stumble across this project which could be quite helpful as it supports the MPU9150 as well as several over IMU systems. Relevant to this discussion is the note regarding magnetometer calibration

At any rate I will take care to put more separation between the GPS module and the MPU9150 in my next revision of the board, but I'm not convinced that we will ever be able to completely eliminate the need for magnetometer calibration.

-Bryan

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Navigation pyskin - Board Design RFC

Post by dhylands » Wed Jan 07, 2015 7:40 pm

The large Z component is typical depending on where you are.

This is why these types of magnetometers need to be level (if you only use X & Y), and why tilt compensated compasses exist.

If you have other sensors to tell you how much you're tilted off level (acceleromter will give a vector for gravity if you're not otherwise moving - for example) then you can use that to compensate for the large Z component on the magnetometer.

blmorris
Posts: 348
Joined: Fri May 02, 2014 3:43 pm
Location: Massachusetts, USA

Re: Navigation pyskin - Board Design RFC

Post by blmorris » Wed Jan 07, 2015 8:40 pm

dhylands wrote:The large Z component is typical depending on where you are.
There is in fact a fairly large Z component to the field that I measure (~45 uT in vertical component versus ~10uT horizontal) but that isn't the issue that I am referring to. The vertical component is large no matter which magnetometer axis is oriented vertically.
The issue here is that there is actually a large offset in the Z-axis measurement of the magnetometer, such that I get Z readings of -6 to -8 uT if the board is sitting flat on my desk, and +87 to +89 uT if I flip it upside down. The X and Y axes can measure the large Z field component if I turn the board on its edges, but without the ~35uT offset (I'm just doing an eyeball average for these readings.)
It is this offset that will need to be calibrated away for decent sensor fusion performance. Given that this seems to be inherent to the sensor, and the library I linked to has a pretty decent 3D magnetometer calibration routine, I'm not going to worry too much for now about the field offset introduced by the GPS module. I'll try to reduce it with some more distance if I do another board rev, but I think that with calibration this current version will work fine.

-Bryan

Damien
Site Admin
Posts: 647
Joined: Mon Dec 09, 2013 5:02 pm

Re: Navigation pyskin - Board Design RFC

Post by Damien » Thu Jan 08, 2015 8:01 pm

I think the gyro is the most important component for stabilisation of a quadcopter and the magnetometer is just to determine your absolute heading with respect to the earth. I have been playing a bit with my copter and trying to balance it with just the accelerometer of the pyboard but it's very difficult. The accelerometer is just not sensitive enough to small changes in angle.

But anyway it would be a waste not to try and get the magnetometer working as best as possible.

Nice boards BTW!

blmorris
Posts: 348
Joined: Fri May 02, 2014 3:43 pm
Location: Massachusetts, USA

Re: Navigation pyskin - Board Design RFC

Post by blmorris » Fri Jan 09, 2015 4:03 am

Damien wrote:I think the gyro is the most important component for stabilisation of a quadcopter and the magnetometer is just to determine your absolute heading with respect to the earth.
I think it's a little more complicated than that - the sensor fusion algorithms that I have read about really need all three sensors (accelerometer, gyro, magnetometer) to provide a stable orientation calculation. The accelerometer and magnetometer provide gravitational and magnetic field vectors; assuming that there is a sufficient angle between them this provides a complete 3-D orientation reference that is stable over the long term. The problem is that vibrations and lateral accelerations will introduce short term noise in the accelerometer (and the magnetometer is similarly susceptible to local field fluctuations). The gyro provides accuracy for the short-term angle corrections, but the gyro is itself susceptible to long-term drift as any DC bias in the measurements gets integrated over time; the accel/mag orientation reference allows this drift to be cancelled out.

My question is whether a similar trick can be applied using the accelerometer and altimeter to cancel out short term fluctuations in the GPS position readings, while using the GPS as a stable long-term position reference.
Nice boards BTW!
Thanks! I'm pretty pleased with it, but I'll be much happier if I can get a demonstration like this going. It seems like it should be within reach, and the path of least resistance may be to take advantage of the Raspberry Pi support in the RTIMULib package, which already supports the MPU9150 (and I already have an RPi sitting around.)

Of course I'd like to send one or two your way; if i can get interest from others in a few more boards then I'll order parts to assemble ten more boards - the IMU and GPS modules have small price breaks at 10, and it would be nice to take advantage of that.

-Bryan

Damien
Site Admin
Posts: 647
Joined: Mon Dec 09, 2013 5:02 pm

Re: Navigation pyskin - Board Design RFC

Post by Damien » Fri Jan 09, 2015 4:20 am

blmorris wrote: I'll be much happier if I can get a demonstration like this going.
Very nice! Yes, should be possible with the 9150.
Of course I'd like to send one or two your way;
Yes, great, and I can see if I can help with the fusion code.

Turbinenreiter
Posts: 288
Joined: Sun May 04, 2014 8:54 am

Re: Navigation pyskin - Board Design RFC

Post by Turbinenreiter » Mon Jan 12, 2015 7:45 pm

I also got all the necessary parts for the small brother of this board from china this week. Now I'm sitting here like an idiot with now reflow oven, trying to make the solder melt per willpower. Doesn't work. Oh my.

Damien
Site Admin
Posts: 647
Joined: Mon Dec 09, 2013 5:02 pm

Re: Navigation pyskin - Board Design RFC

Post by Damien » Tue Jan 13, 2015 12:00 am

Turbinenreiter wrote:I also got all the necessary parts for the small brother of this board from china this week. Now I'm sitting here like an idiot with now reflow oven, trying to make the solder melt per willpower. Doesn't work. Oh my.
A hot air gun should do the trick. They are pretty cheap. I have an Aoyue Int 6028 SMD reflow station that serves me well.

Post Reply