Scan 100 to 500v at input of PIC microcontroller

innovetion

Joined Oct 16, 2015
4
Hi,

I am using PIC18f4550 micocontroller. Right now I am using inbuilt ADC to check input voltage i.e. 0 to 5v.
But now as per my application I need to scan 100V to 500V DC input voltage at ADC. How can I do ?

GopherT

Joined Nov 23, 2012
8,009
Hi,

I am using PIC18f4550 micocontroller. Right now I am using inbuilt ADC to check input voltage i.e. 0 to 5v.
But now as per my application I need to scan 100V to 500V DC input voltage at ADC. How can I do ?

You can use an optocoupler with a high value resistor. That way it is electrically disconnected from the PIC.

Of a voltage divider (divide by 100) with two resistors. A 22k ohm from ground to input and a 2.2M from input to your 500V source.

Kermit2

Joined Feb 5, 2010
4,162
A high resistance voltage divider with a 100:1 ratio.
Use several 20 Meg ohm resistors in series to make a 100 Meg ohm resistance. Use a single 900k resistor and a 100k pot together as the bottom leg of the divider and adjust the pot to fine tune the divider for exactly 1 to 5 volts.

joeyd999

Joined Jun 6, 2011
5,362
This is not as simple as the posts above make it seem.

Look at page 270 of the datasheet. This show you how to calculate the maximum source impedance of your signal source for maximum resolution. For 10 bit resolution (as per the example in the datasheet), the source impedance (the parallel resistance of your input divider) must be 2.5K ohms or less.

To meet this criteria, you could use a voltage divider with fixed 1% resistors: 243K and 2.49K. The 243K resistor will dissipate 1W with a 500V input, and the maximum current will be 2mA to ground.

For safety, I'd split the 243K into two resistors, 121K 1% 1W (for a total 242K) -- wire wound would be preferable for safety, and use 2.43K 1% 1/4W for the resistor to ground. Nominal error will be 0.6%. If this is ok, no pot necessary.

Some further input protection and noise filtering would be required if this is for public consumption.

If you want to use lower power resistors*, you will need a front end buffer.

*Edit: and higher input impedance.

Last edited:

joeyd999

Joined Jun 6, 2011
5,362
Finally, *even if* you require better accuracy, I would not use a pot. I'd do the calibration in firmware. Firmware is always cheaper than a pot -- even if you get the pot for free.

MikeML

Joined Oct 2, 2009
5,444
Another question: can the HV power supply's 0V terminal be connected to the microcontroller's GND terminal, or do you need to keep the two systems galvanically isolated?

joeyd999

Joined Jun 6, 2011
5,362
Another question: can the HV power supply's 0V terminal be connected to the microcontroller's GND terminal, or do you need to keep the two systems galvanically isolated?
Good question, Mike.

Hopefully, he affirmatively knows the answer (and why). If not, I'll take the opportunity here to advise him that he is playing with some dangerous stuff and to be really, really careful.

Death is irreversible.

ScottWang

Joined Aug 23, 2012
7,411
Vo1=1/5(Vi)=1/5(500V)=100V
Vo2=1/5(Vi)=1/5(100V)=20V
Vo=1/5(Vi)=1/4(20V)=5V

Vo1=1/5(Vi)=1/5(500V)=100V
choose 0.1mA for the input current.
R=E/I=500V/0.1mA=5M

Vo2=1/5(Vi)=1/5(100V)=20V
choose 0.1mA for the input current.
R=E/I=100V/0.1mA=1M

Vo=1/5(Vi)=1/4(20V)=5V
choose 0.1mA for the input current.
R=E/I=20V/0.1mA=200K