Click the thumbnail below, to see an animated image with an A1302 test. I’ve used neodymium magnets for this test.
The sensor output goes from 128 to 255, by an exponential variation (the closer is the magnet, the bigger the value read).
Reversing the magnet, applies an opposed sign magnetic field , resulting in values lower then 128:
So you can also use the sensor to identify the North and South poles of a magnet.
The schematic for this circuit is very simple all you need to do is connect the VOUT pin of the A1302 to one of the ADC pins of your microcontroller:
You can check the datasheet for the A1302 here. The C Code for this project is available here.
I’m planning to use this for a magnetic levitation device. The board was designed with a ATTiny45: