2
\$\begingroup\$

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.

\$\endgroup\$
1
  • 3
    \$\begingroup\$ Although this mentions "arduino" it is really an EE question primarily concerned with details of the analog input circuit, so it's likely to get much more sound treatment here than on the Arduino site. \$\endgroup\$ Commented Aug 27, 2014 at 15:27

3 Answers 3

3
\$\begingroup\$

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Ω.

\$\endgroup\$
6
  • \$\begingroup\$ Yes, probably but it's worth checking the effective input impedance of the analog input, in the mode in which it is going to be operated (for many chips it varies by ADC rate setting) \$\endgroup\$ Commented Aug 27, 2014 at 15:26
  • \$\begingroup\$ @ChrisStratton - I agree. Do you have the figure at hand? IIRC it was about 50kΩ, i.e. about 10x bigger, but I need to check. \$\endgroup\$
    – gbulmer
    Commented Aug 27, 2014 at 15:31
  • \$\begingroup\$ A quick reading of the data sheet suggests it varies from 10kΩ to over 300kΩ depending on the chosen mode. Using the slowest setting which will accomplish the application need would be a help. \$\endgroup\$ Commented Aug 27, 2014 at 15:37
  • \$\begingroup\$ @ChrisStratton - already updated to most conservative value, which should be okay in all cases. Did I earn a +1 :-) \$\endgroup\$
    – gbulmer
    Commented Aug 27, 2014 at 15:41
  • \$\begingroup\$ I object in principle to vote requests \$\endgroup\$ Commented Aug 27, 2014 at 15:52
1
\$\begingroup\$

All you need is a simple voltage divider cosisting of two resistors.

pic

To meet sensor's output driver requirements for minimum load resistance of \$4.7\, \mathrm{k\Omega}\$, \$R_2\$ is \$3.3\, \mathrm{k\Omega}\$ and \$R_1\$ is \$1.8\, \mathrm{k\Omega}\$. This combination will scale \$5V\$ input to \$3.24V\$ output.

\$\endgroup\$
1
  • \$\begingroup\$ Yes, probably but it's worth checking the effective input impedance of the analog input, in the mode in which it is going to be operated (for many chips it varies by ADC rate setting). If that impedance is not substantially larger than your resistors, it will distort the reading. \$\endgroup\$ Commented Aug 27, 2014 at 15:28
1
\$\begingroup\$

With no current, the output of the ACS712 is Vcc/2. For 5 V, it will be 2,5 V. I dont know the sensitive of the 20A version, but in the case of 5A version, it has a sensitive of 185mV/A, and with the max current, the output is a little bit more than 3,5 V. I dont think u need to scale the output. Although, Vcc for this chip is from 4,5 to 5,5, so u have to use 2 power source.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.