Skip to content
MODMYPI edited this page Sep 3, 2018 · 36 revisions

Basics

WARNING: We wholly recommend that you fully configure your relays and assigned GPIO's before plugging in the circuits that the relays will be switching. High current and high voltage sources, such as mains electricity can and does kill. If undertaking a project of this scope, please take all the necessary precautions required to protect yourself - you have been warned.

The PiOT relay board enables direct switching of a relay by toggling a GPIO pin on or off. Basic operation involves binding GPIO pins to relays!

One of the key benefits of the PiOT Relay Board is the ability to reorder and re-assign which GPIO fires which relay without any re-wiring. The PiOT Relay Board also has the ability to swap between GPIO numbering (gP) or pin numbering (Pn), depending on your personal preference. To edit this, please see the section on:

Menu - Io - Pin Numbering

Layout

The relay board is relatively simple. Configuration is completed using the "Pin Select Buttons", and configuration information is displayed on the "Display Screen". These buttons, and your Raspberry Pi, are all you require to start using the PiOT Relay Board.

The display screen has 3 distinct modes:

  • Monitor Mode - Shows boot status and relay on/off status
  • Pin Select Mode - Shows pin numbering system and enables pin/relay assigning
  • Menu Mode - Shows the menu for advanced configuration
  • Testing Mode - For individually testing relays

The display will always default to monitor mode unless you are either in the menu configuration or selecting a pin.

Boot

First step is to plug in your relay board (with the power off) and then switch on your Pi!

The PiOT Relay Board utilises configurable start up modes to negate GPIO chatter. If either delayed start or handshake modes are enabled the display with show two horizontal lines, until either the time delay has finished, or the handshake has been received.

See Menu - St - Start Up Mode for more information.

By default the board is set to a 30 second delayed start before it activates any relays. The start delayed can be configured via the menu from 1 - 99 seconds.

See Menu - dL - Start Up Delay for more information.

Assign GPIO to Relay (Pin Select)

To assign a GPIO pin to a relay, enter Pin Select Mode. To do this simply press the pin select button next to relay you wish to bind to a GPIO pin.

On the first press it will show the numbering scheme (GPIO numbering "gP" or pin numbering "Pn"):

After a short delay the GPIO / Pin number assigned to that relay will be shown:

To change the assigned GPIO or pin on that relay, repeatedly press the same button until your chosen GPIO pin number is shown. Once you've reached the correct number stop pressing the button and wait a few seconds. When the display switches back to monitor mode, your relay/pin will be set. If you overshoot don't worry, the numbering simply cycles from bottom to top.

Relays can also be set to "nc", which stands for NOT CONNECTED. In this state, that relay is not bound to any GPIO pin, and will not switch. We recommend that you set any unused relays to this state.

In the picture above we've assigned a relay to GPIO pin 7.

Multiple relays can be assigned to a single pin, or each relay can be assigned to a different GPIO pin; the combination is entirely up to you.

Relay Switching

When the relay board is not in pin selection mode or menu mode, it will be in monitor mode.

If the relay board is active, but no relays are on, the display will be blank. When a relay activates, the active segment on the bottom half of the display will light, showing at a glance, which relays are on.

Example:

Relays 1,2,4 - ON
Relay 3 - OFF

Testing

Each relay can be individually tested without the need of setting any GPIO. This is useful if you need to quickly test a connected circuit or device without binding your Pi/relay pins.

To enter test mode for a specific relay, press and hold the button, next to the relay you want to test. After about 2 seconds the display will light one of the top segments to show that the relay is now ready to be manually tested.

Press the button again to toggle the relay on and off. The bottom segment will light to show that the relay is currently active.

To exit test mode, either do nothing for a few seconds or press and hold the relay button.

Now we've covered the basic functionality of the PiOT board, it's time to get some code on our Pi:

Example Python