Lesson 8 – Metal Detector!
Following closely on the heels of our previous lesson where we used the micro:bit as a compass we used the same sensor (magnetometer) in a slightly different way, measuring the strength of a magnetic field rather than the direction.
The code was simple, so rather than writing it for the students we presented a selection of blocks for them to put together:
Once installed on your micro:bit this code acts as a very effective detector of magnetic fields – either from magnets themselves or large metal objects which have their own magnetic field. Prior to the lesson we had hidden 4 magnets in various locations in another classroom and the students then had to use their micro:bit detectors to find them!
We also experienced the calibration required when using the micro:bit magnetometer (drawing a circle on the screen by rotating the device) and found that it often required re-calibration when exposed to strong magnetic fields. For our space program we will capture the strength of the surrounding magnetic field as well as the direction so that we can see how that changes as the payload gets higher.