Electrical – How to read a high voltage logic signal with pic microcontroller

high voltagelogic-levelmicrocontroller

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.
Circuit Schematic

Best Answer

Use Voltage Divider Circuit to read the battery level

  1. Firstly convert 12V to 5V (or 3.3V depending on the micro controller)
  2. Use ADC to read the input voltage level.

If your PIC ADC support 3.3V then circuit will look like this one enter image description here

If support 5V then use this enter image description here

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