Voltage divider

Hi Guys,

I think this is the correct place to post this i am trying to create a voltage divider to measure a voltage greater than 5V the analog pin can handle(15Kv is the end goal but i just chose these resistance values to test). I am new to using Arduino but i was able to get the circuit/program working but i am having issues with the accuracy of the measurement i added the line "Vcalc = Vcalc*9.81;" so i can use the exact ratio of the divider measured with a multimeter. i use this measurement and the 10V will read 8.5 and 20V will read 17. I can adjust the Ratio in the program to get it closer to 10V at 10V (around 10.2-10.5) but the 20 will then go up to 22/23V.

I would also sometimes have my LCD showing 1.1-1.4V with nothing connected to the A0 PIN

I think this problem is to do with the Arduino as the divider is working correctly (its just 2 resistors) and the LCD is working correctly

Edit: I had uploaded the wrong circuit diagram

Edit2: I have had a lot of comments about safety. I am not currently using 15KV i am trying to get the circuit to work with a lower voltage 50V before i try anything HV i am just trying to get the circuit to work correctly

MY CODE

#include <Adafruit_NeoPixel.h>

#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);

//VCC to 5V

//GND to GND

//SCL to A5

//SDA TO A4

//Voltage divider/measurement

int VoltageV = A0; // Pin that the voltage is measured from

void setup() {

pinMode (VoltageV, INPUT); //declares A0 as input

lcd.init();

lcd.backlight();// initialises lcd and backlight

}

void loop() {

int VoltageMsmt = analogRead(VoltageV); // read voltage on A0 pin

float Vcalc = (5.0/1023)*VoltageMsmt; //divide max voltage by 1023 and times it by the reading from the analog pin

Vcalc = Vcalc*9.81; //ratio of the divider

lcd.setCursor(4,0);

lcd.print ("Voltage");//top row of segments

lcd.setCursor(5,1);

lcd.print(Vcalc);//bottom row of segments

}

Your voltage divider is 100k/1.1M (or 1/11) so multiply by 11 to get the voltage into the voltage divider.

I'd recommend some protection diodes in addition to a voltage divider, and any other precautions you are taking. (You don't need the current-limiting resistors shown in the protection circuits. The voltage divider resistors will take care of that.)

And note that any errors/variations in your 5V reference will be reflected in your voltage measurements.

An open pin will float to an undefined voltage. In my limited experiments it was usually somewhere in the middle, but that was just one Arduino. And since the input impedance/resistance is around 100M Ohms, it's very susceptible to noise pickup.

With voltage divider, and nothing else, it should be pulled to ground.

1 Like

Beware of the voltage ratings for your resistors. a single leaded resistor is likely rated at 450 volts or less.

2 Likes

Thank you. So i should put a zenner diode in parallel with the second resistor in the divider i have some 1N4733(5.1V) one of these would work right?

Thank you. For the end design i was going to order some higher voltage resistors i just wanted to give it a go with what i already had

Your R1 resistor will have 14995 volts across it. How will you keep it from arcing over if it's only 1/2 inch or 13mm long?

1 Like

I haven't looked at it properly yet i was just trying to get it working with a lower voltage first but i was assuming something like one of these would work

https://www.mouser.co.uk/ProductDetail/Ohmite/MOX-2N-131004FE?qs=%252BW0qg7sgkX84Z5%252BcxDxWCA%3D%3D

https://uk.farnell.com/cgs-te-connectivity/hb31m0fzre/res-1m-1-4w-radial-thick-film/dp/1502897?CMP=GRHB-OCTOPART

Just be careful, good luck.

1 Like

What is the current capability of that 15KV source.
A 1Megohm resistor is a 15mA drain at 15KV, which could be too high.
My high voltage probe uses a 990 Megohm resistor (three x 330Meg in series).
Leo..

15KV DC? Or is it AC?

please be realistic! A resistor that can withstand 15,000 volts will be at least 6 inches long! Yes, you can buy them, or could. They were sometime used in the old color television sets.

A few issues:
first its poor practise to take a number, divide, then multiply.

Also I prefer not to see magic numbers in a program.
Where does 9.81 come from? unless your resistors are wildly out the diivider ratio is (1M + 100k)/100k ie 11.

Where does 1023 come from (its wrong)

you are using the DEFAULT USB voltage as a reference. You cant rely on that so why not use the INTERNAL reference?

and calibrate the ADC?

Why should it show zero?

Ok … this sounds dangerous , what is project and why do you need to measure such a voltage . A project you should avoid unless you have the correct experience and qualifications ( clearly not !)
A voltage divider using resistors will not do it .

Any voltage measuring system
Will need calibration to get the correct voltage , due to the tolerance of resistors and the actual
Value of the reference used by the Arduino A/D

From Mr Google
750V - <50kV

The LAB and RAB vary depending on voltage present. Best practice is to keep any unqualified person 10’ or more away from the hazard. Please see the chart below to determine these distances for the above identified voltages and greater:”

As a forum we need to be careful advising on any item with dangerous voltages .

You got me curious here :slight_smile: Turns out they're far from that big and still readily available, these 18 kV resistors are just 52 mm long. and they have 20 kV versions that are just a few mm longer.

Otherwise having a series of "regular" resistors in series and coating them in epoxy should do the job.

1 Like

You don't want to be anywhere near the max voltage rating, have a good margin of safety - 50kV resistor sounds more plausible, but of course at these voltages creepage is very much a thing to be wary of. High relative humidity and all bets are off.

15kV with power behind it is instant death, so you do need to know what you are doing - look up arc-flash...

1 Like

i believe it is 1.5ma ill have to double check

Edit: it is 15kv 3ma short circuit current

it is DC

As i said im new to Arduino so im not sure what the better way to achieve the calculated value

I applied 10v and measured the drop over the first resistor and drop over the second resistor to get the 9.81

I have seen people say to divide the maximum voltage 5v by the ADC(which assuming it is 10 bit it should be 1023/1024 i wasn't sure what one to use)

i tried using the usb connected to my pc and also a 12V input both of which did the same

I just thought with no voltage on the end it should be 0V but im guessing as someone else said noise is causing the voltage because it isn't being pulled down

Ill have a look at calibrating the ADC and using the Internal voltage referance

it is 15kv 3ma short circuit current

The scale runs from 0-1023 giving it 1024 distinct values. That's why this is an ongoing discussion: some insist you have to divide by 1023, others by 1024. In reality, it usually simply doesn't matter as the difference is really small.

1 Like