This User Guide Covers: 2-Channel, 4-Channel, and 8-Channel Modules | Input 3.6V–24V | Output 3.6V–30V
Table of Contents
- What Is an Optocoupler and Why Use One?
- Module Overview
- Module Specifications
- Module Schematic
- Pin Descriptions
- Understanding the Jumper Settings
- How the Circuit Works
- Choosing the Right Input Resistor
- Wiring Hookup Diagrams
- Application Examples
- Arduino Example Code
- Important Design Considerations
- Troubleshooting
- PC817 IC Quick-Reference Specifications
- Frequently Asked Questions
- Tutorials and References
💡 What Is an Optocoupler and Why Use One?
An optocoupler (also called an opto-isolator or photocoupler) is a component that transfers an electrical signal between two isolated circuits using light. Inside the package, an infrared LED on the input side shines onto a phototransistor on the output side. Because the signal crosses as light — not through a wire — the two circuits share no electrical connection.
Why This Matters
- Electrical Isolation: Protects sensitive low-voltage electronics (Arduino, ESP32, Raspberry Pi) from high-voltage or noisy circuits (industrial sensors, PLCs, solenoids, motors)
- Noise Immunity: Eliminates ground loops and blocks electrical noise from crossing between circuits
- Voltage Level Shifting: Safely converts signals between different voltage domains (e.g., 24V industrial sensor → 3.3V microcontroller)
- Safety: Provides a galvanic isolation barrier rated up to 5,000 Vrms on the PC817
📦 Module Overview
These PC817 optocoupler isolation modules provide a convenient, pre-built breakout board that handles the supporting circuitry for you. Each module includes:
- PC817 optocoupler IC(s) — one per channel
- Current-limiting resistors on the input (LED) side
- Pull-up resistors on the output (phototransistor) side
- Screw terminals or pin headers for easy wiring
- Jumper for selecting the output pull-up configuration
- LED indicators — one per channel, showing input activation status
Available Configurations
| Module | Channels | Typical Board Size |
|---|---|---|
| 2-Channel | 2 isolated channels | ~50mm × 25mm |
| 4-Channel | 4 isolated channels | ~72mm × 25mm |
| 8-Channel | 8 isolated channels | ~100mm × 25mm |
Each channel is fully independent — you can use different input voltages and different output voltages on each channel simultaneously.

📊 Module Specifications
| Parameter | Value |
|---|---|
| Optocoupler IC | PC817 (1 per channel) |
| Input Voltage Range | 3.6V to 24V DC |
| Output Voltage Range | 3.6V to 30V DC |
| Isolation Voltage | 5,000 Vrms (per PC817 datasheet) |
| Channels | 2, 4, or 8 (fully independent) |
| Input Indicators | 1 LED per channel (lights when input is active) |
| Output Type | Open-collector (active LOW when triggered) |
| Connector Type | Pin headers (input & output sides) |
| Mounting | M3 mounting holes |
🏗️ PC817 Module Schematic
The schematic below shows one of the PC817 optocoupler module channels. Each channel uses one PC817 optocoupler IC, configured as shown below. Each board has two, four, or eight of these channels, depending on the board model.

