Electronic – arduino – ACS712 to Arduino Due ADC input

adcarduinosensor

I want to read the armature current of a brushed DC motor. I am using the current sensor ACS712 20A. How can I feed the output of the sensor to an Arduino Due analogue input pin (A0) to read its digital value using the analogRead() function?

The Arduino Due operates at only 3.3V, but the sensor output is 5V as it operates on a 5V supply.

Best Answer

The ACS712 datasheet says:

Output Resistive Load, RLOAD: 4.7kΩ (MINIMUM)

So as long as the resistance on the output is bigger than 4.7kΩ it is safe.

Any voltage can be stepped down using a pair of resistors in series. This is called a voltage divider. In this case (5V down to 3.3V) it would ideally have a ration of 5:3.3 However, for simplicity this shows 5v to 3V, using standard resistor values

schematic

simulate this circuit – Schematic created using CircuitLab

That has a total resistance of 2.2kΩ+3.3kΩ = 5.5kΩ, so enough above 4.7kΩ to be okay.

If you assume the same current flows through R1 and R2, then the current through R1 and R2 is:

I(r1+r2) = 5v/(R1+R2) = 5V/5.5kΩ = 0.9mA

So the voltage across R2

Vr2 = 0.9mA x 3.3kΩ = 3V

That could be slightly improved by getting the ratio of the two resistors closer to 5:3.3. However, that is only 10% off, and those resistor values should be extremely easy to get.

Further, the arithmetic should be very easy to understand; it is a ratio of 3:5 (2+3).

The power rating (Watts) of the resistors is almost anything; its only creating less than 5mW of heat. Easy to find resistors are usually 1/4 watt (25omW) so almost embarrassingly big enough.

You might increase the resistance of the two resistors overall, but don't lower it below 4.7kΩ.

Edit: Don't increase the resistance of R1+R2 above 10kΩ. The analogue input of the Due needs some current to track the output voltage of the ACS712. My skim of the SAM3X8E datasheet is it will track voltages at all sample rates, with full 12bit resolution for inputs with an impedance of less than 10kΩ.