Saturday, March 26, 2011

I2C sensors - Compass

I've already posted about the compass that I'll be using in the boat. But as with anything there is more to it that just the specific part. In fact we have several options when it comes to tilt compensation compasses.
  • LSM303, $30, I2C, no internal calculations, accuracy depends...
  • HMC6343, $150, I2C, tilt compensation calculated internally, accuracy of 2 degrees
  • OS5000-s, $260, RS232, tilt compensation calculated internally, accuracy of 0.5 degrees
As I said earlier I'll probably go with the HMC6343. So lets talk about I2C and the Arduino. Most of this information was taken from tronixstuff. Another great tutorial is at Robot Electronics.
  • I2C uses pins A4 for SDA (data) and A5 for SCL (clock)
  • I2C needs Arduino librarywire.h>
  • The default (factory) HMC6343 7-bit slave address is 0x32 for write operations, or 0x33 for read operations.
  • The compass requres pull-up resisters on SDA and SCL to 3.3v and supply voltage of 3.3v
  • The Arduino has built in pull-up resisters on A4, A5, but it is to 5v...
To get the correct logic and supply voltage to the HMC6343 it looks like you can use a logic level converter at least at $1.95 they don't cost much...

I initially thought that I could use 3 wires for each of my sensors and use servo connectors. Now I'm starting to realize that most of the sensors take more connections that that. I2C components require 4 wires.

More Resources on Arduino I2C and Level Shifting

No comments:

Post a Comment