Home

BG_Automation

Background

I purchased this Relay PI-Plate and it works very well using python. I though i could expand its uses with codesys and make my own driver. I emailed the support and asked for a C library or if they would explain more about how the driver works. They said no, they would not help. The python libaray was the only thing they would supply, but I was welcome to develop my own library based on their python library. I read how to develop a SPI bus device driver on the forge and though I would give it a shot. Below is what I discovered so far.

My main goal would be to add a device under the SPI bus master and map each relay to a boolean value. Also the relay. I would like to get also poll all the board information and map that to a variable.

Product Data
https://pi-plates.com/relayr1/

Python Code
https://forge.codesys.com/drv/relay-pi-plate/wiki/Pi-Plate%20Code%20to%20Convert%20To%20SPI/

User Guide
https://pi-plates.com/relayplate-users-guide/

Command Reference
https://pi-plates.com/downloads/RELAYplateQuickReferenceGuide.pdf

Data

Relay Plate Address
Relay Number
Relay State

Relay Functions
Turn Relay On
Turn Relay Off
Toggle Relay
Relay All (Byte)
Return Relay State

LED Functions
Set LED
Clear LED
Toggle LED

System Functions
Get Firmware Version
Reset

Address Range of boards 0 to 7
Relay Range 1 to 7

GPIO Used, I will write out what they are for when I find out.

The following pins are dedicated to Pi-Plates and cannot be shared:
Pin 22 / GPIO 25
Pin 26 / GPIO 7
Pin 16 / GPIO 23
Pin 15 / GPIO 22
The following pins are used for SPI communication and can be used by other SPI-enabled devices selected by CE0. They cannot be used for GPIO:

Pin 19 / GPIO 10
Pin 21 / GPIO 9

Pin 23 / GPIO 11
The following pin may be used by Pi-Plates if their features are enabled:

Pin 12 / GPIO 18

The following pins are reserved for future expansion:

Pin 16 / GPIO 23
Pin 18 / GPIO 24