Shop Learn
Cheap compass sensors: a cautionary tale — Parallax Forums

Cheap compass sensors: a cautionary tale

Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,045
edited 2014-11-15 13:39 in Accessories
This is almost too embarassing to post on Parallax's forum, but here goes...

I'm teaching Spin programming in a high-school robotics class. We're using ActivityBots in the class, and the overall objective this semester is to be able to navigate autonomously using GPS waypoints. The year-long objective is a floating automous vehicle that will survey the local wasting-desease-challenged sea star population using a GoPro or other camera to create a photo-mosaic image of the subtidal seafloor. It's a tall order and an ambitious project, but I think we can accomplish it.

One of the requirements of the project is to know which direction the ASV (autonomous surface vehicle) is pointed, so that it can turn towards the next waypoint before approaching it. (GPS does not provide heading data unless you're moving.) So an electronic compass module was in order. Now, my class has an extremely limited budget for equipment. So I went all erco and scoured eBay for bargain compass modules. Not unexpectedly, I found some HMC5883L modules for cheap. How cheap? Two dollars and change, compared to Parallax's nearly $30 module that uses the "same" chip. The best part was that I could use the same Spin objects that are used for Parallax's $30 compass modules. I ordered 16 of them for the class more than a month ago, and a few weeks later, they arrived via Hong Kong Post.

Fast forward to last Monday. 'Time to prepare the lesson for this week's Thursday and Friday classes, and "navigation by compass" was on deck. So I solder the headers onto all 16 modules, grab one, wire it up, and start to work on the new lesson. Wow! This thing works great! Imagine my giddiness at finding such a bargain! So I prepare an 11-page handout for the kids to use to calibrate their compass modules and even create an online website that takes their raw data and uses Fourier analysis to compute correction factors for the raw X/Y compass data so that an arctangent function can produce reliable heading results. I have never worked so long and hard on one lesson, nor been so happy with the results.

Thursday arrives, and I hand out the compass modules, some printed compass roses, a Silva backpacking compass for aligning their taped-down roses to magnetic North, and the student's worksheets. That's when things start to go downhill and spin out of control. First, the classroom's worktables are made of steel. (Mine are made of wood.) "North" for the students pointed in wildly different directions. Second, and significantly more troubling, several students started reporting that their compass modules were returning data with very low values or no data at all. So far, I've counted seven of the sixteen modules that are defective. There might be more that the students have not discovered yet.

Volunteer teachers without any real authority, like me, maintain a very tenuous grip on their students' attention. When things start to go wrong, that grip loosens pretty quickly. So it's imperative to come to class prepared with reliable equipment, even it you can't afford it, and an iron-clad plan for implementing it. eBay sensors might look like bargains, but caveat emptor still rules the day. And if a deal sounds to good to be true, it probably is. Where young minds are concerned, the lesson is to buy quality. In the long run, it's cheaper than the "bargain" alternative.


Addendum: Who knows what I got from China. Honeywell rejects? Counterfeit chips? The really bizarre aspect of this misadventure is that the defective chips all pass the internal self-test. And this isn't some phony, simulated test either. The chip uses a 10mA current to create its own internal magnetic field against which the sensor is tested. The bad ones all passed. Yet, when the internal field is turned off, they're blind to the Earth's magnetic field.


  • ercoerco Posts: 19,988
    edited 2014-11-15 02:31
    Wise words, PhiPi! When I was teaching I used Parallax BS1s and BS2 without any issues (no surprise) but I sympathize with your Ebay rejects, nearly 50% bad. Yikes! Any chance the students blew them up by miswiring? That always scared me, but the boards I used (BS1 project board and BS2 Homework board) had protection resistors, which surely helped avoid disaster.

    Man, how I would love to be in your class, learning from the master. A "tenuous grip on your students' attention"? Surely you jest, good sir!
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-11-15 06:50
    The core issue is whether people should be shopping in places where universities lecture graduate students in business with ideas such as there is no economic model that cannot perform better by cheating and not getting caught.

    I've been in Asia for 19 years and this approach is taught by some in local universities. The result is I buy less as I assume I am going to be disappointed. There are advantages to shopping a more western ethic.

    I even have a few phony 2n3055 in TO-3 cases and it amazes me that someone would bother with creating a bogus labe; (it is not the Motorla M) and dig up junk devices. Most recently, a major food oil supplier has gone out of business just because the company salvaged 'gutter oil' and sold it to bakers for the Mid-Autumn Festival as 'pure lard oil'. What's 'gutter oil'? Well, when one cleans the gutters in a restaurant district, you get oil and grease. They really should just be using this to fuel their Mercedes-Benz.

    I again fell into the trap by buying 4 items from Deal Extreme recently. Two arrived very late, the rest will arrive sometime later.. maybe. And I am unsure anything will work well.
  • kwinnkwinn Posts: 8,693
    edited 2014-11-15 07:52
    A frustrating lesson to learn. Been there, done that.

    On the other hand there were two valuable lessons your students got from that.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-11-15 08:59
    I've have certainly had my share of lesson plans that blow up once the class starts. But I don't have to pre-test technological kit for all my students.

    Parallax has always tried to deliver pre-written code that will actually verify their products are working as promised.... something that the EBay and Arduino device crowd seems to omit.

    My frustrations have only arisen as I began to actually think that the Arduino boards from obscure makers are supposed to performs as good as Parallax.

    In sum, if you can't locate the maker, or if you have to reverse engineer documentation --- don't expect a lot.

    It has been a big year for food scandals here in Taiwan. Lots of products recalled due to the gutter oil getting into almost everything. And now, the news is full of stories about Grade A and Grade B lamb is really a mix of lamb and pork; while Grade C lamb is 100% pork.

    I just don't get it when people violate the public trust about food, water, medications, or other basics.
  • Ken GraceyKen Gracey Posts: 7,325
    edited 2014-11-15 13:39
    We tend to focus on the cost of the parts we can get from China, rather than the far more important cost of our time (and lost time - the opportunity cost).

    In this case, Phil is a very productive engineer and suppose he easily charges his time at $100/hr. Let's add up the time monkeying around with these Chinese parts.

    "scoured eBay for some bargain compass modules" - 1 hour
    "ordered 16 units and wait for them to arrive, more than a month ago" - lost time, hard to imagine, but lets say 4 hrs.
    "soldered headers on to the 16 modules" - Parallax sensors include headers, but maybe this was another 1 hour of work
    "students started reporting their compass modules returned low data or nothing at all" - 2 hours, not to mention total humility and loss of the students time

    Phil really came clean by admitting these details. I'd like to use his experience as an example, without making fun of Phil. He easily used about seven hours of work and loss a month waiting and precious class time. That's a cost of well over a thousand ($1,000) considering his time and even a small amount of the student's.

    16 Parallax compass modules are $26.99 each, or $431.84. It's just not worth it to risk your time buying unknown Chinese parts when you can have Parallax quality. If any of our sensors were bad, I'd have shipped him replacements overnight to keep his course going. Phil and I will get him authentic Parallax compass modules as soon as possible when we open Monday morning.

    Parallax also spent time developing our Spin code, so it's appropriate to support us by purchasing the parts from us.

    There is a place for pointy-headed managers when it comes to engineering choices, trade-offs and opportunity cost. Phil, I honor your sincerity here and it's one of the reasons I continue to work with you every chance we find a project together.

    Ken Gracey
Sign In or Register to comment.