0
\$\begingroup\$

I'm using an ACS712-5A hall effect current sensor that output a voltage roughly between 1.5V to 3.5V. I'm am measuring a main AC power line at 50Hz. I'm using and ESP32 which has a built-in ADC with a reference voltage of 3.3V. Hence, the signal will be alternating from 1.5V to 3.5V which will then be processed by the MCU accordingly. I understand that I can simply use a voltage divider to step down the voltage but that will lose some precision. I have two solutions which I'm not sure which is better.

Solution 1: Using a zener diode with a Zener voltage of 3.3V to clip the output voltage. I won't be operating the current sensor at full capacity all the time so it shouldn't be a big problem. Will this work? Do I have to add a resistor in series with the voltage output or anything else?

schematic

simulate this circuit – Schematic created using CircuitLab

Solution 2: Using a rectifier circuit recommended in the datasheet of current sensor. However, I don't fully understand this circuit and unsure on how to calculate the values of Rf and C1. enter image description here

\$\endgroup\$
2
  • \$\begingroup\$ What is the signal that your rectifying? How fast? Are you rectifying to DC? \$\endgroup\$ – Voltage Spike Nov 6 '19 at 20:41
  • \$\begingroup\$ I have edited the question accordingly. But in short the signal is AC alternating from 1.5V to 3.5V @ 50Hz. And no I'm not rectifying to DC but more of scaling it to be compatible with 3.3V MCU. \$\endgroup\$ – Max Nov 6 '19 at 21:02
1
\$\begingroup\$

I'm using and ESP32 which has a built-in ADC with a reference voltage of 3.3V. Hence, the signal will be alternating from 1.5V to 3.5V which will then be processed by the MCU accordingly. I understand that I can simply use a voltage divider to step down the voltage but that will lose some precision.

How much precision will you lose? To reduce 3.5V to 3.3V the voltage divider must have a ratio of 3.3/3.5 = 0.943. Each bit represents a power of 2, so to lose a full bit of precision the signal amplitude would have to be reduced by 50%. But you will only lose 6%, which is much less than a single bit.

However the ACS712-5A actually has an output voltage range of about 0.6V to 4.4V, so you should use a divider with a ratio of 0.75. This will still only reduce precision by half a bit, not enough to be worried about.

\$\endgroup\$
5
  • \$\begingroup\$ Based on the datasheet, the ACS712 shows linear properties for -5A to 5A with a resolution of 185mV/A with a center voltage of 2.5V (1.575V to 3.425V). My ADC is a 12-bit 3.3V which gives a precision of 0.81mV/bit. Hence, the system will have a measurement precision of 4.36mA/bit. With a 0.75V divider the new resolution will be 141mV/A. Therefore, giving the measurement precision of 5.73mA/bit. If my calculations are right this is a loss of precision by 31.6%. \$\endgroup\$ – Max Nov 7 '19 at 8:17
  • 1
    \$\begingroup\$ Sounds bad when you say it that way, but is it really? You could display the current with 0.01A resolution and the difference would never be more than 1 count (and would be identical most of the time). But the ACS712-05 has typical noise of 21mV at 2kHz bandwidth, so the lower 4 bits will just be noise anyway. To get those 4 bits back you would have to average over 256 samples, and then the dithering effect of the noise would make the loss of precision ~16 times smaller. \$\endgroup\$ – Bruce Abbott Nov 7 '19 at 10:43
  • \$\begingroup\$ I see. I did more calculations and decided to use a potential divider with a ratio of 0.9 which will only give me a loss of precision of 10%. However, I'm still concern if the voltage spikes up a little and goes over 3.3V. I saw other articles where you can use dual schottkey diode and a resistor to clamp the voltage to VCC. Since I already have resistor in the potential divider do I still need another resistor? And does introducing this give any down side to the stability of the voltage? \$\endgroup\$ – Max Nov 7 '19 at 13:33
  • 1
    \$\begingroup\$ The divider resistance itself will do it. A single Schottky diode to 3.3V will probably clamp the over-voltage sufficiently (check MCU specs to make sure) and won't affect stability. Max output current of ACS712 buffer is 3mA, so use resistor value high enough to stay well below 3mA (2k would be plenty). Note that this injects current into the MCU supply (could be a problem if current draw is very low, eg. in sleep mode). A ratio of 0.872 should get exactly 5mA/bit, which might improve precision of a displayed value. You could even make the resistor a trim-pot to calibrate your sensor. \$\endgroup\$ – Bruce Abbott Nov 7 '19 at 18:59
  • \$\begingroup\$ Okay thank you. I would like to put a trim-pot but I don't have sufficient PCB space to place it. Its alright though, this is still a prototype and I will conduct multiple test to test the stability of the circuit. Thanks again for the help. \$\endgroup\$ – Max Nov 7 '19 at 20:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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