Skip to content
3lv edited this page Dec 19, 2023 · 2 revisions

General Description

image

The 4-RELAYS-4-INPUTS card is a stackable expansion card for Raspberry Pi. It is compatible with all Raspberry Pi versions from Zero to 4. It offers a compact and inexpensive solution for adding up to 32 relays to your Raspberry Pi project. In addition, the card can read 4 optically isolated, digital inputs, ranging from 3V to 240V AC or DC.

Pluggable connectors make the card easy to use when multiple cards are stacked up. Loads of up to 8A and 240V can be switched by all relays. Status LEDs show when relays are on or off and also when the inputs are activated.

Each relay has a corresponding LED installed on the long side of the card which turns on when the relay is energized. A LED also shows when power is applied to the board. A pushbutton permits the user to issue a command to Raspberry Pi or to shut it down (a script is required for the desired application). Each input has also a corresponding LED which shows when a signal is present.

The card has also an RS485 driver which can communicate with other industrial equipment using the MODBUS protocol.

Mechanically, the 4-RELAYS-4-INPUTS card adheres to the Sequent Microsystems Modular Industrial format. It can be installed in the free 3D printable stackable enclosure. All the cards in this format have the same mechanical specifications.

Features

  • Four relays with status LEDs
  • Four universal optically isolated inputs with status LEDs
  • Eight layer stackable to 32 relays and 32 inputs
  • Pluggable connectors (26-16AWG wires) on all inputs and relay contacts
  • Normal-Open and Normal-Close contacts on all relays
  • 8A /240VAC, 8A/30VDC relay loads
  • 3V-24V and 24V-240V, AC/DC inputs
  • RS485 Port with TVS protection
  • Software self-test
  • Command Line, Node-RED and Python Drivers

Up to eight cards can be stacked on top of one Raspberry Pi. The 4-RELAYS-4-INPUTS cards share a serial I2C bus using only two of the Raspberry Pi’s GPIO pins to manage all eight cards. This feature leaves the remaining 24 GPIOs available for the user.

New Features For Version 4

The 4.0 release of the card replaced the I/O expander with a local processor. This enhancement allowed us to add several new features:

  • Independent RS485 (no Raspberry Pi needed)
  • MODBUS protocol allows the card to be controlled from any PLC
  • Transition counters to 400 Hz on all inputs
  • Input counters with cumulative or PPS (pulse per second) reading up to 400 Hz
  • 2 x Quadrature encoder inputs reading up to 400 PPS
  • PWM inputs on each channel, reading both the fill factor and the frequency

What Is In Your Kit

  1. 4-RELAYS-4-INPUTS card for Raspberry Pi

image

  1. Mounting hardware
    • Four M2.5x18mm male-female brass standoffs
    • Four M2.5x5mm brass screws
    • Four M2.5 brass nuts

image

  1. Two jumpers.

image

You do not need the jumpers when using only one card. See Stack Level Jumpers section if you plan to use multiple cards

  1. All the required female mating connectors.

image

Quick Start-UP Guide

  1. Plug your 4-RELAYS card on top of your Raspberry Pi and power up the system.

  2. Enable I2C communication on Raspberry Pi using raspi-config.

  3. Install the 4-RELAYS software from github.com:

cd
git clone https://github.com/SequentMicrosystems/4relplus-rpi.git
cd 4relplus-rpi
sudo make install
  1. Run the software:
4relplus

The program will respond with a list of available commands.

Board Layout

image

The 4-RELAYS-4-INPUTS card comes with appropriate mounting hardware. Up to eight cards can be stacked on top of one Raspberry Pi.

A power LED indicated when the board is active. The LED flashes at 0.5s interval, indicating also that the local processor is up and running.

Four LEDs indicate the status of their respective relay. A LED is lit when the corresponding relay is energized. Other four relays indicate the status of the inputs. LEDs are lit when inputs are high. The General Purpose Pushbutton is read by the local processor, which can be programmed to signal the Raspberry Pi by setting low pin 37 of the Raspberry Pi GPIO connector (GPIO26). You can also read the status of the pushbutton from the I2C interface.

The three right-most positions of the J3 jumper block are used for selecting the stack level (see next section). The three left-most jumpers are used to control the RS485 communication.

Stack Level Jumpers

The 4-RELAYS-4-INPUTS card is controlled by Raspberry Pi using only the I2C interface. The card occupies the address space 0x20 - 0x27. The local address can be configured using the Stack Level Jumpers. Two jumpers are provided for your convenience. A maximum stack of eight cards requires a total of 12 jumpers.

Cards can be installed on Raspberry Pi in any order. The 3 position jumper is selecting the stack level of the card, as follows:

image

RS-485 Communication

The 4-RELAYS-4-INPUTS card contains a standard RS485 transceiver which can be driven from the serial port of the Raspberry Pi or from the local processor.

The left most position (485-TERM) is used for the RS485 terminator. Install the jumper if the card is the last on the RS485 chain. The next two positions (485-TX and 485-RX) select the master of the RS port. Install the jumpers if you want to drive the RS485 port from the Raspberry Pi. Remove the jumpers to drive the port from the local processor.

Extended Functions Of The Inputs

All inputs can be used to count transitions up to 400 Hz. For slow signals you can read the cumulative transition counts. For fast transitions you can read the PPS (pulse per second).

Inputs can be paired (1 with 2 and 3 with 4) to read quadrature encoder devices with up to 400 PPS.

Inputs can also be used to read PWM signals, reading both the fill factor and the frequency. PWM signals up to 100Hz can be processed with resolution better than 1%. Faster signals up to 500Hz can also be processed with 5% precision.

Power Requirements

The 4-RELAYS-4-INPUTS card requires +5V power, supplied either from the Raspberry Pi expansion bus, or from its own pluggable connector. The on-board relays are powered by the +5V (See Schematic).

Raspberry Pi current consumption:

  • 250 mA @ +5V (could be as high as 2A)

4-RELAYS-4-INPUTS Card current consumption:

  • 10 mA @ +5V (all relays OFF)
  • 400 mA @ +5V (all relays ON)

The connector which powers the card can supply up to 4A and is protected by a 3A resettable fuse We recommend using a 5V regulated power supply rated at 3A or higher. The 4-RELAYS-4-INPUTS card can be stacked up to eight levels. A multi-stack configuration can be powered from any of the cards.

Mechanical Specifications

image

The card is compatible with any card manufactured by Sequent Microsystems and can be mounted in any order. You may also inter-mix cards from other vendors, assuming they do not use the same I2C address. It can be installed in the 3D-printable modular enclosure available for download from our website.

Software Setup

  1. Have your Raspberry Pi ready with the latest OS.

  2. Enable I2C communication:

sudo raspi-config

image

image

image

  1. Install the 4relind software from github.com:
cd
git clone https://github.com/SequentMicrosystems/4relind-rpi.git
cd 4relind-rpi
sudo make install
  1. Run the software:
4relind

The program will respond with a list of available commands.

  • Run 4relind -h for online help.

  • After installing the software, you can update it to the latest version with the commands:

cd ~/4relind-rpi
git pull
sudo make install