# ACS712 circuitry with STM32F4

I am trying to measure a current of a PV module that can range from 0-15 A. The ASC712 chip can handle current from -20 to 20 A.

However, the issue is that to get a current of 15 A, the output voltage of the current sensor would be 4 V, and my STM32F446re can only handle 3.3 V. I therefore need a voltage divider. My circuit looks as follows:

I am trying to scale the 5 V down to about 3.2 V.

I therefore expect the voltage at the output pin of the current sensor to be 2.5V at 0 A (which I get), however, when I connect the output of the voltage divider (I1) to the ADC pin, the (12-bit) ADC reads a value of 1938 (1.5 V), which is way off 2.5 V.

I understand I need to calibrate the sensor but I dont see a linear relationship with the current input and voltage output of the sensor.

From research I suspect something to be wrong with the choice of my resistors, since I have take into consideration the output resistive load of the ACS712 (4.7 kΩ) and also looked at the input impedance of the ADC pin. I dont know how to take these conditions into considerations, if that's where the problem is.

I also found an application circuit in the datasheet shown below:

.

However, I do not know how to design for RF and C1.

Please advise on why am I misunderstanding a simple voltage divider concept.

• Zeners aren’t quite the component you hope they’d be. Namely that they’re leaky and coupled with your high resistor values means you will get significant errors. Remove the zener, divide your resistors by 10 and add a 100nF capacitor from gnd to the analog input pin. With the example circuit with Rf as 2k and the other as 10k, the voltage to divided by 10/(10 +2) or 5/6. Increase Rf if you need a greater division. Commented Sep 9, 2022 at 8:30
• Why R1= 560 k? 20 A will never pass ... through IP+ and IP-. Commented Sep 9, 2022 at 12:29
• What is V1 at the IP- side of the sensor?
– Jens
Commented Sep 10, 2022 at 5:05
• Sorry, so I havent indicated the remaining part of the circuit, but from terminal 3 of ACS712 I have low resistance path to the rest of my circuit for the current to flow. Hence dont want a lot of current to flow through the resistors for better voltage division. Commented Sep 10, 2022 at 8:12
• @Kartman Thank you. So the capacitor value in the example circuit I can have it 100nF as you suggested or it would change in this case? Commented Sep 10, 2022 at 8:18