PDA

View Full Version : 3 Axis Tilt Compensated Compass



JonHylands
06-06-2008, 12:48 PM
So I've been using a 3-axis tilt compensated compass in my AUV MicroSeeker (http://www.huv.com/uSeeker) for a few years now. It works great, but is crazy expensive (around $500).

Sparkfun is carrying a nice one (http://www.sparkfun.com/commerce/product_info.php?products_id=8507) that is almost half the price, and is even smaller to boot.


However, recently I came across a new one (http://www.silabs.com/tgwWebApp/public/web_content/products/Microcontrollers/en/F350-COMPASS-RD.htm), by Silicon Labs, that is available for $72. This one is a little bigger, and needs a PC (unless you're willing to hack the board a little) since it uses USB. It includes a nice LCD and a built-in battery holder, so you can use it as a hand-held compass for testing purposes.

It is a reference design, and has an onboard microcontroller, and they have the source code that is running on the microcontroller available on their site.

Mouser carries it, if you want to order it...

- Jon

Adrenalynn
06-06-2008, 12:59 PM
Heck, just that LCD has got to be worth $35. It's socketed and appears to be reasonably high-res graphic.

Adrenalynn
06-06-2008, 01:06 PM
Your Order is Now Complete


You will receive an additional email confirmation when your order ships. If you have questions or concerns about your order, please contact us (https://www.mouser.com/ContactUs/ContactUs.aspx) and reference the order number below

Too cheap. Couldn't resist the urge. ;) Thanks a lot. I can't decide if I should do a +rep or -rep on that. :P Dang it, I couldn't give you +rep. Sorry. Bank it for later - I have to "spread it around".

JonHylands
06-06-2008, 01:28 PM
I think the LCD is one of those "specific" LCDs, not a generic graphical LCD.

http://www.huv.com/Compass-LCD-small.jpg

Big Version (http://www.huv.com/Compass-LCD.jpg)

- Jon

Matt
06-06-2008, 02:05 PM
Wow, what a killer find! Thanks for reporting it Jon. Jodie, give me your review of this when you are done playing also. This may be a must stock item.

Adrenalynn
06-06-2008, 02:41 PM
Good call Jon, thanks. I just saw the silabs boot screen and figured it was graphical. It's still amazingly inexpensive.

Did you get the RD yet yourself, Jon? I understand the package includes: "complete compass, user guide, schematics, USB Cable, and PC GUI Software". It's a true reference board, apparently, and I can't believe the deal there. I'll be hacking on it to see what it really is. The chips are just a few dollars in 10k quantity.

JonHylands
06-06-2008, 02:53 PM
Yeah, I took the picture above. Its a really nice package, comes with all the above mentioned stuff. I ran the calibration procedure, which was very simple with the included push-buttons and LCD panel. I used this page:

http://www.ngdc.noaa.gov/geomagmodels/struts/calcDeclination

to figure the magnetic deviation for where I am.

I haven't plugged it into my PC yet, but that will be next.

- Jon

Adrenalynn
06-06-2008, 03:19 PM
That's awesome, thanks! Good initial report! Mine should be here end of next week.

I do a lot of hiking and climbing (and geocaching), so I know my dec by rote. I'd personally never use a digital compass in the boonies (I have a Brunton Outback that was a gift, but wouldn't ever use it, I had it out to consider hacking it - but this kit is just too reasonable), I carry a Cammenga Tritium US Milspec as my primary and a Silva Type 20 as my backup. But for a robot? They're a must have. Although - one COULD read a magnetic compass with a camera. Hmmm. ;)

Alex
06-06-2008, 04:43 PM
BTW Jon, are you planning on entering your microseeker in the TRC Contest?

Adrenalynn
06-06-2008, 05:37 PM
More questions for you, Jon -

Do they offer the source code for their PC GUI? Have you figured out how to interface with it (even over the USB) - I know you said you haven't plugged it into the PC yet, but was there any good interface documentation outside the MC docs/source? Bonus points for the source for the PC GUI they advertise.

I'd expect a reference design to offer the source for all pieces, but this thing is just sooo inexpensive!

JonHylands
06-06-2008, 08:12 PM
The interface over USB is a virtual COM port (they are using a CP2102 onboard).

According to a post in the SiLabs forum:

===================================
serial: 57600 baud 8-N-1command: 0x11 (UART_DATAREQ)
reply: 9 bytes
0: degree high (unsigned 16bit)
1: degree low
2: minute (unsigned 8bit)
3: temperature high (status bit + 7bit)
4: temperature low (sign bit + 7bit)
5: inclination Y (sign bit + 7bit abs)
6: inclination X (sign bit + 7bit abs)
7: status
8: checksum

- The demo app opens the RS232 port with 57600 baud 8-N-1
- The demo app sends a single byte command "0x11"
- The board replies 9 bytes data, like above.
===================================


- Jon

JonHylands
06-06-2008, 08:34 PM
BTW Jon, are you planning on entering your microseeker in the TRC Contest?

I have a pile of robots I've built over the years, but I kind of feel silly entering something I started working on 10 years ago, and haven't really done anything with in the past few years...

The underwater videos (http://www.huv.com/uSeeker/poolTest-20040901/index.html) are pretty cool though...

- Jon

Adrenalynn
06-06-2008, 08:35 PM
Well dang, that's pretty simple! I won't pester you with questions - I'll wait until I get mine.

Thanks kindly, Jon, for your help!

Adrenalynn
06-06-2008, 08:39 PM
Someone give this man a +rep, pretty please?

Seriously, apparently the system wants me to "spread it around" to more people than we have. ;)

Woohoo! I finally managed to spread it think enough to get back to you. :)

Alex
06-09-2008, 09:31 AM
Someone give this man a +rep, pretty please?

Done;)

Being an admin though, I gotta be conservative (WOW, did I just call myself conservative??) with that cuz I have a ridiculous amount of rep power, haha! Jon totally deserves a +rep from me though; He's helped out so many in the TRC:D

JonHylands
06-09-2008, 09:39 AM
Awww, gee, thanks :-)

