Problem with analogread and acs712

Hello,

I try to measure a current with a acs712 hall sensor module.
Sensor output is connected to A0. I know that hall sensor are noisy and not precise.
This is not the problem.

I also read an analog voltage on pin A1.
This voltage is correctly read only when the acs712 output on A0 is disconnected (with the hall sensor module still powered). As soon as I connect the hall sensor A1 voltage reading become erratic (even if A1 is directly grounded).

I have try a 100 nF from A0 to ground but this dont change anything.

The Nano is powered by an external 8 Vdc source and then I have good 5.00 V reference (made by the Nano regulator). The acs712 module is powered by this 5V supply.

Any advice appreciated.
Regards.
Philippe

Post:

Image of project
code in code tags

WHAT!
Never mess about with changing the wiring when a system is powered up. It is the best way of frying components.

The analog pins share one ADC. When you switch inputs, it can disturb the readings. After changing to a new input, perform one dummy read before your reading.

If that doesn't work, then do as reply #2.

1 Like

You are right.
The code alternatively read A0 then A1 and so on...
Performing two successive readings on a pin and use only the second value completely solve the problem.
More explanations for understanding will be appreciated.
Thanks a lot anyway.
Philippe

Complete explanation is in the processor data sheet.

In front of the A/D is a sample and hold circuit. This holds the voltage steady during the conversion. If the impedance of the source voltage is too high then it takes longer to charge up the sample and hold capacitor. So two readings are required so that the new voltage on the newly selected capacitor has time to charge or discharge the capacitor to the correct level.

This is why when using pots a 10K pot is advisable as this charges up the sample and hold capacitor in the time allotted to a normal sample acquisition. Get above 100K and you will have problems like this.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.