Close

Adding a Magnetometer

A project log for Stubby the (Teaching) Hexapod

100% open source robot platform with accessability and affordability in mind: teaching children of all ages about robots & programming

The Big OneThe Big One 09/16/2014 at 05:030 Comments

While working on the Processing API with Princess Sparkle, we found that Stubby was having problems going perfectly straight; it would veer one direction or another, depending on the angle of movement.  After hours of research, we determined that the problem was due to slight variances in each leg.  When walking, these tiny differences in each step compound, and make for large errors in the outcome.  (This is the same principle which happens in a flock of female velociraptors with spliced frog DNA, where some individuals will spontaneously change gender... oh wait, nevermind.)  More accurate calibration of the legs can help, but it doesn't eliminate the problem completely.  Compounding this problem, there are also inaccuracies when turning in place, depending on the surface that the robot is walking on (e.g. tile vs. carpet).

Warren and I discussed a number of options on how to solve this.  The idea which seems most promising (both due to the simplicity, the low cost, and the low processing requirements) is to add a magnetometer.  This will allow Stubby to keep track of the direction it is facing; when moving, we will use the feedback from this sensor to make small course adjustments as the robot is walking (basic PID functionality, although the I component will probably not be included, and D, if any, will be minor).  The biggest unknown at this time is whether the magnetometer will a) be accurate enough and b) will work properly even though it is encircled by (admittedly small) motors.

Since I have just ordered the rev 2.0 PCBs (which, BTW, are marked as Shipped, yay!), I bought a standalone i2c magnetometer from Adafruit for prototyping:

Assuming we can get things working as planned, I will add this chip to the Stubby control PCB itself.  In the mean time, I have a new top layer designed, which fits the new control PCB and has room for the magnetometer as well:

Cheers

Discussions