Member Since: September 29, 2011

Country: United States

  • A propeller, huh? Well I haven't personally worked with a propeller but first and foremost it's important to know when needing a motor to spin you will have to power it with secondary power source besides the arduino. The arduino doesn't have enough current to drive the motor alone. That can be accomplished by putting a transistor (with something like 100ohm attached to the base of the transistor) to the pin you would like to use. Then connect the motor to the secondary power supply through the transistor. Since you are using a motot it's best to use a PWM pin on the arduino.

    If you already know that then next I would suggest using the arduino's "map" function. The compass module will send numeric values from 0 to 360 (as floats i.e. 0.00) to the arduino and from there you can write your code based on the values received. So the map function might look something like "PWMpipn = map(0,360,0,1023);". I can't remeber if it's 1023 or 255, but at any rate that funciton will translate the first values into the second values to be used proportionately on the PWM pin. The higher the number the faster it will spin.

    This is all just a simple and fast stech to what I THINK would work...not sure if it will becuase I haven't tested it. But start there. I hope that helped in some way. Sorry if it didn't.


  • I was able to get this calibrated correctly. I have to code and process you will need if you aren't able to figure it out. Good luck and take care!

  • It's either something simple or your component is bad...I'm betting it's something simple.

    So first of all if your component is the exact one you bought up above (not sure what the "TR" means in the LSM303DLHTR name) then I would try the follow sanity checks.

    1. If you AREN'T using an Arduino Uno then the I2C pins (SDA & SCL) are going to be different on a different Arduino board. The component will still work but you will have to put the SDA & SCL pins to their appropriate pins on the other boards if you aren't using the Uno.

    2. Visually verify you are actually connecting the correct pinout of the component to the Arduino. (Not trying to insult your breadboard skills but if you are using a breadboard or the proto-sheild make sure you are connecting the pins in the correct rows/columns.)

    3. Make sure you have the correct Arduino selected from the Tools option menu. Tools->Board-> Which ever Arduino you are using.

    4. When uploading the code to the Arduino, I had the issue of the code being outdated with Wire.send/wire.recieve. So make sure those are corrected. (The debug messages tells you what to replace those with. It should be like and Wire.write I think)

    5. The final thing I would try is ensuring your baud rate is matching. In the code (and most standard cases) the baud rate is 9600, shown by "Serial.begin(9600);" this is used for the Arduino to communicate back to the computer and visually output your results. On the actual serial monitor there should be a drop down selection. Select 9600 from the list and resend the code to the Arduino.

    If none of those things work I would try to select another serial port if available. Tools -> Serial Port -> pick another.

    If still that doesn't work then call the Tech Support and they are very quick, friendly, and understanding about either figuring out what's wrong and give a solution or just completely returning items that don't appear to work.

    I hope this helps. Good Luck and enjoy your compass!

    (btw, if you do get it to work then the next step would be to calibrate it. That's where I'm stuck on right if you get to that point and receive valid instructions/code to calibrate please share it with me! Thanks in advance!)

  • Thanks for your response, however you have simply restated my question. I understand I should follow the instructions presented by the datasheet for calibration but is in fact my question. HOW am I to follow it? It is very vauge with information (granted this chip wasn't made specifically to be used by the Arduino language) on how to make calibration code to run. That's what I am asking. So going back to my original question, does anybody know how what the code is for the Arduino language in order to calibrate this chip?

  • Has anyone figured out how to calibrate this compass using the Arduino language? I can't figure this out based on what the datasheet says. Someone help please!


  • So has anyone figured out how to code this in arduino language to calibrate it? My north and south are on point but east and west are always about 33 degrees off. I need help and direction on how to calibrate it that makes sense. The data sheet does a horrible job with this.

No public wish lists :(