Arduino Milligaussmeter - Magnetic Measurement

Introduction: Arduino Milligaussmeter - Magnetic Measurement

About: We are a supplier of neodymium, rare earth magnets. We also love to conduct experiments with our magnets and build unique projects with them! We have several engineers on staff who are always thinking of new p…

Can strong magnets be shipped on a plane? We ship out a lot of magnets and there are certain regulations for shipping magnetic material, especially on a plane. In this article, we explore how you can make your own Milligaussmeter for Air Shipments of magnetic materials, to make sure your shipment complies with all shipping regulations! This device can detect very small magnetic fields, which could be fun/useful in other applications as well.

For some good information on the topic, check out this article - it'll give a good intro into why we need this device!



Triple-axis accelerometer+magnetometer


Display board

Breadboards and wires

Step 1: Assemble Parts

Assemble together all of the components! The display we used comes with various components that need to be soldered to the board. Follow the instructions that come with the package!

We used breadboards to connect the Arduino, sensor and display together, but you could hard wire them, too!

Also, be sure to check out the wiring diagram we included.

Connect power and ground from the Arduino to the sensor and display.

Two wires to the sensor from the Arduino enables serial communication and two wires from the Arduino to display do the same.

We added a buzzer which would beep if the field was too strong for our guidelines.

Step 2: Plug Into Computer for the Code

Next, we needed to program the Arduino. Here is a link to the code for the device. Save the code as a text file.

You can find some awesome Instructables on how to setup/configure an Arduino, but here is a brief synopsis of what we did:

Plug the Arduino into the computer and download the Arduino software

Open Arduino program

Open the file (sketch) you want to load - Arduino programs are called sketches. Load the saved text file (link above)

Go to the sketch menu and click "Verify/Compile". This will check to see if there are any problems.

Go to the sketch menu and click "Upload".

Viola, the code should be on the Arduino and ready to calibrate (next step).

Step 3: Calibration

Apply power to the device. We just plugged it into a laptop in the video, but you could just as well power it with batteries.

For the first 15-20 seconds after power-on, we need to do a calibration. These sensors aren’t perfect, so we need to, “zero it out.” Keeping the device flat on a horizontal surface, rotate it around 360 degrees within this time to complete the calibration.

Once calibration is complete, the display should indicate the direction the X arrow (on the sensor board) is pointing, as a number from 0 to 359. Turn the sensor until it points north (a "zero" reading).

Press the SELECT button to zero it on the heading. It sometimes helps to do this more than once. Now, as long as the zeroed reading doesn’t drift, you can measure magnets. If it does drift a little without any magnet nearby, you can zero it out again.

Step 4: Test It Out!

After zeroing out the sensor, test it out by placing a strong magnet nearby!

Place the magnet/shipment 7 feet away to the east or west of the sensor, and slowly rotate it around. If the Arduino senses a compass direction change of more than 2 degrees, it should beep. indicating that the magnet is too strong to ship via air. The display also tells us that it fails!

We had to do this outside, because our building is full of strong magnets that could mess with the sensor calibration!

Be the First to Share


    • Make it Glow Contest

      Make it Glow Contest
    • First Time Author Contest

      First Time Author Contest
    • PCB Challenge

      PCB Challenge