# How to read a high voltage logic signal with pic microcontroller

On my circuit I have a voltage detected (TC54) to detect when the level of the battery gets low. The output of this ic is high when there is enough battery, but it will be at battery voltage (12 or 15 volts). I am using a LM7805 to supply power for the microcontroller. Will feeding this high voltage level into the microcontroller cause damage? ( I would say yes to that). How can I read the signal out from the TC54? Would putting a large resistor in series with it solve the problem (1-5Meg)? Here is the schematic for the design. The RB0 goes to the microcontroller. J2 is the input terminal on the board. • Why use the TC54 if you have a PIC? Just use the PIC's ADC with a voltage divider. – Leon Heller Mar 15 '17 at 8:23
• Just use a voltage divider? – C K Mar 15 '17 at 9:09
• Suggest that you use the TC54VN variant that provides an open-collector output. The output will be high-impedance unless driven low by the TC54. You can then connect it to a 4.7K resistor to the PIC's Vcc. This will directly drive RB0. – DoxyLover Mar 15 '17 at 9:48

Use Voltage Divider Circuit to read the battery level

1. Firstly convert 12V to 5V (or 3.3V depending on the micro controller)

If your PIC ADC support 3.3V then circuit will look like this one If support 5V then use this Note: If you want high accuracy choose right resistors for circuit, resistance value should be small as possible but same time it should not draw enough current that will effect battery. For more detail see this Link

• This solution draws a constant ~2 mA from the battery. – pipe Mar 15 '17 at 11:15
• if current is problem he need to replace resistance with high value – Kapil Singh Rawat Mar 15 '17 at 11:18
• And if you do that, you might not get an accurate reading for the ADC, and then you need to buffer the signal, etc. – pipe Mar 15 '17 at 11:25
• Resistance should be as small as possible so that it will not impact on load (ADC) but same time do not draw current as well. – Kapil Singh Rawat Mar 15 '17 at 11:59

How to read a high voltage logic signal with pic microcontroller

Will feeding this high voltage level into the microcontroller cause damage?

those are two totally different questions. to read a HV analog signal, you can divided it down with a resistive divider (generally). to read a HV logic signal, the same can be employed or a high value resistor is all needed, depending on your application.