Arduino Digital Magnetic Compass (HMC5883L - 2 display modes)

I prefer to build my own arduino based circuit by using the ATmega328p uno possessor, but this is optional for you. Buttons are used for turn on or off display leds and to change display mode of compass.

Step 1: 4 Steps for full progress

Step 1: About HMC5883L board
The HMC5883L sensor is a 3-axis digital magnetometer IC designed for low-field magnetic sensing. The sensor has a full-scale range of +8 to -8 Gauss and a resolution of up to 5 milli-Gauss. Communication with the HMC5883L is simple and all done through an I2C interface. That means you will need to connect power, ground and only two cables to Arduino uno board (SDA,SCL).
 
The HMC5883L board can be powered up by 5V or 3.3V pins of Arduino uno board. No need to add any capacitors or resistors to your circuit.
 
Pinout and connection with uno:
 
Vcc to 5V or 3.3V
GND to GND
SDA to A4
SCL to A5
DRDY to nothing...
Because this is a magnetic compass if you put it near to battery, motors, metallic surface or magnetic field, the result will diverge from the actual. Also make sure to use it on a flat surface!
 
Step 2: Breadboard schematic circuit
Here is the circuit on breadboard schematic. Make sure to read "pinout" notes on image and connect lcd and sensor correct with arduino uno.
Step 3: Libraries and code
 
Before open code file "arduino_compass.ino" install the necessary libraries to arduino ide libraries folder.
 
Just open the libraries.rar file and extract / copy all files to libraries folder.
 
If you have windows os and you don't know where this folder is, watch this video on YouTube: youtu.be/CdjUUo_owIc
 
For some parts of code, I want to thank Markus Ulsab and Galin Dimitrov who shared their own arduino compass projects.
 
What I did?
 
Changed Markus project to support HMC5883L sensor
Combined two projects for "two display modes" function
Correct some minor bugs
Add comments in my code
Step 4: Building the 'box' - tips
This is an optional procedure!
 
To build the box i used one thin balsa sheet. You can easily cut it with a small cutter and paint it with marker.
 
See the images above to take an idea, but keep in mind that you can design and build your own box.
 
If you will use a battery, do not put it near HMC5883L sensor.
 
Some tips:
 
Make marks of components on balsa sheet
Cut carefully with a small cutter - Be patient and make sure that you will not cut your self!
Paint it with your favorite color marker
Put components on it
Use some glue to close the box
Watch video on YouTube: youtu.be/i7GaVqMSzMA (make sure to click like button ;-) )
 
www.ardumotive.com find Greek Arduino Projects






Mar 19,2015
3,704 viewsReport item
  • Comments(0)
  • Likes(1)
You can only upload 1 files in total. Each file cannot exceed 2MB. Supports JPG, JPEG, GIF, PNG, BMP
0 / 10000

    You might like