Magnetic Field Detector

My son Ryker needed a science project, and he wanted to do something with electronics. We landed on a
magnetic field detector — a thing you wave near magnets to see how strong they are. The output is a
rainbow bargraph of LEDs that lights up further and further to the right as the field gets stronger.

Magnetic field detector with the full rainbow LED bargraph lit

The build

An ESP32 microcontroller reads a hall-effect sensor, maps the value to a level on the bargraph, and lights
the LEDs left-to-right. Eight LEDs (green → yellow → red) with matching current-limiting resistors,
all on a breadboard so Ryker could see exactly what was wired to what.

Wider shot of the breadboard with ESP32 and wiring

Close-up detail of the hall-effect sensor and breadboard rail

Close-up of the rainbow LED bargraph lit up

Testing

The fun part — bringing different magnets near the sensor and watching the bar fill.

Testing the detector with a small magnet

Hand holding a magnet near the sensor, green LEDs lit

Side view of the lit rainbow bargraph

The big ring magnet pegs the meter.

Large ring magnet lighting up all eight LEDs

What he got out of it

Ryker didn’t need to know what an analog read or a bargraph mapping function was to feel like he
built something that worked. He got to wire it, debug it (we had a few LEDs in backward, classic), and
demonstrate it. The point of this kind of project, for me, is that the kid ends up with a real working object
they made themselves — not a kit, not a worksheet.