Skip to content
R

Relay

Controlling Relay 1CH with Raspberry Pi

What is the Relay 1CH?

Relay 1CH practical reference

A single-channel relay module with opto-isolation, letting a microcontroller safely switch AC appliances or high-current DC loads.

Key specifications

  • Control side: 5 V DC, opto-isolated, ~15-20 mA when energized
  • Switching side: Up to 250V AC / 10A or 30V DC / 10A on the common SRD-05VDC-SL-C relay used on most of these boards
  • Trigger logic: Active LOW on most modules — a LOW signal closes the relay, HIGH releases it. Some boards are active HIGH, check the silkscreen or test with a multimeter first
  • Indicator: Onboard LED lights when the relay is energized

Pinout and connection notes

If you're switching mains voltage, treat COM/NO/NC as a separate high-voltage circuit — keep it physically isolated from the 5V control side and never touch it while powered.

  • VCC: Power, 5V DC, control side
  • GND: Ground, control side
  • IN: Signal input from the MCU — active LOW on most modules
  • COM: Common, switching side
  • NO: Normally open — connects to COM when energized
  • NC: Normally closed — connects to COM when de-energized

Integration checklist

  1. Confirm the exact part number and breakout-board revision.
  2. Verify supply voltage, current demand, logic levels, and signal direction against the datasheet.
  3. Check controller pin assignments and bus address or interface mode against the example code.
  4. Power up with external loads disconnected, then test signals before full integration.
  5. If readings or communication fail, check power and ground first, then pin mapping, interface settings, and library initialization.

Troubleshooting and reproducibility

Record the board used, wiring, library/version, supply arrangement, and measured behavior. Use the selected board-specific wiring example as the source of truth. Never assume visually similar modules share identical voltage tolerance or pin order.

Setting Up Relay 1CH with Raspberry Pi

Library

RPi.GPIO by Ben Croston

pip install RPi.GPIO

Wiring

Component pinRaspberry Pi pinNote
VCC5V (Pin 2)Powers the relay module's coil driver
GNDGND (Pin 6)
INGPIO26 (Pin 37)Most modules are active-LOW: driving this LOW energizes the relay

Swipe sideways to see every column →

Python

This is one of the most common Raspberry Pi home-automation building blocks — controlling lamps, fans, or sprinkler valves from a script or web dashboard. Always call GPIO.cleanup() on exit, and keep mains-voltage wiring on the relay's output side isolated from the Pi.

Related Components

Related Guides & Projects