module for the HMC5883L compass
Moderators: David Barker, Jerry Messina
-
- Posts: 18
- Joined: Sun Feb 03, 2013 2:26 am
- Location: Salmon, Idaho
module for the HMC5883L compass
Want to experiment using an electronic compass and all I find are Adriuno library stuff and one using an 18F4550 but in C.
So I guess I need to convert the C source code into Swordfish (familiar territory) but???
I figure I would inquire if anyone has dealt with an electronic compass using Swordfish?
So I guess I need to convert the C source code into Swordfish (familiar territory) but???
I figure I would inquire if anyone has dealt with an electronic compass using Swordfish?
I miss backpacking the Sierras
-
- Swordfish Developer
- Posts: 1473
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
Re: module for the HMC5883L compass
Looks like the HMC5883L is no longer available... you might want to try another IC
-
- Posts: 18
- Joined: Sun Feb 03, 2013 2:26 am
- Location: Salmon, Idaho
Re: module for the HMC5883L compass
been looking at using the breakout board available from adafruit as well as sparkfun unless there is a better choice?
I miss backpacking the Sierras
-
- Swordfish Developer
- Posts: 1473
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
Re: module for the HMC5883L compass
From what I see both of those are no longer available.
I don't have any suggestions... never used one.
I don't have any suggestions... never used one.
-
- Posts: 18
- Joined: Sun Feb 03, 2013 2:26 am
- Location: Salmon, Idaho
Re: module for the HMC5883L compass
found what may be a better solution
https://www.memsic.com/userfiles/files/ ... _FRevH.pdf
has PWM as well as A/D output
Now to figure out how to implement.
Microchip has a paper on it AN996
http://ww1.microchip.com/downloads/en/A ... 00996a.pdf
now the fun begins but looking at the data sheet it looks like it may be easier than it looks using A/D
I am only interested in measuring about 5-10 degree difference but don't really need an LCD display for my project that I want to build for my E-trike
https://www.memsic.com/userfiles/files/ ... _FRevH.pdf
has PWM as well as A/D output
Now to figure out how to implement.
Microchip has a paper on it AN996
http://ww1.microchip.com/downloads/en/A ... 00996a.pdf
now the fun begins but looking at the data sheet it looks like it may be easier than it looks using A/D
I am only interested in measuring about 5-10 degree difference but don't really need an LCD display for my project that I want to build for my E-trike
I miss backpacking the Sierras
-
- Posts: 18
- Joined: Sun Feb 03, 2013 2:26 am
- Location: Salmon, Idaho
Re: module for the HMC5883L compass
the mxd2020el is no longer in production but did find several sources for a breakout board using the HMC5883L
https://www.robotshop.com/en/hmc5883l-b ... mpass.html
the A/D feature nice but?
https://www.robotshop.com/en/hmc5883l-b ... mpass.html
the A/D feature nice but?
I miss backpacking the Sierras
-
- Posts: 18
- Joined: Sun Feb 03, 2013 2:26 am
- Location: Salmon, Idaho
Re: module for the HMC5883L compass
After some searching for a sensor that is available I found a breakout board at sparkfun that has a simple code that dosen't use any adrunio library. now I need to convert to Swordfish to load into a pic. then instead of an lcd (will use opti-coupler) in final project).
Code: Select all
#include <SparkFun_MAG3110.h>
MAG3110 mag = MAG3110(); //Instantiate MAG3110
void setup() {
Serial.begin(9600);
mag.initialize(); //Initializes the mag sensor
mag.start(); //Puts the sensor in active mode
}
void loop() {
int x, y, z;
//Only read data when it's ready
if(mag.dataReady()) {
//Read the data
mag.readMag(&x, &y, &z);
Serial.print("X: ");
Serial.print(x);
Serial.print(", Y: ");
Serial.print(y);
Serial.print(", Z: ");
Serial.println(z);
Serial.println("--------");
}
}
I miss backpacking the Sierras
Re: module for the HMC5883L compass
I used the CMPS11 module https://www.robot-electronics.co.uk/htm/cmps11doc.htm with great success. This particular module does all the heavy lifting as it takes care of the tilt compensating maths for you. If you decide to go down this path I can post the two or three lines of code that I used - it was very simple to get going.