Difference between revisions of "Relay (12V) + Raspberry Pi"

From ESE205 Wiki
Jump to: navigation, search
m (Ethanshry moved page How To Connect a 12V Relay With a Raspberry Pi to Relay (12V) + Raspberry Pi: Fall 2018 Wiki Reworks)
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Using a relay is very helpful when trying to power something with a raspberry pi that requires more than 5v.  To be able to do this you are going to need a raspberry pi, a relay, and an external power supply.
+
Using a relay is very helpful when trying to power something with a raspberry pi that requires more than 5v.  To be able to do this you are going to need a raspberry pi, a relay, and an external power supply.[[File:Relay_1.jpg|450px|thumb|center]]
[[File:Relay_1.jpg]]
+
 
The first step is to connect the raspberry pi to the relay.  The first step is to connect a ground pin on the raspberry pi to the GND pin on the relay.  Next, connect one of the 5v pins on the raspberry pi to the VCC pin on the relay. Finally, connect any of the GPIO pins on the raspberry pi and connect it to any of the IN1 - IN4 pins on the relay depending on which relay is used.  For this tutorial, the images shown are from a 4 channel relay but relays can have anywhere from 1 to 8 channels.  It all depends on how many things you need to power.
+
The first step is to connect the raspberry pi to the relay.  The first step is to connect a ground pin on the raspberry pi to the GND pin on the relay.  Next, connect one of the 5v pins on the raspberry pi to the VCC pin on the relay. Finally, connect any of the GPIO pins on the raspberry pi and connect it to any of the IN1 - IN4 pins on the relay depending on which relay is used.  For this tutorial, the images shown are from a 4 channel relay but relays can have anywhere from 1 to 8 channels.  It all depends on how many things you need to power.[[File:Relay_3.jpg|450px|thumb|center]]
[[Files:Relay_3.jpg]]
+
 
 +
The last thing you need to do is connect the external power supply to the relay.  The positive end of the power supply will go in the middle of the 3 ports.  The negative end of the power supply is going to go to what you are trying to power.  Next, take a wire and put it in the port on the right, this port has a normally open connection which means that the circuit powering the device will not be completed until a current is being sent to the relay.  Finally, take the wire from the port on the right and connect it to the device being powered.[[File:Relay_2.jpg|450px|thumb|center]]
 +
 
 +
All you have to do now is code the raspberry pi to turn on the GPIO pin that you connected to the relay and the circuit will be complete.
 
[[Category:HowTos]]
 
[[Category:HowTos]]
 +
[[Category:Raspberry_Pi]]
 +
[[Category:Electronics]]

Latest revision as of 13:33, 18 August 2018

Using a relay is very helpful when trying to power something with a raspberry pi that requires more than 5v. To be able to do this you are going to need a raspberry pi, a relay, and an external power supply.
Relay 1.jpg
The first step is to connect the raspberry pi to the relay. The first step is to connect a ground pin on the raspberry pi to the GND pin on the relay. Next, connect one of the 5v pins on the raspberry pi to the VCC pin on the relay. Finally, connect any of the GPIO pins on the raspberry pi and connect it to any of the IN1 - IN4 pins on the relay depending on which relay is used. For this tutorial, the images shown are from a 4 channel relay but relays can have anywhere from 1 to 8 channels. It all depends on how many things you need to power.
Relay 3.jpg
The last thing you need to do is connect the external power supply to the relay. The positive end of the power supply will go in the middle of the 3 ports. The negative end of the power supply is going to go to what you are trying to power. Next, take a wire and put it in the port on the right, this port has a normally open connection which means that the circuit powering the device will not be completed until a current is being sent to the relay. Finally, take the wire from the port on the right and connect it to the device being powered.
Relay 2.jpg

All you have to do now is code the raspberry pi to turn on the GPIO pin that you connected to the relay and the circuit will be complete.