Hello
I need to measure DC currents with 0-4A range, I was thinking of using a resistor as shunt and measure the drop between two ADC pins of an ESP32.
Is that possible/safe?
Hello
I need to measure DC currents with 0-4A range, I was thinking of using a resistor as shunt and measure the drop between two ADC pins of an ESP32.
Is that possible/safe?
Yes. With a common ground just place a shunt in the load's ground and measure the output voltage. A shunt for measuring amperes is generally a high wattage low resistance resistor. There will be a voltage drop across that resistor, that is what you are measuring and converting to amps. A 0.25 Ohm will give you 1 volt at 4 amps. Assuming this is 12V you will now have 11 at the load.
Thank you gilshultz,
I thought I need to find the voltage difference between two ADC pins, but wiring it like that gave weird results even though no current was flowing.
Now I understand that one side of the shunt goes to the ADC pin but the other side (going to -) need to be common with the ESP32.
Am I right ?
The ADC reads voltage (a number proportional to voltage) relative to the Arduino's ground.
You can subtract to find the difference between two analog inputs, but both of those voltages are relative to Arduino ground so in this application it doesn't help.
There are isolated hall-effect current sensors and that may be a better option.
I would go with an ACS712 current sensor already in a module form. I would get the 5.0 Amp version.
Ron
Problem with an ACS712 is that it is a 5volt-logic sensor, and won't play well with a 3.3volt-logic ESP. If grounds can be shared, then it's better to use an INA-type sensor, like the INA219.
Leo..
No clue I cannot see what is there and how the ESP is connected. The resistor goes between the supply ground (also the controller ground) and the load ground. Measure the voltage at the load ground. Note this must not be the ESP ground. Also what value resistor did you use?
Thank you, can you advise how to go around that? unfortunately I am limited to ESP32.
Thank you all for the answers, I guess the best is to go with ACS712, is there a problem with using a logic level converter with it?
Also I couldn't find locally the 5A version of the ACS712, only the 20A and 30A. Should I expect a good difference between them?
Only if the potential at both ends of the shunt lie within the range of the ADC, or if the two circuits are completely isolated.
Otherwise its a recipe for disaster.
The smallest current you can measure for the 5A, 20A and 30A is around 110mA for all three
Not if you won't tell us what you're measuring. As said, if grounds can be shared then an INA226 breakout board is a much better solution for the ESP than an ACS712.
Leo..
I have INA226 I was willing to use, but I couldn't find sensors with shunt values other than 0.1ohm, for 0-4A measurements I believe I need about 20mOhm which I couldn't find somewhere close!.
Thanks
The 0.1ohm shunt on that INA226 board measures to 3.2Amp.
What stops you to add another shunt to the screw terminal, like you did in the image of post#3. Try 0.33 ohm. That will give you a range of 4.17 Amp. The 0.33ohm resistor can be made with three 1ohm resistors in parallel.
Leo..
Careful with these numbers. The INA219 supports up to 320mV Shunt Voltage, yes. But for the INA226 the maximum shunt voltage is 81.92mV. So the OP is correct in thinking he needs a 0.02 Ohm shunt resistor.
But the approach of putting a second shunt in parallel with the onboard resistor should work. At these low resistance values a Kelvin connection would be preferred, but you could also just do a calibration by taking measurements from an accurate test current source.
Thanks for pointing that out. I assumed the 226 had the same PGA as the 219.
Assumption is the M of all F.
Leo..
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.