5V Relay (Raspberry Pi)
Intro: 5V Relay (Raspberry Pi)
Basic tutorial of how to setup a 5V Relay with the Raspberry Pi.
STEP 1: Parts
RPI 3 - https://amzn.to/2VA9pQY
4 Amp Power Adapter - https://amzn.to/2CTptWu
16GB micro SD - https://amzn.to/2SFMwd3
120 pcs jumper cable: https://ebay.to/2VAb9cY
5 Volt Relays: https://amzn.to/2SYHxnH
12 Volt Power Supply - https://amzn.to/2srHmWv
5.5x2.1mm Male+Female DC Power Socket: https://amzn.to/2VA5ZNW
STEP 2: Setup
VCC -> 5 volt pin
GND -> Ground pin
IN -> GPIO 21
*Ensure postive leads are hooked up to NO and C terminals
STEP 3: Code
1. Copy Script to Raspberry Pi
2. Type "python relay.py" to run
STEP 4: Additional Info
Online Guide: https://www.piddlerintheroot.com/5v-relay/
8 Comments
StillnetMaker 6 weeks ago
So how exactly do you power a 5v relay with a 3.3v gpio pin? I didn't see the answer on this page or the linked source site. Do I have to watch the 10 minute video to get the answer? Can someone just tell me?
ibrahimtheo914 4 years ago
nadir.kiyanclar 4 years ago
DilithiumC 5 years ago
ibrahimtheo914 4 years ago
maxwega 6 years ago
ibrahimtheo914 4 years ago
KonstantinosT10 5 years ago
I have got a 5v relay (https://www.amazon.de/gp/product/B0057OC5WK/ref=oh_aui_detailpage_o00_s01?ie=UTF8&psc=1) but as soon as i set the GPIO.setup(7, GPIO.OUT) the relay clicks and closes the circuit. toggling the output to HIGH or LOW has no effect on the relay. My relay is connected to the 5v pin of my PSpi 3 model b. When I try the 3.3v pin i get a red led on the relay board and nothing happens. Should I start looking for another relay board? :(