Example Code

Magnetometer with Arduino UNO

Code and Documents

Attachment

Download All
Simple demo application that uses the Arduino UNO board and an I2C 3-axis magnetometer. A 3D cone, which represents an arrowhead, rotates according to the motion of the sensors w.r.t. the magnetic field. When the z-axis of the sensor points the north, the arrowhead points out of the screen. A moving average filter can be applied to smooth the signals.
Spoiler
HW requirements: Arduino UNO board; HMC5883L 3-Axis magnetometer compatible (see datasheet for specifications).
SW requirements: LabVIEW 2011 or later and LabVIEW Interface for Arduino. 

Immagine board.jpgSharedScreenshot.jpg

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Mannaor
Member
Member
on

Dear C.Fontana,

what I need to change if I will use MLX90393 magnetometer (not HMC5883L)

I tried to use your code but it doesn't show anything and also it doesn't show any error.

 

Best wishes,

Mannaor.

Contributors