DC current readings ESP32

I have a project I will starting on soon. This project will require the use of of a shunt resistor like the one pictured. I have a few questions:

  1. Can i read the voltage and current of the DC power through the shunt resistor? or is it just reading the current?
  2. Is it safe to assume i will use the ADC pin to read this?
  3. how would I wire it correct to meet my needs in #1?
    4 what would the ESPhome yaml look like for this also?
    Thank you for any help !

U=RI, basically you are measuring a voltage drop across the resistor. And here you’ll know the R of the shunt. However, I’m unsure how good an ESP is at measuring differential voltages. Moreover, if it’s not isolated you’ll get at best-skewed results and at worse a short to ground.
The best way to do it would be with an op-amp https://www.arrow.com/en/research-and-events/articles/fundamentals-of-op-amp-circuits in a ‘Differential Amplifier’ setup with R2 and R1 set up according to what the max current you’ll be measuring and what the max voltage the esp32 car read.
So here’s a reply to each question

  1. You can but you’ll have to use the op-amp. Or you can use voltage dividers to the ground on each side of the shunt to 2 adcs on the ESP32 which have to mesure exactly at the same time. Or the results will be incorrect. Go the op-amp route.
  2. Yes
1 Like

Thank you. Looks like to make it work will be over my current abilities.

What voltage and current will you be measuring?

I wouldn’t give up if I was you, the op-amp route is very easy to implement. Here are a couple of sources :

24v DC current up to 200amps

this was pretty helpful. Thank you.