Relays and Optocouplers
When you need to control high-power devices or isolate different electrical systems, relays and optocouplers are your tools.
Relays
A relay is an electrically-operated switch. A small current through the coil creates a magnetic field that physically moves the switch contacts.
Types of Relays
- **SPDT (Single Pole, Double Throw):** One input, two outputs - good for reversing polarity
- **DPDT (Double Pole, Double Throw):** Two independent SPDT switches - perfect for reversing loops
- **Solid State Relays:** No moving parts, faster switching, longer life
Applications
- Turnout motor control
- Block power routing
- Reversing loop automation
- Accessory power switching
Optocouplers
Optocouplers use an LED and phototransistor to transfer signals without electrical connection.
Why Use Them?
- Protect sensitive electronics from power surges
- Isolate DCC track power from control circuits
- Interface different voltage systems safely
Popular Optocouplers
- **4N25:** General purpose, good for digital signals
- **PC817:** Compact, commonly used in Arduino projects
- **6N137:** High-speed, good for DCC signal detection
Choosing Between Them
- Use **relays** for high-current switching (motors, track power)
- Use **optocouplers** for signal isolation and low-power digital signals