Wednesday, March 13, 2019

Minimal 3-Axis Magnetometer Rapid Prototype




This project started when a friend asked me to develop a method to measure the strength of a low-level magnetic field for a fixture in one stage of the playing field for a robotics competition. This was a college level event with teams from around the globe. The system used a low-level magnetic field so detecting the field was more challenging than simply using a reed-switch or hall effect sensor.

The design target for the magnetic field stage of the event was 1000 microTesla (μT), or 1 milliTesla (1mT). To ensure fair competition, the event manager needed a way to verify all of the boards produced a field meeting or exceeding 1000 μT. I suggested a potential sensor, the Melexis MLX90393 Triaxis Magnetometer for calibrating the fields and was quickly asked if I could put something together. That is the ever present danger of tossing out an idea in a meeting, "That sounds great! Why don't you make that happen!".

It sound like a great opportunity to quickly assemble a minimal viable product (MVP) and share some rapid prototyping tips. Here is how I built the magnetometer used to validate the magnetic field generators for the IEEE Southeastcon 2017 Student Robotics Competition

One of the robot challenges required performing an action only when a magnetic field was present (there was a Star Wars theme for this stage so detecting the field was referred to as sensing "The Force"). The goal was for the robot to detect the field and mechanically tap the target to score and turn off the magnetic field. After a random time delay the field turns back on and the process repeats until the end of that timed stage. Tapping the target when the field was off would award negative points. The video below shows The University of Alabama on this stage. You can watch the whole video to see all of the event's stages.

"Sense the Force" Stage from The University of Alabama

There were many innovated robots on display at the event. Here are more videos from this and other IEEE Southeastcon events.

The MLX90393 was available from Sparkfun as a SparkX product (SparkX devices are early development boards made available to adventurous customers for early testing). Note that this breakout board is now availability as a regular Sparkfun product with the modular Qwiic connectors. Sparkfun also offers a full hookup guide to get you started with your own project.


I purchased a couple of SparkX boards, combined them with a Sparkfun Arduino Pro Mini and a Sparkfun Basic Serial board along with an OLED display on a bread board and got started. Below you can see all of the elements on a breadboard on my workbench.




I began with an example sketch, modified it to send the the data to the OLED, added a little text formatting for the display and the programming was done! Here is a link to the code that was hacked together from several sources.

https://github.com/sdtrent/Minimal-Magnetometer

Next up, the breadboard was fine for my workbench, but how should I package the magnetometer for travel and use on the floor at the actual IEEE event? This was a fast and dirty project so I did not want to design a case. I wanted something that was just good enough to meet my minimal requirements. A quick glance around my workbench provided the answer! At arm's reach was a Sparkfun box that fit the bill nicely!

It was quickly re-purposed to hold the sensor, display and power switch. It took only a few minutes to make holes in the box for each of those. By carefully cutting the holes as slits and keeping the fit tight, the flex and friction of the box held everything in place. I did cover the actual sensor with a layer of clear packing tape to provide some insulation since we were going to be placing the sensor up against the the metal head of the bolt used for the core of the electromagnet. The clear tape also made it easy to see the sensor to help ensure we were putting it directly over the head of the bolt.



The 18650 Lithium Ion battery is massively over spec for the use-case, but I had the battery and holders on hand so in they went! The breadboard and battery holder were attached with Velcro dots.


The device worked great in the field. We even caught when a few of the boards were wired (or wound) with the opposite magnetic polarity. Those boards were quickly rewired to ensure a level playing field for all of the teams.

I was impressed with the performance of the Melexis MLX90393. It could easily measure the change in magnetic field when a neodymium magnet is rotated 15 cm from the sensor.

This is one example of how you can quickly assemble a proof-of-concept prototype to test an idea or even provide a Minimum Viable Product for initial field testing. I hope this helps you with your prototyping!

No comments:

Post a Comment