Raspberry Pi Compass : Info requested
Martin Hansen (393) 56 posts |
I’m at the early stages of writing a simple electronic compass application for the Raspberry Pi. I was wondering if anyone’s already done this, or sussed out some of the software/hardware issues. I’ve yet to buy any hardware or write any software. Hoping to produce a straight forward simple desktop application which I’ll make freely available, so any code shared will be going towards community benefit. |
Martin Hansen (393) 56 posts |
I’ve ordered some of these 3-Axis Compass Boards off eBay; Amazed that they cost less than £2 each. |
Steve Pampling (1551) 8172 posts |
https://cdn-shop.adafruit.com/datasheets/HMC5883L_3-Axis_Digital_Compass_IC.pdf possibly. |
Martin Hansen (393) 56 posts |
Thanks Steve, I printed that off earlier today so we’re hurtling down the same path. It’s the software needed to access the GPIO pins on the Raspberry Pi side of things in the correct manner that I was hoping someone had already sussed out. Probably need a tiny assembly language routine as I doubt it can be done from Basic. |
Andrew Conroy (370) 740 posts |
The board you linked to looks like it’s interfaced by I2C, so you should just be able to use the OS_IICOp SWI to talk to them, unless I’m missing something? |
Chris Hall (132) 3559 posts |
The board’s 7-bit IIC address is &1E so its 8-bit address is &3C/&3D for write/read. Pins 3 and 5 on the 40 pin header are the clock and data pins for IIC on the Pi, using 3.3V logic on the Pi but using 1.8V logic on the chip. Problem. |
Andrew Conroy (370) 740 posts |
The eBay listing for the module rather than the bare chip suggested that the module worked on 3-5V, so hopefully less of a problem. |