npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pai-relay-control

v1.0.1

Published

Relay connected to a Raspberry-PI control

Downloads

3

Readme

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 [email protected].

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