I want to connect an input signal to pc817 and the output to a microcontroller. I don't know how to put the LED at the input to indicate that the input signal is working.

For example my input is limit switch. My \$V_{in}\$ is 3.3V. Before the limit switch is closed, the voltage at the first pin of optocoupler should be the forward voltage 1.4V. After the limit switch is closed, the voltage become 3.3V. So my question here is how to connect the LED to the input and how to connect the signal of the input to the optocoupler. other than limit switch i will use digital or analog sensor as input to be isolated and interface to the microcontroller. i would like to make the led as the indicator when the sensor is sensing object, and the led will light. so how to make the led work like that. enter image description here

  • \$\begingroup\$ Connect the indicator LED in parallel with the optocoupler's LED. And don't forget to put current-limiting resistor in series with each of the LEDs. \$\endgroup\$
    – m.Alin
    Mar 21, 2013 at 7:33
  • 2
    \$\begingroup\$ Please add a schematic or at least a hand-drawn sketch of what you have done so far, and what you are trying to achieve. An image is easier to grasp at a glance, than a verbal description. As you do not yet have sufficient reputation for posting images, upload to any public image hosting site and post the link as a comment here. Someone will edit your images into the question. \$\endgroup\$ Mar 21, 2013 at 7:34
  • \$\begingroup\$ Huh? You want to connect a input signal to a "PIC817". There is no such PIC, perhaps 16F817? Then you want the output (whatever that is) to go to a microcontroller. But the PIC already is the microcontroller. Then the schematic you show has no microcontroller in it at all. It is impossible to tell what is being asked here. \$\endgroup\$ Mar 21, 2013 at 12:15

1 Answer 1


As Olin points out, it's hard to tell what you're really asking. I'm going to assume that you want an indicator LED to light up whenever the optocoupler in ON. In that case, your circuit should look like the one below:


The "limit switch", when closed, should tied the INPUT signal to 3.3V and light up the indicator LED and the optocoupler's internal LED. The OUTPUT signal goes to an input of your PIC microcontroller.

The value of the resistors will depend on the optocoupler and the LED you choose to use.

  • \$\begingroup\$ Thanks! The ground for the output should be the seperated ground right? I mean the ground in the other circuit? Actually i want to make an isolation between signal and my mainboard. So signal is the input and the output will interface to the mainboard. Example for my input is like limit switch and sensors. \$\endgroup\$
    – anonymous3
    Mar 27, 2013 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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