A PC817 with an output that is always on, never switches, or sits at an unstable voltage is not necessarily defective. An incorrectly selected input resistor, reversed pinout, shared grounds, excessive collector load, or an in-circuit measurement can produce the same symptoms. These six checks progress from a de-energised component test to a controlled low-voltage functional test.
The PC817 contains an infrared LED between pins 1 and 2 and a phototransistor between pins 4 and 3. Sharp specifies 5 kV RMS input-to-output isolation, an 80 V collector-emitter rating, and CTR classes that depend on the exact suffix. Those limits are not test voltages for a breadboard. The procedure below uses two isolated 5 V sources or a laboratory supply with genuinely independent outputs.
Symptoms and likely causes
| Symptom | Likely cause | First check |
|---|---|---|
| Output always high | No LED current, reversed LED, or insufficient current | Measure input current and LED voltage. |
| Output always low | Shorted transistor, missing pull-up, or input always active | Disconnect the input and check collector-emitter. |
| Intermediate voltage | Insufficient CTR or pull-up value too low | Compare required collector current with minimum CTR. |
| Slow switching | Deep saturation, load capacitance, or high resistance | Reduce the collector current demand and inspect the load. |
| No real isolation | The grounds are connected elsewhere | Trace USB, oscilloscope, and supply connections. |
Confirm the pinout first
Viewed from the top with the notch or pin-one dot correctly oriented, pin 1 is the anode and pin 2 the cathode. Pin 3 is the emitter and pin 4 the collector. Rotating the package by 180 degrees swaps the input and output sides. Read the marking, locate pin 1, and confirm the exact suffix datasheet instead of relying only on PCB artwork.

Six troubleshooting checks
1. Remove all power
Disconnect every source and discharge capacitors using an appropriate procedure. Do not probe a PC817 on a mains power supply while hazardous voltage may remain. Photograph the wiring and identify the isolation barrier. In-circuit readings may be altered by nearby resistors, protection diodes, or transistors.
2. Check the input LED in diode mode
Place the red probe on pin 1 and the black probe on pin 2. The meter should show a plausible forward drop. Reverse the probes and an open indication is normally expected. The exact value depends on meter test current and temperature. A low result both ways or an open result both ways should be confirmed after lifting at least one lead.
3. Calculate the input resistor
Use R = (VIN − VF) / IF. With 5 V, an assumed 1.2 V LED drop, and 5 mA, the result is 760 Ω. A standard 750 Ω or 820 Ω part can be selected according to the desired margin. Resistor dissipation is about 19 mW in this example. Never drive the LED from a logic output without current limiting.
4. Verify the output pull-up
The phototransistor does not create a high level by itself. A resistor normally connects the collector to the output supply. A 4.7 kΩ pull-up at 5 V demands about 1.06 mA when low. If the available minimum CTR cannot deliver this current with saturation margin, the low voltage rises. Try a lighter load such as 10 kΩ before rejecting the optocoupler.
5. Perform an isolated functional test
Drive the input through its resistor from one 5 V supply. On the output side, use a second 5 V supply, a 4.7 kΩ pull-up, and measure collector voltage relative to emitter. With input off, the output should be near its supply. With input on, it should fall clearly. Do not join the two grounds because their separation is the purpose of the device.

Input off produces a high output; input on lets the transistor pull the output low. 6. Compare required current with CTR
CTR is collector current divided by LED current under stated conditions. Sharp offers different ranking classes and specifies results at defined current, voltage, and temperature. At 5 mA input and a hypothetical 50% minimum CTR, 2.5 mA would be available under those conditions. This is a design boundary, not proof that every unit switches correctly in every circuit.
Avoiding a false diagnosis
A PC817 may pass the diode test while having degraded CTR. Conversely, a collector that does not fall to zero may be healthy when the external load demands too much current. Measure voltage across the input resistor to calculate LED current, then voltage across the pull-up to calculate collector current. Their ratio gives an approximate CTR for the low-voltage test condition.
For faster signals, avoid forcing deep saturation. The PC817 suits relatively slow isolation tasks, while a large pull-up and parasitic capacitance make edges slower. An oscilloscope can characterise the response only when its probe reference cannot bridge the isolation barrier.
Common mistakes
- swapping collector and emitter;
- omitting the LED current-limiting resistor;
- joining grounds through a USB instrument;
- selecting a pull-up without calculating collector current;
- probing an energised board in diode mode;
- replacing the optocoupler without checking the entire feedback loop.
Frequently asked questions
Why is the output inverted?
With a pull-up, LED off means transistor off and output high. LED on means transistor conducting and output low. That inversion is normal.
Can a multimeter alone prove the PC817 is good?
Diode mode mainly detects an open or shorted input LED. A current-limited functional test with a known output load is needed to verify switching.
Does the PC817 automatically make a mains circuit safe?
No. Safety also depends on PCB spacing, package approval, installation, insulation class, and applicable standards. A solderless breadboard must never be used for mains voltage.
Be the first to leave a comment.