Friday, October 5, 2012

Rant to Self: Arduino Development of Haptic Compass on Arch Linux

Poni Halp Me
Yesterday I was able to get the arduino development environment setup on Arch Linux AND get the compass module talking to the arduino over I2C (yay pre-existing code).

A lot of the haptic compass projects I see are driving the vibrator motors directly from the digital pin on the arduino, naughty!

I'll post how I used a transistor to switch each motor, even though I haven't done it yet :-P

So now the hard part where I'm sort of flabbergasted at the moment.  I have 6 registers of data spilling out magnetic field strength data for 3 axis, oh yeah the module I have exposed the DRY (data ready) pin from the compass chip, so I altered the sparkfun code to update continuously when that pin is high... high ... heh.

Anyway. When the data is inspected as a signed integer, I seem to see values from -700 to 700 for each axis.  I'll probably have to do something called 'vector addition' heh made that up, maybe, but like... I know I can't directly add or subtract the vectors, x and y are on the same plane and z is sticking out, and it seems like the higher the number the more aligned to north the axis is, negative is when the axis is "pointing" south.

Also when an axis is pointing down towards the ground its a positive, when it's pointing towards the sky it's negative. Not too sure about this behavior yet.

I should really read the data sheet more in depth now. Until next time!

No comments:

Post a Comment