For technical specifications of the PC817 Optocoupler IC used in these modules, see the PC817 Optocoupler IC Datasheet in the Tutorials and References section below.
📌 Pin Descriptions
Input Side (Low-Voltage or High-Voltage Signal Side)
| Pin | Label | Description |
|---|---|---|
| VCC | Input Power (+) | Connect to the positive voltage of the input signal source (3.6V–24V) |
| GND | Input Ground (−) | Connect to the ground of the input signal source |
| IN1–INx | Signal Inputs | Each input pin triggers its corresponding channel. Active when pulled LOW (connected to GND through the signal source) |
Output Side (Isolated Side)
| Pin | Label | Description |
|---|---|---|
| VCC | Output Power (+) | Connect to the positive voltage of the output circuit (3.6V–30V) |
| GND | Output Ground (−) | Connect to the ground of the output circuit |
| OUT1–OUTx | Signal Outputs | Open-collector outputs. Active LOW when the corresponding input is triggered |
⚠️ Important: The input-side VCC/GND and output-side VCC/GND are completely separate power domains. Do NOT connect them together — this would defeat the purpose of isolation.
🔧 Understanding the Jumper Settings
A Quick Concept: Why Does This Module Even Need a Jumper?
The output side of every PC817 optocoupler works as an open-collector transistor. Think of it like a switch that can pull a signal line to GND (LOW) when triggered — but that switch is not connected to anything on the other end. It can pull the signal down, but on its own, there is nothing to pull it up to a defined HIGH voltage when the switch is open.
This is where a pull-up resistor comes in. A pull-up resistor connects the output signal line to the output VCC (positive supply). It "pulls" the output signal line HIGH by default. When the optocoupler is triggered, the transistor pulls that same line LOW, overcoming the pull-up resistor.
The module has an on-board pull-up resistor already installed. The jumper controls whether that on-board pull-up resistor is actually connected to the output VCC — or disconnected, leaving you free to supply your own.
The Two Jumper States
✅ Jumper ON (Installed / Bridged) — Most Common Setting
When the jumper is installed, it bridges the on-board pull-up resistor to the output VCC. This completes the circuit on the output side, so the module works out of the box without any additional components.
What this means in practice:
- When no input signal is present → the phototransistor is OFF → the pull-up resistor holds the output pin HIGH
- When an input signal is active → the phototransistor turns ON → it pulls the output pin LOW
This is called active-LOW output behavior: the output normally sits HIGH and goes LOW when triggered.
| Condition | Phototransistor | Output Pin |
|---|---|---|
| Input inactive (no signal) | OFF | HIGH (held up by pull-up resistor) |
| Input active (signal present) | ON | LOW (pulled to GND) |
Use the Jumper ON setting when:
- Connecting to a microcontroller GPIO pin (Arduino, ESP32, Raspberry Pi, etc.) configured as a digital input
- You want to use the module with minimal external wiring
- The output VCC you supply matches the correct logic level for your circuit
❌ Jumper OFF (Removed / Open)
When the jumper is removed, the on-board pull-up resistor is disconnected from the output VCC. The output pin becomes a bare open-collector output — it can only pull to GND when activated; it cannot pull to any HIGH voltage on its own.
In this state, the output pin is described as floating when inactive. A floating pin has no defined voltage and may read as either HIGH or LOW unpredictably. You must add an external pull-up (or pull-down) resistor to use the output reliably when the jumper is removed.
Why would you remove the jumper?
-
Your output circuit uses a different voltage than the on-board pull-up.
The on-board pull-up connects to the output VCC terminal. If that terminal is 5V but your circuit needs a 3.3V logic signal, remove the jumper and add your own 3.3V pull-up resistor externally. -
Your receiving device already has an internal pull-up.
Many PLC digital input terminals and some microcontroller pins have built-in internal pull-up resistors. Using the module's on-board pull-up in addition to the device's internal pull-up can cause incorrect voltage levels. Removing the jumper lets the receiving device's pull-up do the job on its own. -
You need a pull-down instead of a pull-up.
Some applications require the output to idle LOW and go HIGH when triggered. By removing the jumper and adding an external pull-down resistor (to GND), you can achieve active-HIGH output behavior instead. -
You need maximum electrical isolation.
With the jumper installed, the pull-up resistor ties the output signal line to the output VCC. In sensitive isolation applications, removing the jumper and using a completely independent external pull-up ensures the cleanest possible separation between the output circuit and the module's onboard components.
Quick Decision Guide
| Your Situation | Jumper Setting |
|---|---|
| Connecting to an Arduino, ESP32, or Raspberry Pi GPIO input | Jumper ON |
| Connecting to a PLC input with its own internal pull-up | Jumper OFF |
| Output VCC is a different voltage than your required logic level | Jumper OFF (add external pull-up at correct voltage) |
| Simple wiring, minimal components, standard microcontroller | Jumper ON |
| You need active-HIGH output behavior | Jumper OFF (add external pull-down resistor to GND) |
Summary
The jumper is essentially an on/off switch for the on-board pull-up resistor. For most users connecting this module to a microcontroller, leave the jumper installed — it is the correct setting for the vast majority of applications. Remove it only when your specific circuit requires a different pull-up voltage, already provides its own pull-up, or needs a fundamentally different output behavior.
⚡ How the Circuit Works
Understanding the internal circuit helps you wire the module correctly and troubleshoot issues.
Input Side (Per Channel)
Input VCC ──── [R_in (current-limiting resistor)] ──── [LED anode (+)]
│
Input Signal Pin (INx) ──────────────────── [LED cathode (−)]
When the input signal pin is pulled LOW (connected to input GND through your signal source), current flows through the resistor and the LED, causing it to emit infrared light. The on-board indicator LED also lights up.
Output Side (Per Channel)
Output VCC ──── [R_pull-up] ──── Output Pin (OUTx)
│
[Phototransistor Collector]
[Phototransistor Emitter]
│
Output GND
When the infrared LED is ON, the phototransistor turns ON (saturates), pulling the output pin LOW. When the LED is OFF, the phototransistor is OFF, and the pull-up resistor holds the output pin HIGH.
Signal Logic Summary
| Input Pin State | LED | Phototransistor | Output Pin |
|---|---|---|---|
| HIGH (no current) | OFF | OFF (open) | HIGH (pulled up) |
| LOW (current flows) | ON | ON (saturated) | LOW (pulled down) |
Note: The output is inverted relative to the input. Input LOW → Output LOW. Input HIGH → Output HIGH. (Both are active-LOW logic.)
🎯 Choosing the Right Input Resistor
The on-board input resistors are sized for a typical input voltage (usually around 5V–12V). If you're using a significantly different input voltage, you may want to verify the LED current is within the optimal range.
Calculating LED Forward Current
I_F = (V_input - V_F - V_indicator_LED) / R_input
Where:
- V_input = your input signal voltage
- V_F = PC817 LED forward voltage (~1.2V typical)
- V_indicator_LED = on-board indicator LED drop (~2.0V typical)
- R_input = on-board current-limiting resistor value
Recommended Operating Current
| Parameter | Value |
|---|---|
| Optimal I_F for reliable switching | 5mA–20mA |
| Minimum I_F for CTR spec | 5mA |
| Absolute Maximum I_F | 50mA (do not exceed) |
Example Calculations
5V Input with 1kΩ on-board resistor:
I_F = (5V - 1.2V - 2.0V) / 1000Ω = 1.8mA
This is on the low side. The module should still work but may be marginal with low-CTR PC817 variants.
12V Input with 1kΩ on-board resistor:
I_F = (12V - 1.2V - 2.0V) / 1000Ω = 8.8mA
This is well within the optimal range.
24V Input with 1kΩ on-board resistor:
I_F = (24V - 1.2V - 2.0V) / 1000Ω = 20.8mA
This is at the upper end of optimal — still safe but approaching higher power dissipation.
💡 Tip: If you're using a 3.3V input source and the module seems unreliable, the LED current may be too low. You can add an external resistor in parallel with the on-board resistor to increase current, or bypass the on-board resistor entirely with a lower-value external resistor (e.g., 220Ω–330Ω).
🔌 Wiring Hookup Diagrams
Basic Hookup: 24V Sensor → Arduino (5V)
Input Side:
- Input VCC → 24V sensor power supply (+)
- Input GND → 24V sensor power supply (−)
- IN1 → Sensor signal output (goes LOW when sensor triggers)
Output Side:
- Output VCC → Arduino 5V pin
- Output GND → Arduino GND pin
- OUT1 → Arduino digital input pin (e.g., D2)
- Jumper: ON (to use on-board pull-up)
Basic Hookup: Arduino (5V) → 24V PLC Input
Input Side:
- Input VCC → Arduino 5V pin
- Input GND → Arduino GND pin
- IN1 → Arduino digital output pin (e.g., D7) — set LOW to activate
Output Side:
- Output VCC → PLC 24V supply (+)
- Output GND → PLC 24V supply (−) / COM
- OUT1 → PLC digital input terminal
- Jumper: ON (or OFF if PLC provides its own pull-up)
Driving a Relay Load from the OUT Pin (12V Example)
The OUT pin on this module is an open-collector output — it acts as a current sink, pulling the connected load to GND when the optocoupler is triggered. This makes it well-suited for switching relay coils directly, without any additional components other than a protective flyback diode.
How it works: The relay coil is wired between the Output VCC supply (e.g., 12V) and the OUT pin. When the optocoupler is triggered, the OUT pin is pulled LOW, completing the circuit and energizing the relay. When the input signal is removed, the OUT pin returns HIGH and the relay releases.
Input Side:
- Input VCC → Your signal source positive voltage (3.6V–24V)
- Input GND → Your signal source ground
- IN1 → Signal that triggers the relay (goes LOW to activate)
Output Side:
- Output VCC → 12V supply (+)
- Output GND → 12V supply (−) / GND
- OUT1 → One terminal of the relay coil
- Other terminal of relay coil → Output VCC (12V)
- Jumper: ON
| Module Terminal | Connect To |
|---|---|
| Output VCC | 12V supply (+) |
| Output GND | 12V supply (−) / GND |
| OUT1 | Relay coil terminal (−) |
| Relay coil terminal (+) | Output VCC (12V) |
| Jumper | ON (installed) |
⚠️ Important — Always add a flyback diode across the relay coil. When a relay de-energizes, its coil generates a brief reverse-voltage spike that can damage the PC817 phototransistor over time. Place a diode (e.g., 1N4007) in parallel with the relay coil, with the cathode (banded end) toward the 12V / Output VCC side and the anode toward the OUT pin. This is required for reliable long-term operation.
⚠️ Check your relay's coil current rating. The PC817 phototransistor has a maximum collector current of 50mA. Most low-powered 12V relay modules draw between 15mA–40mA, which is within this limit. Verify the coil current in your relay's datasheet before wiring. For relays requiring more than 50mA, use an intermediate NPN transistor (such as the 2N2222 or BC547) driven by the OUT pin to switch the relay coil.
Basic Hookup: ESP32 (3.3V) → 12V Relay
Input Side:
- Input VCC → ESP32 3.3V pin
- Input GND → ESP32 GND pin
- IN1 → ESP32 GPIO output pin — set LOW to activate
Output Side:
- Output VCC → 12V relay coil supply (+)
- Output GND → 12V relay coil supply (−)
- OUT1 → Relay coil terminal (−)
- Other relay coil terminal (+) → Output VCC (12V)
- Jumper: ON
⚠️ Always add a flyback diode across the relay coil. When a relay de-energizes, its coil generates a brief reverse-voltage spike that can damage the PC817 over time. Place a diode (e.g., 1N4007) in parallel with the relay coil, with the cathode (banded end) toward the 12V / Output VCC side and the anode toward the OUT1 pin.
⚠️ Check your relay's coil current rating. The PC817 phototransistor can sink a maximum of 50mA. Many small 12V relay modules draw between 15mA–40mA and work within this limit — check your relay's datasheet to confirm. If your relay coil draws more than 50mA, use the OUT pin to drive a small NPN transistor (such as the 2N2222 or BC547), and use that transistor to switch the relay coil instead.
🚀 Application Examples
Industrial Monitoring
Monitor 24V proximity sensors, photoelectric sensors, or limit switches with a 3.3V/5V microcontroller while maintaining full galvanic isolation.
PLC Signal Interfacing
Convert 5V microcontroller outputs to 24V PLC-compatible inputs, or read 24V PLC outputs with a low-voltage microcontroller.
Home Automation
Isolate smart home controllers (ESP32, Raspberry Pi) from mains-adjacent circuits like doorbell transformers, HVAC control signals, or security system zones.
Noise Isolation in Audio/Sensor Systems
Break ground loops between a noisy motor driver circuit and sensitive analog sensor or audio circuits.
Multi-Voltage Systems
In systems with multiple voltage rails (3.3V, 5V, 12V, 24V), use the optocoupler module to safely pass signals between voltage domains without level-shifting ICs.
💻 Arduino Example Code
Reading an Isolated Input
This example reads a 24V sensor through the optocoupler module and prints the state to the Serial Monitor.
// PC817 Optocoupler Module - Reading an Isolated Input
// Output side connected to Arduino: OUT1 → Pin 2, VCC → 5V, GND → GND
// Jumper: ON (pull-up enabled)
const int OPTO_INPUT_PIN = 2; // Output from optocoupler module
void setup() {
Serial.begin(9600);
pinMode(OPTO_INPUT_PIN, INPUT); // Pull-up provided by module
Serial.println("PC817 Optocoupler Input Monitor");
Serial.println("-------------------------------");
}
void loop() {
int sensorState = digitalRead(OPTO_INPUT_PIN);
if (sensorState == LOW) {
// Output is LOW = input sensor is active (triggered)
Serial.println("Sensor: ACTIVE (triggered)");
} else {
// Output is HIGH = input sensor is inactive
Serial.println("Sensor: INACTIVE");
}
delay(250); // Read 4 times per second
}
Sending an Isolated Output
This example uses the optocoupler module to send a 5V Arduino signal to a 24V PLC input.
// PC817 Optocoupler Module - Sending an Isolated Output
// Input side connected to Arduino: IN1 → Pin 7, VCC → 5V, GND → GND
// Output side connected to PLC 24V input
const int OPTO_OUTPUT_PIN = 7; // Input to optocoupler module
void setup() {
pinMode(OPTO_OUTPUT_PIN, OUTPUT);
digitalWrite(OPTO_OUTPUT_PIN, HIGH); // Start with LED OFF (inactive)
Serial.begin(9600);
Serial.println("PC817 Optocoupler Output Control");
}
void loop() {
// Activate the optocoupler (send signal to PLC)
digitalWrite(OPTO_OUTPUT_PIN, LOW); // LOW = LED ON = output active
Serial.println("Signal: ON (sent to PLC)");
delay(2000);
// Deactivate the optocoupler
digitalWrite(OPTO_OUTPUT_PIN, HIGH); // HIGH = LED OFF = output inactive
Serial.println("Signal: OFF");
delay(2000);
}
⚠️ Important Design Considerations
Speed Limitations
The PC817 has a typical cut-off frequency of 80 kHz and rise/fall times of 4–18 µs. This makes it suitable for:
- ✅ Digital on/off signals, switch states, sensor triggers
- ✅ Low-frequency PWM (up to ~10 kHz with careful design)
- ❌ Not suitable for high-speed serial communication (UART at 115200 baud, SPI, I²C)
- ❌ Not suitable for analog signal transmission
For high-speed isolated serial communication, consider dedicated digital isolators (e.g., ISO7221, Si8621) or high-speed optocouplers (e.g., 6N137, HCPL-2630).
Current Sinking Limits
The output phototransistor can sink a maximum of 50mA with a maximum V_CE of 35V. Keep your load well within these limits. For higher-current loads, use the optocoupler output to drive a MOSFET or relay driver transistor.
Temperature Effects
Per the PC817 datasheet:
- CTR decreases at temperature extremes — at 100°C, CTR drops to approximately 50%–60% of its 25°C value
- Collector dark current increases with temperature — from ~0.1µA at 25°C to ~100µA at 100°C
- Design with margin if operating in high-temperature environments
LED Aging
Like all LEDs, the infrared LED inside the PC817 degrades over time, especially at higher forward currents. For long-life applications:
- Operate at 5mA–10mA forward current rather than the maximum 50mA
- This extends the useful life from ~10,000 hours to 50,000+ hours
🛠️ Troubleshooting
| Symptom | Possible Cause | Solution |
|---|---|---|
| Output stays HIGH (never triggers) | Input current too low | Check input voltage; verify I_F ≥ 5mA; try lower input resistor |
| Input wiring reversed | Verify input polarity — VCC to (+), signal to INx | |
| Faulty PC817 IC | Test with a different channel or swap the IC | |
| Output stays LOW (always triggered) | Input signal floating | Ensure input pin has a defined HIGH state when inactive |
| Output pull-up not connected | Check jumper is installed (ON position) | |
| Intermittent or noisy output | Marginal LED current | Increase I_F to 10mA+ for reliable switching |
| Long output wires picking up noise | Add 0.1µF capacitor across output pin to GND; use shielded cable | |
| Ground loop | Verify input and output grounds are NOT connected | |
| Indicator LED doesn't light | Input voltage too low | Minimum ~3.6V required |
| Wrong input polarity | Check VCC and GND connections on input side | |
| Module works but signal is inverted | This is normal behavior | The output is active-LOW; handle in software with !digitalRead(pin) or adjust your logic |
📋 PC817 IC Quick-Reference Specifications
Data sourced from the Sharp PC817 datasheet.
Absolute Maximum Ratings (T_a = 25°C)
| Parameter | Symbol | Max Rating | Unit |
|---|---|---|---|
| Forward Current | I_F | 50 | mA |
| Peak Forward Current | I_FM | 1 | A* |
| Reverse Voltage | V_R | 6 | V |
| Input Power Dissipation | P | 70 | mW |
| Collector-Emitter Voltage | V_CEO | 35 | V |
| Emitter-Collector Voltage | V_ECO | 6 | V |
| Collector Current | I_C | 50 | mA |
| Collector Power Dissipation | P_C | 150 | mW |
| Total Power Dissipation | P_tot | 200 | mW |
| Isolation Voltage | V_iso | 5,000 | Vrms |
| Operating Temperature | T_opr | -30 to +100 | °C |
| Storage Temperature | T_stg | -55 to +125 | °C |
*Peak: pulse width ≤ 100µs, duty ratio ≤ 0.001
Electro-Optical Characteristics (T_a = 25°C)
| Parameter | Symbol | Conditions | Min | Typ | Max | Unit |
|---|---|---|---|---|---|---|
| Forward Voltage | V_F | I_F = 20mA | — | 1.2 | 1.4 | V |
| Reverse Current | I_R | V_R = 4V | — | — | 10 | µA |
| Collector Dark Current | I_CEO | V_CE = 20V | — | — | 10⁻⁷ | A |
| Current Transfer Ratio | CTR | I_F = 5mA, V_CE = 5V | 50 | — | 600 | % |
| V_CE Saturation | V_CE(sat) | I_F = 20mA, I_C = 1mA | — | 0.1 | 0.2 | V |
| Isolation Resistance | R_ISO | DC 500V | 5×10¹⁰ | 10¹¹ | — | Ω |
| Cut-off Frequency | f_c | V_CE = 5V, I_C = 2mA | — | 80 | — | kHz |
| Rise Time | t_r | V_CE = 2V, I_C = 2mA | — | 4 | 18 | µs |
| Fall Time | t_f | V_CE = 2V, I_C = 2mA | — | 3 | 18 | µs |
❓ Frequently Asked Questions
Q: Can I use different voltages on different channels of the same module?
A: Yes. Each channel's input is independent. However, all input channels share the same input VCC and GND pins on the module, so the input-side voltage is common. The output side also shares VCC and GND. If you need truly different voltages per channel, you would need to modify the board or use separate modules.
Q: Can I use this module with AC signals?
A: No. The PC817 is designed for DC signals only. The internal LED is a diode and will block the negative half-cycle of an AC signal. For AC signal isolation, use an AC-compatible optocoupler or add a bridge rectifier on the input.
Q: Is this module suitable for PWM signals?
A: It depends on the frequency. The PC817 has a cut-off frequency of ~80 kHz, so it can handle PWM signals up to approximately 10 kHz with acceptable waveform fidelity. Above that, the output waveform will degrade. Standard Arduino analogWrite() PWM at 490 Hz or 980 Hz works fine.
Q: Can I use this to isolate I²C or SPI communication?
A: No. The PC817 is far too slow for these protocols. Use dedicated digital isolators (ISO7221, ADuM1250) for isolated I²C/SPI.
Q: What's the maximum cable length for the output side?
A: There's no hard limit, but longer cables pick up more noise. For runs over 1 meter, use shielded cable and add a 0.1µF decoupling capacitor at the output pin. For runs over 10 meters, consider using RS-485 or another differential signaling method instead.
Q: Can I drive a relay directly from the output?
A: Only if the relay coil draws less than 50mA at the output voltage. Most standard relays draw more than this. Use the optocoupler output to drive a transistor (e.g., 2N2222) or MOSFET that switches the relay, with a flyback diode across the relay coil.
📚 PC-817 Tutorials and References
- PC817 Optocoupler IC Datasheet (PDF)
- Using the PC817 module as an Arduino digital input board by Michael Schoeffler
- Using the PC817 module as an Arduino digital output board by cmheong
Sold and supported by Envistia Mall. Ships from the USA. The manufacturer and Envistia LLC (dba Envistia Mall) are not responsible for any damages or losses resulting from the use of this product. Always follow proper electrical safety practices when working with electronic components. Specifications are based on manufacturer data and are subject to change without notice.