pai-relay-control

1.0.1 • Public • Published

relay-control

Relay connected to a Raspberry-PI control

How to Connect a Relay Board to a Raspberry Pi

Welcome

In this tutorial I will show you how to connect a relay board to a Raspberry Pi, relays are an electromagnetic switch that allows you to control a high voltage electrical circuit by opening and closing contacts in another low voltage circuit. On the Raspberry Pi the control circuit will be operated by our GPIO pins. A relay generally has 3 connection points on the controlled circuit side, Normally Open (NO), Normally Closed (NC) and a Common, an important convention to note is that when a relay contact is normally open (NO) the relay is not energized.

To configure the relay board with a Raspberry Pi I am assuming that you are running the latest version of Raspbian and have the ability to connect to your Pi through SSH with Putty and FTP with Filezilla, or directly with a keyboard and monitor.

Materials

  • Raspberry Pi (2, 3 or 4)
  • Micro SD Card
  • Power Supply
  • 1 Channel Relay Module
  • Breadboard
  • Jumper Wires
  • Raspberry Pi Case (Optional)

When describing the physical pin connections I will be following the GPIO pin numbering convention shown below:

gpio-numbers-pi2

I'm going to use this Relay module:

relay-1-channel

As you can see, these are the specs:

INPUT

The pins are marked on the PCB:

  • GND – Connect 0V to this pin.
  • SIG – Controls this relay, active Low! Relay will turn on when this input goes below about 2.0V
  • VCC – Connect 5V to this pin. Is used to power the opto couplers

OUTPUT

The 1 channel relay module contain: 1 normally Open (NO), 1 normally closed (NC) and 1 common Pins (COM).

  • COM- Common pin
  • NC- Normally Closed, in which case NC is connected with COM when INT1 is set low and disconnected when INT1 is high
  • NO- Normally Open, in which case NO is disconnected with COM1 when INT1 is set low and connected when INT1 is high
**NOTICE**
- The maximum DC load is 10A
- The maximum DC load voltage is 30V the maximum AC load is 10A 
- The maximum AC load voltage is 250V.

I used a Breadboard and Jumper Wires.

Before we continue with this lesson, I will warn you here that we will use High Voltage

**Warning**: Working with AC current is Dangerous, Please exercise extreme caution and preferably consult a
professional to make any AC Power connections. Always disconnect the circuit from the mains when not in use
and mount in a secure, sealed enclosure to prevent accidental contact.

images

Overview

In this example, I will show how to use a Raspberry Pi 4B board to control a relay to turn on/off the lamp. The Raspberry needs to be turned off before any connection of wires.

Connection

  1. BLACK jumper wire connects to the GND pin
  2. RED jumper wire connects to the 5V pin
  3. BROWN jumper wire connects to GPIO number 21

get-file

For more information

License

Relay-Control Module is copyright (c) 2018-present PAI-TECH ARTIFICIAL INTELLIGENCE contact@pai-tech.org.

Relay-Control Module is free software, licensed under the GNU General Public License, Version 3.0. See the LICENSE file for more details.

Readme

Keywords

Package Sidebar

Install

npm i pai-relay-control

Weekly Downloads

0

Version

1.0.1

License

GPL-3.0

Unpacked Size

25.8 MB

Total Files

178

Last publish

Collaborators

  • rg-dev