Use Raspberry pi to driver a Relay


Use Raspberry pi to driver a Relay

Use the following diagram to connect a Relay Switch.


A couple of notes before you get started:
The provided diagram is just an example of how to connect the sensor. There are many ways to connect sensors and extensions, so try what works best for you! For this example, we will use our relay switch to switch an LED on/off.
Relay switch boards come in many sizes, allowing you to connect and control several devices. In our case, we will use a board with 2 inputs but only connect our device on the first channel.
The voltage required by your relay switch may differ from that used in the example. Please refer to the specifications of your device to verify power requirements.
Make sure Raspberry Pi is powered off when connecting wires.
When using a GPIO ribbon cable, make sure the power wire (it’s a different color than the others) is connected to the corner of your Raspberry Pi and the top of your Pi cobbler.
Some full-size breadboards (used in diagrams below) have a powerline that is separated in the middle. If this is the case, be sure your sensors are connected on the same half of the breadboard as your Pi Cobbler.

Step 1
Connect 5v power from the Pi Cobbler to the relay board.

Step 2
Connect ground from the Pi Cobbler to the relay board.

Step 3
Connect the relay control pin (IN1) to a GPIO pin on the Pi Cobbler, in this case Channel 13.

Step 4
Connect 3V power from the Pi Cobbler to the LEDs longer pin, through the resistor.
Step 5
Connect the relay (K1) common (CO) pin to ground. Also connect the normally open (NO) pin to the LEDs short lead. You may chose the normally closed (NC)
pin of the relay instead, depending on your needs.
Step 6
You’re done! You can now add the Relay Switch to the dashboard and use it to control the LED on GPIO 13.

About the Author

amber administrator

You must be logged in to post a comment