Reading 850V DC via INA3221 and ESP8266 and broadcast it via public MQTT Broker

Thread Starter

huramentzefix

Joined Dec 23, 2018
27
I would like to read 850V DC via INA3221 and ESP8266 and broadcast it to a public MQTT Broker.

The idea is to read the voltage of an solar panel array and broadcast it x times per second to a public MQTT Broker.
I have an INA3221 module here and an ESP8266.

Regarding the Voltage divider. I just experimented with two 1/4 Watt 10Mohm resistors.
But from 245V line voltage (split phase)I just read about 39V.
And testing on 14.2V battery voltage DC I read about 4V.
Reading are off, why would that be?

What voltage divider should I use to get 25V from 850VDC?

Should I use a real time clock to send a timestamp with the reading or is that not necessary?
 

Thread Starter

huramentzefix

Joined Dec 23, 2018
27
2.5MOhm 1/4W 1% and 1/4 1% 76KOhm
Resistor 1
Voltage:824.92 V
Current:0.000 A
Power:0.27 W
Resistor 2
Voltage:25.08 V
Current:0.000 A
Power:0.01 W

factor: 33,8915
would that give stable results?
 

ronsimpson

Joined Oct 7, 2019
4,646
You will have most of 850V across that little resistor. Get a data sheet on your resistor but it probably is only good for 100 to 200 volts.
You might need 10 x 250K resistors.
If you can't find a data sheet, we can help. Is it through hole or surface mount?
 

Thread Starter

huramentzefix

Joined Dec 23, 2018
27
At some point I randomly ordered reels of 1/4 Watt resistors. They were bulk and cheap and no, I don't have any data sheet.
They are through hole.
But yes I am sure that you are correct in your suggestion and I really would have to take 10 in series.
Thanks a lot!

But what about accuracy when using 11x 1% resistors plus the INA3221 which also meassures across a resistor, could this one be 1% or rather 5%?
?
 

ronsimpson

Joined Oct 7, 2019
4,646
I went to Digikey and looked for a 1% 2.5M 250mW metal film resistor. Visha Here is a link 250V max,

I worry more about temperature stability. Get the two values of resistors from the same company and same type of resistor. My designs often need to work from very cold to very hot.
1% or 5%, you can always calibrate the 5% out. But temp changes are very hard to deal with.
 

schmitt trigger

Joined Jul 12, 2010
2,027
The readings are off because your DMM has an input resistance which is set in parallel with the resistor you’re measuring the voltage across.
If you think that is bad, wait until you actually use the microcontroller’s A/D. I haven’t read the ESP8266‘s data sheet, but a rule of thumb is that the source impedance feeding a microcontroller’s A/D to be below 10k.

Therefore set the bottom resistance to 10k and work out the required total upper resistance using Ohm’s law. The total upper resistance will be divided amongst several individual resistors, as explained above.

And yes, ALL OF THE RESISTORS must be 1% tolerance or better. You could potentially calibrate via software a lesser tolerance divider, but do you have a stable 850 volt source to perform an accurate calibration?
 

ronsimpson

Joined Oct 7, 2019
4,646
I think I should be looking for a designated high voltage divider.
You can use a HV divider. Cost?
Look at the spacing from Pin 1 to Pin 6. You need that much spacing around the 850 volts on the PCB.
1753715546840.png
If you make a divider out of 10 or 11 resistors. Remember no parts or copper near the resistor connected to the 850V. At the mid-point the voltage will be 425V and the space could be 1/2. At the bottom the voltage will be under 5V so almost zero spacing is OK.
If you need help with the PCB layout, we can dive directions. There are many ways to do HV printed circuit boards.

There are HV resistors. They are large. probably as long as the HV divider.
 

Thread Starter

huramentzefix

Joined Dec 23, 2018
27
Thanks!

The readings are off because your DMM has an input resistance which is set in parallel with the resistor you’re measuring the voltage across.
If you think that is bad, wait until you actually use the microcontroller’s A/D. I haven’t read the ESP8266‘s data sheet, but a rule of thumb is that the source impedance feeding a microcontroller’s A/D to be below 10k.

Therefore set the bottom resistance to 10k and work out the required total upper resistance using Ohm’s law. The total upper resistance will be divided amongst several individual resistors, as explained above.

And yes, ALL OF THE RESISTORS must be 1% tolerance or better. You could potentially calibrate via software a lesser tolerance divider, but do you have a stable 850 volt source to perform an accurate calibration?

The ESP8266 can only do 1V at it's only analog pin. this is 1V divided by 1024 which is not something that I want to do.

I am working with the TI INA3221 which is connected to the ESP8266.
INA3221 data sheet

OK understood, bottom resistance to 10k and upper to whatever corresponds.

330kOhm and 10kOhm = 850V/25V
P: 850/340000=0.0025A*850V=2.125W
0.0025*330000=825V
0.0025*10000=25V

825V/330000Ohm=0.0025A=2.0625W
25V/10000Ohm=0.0025A=0.0625W
MGM3FT330K

This could be the solution if I could just order ONE resistor or a pack of 10.
 

Rf300

Joined Apr 18, 2025
72
In my opinion the INA3221 is a little bit of overkill for your application since it is intended to be used for measuring supply voltage for a load and the corresponding supply current via a shunt resistor. However it could work. You should connect the IN+ and IN- pins and measure only the bus voltage at the IN- pin.Keep in mind that the input impedance of the IN- pin and the paralleled IN+ pin (670 kOhm || 20 uA) causes an additional measurement error which reduces your measured voltage. Maybe you can do a correction/calibration by software. For a safe design I would recommend to reduce the lower resistance of your voltage divider to maybe 8.2 or 6.8 kOhm. This reduces your input voltage to 20.5 or 17 V (you need not worry about overloading your analog inputs in case of an overvoltage) at the cost of a reduction of your resolution of 0.3 or 0.6 bit.
 
Top