Skip to the steps
Contents WheellyAssembly guide

Chapter 11

Setting the air gap

The sensor reads a magnet through a gap of less than a millimetre, and that gap is set by one dimension of one printed part - the pad the bracket stands on. Too far and the field is too weak to resolve; too close and the magnet touches the chip. This chapter finds the right height by measuring, not by calculating, because the stack it depends on includes the glue.

If you are building on the same wheel this project was drawn around - a Ø158 mm manual filter wheel, Ø145 mm across the rotating disc - with the same Ø8 × 1 mm diametral magnet, skip straight to the next chapter: the bracket as published already carries the height this procedure arrived at. Come back here only if the readings in chapter 13 come out poor.

What you need

Parts

  • 1×U3 AS5600 magnetic encoder moduleround Ø16.85 flattened to 15, a row of 8 pads; needs the VDD5V-VDD3V3 bridge, after which it no longer takes 5 V

Tools

  • any ESP32 board on a breadboard - it does not have to be the XIAO
  • 2 × M2 × 4 screws, cylinder or countersunk head
  • a 2 mm flat screwdriver, or the driver for those heads
  • a caliper
  • Chrome or Edge: the test page uses Web Serial

Step 1 Why this cannot be calculated

  • The design stack says the spacer and magnet sit 1.8 mm above the hub face. Glued on a real pivot it measures 2.3 - half a millimetre disappears into the two joints and the print tolerance of the spacer.
  • Half a millimetre is not a detail here: without counting it the bracket comes out that much too low, and the real gap was 0.07 mm - the magnet grazing the chip.
  • So the height is chosen by trying feet of known thickness and reading what the sensor says. It takes twenty minutes and it is the only way to include the glue.

Step 2 Print the feet and the spacer

  • `out/tools/gap_gauges.step` holds 7 feet, 4.6 to 5.8 mm tall - gaps from 0.67 to 1.87 mm - with the height engraved on the tab. `out/magnet_spacer.step` is the spacer the magnet sits on.
  • In the slicer, do not also turn on hole compensation: the magnet hole is already drawn oversize for it, and the two corrections add up.
  • After printing, measure the magnet hole with a caliper and tell the model: `Comp_hole_printing` is a number about your printer, not about this project, and from then on it applies to the real bracket too - which wants that fit tight.
  • You also need two M2 × 4 screws, cylinder or countersunk head: they cut their own thread in the 1.8 mm hole. Longer ones poke through and hold the foot off the face.

Step 3 Wire the sensor board on the bench

  • Any ESP32 will do for this - a WROOM-32 on a breadboard is fine, it does not have to be the XIAO. Power the AS5600 module at 3.3 V, SDA and SCL to the two I²C pins, and DIR to ground.
  • The module must carry its VDD5V-VDD3V3 jumper, and after that jumper it no longer tolerates 5 V. Check continuity between pins 1 and 2 of the chip before you power anything: a lifted jumper does not go silent, it quietly halves the readings and looks exactly like a weak magnet.
  • Load `firmware/air_gap_test/air_gap_test.ino`: `cd firmware && ./flash.sh air_gap_test`.

Step 4 Read it on the page, not on the serial monitor

  • `cd firmware && ./gap_page.sh` serves the test bench on http://localhost:8770/ and opens it. It shows AGC live, lights up the sectors of the turn as you cover them, and keeps the table of measurements with the suggested gap already worked out.
  • It needs Chrome or Edge: the page talks to the board over Web Serial, which Safari and Firefox do not have. And it must be served over localhost, not opened as a file.
  • Close any other serial monitor first - the IDE's, or the one `flash.sh` leaves open. One program at a time can hold the port.

Step 5 One foot at a time, and turn the disc a full turn

One foot at a time, and turn the disc a full turn
  • Wheel on the table, telescope side up. Foot on the face with its ring around the magnet - it centres itself and stays there under its own weight - then the sensor board screwed down on top.
  • Screwed, not just resting. A board that only sits there lifts, and then the foot is not what sets the gap any more. It is the first mistake to not make twice.
  • For each foot: `r` on the page or the monitor, one whole turn of the disc by hand - take it by the knurled rim - then `s` for the summary. A full turn matters because the magnet is never perfectly centred, and a single spot flatters or punishes it.
  • Judge on magnitude, not on AGC. With this magnet at 3.3 V the AGC sits at full scale whatever the height, so it tells you nothing; magnitude is the number that moves.
  • If even the lowest foot cannot bring the readings up, the Ø8 × 1 mm magnet is too weak as it stands and you want a thicker one. That is a conclusion, not a failure.