I've thought more about the sensor issue, and it probably doesn't make sense to put this off until a later phase of the project. I'm now fairly convinced I'll need a custom sensor head early, so it makes sense to get a board designed and off to fab. I can code while I wait for the board and parts. But first, let's consider the fields we'd like to measure.
Magnetic Field Strengths
My ideal goal is to be able to measure a range of magnetic field strengths you might find around items we usually associate with magnetism. A comprehensive scale of field strengths can be found on wikipedia. We consider the Earth to have a relatively "weak" field (at 30-60 μT) , and I think fields of this magnitude are a good low bound. As it turns out, there's an active market for sensors to measure fields in this range for use as compasses, yielding noise-limited resolutions of under 1 μT. Probably the strongest fields in common experience are produced by neodymium-iron-boron rare-earth magnets, on the order of 1.4T maximum. This is 45,000 times more powerful than the Earth's field, and easily overwhelms "compass" sensors, which may have full-scale readings on the order of 1000 μT. It adds up to a very wide range. Let's have a look at what we can do with readily available sensors.
Integrated Sensor Roundup
Here's a quick table I put together for the three-axis sensors I could order today from DigiKey or Mouser. I'm not particularly interested in using unobtainium sensors in this project, so I won't consider any you can't buy or make from parts offered by these distributors.
Part # | Manufacturer | Noise (resolution) (μT) | Max. FS (μT) | Cost (Qty. 1) |
LIS3MDL | ST Microelectronics | 0.32 | 1600 | $1.70 |
AK8963 | AsahiKASEI | (0.15) | 4900 | $3.08 |
MAG3110 | Freescale/NXP | 0.25 | 1000 | $1.46 |
HMC5883L | Honeywell | 0.2 | 800 | unknown |
MLX90393 | Melexis | 0.5 | 50000 | $2.14 |
Notes:
- Click the part numbers for datasheets
- In cases where RMS noise was listed in the datasheet, I've reported that as a limiting factor, otherwise I've listed the maximum resolution (in parenthesis). All of these are probably noise-limited, so be wary of the parenthesized values.
- For the MLX90393, the noise depends on a settable averaging time parameter. I chose approximately 50ms as a conversion/averaging time for this table.
- I couldn't find an orderable HMC5883L in ten minutes of looking. From the table, I'm not sure the part is best for this project, anyway, despite its popularity in hacker-friendly breakout boards.
The MLX90393 is the clear winner here, at least based on a quick scan through the datasheets. It's positioned as a general-purpose sensor, as opposed to the others, which are fairly compass-specific. Some of the applications they list are rotary and 3D joystick encoders (with permanent magnets), which is pretty interesting in itself. Melexis offers a $20 breakout board at DigiKey, so I'll order one of those to evaluate as a start. It's a shame that a 3x3mm part needs a breakout board so large - I'll definitely need a much smaller custom sensor board/head for the final scanner.
Beyond 50 mT
While the 50 mT maximum range of the MLX90393 is a big step up from the 0.8 mT range of the hacker-favorite HMC5883L, it still falls short of being able to measure fields from powerful permanent magnets. Wikipedia lists 5 mT for typical refrigerator magnets, so they're in, but Nd2Fe14B magnets at 1T or more are still way out of reach. I have three (EDIT: four!) ideas so far for extending the range. In each case, I'm considering adding a secondary sensor for strong fields (of course, the more sensitive sensor will need to survive the strong-field exposure).
Single-Axis Sensors
Single-axis Hall-effect sensors are available for position sensing in stronger fields. From a cursory look, drift with time and temperature might be a problem, since they're not typically aimed at precision measurement applications. I'm going to look further into this.
Magnetic Shielding
By enclosing one of the above sensors in a "soft" iron shield, it should be possible to extend the full-scale range significantly, and it may be possible to accurately calibrate out field distortions caused by the shielding. The idea is that most of the magnetic flux will be contained in the high-μ shield, leaving a smaller field inside for the sensor. I'll have to rig up a quick test with some cast-iron pipe fittings as a shield (too big and probably too magnetically "hard" for use in an actual sensor). One issue with this approach is that the shield will experience forces due to the field while scanning. 3D printers, as opposed to milling machines and the like, are not designed to resist serious forces on the head. This will require some thought.
DIY Sensor
I can't help myself. I prototyped a simple 2-axis fluxgate on a high-μ ferrite core years ago, and was able to crudely sense compass headings. Maybe I can revisit this with a low-μ core for sensing more powerful fields.
"Compensation Coil"
This was the original thought I had - then I forgot it writing up this log - by surrounding the sensor with a 3-axis field coil, a controllable portion of the external field can be "cancelled out" inside the coil. This is known as "active shielding". It suffers from the same problem as the passive shielding described above, namely forces exerted by the external field. Additionally, generating a field strong enough to partially cancel that from a rare-eath magnet won't be easy - and then there are thermal issues to consider (the coils will get hot). The upside to this method is that a single sensor could conceivably be used for both strong and weak fields just by varying the coil current.
Printer Thoughts
I've been looking at 3D printers in a different light recently. It seems that parallel robots (e.g. delta-bots, scara designs) are probably better than serial (e.g. cartesian) 'bots for this type of scanning, since all the stepper motors can be outside the build (scanning) volume. I notice that #low-field MRI settled on a polar-coordinate arrangement to deal with this issue. I'm thinking that out of the typical printing arrangements, a delta-bot designed for a Bowden extruder might be best. I may have to find a cheap delta-bot kit to hack for testing, because unfortunately, serial bots in my lab outnumber parallel designs 3.5 to 0 (the 0.5 is from my unfinished homebrew franken-printer)
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
Hi.
I have been looking at a project using the MLX90393 and I hope your experiences with it can help me. Essentially I want to be able to stick magnets on a person's face, and then position a fiberglass shield that matches the contours of their face. On this shield will be several MLX90393 and I hope to detect the movements of the magnets under the shield when the wearer smiles, frowns etc.
I am considering small rare earth magnets with an approx distance of up to 4cm from the sensor. The size of the magnets would be about 2mm x 2mm.
Would the sensor have the sensitivity to pick up the magnetic field or would it be saturated.
Many thanks for any observations.
Dave
Are you sure? yes | no
So, consider a single magnet stuck on your cheek. It has six degrees of freedom. One magnetometer collects three datapoints, so you need two sensors to find the position and orientation of the one magnet. This analysis extends to multiple magnets - so you need at least twice as many sensors as magnets (and there is not a guaranteed solution).
Once you start adding multiple magnets, though, you get all sorts of issues. For one, the distance between magnets will be on the same order as the distance from the magnet to the sensor, so each sensor will "see" the field from multiple magnets. The combined field created by the array of magnets on the face is likely to be quite complex, and determining the position and orientation of each individual magnet from a set of sensors sounds like a difficult inverse problem. Nearby magnets will also attract/repel each other, distorting the face to some extent. You, of course, are free to prove me wrong :-)
My gut feeling for your problem is that it's best accomplished through computer vision. The "hot" research tries to do this without marking the face, because that's what you can publish these days. If you want something quick and reliable, and you don't mind augmenting the face, use a stereo camera rig with fiducial markers stuck on (or drawn on) the face. You could probably hack together something in OpenCV in a few days, if it doesn't just exist already - it has definitely been done before.
All of the above has been assuming that you want to determine the 3D positions and orientations of points on the face as a first step towards facial gesture recognition. Maybe you really just want a black box that outputs {"smile", "frown", etc}. Then you *might* be able to just take the raw magnetometer outputs, throw them into a machine learning algorithm and have it come up with some shortcuts to the more difficult problem. You'd probably need a ton of labeled data, though. This kind of approach is in vogue at the moment (deep learning, neural networks, etc). It may or may not work, and either way, you won't know why :-)
Are you sure? yes | no
Oh, I forgot, strong magnets are dangerous. Should they become unstuck from the face, they can smash together with great speed and force, possibly injuring the wearer (think of the eyes). I have had my fingers pinched more than once playing with strong magnets. You would have to take serious precautions to avoid injury.
Are you sure? yes | no
Hi Ted.
Many thanks for the reply. As I mentioned min my previous post the size of the magnets are very small. https://aussiemagnets.com.au/product/--2.5mm-x---2mm-Disc-%28Rare-Earth%29---%28Pack-of-100%29.html
An example would be to have a sensor mounted 3cm above the eyebrow, and then have the magnet attached to the eyebrow. As the eyebrow raises and lowers the magnetic intensity will change.
The concept of computer vision is excellent however not practical in my situation. I need a very 'flat' sensor design that can be worn under a costume head - say a werewolf head.
The movements I want to try and capture are eyebrows up/down, mouth widen/narrow, and upper lip lift/lower. I would prefer that there was not physical link between the sensor reference point and the actual sensor for ease of taking the costume head off.
Many thanks for your prompt reply.
Are you sure? yes | no
I get it now. For the limited number of points you want to track, it might work.
I still wouldn't want magnets near my eyes, possibly coming loose.
Maybe you could mount the magnets on the mask instead, and get the magnetometers taped on to the face with flexible wires.
Are you sure? yes | no
Hi Ted,
It's really encouraging to know that someone else is interested in building a magnetic field scanner! David and I have been getting back to tinkering with the low field MRI, and were discussing many of these issues recently. I hope that we can benefit from each other's work! Here are a couple of thoughts:
1) I had designed a board with an 8x8 array of HMC5883L's ( https://hackaday.io/project/5030-low-field-mri/log/15914-concept ) spaced 10mm apart to try to scan fields faster. I wasn't able to successfully populate the 8x8 array (purely my lack of being able to accurately stencil such a large board), but I did get the 4x4 array working. These are very easy to use sensors, but as you mentioned, the dynamic range is limited. I also remember being a little surprised at how much variation there was between sensors, especially when having 16 of them beside each other, measuring essentially the same fields.
2) I ended up also going the route of building-ones-own-3-axis-CNC with a single magnetometer attached for scanning, after the large arrays ended up being trouble to assemble. I tried very hard to keep anything metallic quite far away from the sensor, and built all the stages, etc., out of various plastics or laser cut MDF, in that polar configuration (to be able to map the inside of a large solenoid coil). This works okay, but it's a great deal of engineering to reinvent the axes -- so it ended up being more a fun design problem and prototype than a particularly useful scanner for the application.
3) On the CNC, something that we've been thinking of doing is just building a small fairly-normal looking 3--axis CNC with ~10cm of travel on each axis, setting it a foot or two away from the field, and then mounting the magnetometer on the end of a long rod. It's not an elegant solution, but it'll likely work just fine given how fast magnetic field intensity falls off, and be a great deal faster to build.
4) The Melexis MLX90393 magnetometer is a very good find, not only for it's extremely large dynamic range, but also because (if I'm reading the datasheet correctly), it seems to require 0 external components. Many (most?) of the others require a few large tank capacitors for the measurement process, and I've always wondered how much this affects the measurements (when using them to measure fields, rather than as compasses). You're probably also thinking that it would be helpful to have one of these on an extremely low profile board -- perhaps even a thin flat flex board with 6-12 inches of flat flex between the magnetometer and a connector. Maybe we can collaborate on this, since flat flex usually requires a moderate order?
5) Also something useful would be an Arduino-compatible driver for the MLX90393, if one doesn't already exist. The Melexis sensors that I've used before are beautiful, but they do tend to be nontrivial to get running.
6) With respect to the active shielding and dealing with the large 1T+ fields from rare earth magnets -- since the field strength falls off at 1/r^3, though the surface field is ~1T, even 1cm away the field intensity should fall off to well within the range of the Melexis sensor. You could always put together a scanning protocol that monitored the intensities and skipped any areas that appeared to have too high an intensity, and this will likely only have you miss about a centimeter of the field, if that's okay for your application?
best wishes,
Peter
Are you sure? yes | no
Peter,
Thanks for the thoughtful note! Good ideas and motivation. Yes, let's keep in touch about progress; we're definitely going to face similar issues. Addressing your numbered points:
1. Sorry about your losing 64 sensors on that board. Maybe it's the kind of thing you can do (over a few days if necessary) with a 1cc syringe of paste and an inspection microscope? Not scalable, but for a one-off, probably doable - I do my boards this way, although they're relatively small in size and number.
I suspect the designers of the HMC5883L were more interested in ratiometric accuracy than absolute, since they're primarily intended as compasses. I'm planning on including a Helmholtz or Maxwell coil for calibration - easy to calculate the field from first principles, and you don't have to be super-accurate about positioning the sensor inside. I actually have a parametric printable Maxwell coil design I've been using for a while, but need to clean it up a bit before releasing it.
2/3. My original thought was to leverage the base of existing 3D printers, and accept the accuracy limitations that imposes. Given this, the problem becomes how to calibrate out fields from the printer, and there are some ways to do this. Interaction of the target field with magnetic parts of the printer is a different story, although perhaps an interesting inverse problem. It would be much easier to avoid it entirely, however. In my prototype setup, I have the sensor on a wooden dowel, but the design of most cartesian printers (two serial axes with the third separate) doesn't lend itself to the "poke it with a long stick" sensor arrangement you have in mind (a good idea nonetheless). Delta printers are better in this respect. I think if I concentrate on using existing printers, though, it would be a short jump to modifying a printer design into a dedicated scanner. This approach also puts scanners into more home and educational labs quickly.
4. I'm excited to try the Melexis part. It's supposed to be here Thursday. The eval board appears to only have two zero-ohm jumpers populated:Not even the bypass cap is present - that scares me. A flex board might work - as long as I can reflow it on a skillet :-) iTead appears to still be offering 5x10cm at 10x copies for $90. They let you panelize 5 per "board", at least for the FR4 boards. In that case, you could get 50 boards for $90 - plenty to split up. Seeed looks more expensive, but more configurable. If the part works out, let's consider a design and shared order - maybe we'll find some other interested parties to defray the cost even further.
5. I was thinking bus pirate for initial experiments with the MLX90393, but Arduino might work for a larger audience. There's an (Apache-licensed) MLX90393 Arduino library here (https://github.com/rosickey/mlx90393), but I haven't looked at it yet.
6. Thanks for re-setting my head on this one. The original plan when I only had the HMC5883L was to just ignore areas with high fields, but then I found the part doesn't actually saturate in high fields, it just gives garbage (in-range) values (I still need to verify this with a second instance of the part, which recently arrived). Have you noticed this at all? In this case, there's no way to skip high-intensity areas, because they incorrectly look like in-range values. So I got thinking about extending the range with active or passive shielding. If the Melexis part truly yields clamped output values when in a saturating field, then you're right, I can go back to ignoring clamped values and/or avoiding out-of-range areas. The question of maximum field intensity is kind of orthogonal to this. If I can push it significantly above 50 mT with a little work, it's probably worth doing. Worth investigating, anyway.
Are you sure? yes | no