Menu

Tree [946586] dev /
 History

HTTPS access


File Date Author Commit
 templates 2024-01-09 Wes Peters Wes Peters [0c0c25] Refresh after reboot working, ready to test!
 README.md 2024-05-20 Wes Peters Wes Peters [b74522] Sync pins configurations with documentation in ...
 app.py 2024-05-21 Wes Peters Wes Peters [946586] Finish the startup wrangling - no need to use a...
 cylon.py 2024-05-21 Wes Peters Wes Peters [40ad09] Add a test program to cycle the relays, also do...
 db.sql 2024-01-29 Wes Peters Wes Peters [4b9c61] Fetching configuration from database and config...
 pins16.json 2024-05-20 Wes Peters Wes Peters [7a155d] Typod port I
 pins24.json 2024-05-20 Wes Peters Wes Peters [7a155d] Typod port I
 pins8.json 2024-05-20 Wes Peters Wes Peters [eee6b6] Introduce the full relay object as a map
 test.sql 2024-01-29 Wes Peters Wes Peters [4b9c61] Fetching configuration from database and config...

Read Me

Raspberry Pi Modem PDU

The final design (for Viasat) is intended to use this relay module:

https://www.amazon.com/dp/B09YHD8R9F

These relay modules each contain 8 small 5VDC control relays with opto isolators on the inputs that provide both Normally Open (NO) and Normally Closed (NC) ports per relay. We use the NC ports, so that removing power to the Raspberry Pi and/or any relay boards will result in all associated ports being ON. This reverts to normal manual control (i.e. unplogging the modem) should the Raspberry Pi or one or more of the relay boards fail. One, two, or three relay modules may be installed per Raspberry Pi, offering 8, 16, or 24 switched ports.

The physical description of which relay modules have been installed must be provided in pins.json. The source includes examples pins8.json, pins16.json and pins24.json, for 1, 2, or 3 relay board configurations. When deploying a new build, copy one of these to pins.json. The only information needed in the pins file is a mapping of the external label, A, B, C, etc. to the I/O pin. The rest of the configuration pages will be keyed off the size of the pins array from this file.

On startup, the configuration database will be intialized with each port in the pins configuration labelled as "Port A," "Port B," etc. and the port turned ON.

The ON/OFF status is stored in the database so a reboot of the PDU will restore ports to their previous order. A REBOOT command doesn't change the database, as it is always a temporary state. If the PDU reboots while a device is being rebooted, the device should come up as ON following the reboot.

Raspberry Pi pinout diagrams include both the Broadcom numbering scheme, named GPIO.BCM by the GPIO library, as well as the Raspberry Pi board pin numbers, aka GPIO.BOARD. We use the GPIO BCM numbers in this configuration; Port A is Relay 0 on Module 0 and it is connected to GPIO14 so the pin is 14. The GPIO "BOARD" pins used per relay are:

Label Module Port Name Pin Pin Name Port Module Label
3V3 1 2 5V
GPIO2 3 4 5V
GPIO3 5 6 GND
GPIO4 7 8 GPIO14 0 0 A
0 GND GND 9 10 GPIO15 1 0 B
D 0 3 GPIO17 11 12 GPIO18 2 0 C
E 0 4 GPIO27 13 14 GND GND 0
F 0 5 GPIO22 15 16 GPIO23 6 0 G
3V3 17 18 GPIO24 7 0 H
I 1 0 GPIO10 19 20 GND GND 1
J 1 1 GPIO9 21 22 GPIO25 2 1 K
L 1 3 GPIO11 23 24 GPIO8 4 1 M
1 GND GND 25 26 GPIO7 5 1 N
O 1 6 GPIO0 27 28 GPIO1 7 1 P
Q 2 0 GPIO5 29 30 GND GND 2
R 2 1 GPIO6 31 32 GPIO12 2 2 S
T 2 3 GPIO13 33 34 GND GND 2
U 2 4 GPIO19 35 36 GPIO16 5 2 V
W 2 5 GPIO26 37 38 GPIO20 7 2 X
2 GND GND 39 40 GPIO21

This layout groups the header pins and leaves the I2C interface for a status display (optional).