
Ask HN: Need to generate a magnetic field with a Pi Zero W - nblavoie
I&#x27;m new to electronic and in need to generate a magnetic field I can read value with a Raspberry Pi Zero W. Where should I start ? The object I need to track is very, very fast moving (near 100 km&#x2F;h) and have ferrite in it. I would enjoy your feedback on the matter. The object can be close to the detector (near 2-3 cm) or far (20-30 cm).
======
oblib
You might look into a magnetometer:

[https://en.wikipedia.org/wiki/Magnetometer](https://en.wikipedia.org/wiki/Magnetometer)

[https://www.adafruit.com/product/1120](https://www.adafruit.com/product/1120)

Here's link to a video I made about using one to create an HTML5 animated
compass:

[https://www.youtube.com/watch?v=2YW6HWJg4f4](https://www.youtube.com/watch?v=2YW6HWJg4f4)

Here's a link to code I used and some install instructions for the Pi:

[http://www.raspberryperl.com/compass/](http://www.raspberryperl.com/compass/)

~~~
nblavoie
Thank you for your feedback. Correct me if I'm wrong, but the magnetometer is
only for measuring the earth's electromagnetic field, right ? What if I want
to detect metal nearby, does the same chip will be OK for the task ?

~~~
oblib
No, it will detect a nearby magnetic field. I had to try that just for fun
when I had mine hooked up.