- Jon

JonHylands
08-22-2008, 12:56 PM
Okay, so I found something really nice today...

http://www.sparkfun.com/commerce/product_info.php?products_id=8656

3 axis solid state compass, three axis accel, and a built-in PIC to give an I2C interface. 0.8" square breakout board, 3.3 volts.

Absolutely amazing, price is $150. Sparkfun is out of stock, but robotshop.ca has them in stock, and I just ordered one...

JonHylands
08-26-2008, 07:22 AM
572

Well, I got my HMC6343 (http://www.sparkfun.com/commerce/product_info.php?products_id=8656) yesterday, and it took about an hour to write the code to interface to it, which worked the first time. Of course, the I2C code I ended up using had a couple nice examples, so it was easy to adapt them.

So it works really well - its very responsive, and will update its internal sensor values at either 1 Hz, 5 Hz (default), or 10 Hz.

I'm impressed - the hardest part of the whole thing was building the cable, with some built-in pullup resistors.

I used one of my General I/O boards, which has pin sockets for the two pins (C4 and C5) that are used for I2C, with a 3.3 volt regulator and a hacked in serial port. I grabbed some I2C interface code from here:

http://www.uoxray.uoregon.edu/orangutan/i2c.zip

which worked perfectly.

My code looked like this:



i2c_start_wait (COMPASS_ADDRESS_WRITE);

i2c_write (COMPASS_HEADING_COMMAND);
i2c_rep_start (COMPASS_ADDRESS_READ);
heading = (i2c_readAck () * 256) + i2c_readAck ();
pitch = (i2c_readAck () * 256) + i2c_readAck ();
roll = (i2c_readAck () * 256) + i2c_readNak ();
i2c_stop ();

printf ("Heading: %4d Pitch: %4d Roll: %4d\n", heading, pitch, roll);
- Jon

Hephaistos
08-26-2008, 07:29 AM
Nice work Jon. It's always great to read your write-ups. As soon as I come up with a way to use this little device, I'm all over it!

Electricity
08-26-2008, 12:13 PM
Jon, what are you writing your code it? I like the way it's format works out.

JonHylands
08-26-2008, 12:18 PM
The code is written in C, for the gcc compiler, and runs on an ATmega168.

Being a professional software developer, I make of point of writing easy to understand code. As you can imagine, I write a lot of code, and making sure that the developers intent is clear is the most important thing in writing easy to understand code.

And, looking at that code again, I see I managed to screw that up...

Here's a better version, with slightly different spacing and a couple comments:



// send the HEADING command to the compass
i2c_start_wait (COMPASS_ADDRESS_WRITE);
i2c_write (COMPASS_HEADING_COMMAND);

// now read the response
i2c_rep_start (COMPASS_ADDRESS_READ);
heading = (i2c_readAck () * 256) + i2c_readAck ();
pitch = (i2c_readAck () * 256) + i2c_readAck ();
roll = (i2c_readAck () * 256) + i2c_readNak ();
i2c_stop ();

printf ("Heading: %4d Pitch: %4d Roll: %4d\n", heading, pitch, roll);

4mem8
08-26-2008, 01:46 PM
Jon, Thanks for posting this, But see what I mean! You are a good coder and as you state you write a lot of code and you state you mucked it up. So what chance do I have of getting it right! He he. Brilliant, Again thanks for posting it.

dgeorgester
01-29-2009, 09:09 AM
Hi all;
First a few words about my project;

I'm developing a twin axis solar concentrator (up/down aka altitude or elevation, left/right aka azimuth) and software (in VB6). I was glad to find this impressive site, this is my first posting. What I'm using now is a quadrature feed back set up for the azimuth and a hall effect switch on the elevation. To keep things simple, I thought a digital compass might do the trick since most of them have a built in tilt sensor. The OS5000 is limited to 0 to 60 degree tilt, so this one won't work. It would also have to be quite precise, within a tolerance of of +/- 0.75 degree on both elevation and azimuth to keep the dish in line with the sun. Cost of this project is everything if ever I'm to put it on the market, because the payback period should be a short as possible.

Could anyone of you fine folks inform me of the precision and repeatability of the F350-COMPASS-RD by Silicon Labs? At less then 100$, this is truly a great price, but would it be precise enough to keep things well aligned? That's my big question of the day.

happy regards,
Georges

Adrenalynn
01-29-2009, 12:08 PM
Hi, welcome to the forum!

Naw, nowhere near that, even right after calibration. I see it wobble around a good degree and a half.

dgeorgester
01-29-2009, 09:54 PM
ahhh thanks for the info Adrenalynn. I'll keep looking and if i find something interesting, I'll post it here.