# Read High voltage from PIC16F [duplicate]

I have planned to build a circuit to display voltage and time value using PIC16F877A micro controller.To do this i tested the circuit using Proteus software as i attached here. It can display up to 5V.

my question is can i read up to 300V using this micro controller?(I planned to use LR8N3G voltage regulator to give input voltage to PIC).will it damage the PIC? If so how can I read high voltage from this?

## marked as duplicate by dim, JRE, pipe, Elliot Alderson, Warren HillFeb 7 at 10:58

• What's the lower limit of the voltage to be read? If it's too low (e.g. 1V) then a simple voltage divider may not work. I mean, you may need to build a "smart" divider (i.e. activates/deactivates divider networks based on the input voltage). It also depends on whether the voltage is AC or DC. – Rohat Kılıç Feb 5 at 4:46

No, you usually can't read a voltage higher than the supply voltage of your microcontroller. To know exactly the maximum voltage that your microcontroller can read you need to look in the datasheet. You can use a voltage divider made of two resistors so that your microcontroller can safely read the voltage.

Here are its design equations:

$$\begin{split} &\frac{V_\mathrm{in}} {Z1 + Z2} \cdot Z_2 = V_\mathrm{out}\\ \\ &\frac{(V_\mathrm{in} - V_\mathrm{out})^2}{Z_1} =\text{ Power dissipated by }Z_1 \end{split}$$

I suggest choosing $$\Z_1\$$ first.

If it's AC you'll need something else.

Be careful with high voltage. If you're not sure what you're doing, don't do it.