Eman Tarek
Published

Relay Module 2 Channel

2-Channel Relay Module lets you control 2 high-voltage devices using microcontrollers like Arduino or Raspberry Pi with signal pins.

IntermediateProtip4 hours102
Relay Module 2 Channel

Things used in this project

Hardware components

1N4007 – High Voltage, High Current Rated Diode
1N4007 – High Voltage, High Current Rated Diode
×2
5 mm LED: Red
5 mm LED: Red
×2
Bipolar (BJT) Single Transistor, 1 A
Bipolar (BJT) Single Transistor, 1 A
×2
Relay (generic)
×2
Tube Liquid Sensor, Phototransistor
Tube Liquid Sensor, Phototransistor
×2
Wire-To-Board Terminal Block, 3 Positions
Wire-To-Board Terminal Block, 3 Positions
×2
Resistor 1k ohm
Resistor 1k ohm
×2
Through Hole Resistor, 510 ohm
Through Hole Resistor, 510 ohm
×2

Software apps and online services

Circuit Maker
CircuitMaker by Altium Circuit Maker

Hand tools and fabrication machines

Industrial Design & Fabricated Prototype
You3Dit Industrial Design & Fabricated Prototype

Story

Read more

Custom parts and enclosures

Relay_Module PCB

Schematics

Relay_Module Schematic

Code

Relay_Module code

Python
import RPi.GPIO as GPIO
import time

relay1_pin = 17 
relay2_pin = 27 

GPIO.setmode(GPIO.BCM)
GPIO.setup(relay1_pin, GPIO.OUT)
GPIO.setup(relay2_pin, GPIO.OUT)

GPIO.output(relay1_pin, GPIO.HIGH)
GPIO.output(relay2_pin, GPIO.HIGH)

try:
    while True:
        print("Turning Relay 1 ON")
        GPIO.output(relay1_pin, GPIO.LOW)  # Active LOW
        time.sleep(2)

        print("Turning Relay 2 ON")
        GPIO.output(relay2_pin, GPIO.LOW)
        time.sleep(2)

        print("Turning both OFF")
        GPIO.output(relay1_pin, GPIO.HIGH)
        GPIO.output(relay2_pin, GPIO.HIGH)
        time.sleep(2)

except KeyboardInterrupt:
    print("Program stopped by user")

finally:
    GPIO.cleanup()

Credits

Eman Tarek
3 projects • 0 followers
Electronics engineering student. I design complex hardware-only circuits using logic ICs, sensors, and analog components. No coding.
Contact

Comments

Please log in or sign up to comment.