Well… maybe more than half a brain. Fortunately at the suggestion of forum members on the OpenMarine site, I looked a little closer at the Yachta wind sensor. My first, casual glance showed the sensor Yachta used was a 12 bit sensor. The one I had originally picked out was a 16 bit sensor. Surely, mine would have better resolution and thus be better. Not so fast! It turns out the AS5600 sensor is actually more than just a 3D Magnetometer. It uses a 2D hall sensor, but adds a glutton of filtering, smoothing and hysteresis algorithms to give an angle that comes out at 12 bits. This equates to a resolution of better than 0.1°. The great part of this is it is all handled in hardware and thus totally off-loads all that work off the microcontroller. As a side benefit, I can emerge out of the rabbit hole I was digging trying to get some smoothness to the angles using the QMC5883L sensor without adding to much latency.
Not All Magnets Are Equal
These AS5600 sensors come out at about the same price as the QMC5883L sensor in small quantities, and some vendors even include a magnet. Now… let’s talk about these magnets for a bit. These magnets are special. The magnet this sensor requires is a Diametrically Magnetized Disk Magnet. Doing a search on Amazon and you’ll find that none of the disk magnets are of this type. The more common, commodity disk magnets are magnetized such that the top and bottoms are the North and South poles. We need one that is magnetized side to side.
Shape Matters
A second aspect that requires this specially configured magnet is the shape of the magnetic field. The description in the AS5600 Datasheet indicates that the magnetic field must also be of a certain shape.
Along the circumference of the Hall element circle the magnetic field Bz should be sine-shaped. The magnetic field gradient of Bz along the radius of the circle should be in the linear range of the magnet to eliminate displacement error by the differential measurement principle.
This signifies that the magnet needs to be a disk shape. I noted in the Yachta anemometer, he uses a cube shaped magnet. I’m assuming someone building this has to identify the North and South poles of the cube magnet and then turn it on its side before bonding to the housing. This obviously works, but the magnetic field will not be the same as described in the datasheet. All the smoothing, filtering, hysteresis mathematics are expecting this shape. Other shapes like the shape given off by a cubic magnetic might offer some confusion to the output angle.
Size Matters
Once you get the AS5600 hooked up to your microcontroller, and download an Arduino Library for it, it is possible to query the sensor so you can configure your project. The library will tell you certain things about your configuration. First there are several software flags that tell you whether the sensor is connected properly, whether it detects the magnet and if the magnet is too close or too far away. It also provides a strength value (AGC) between 1 (strongest) and 128 (weakest). The datasheet indicates a typical airgap between the chip and the magnet should be between 0.5 and 3 millimeters. It also hints that a magnet of 6mm in diameter is preferred. The problem is… magnets come in different strengths and different sizes. The datasheet gives no other advice. Is an N35 good enough or do we need an N52? Does it need to be 1mm thick or 2 mm? To help me solve this, I printed out a test rig to allow me to critically position and space the magnet away from the chip.
Each of the eight pie sections space the magnet above the chip between from 0.25mm and 3mm. It is a good thing I performed this test instead of blindly designing the anemometer with a 3 mm spacing as I would have preferred. It turns out the magnets that came with my sensors were on the weak side. At the lowest 0.25mm air gap, I got an AGC reading of 60. At a 0.50mm, AGC was equal to 104. At 0.75mm, AGC was 126. With air gaps of 1mm an above the AGC was off-scale and the too weak flag was lit. Just for grins I put the magnet directly on the chip. I was expecting it to tell me that it was too strong. But no… it showed a AGC reading of 35.
The Datasheet goes on to explain that it is recommended to shoot for an AGC at the mid range or in this case 64. This is to allow any variation in your mechanical design that might not perfectly maintain height. It also allows for the other influences like magnetic fields caused by other wiring and even for magnetic strength loss over time.
Conclusion and Purchasing Advice
If you are designing your own Anemometer, I would highly recommend these AS5600 sensors. They will certainly make the anemometer very accurate and also take much of the software complexity out of the project. The magnets that came with my sensors were only 4mm in diameter and 1mm thick. I’ll be trying to make these work; however, I would have preferred to have larger and/or stronger magnets so I can design with a larger gap. I’m assuming the vendor I chose either didn’t read the Datasheet or skimped on the magnets he included. If I were to get another set of sensors or magnets, I’d look for a vendor that supplies 6mm diameter, Diametrically Magnetized Disk Magnets.
Inq