Using A1326LUA-T for simple gaussmeter

i want to build a simple gaussmeter. components are; A1326 linear hall sensor, arduino uno R3, and 0.1uf ceramic capacitor. i used my PC to power the arduino (+5v), and I’m using the IDE serial monitor to display the the readings.
the arduino ADC has a resolution of 10-bits, the sensitivity of the hall sensor is 2.5mv/G.
1 count = 5/1023,
which is ~ 4.887mV = 1.9550Gauss.

after i had set it up on breadboard, and written my codes on arduino IDE, the output values (when no magnet is applied) been read in gauss is not prescise (large deviation e.g. -15 to +40).

i would appreciate a quick response to this pls

Hi Psalm01,

Welcome to the TechForum.

There are several things to consider.

First, and probably most important, is to note that the zero-Gauss output is specified to be between 2.425V and 2.575V for the A1326LUA, which is equivalent to ±30 Gauss of potential offset (75mV / 2.5mV/G = 30G) which must be calibrated out in your code at start-up.

In your design, I believe that both the ATMega328P ADC internal reference voltage and the A1326 will be using the same 5V, so that should be OK. Any variations should track between the two. However, I would recommend that you stick a much higher value capacitor (a minimum of 10uF, and larger is better) on the supply rail on your breadboard in addition to the 0.1uF cap you already have near the A1326 to keep that supply rail as stable as possible.

Another thing you can do, assuming you don’t need to detect changes of magnetic fields in the kHz range, would be to place an RC filter on the output of the sensor. This would further stabilize the output and help to filter out noise. I believe the default sampling rate for the ADC on the Uno is a little under 10kHz. By placing an RC filter between the sensor output and the ADC, one can eliminate any issues with aliasing noise from getting into the ADC.

Another place for errors to arise is due to the absolute accuracy of the ADC. From page 246 of the Mega328P (the MCU on the Uno R3) datasheet, the accuracy is specified as ±2 LSB, which, based on your calculations above, is ±9.8mV, or ±3.91 Gauss. One can improve this somewhat by oversampling your measurements. By taking 4, 8, or 16 measurements and averaging them, you’ll get improved accuracy.

@David_1528 Thanks a bunch.