I have a development board from Microchip. It works on 12 V DC. The input pins can only work on 3.3 V so what I have done is I have designed a circuit using a PC817 optocoupler. So on the LED side I am supplying 12 V and on the transistor side I am using the 3.3 V from the development board and connecting to the input pins of controller. Circuit below:

enter image description here

Now, looking at the circuit it is isolated. But I am powering the development board and supply the 12 V as input to optocoupler from the same power supply. So I think ground is still common. So this kind of circuit still isolated? If not, how to properly achieve isolation? Do we really need different power supply for isolation? What is the effective way of providing isolation?

  • \$\begingroup\$ Well this looks isolated to me and if your voltage varies even upto 24V then choose the resistor value for this worst case and remember that your forward current should not exceed 50mA i.e. the max forward voltage given in the datasheet. Also the 1kohm resistor you have chosen looks good and are within limits. \$\endgroup\$
    – Jasser
    Commented Jun 9, 2016 at 10:17
  • \$\begingroup\$ Thanks. Because I was worried due to the common ground on both sides of the opto coupler \$\endgroup\$
    – S Andrew
    Commented Jun 9, 2016 at 11:18
  • \$\begingroup\$ Are you looking for actual isolation or just level shifting? \$\endgroup\$ Commented Jun 9, 2016 at 18:01

2 Answers 2


Your circuit is fine and would isolate if the ground weren't tied together. It would be appropriate if you had a separate floating 12 V source that you wanted to test the presence of.

However, since both sides have a common ground, the 12 V and 3.3 V supplies are not isolated from each other. Since they are not isolated, you can use a more direct connection. Your opto-isolator would still work, but adds unnecessary cost and complication.

One simple approach is:

This inverts from the logic you have. The microcontroller input will be low when 12 V is present and high otherwise. Since it's a microcontroller input, you generally do what's convenient for the hardware and handle the polarity in the firmware accordingly.

  • \$\begingroup\$ Thanks. This approach is great. I will definitely consider it.! \$\endgroup\$
    – S Andrew
    Commented Jun 9, 2016 at 12:16

If you need ground isolation then you need different power supplies. However if your only concern is the voltage level i.e. you don't want to damage the micro controller then you do not need ground isolation. All you need to do is to guarantee that the maximum voltage that reaches the pins does not exceed the maximum.

This can as you have suggested be achieved through optical isolation; however, there are cheaper ways to do it. One example would be to use a voltage divider.

This should help you out further.

  • \$\begingroup\$ Thanks my major concern is voltage and as I am using 3.3v from the development board so I dont think it will increase above maximum. I want to know what will happen in case when the voltage rises from 12 v to say 24v.? What exactly isolation means.? \$\endgroup\$
    – S Andrew
    Commented Jun 9, 2016 at 9:39
  • \$\begingroup\$ If you use an isolator, no problem (as long as the isolator diode can handle the increased current, so be sure to size the resistor accordingly). It would be a problem with a voltage divider. \$\endgroup\$
    – Adam Z
    Commented Jun 9, 2016 at 9:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.