Commissioning a Raspberry Pi Relay HAT: Map Every Channel and Test Restart Behaviour
Eight relays give a project eight opportunities for a channel number, GPIO number or terminal label to be misunderstood. A simple commissioning record prevents a software command intended for one light from operating another output.
For a first evaluation, keep all real loads disconnected and use isolated, low-voltage test circuits. Establish the channel map and operating behaviour before installing the board into a larger system.
Identify the exact relay board
PMD Way's eight-channel relay board for Raspberry Pi provides changeover contacts, a Pi mounting area and a rail-mount base. Its listing specifies a 5 V supply and links to the Waveshare RPi Relay Board (B) documentation.
Use the matching manufacturer's user manual to identify the header and control jumpers. Board revisions and jumper positions matter. An example for a three-channel board or a similarly named relay product is not an interchangeable wiring guide.
Check the Pi's physical clearance, mounting arrangement and supported software before assembly. Fit or remove the board with all supplies disconnected, and ensure the underside cannot touch a loose screw or conductive surface.
Create one authoritative channel map
The board manual separates channel number, physical Raspberry Pi pin, wiringPi numbering and BCM numbering. For example, its default CH1 mapping is physical pin 29 and BCM GPIO5. Those are two names for one connection, not separate alternatives.
Make a project table with one row per channel. Include the board label, selected GPIO, application name, connected terminal pair and desired inactive state. If you change a control jumper or software pin assignment, update that table immediately.
Use descriptive application names such as “display lamp” rather than scattering raw numbers throughout the program. Keep the hardware mapping in one configuration location so a later wiring change does not require searching every control routine.
Verify contacts independently of the indicator LEDs
Each changeover contact set has a common terminal, a normally closed path and a normally open path. “Normally” refers to the relay's de-energised mechanical condition, not the state your software happens to call normal.
With the contact side disconnected from every external voltage source, check the de-energised contact arrangement using an appropriate continuity test. Then operate one channel through its documented control method and verify the changed contact pair. The control electronics can be powered for this test, but the measured contacts must remain isolated from powered load circuits.
An LED or click supports the observation that the driver or mechanism responded. It does not prove that the intended load terminal is connected. Record the contact result before moving to the next channel.
Keep logical “on” separate from the electrical trigger
Establish whether the fitted board energises a channel with a low or high control level. Confirm that behaviour against its documentation and your unloaded test. Then translate application commands into the required electrical level in a single driver function.
That separation makes the rest of the application readable. “Set display lamp off” should have a clear meaning without every caller needing to remember an inverted input. Also define what an invalid channel number does; it should be rejected rather than quietly selecting another output.
Check a complete sequence: all channels inactive, one channel active, that channel inactive, then the next. Do not begin with an endless demonstration that cycles everything while real equipment is connected.
Measure supply demand with realistic channel combinations
The manufacturer's product specification includes a “closed current” figure of 6 mA per channel. That wording is not a complete supply-current budget for the Pi, relay coils and control electronics. Do not size the whole supply by multiplying that number by eight.
Establish the board's documented power path and measure current for representative combinations: none energised, one energised and the maximum number intended to operate together. Include the Pi and its attached peripherals when they share the same supply. Check voltage at the board while switching, not only at an unloaded supply connector.
Do not attach multiple supplies to interconnected power rails without a verified arrangement. The board schematic is the appropriate reference for tracing those connections; the presence of optocouplers alone does not establish complete galvanic separation in the assembled system.
Test application ownership and restarts
Give one service responsibility for the relay outputs. A web demonstration, scheduled job and background controller can otherwise issue conflicting commands. Stop unrelated test programs before assessing the final controller.
Decide whether the application should restore previous commands after restarting or require a fresh instruction. For a classroom lighting demonstrator, starting inactive may be appropriate. Other projects need a different policy, but it should be deliberate and tested with harmless indicators.
| Event | What to observe |
|---|---|
| Normal boot | Contact states before and after the application starts. |
| Application stop | Whether outputs change, remain driven or become uncontrolled. |
| Application restart | Whether saved commands are restored unexpectedly. |
| Lost user connection | Whether local control continues according to the intended policy. |
| Orderly Pi shutdown | Final contact states and any brief transitions. |
A software cleanup routine cannot guarantee behaviour after every crash or power interruption. If an unintended output could cause harm, provide a control architecture designed for that responsibility. A hobby relay board should not be the sole emergency-stop or safety interlock.
Add the actual load only after the control tests pass
Check the load against the complete assembly's documented limits, including contacts, terminals, wiring and protection. Motors, lamps and capacitive loads can demand much more current during switching than their steady reading suggests. Omron's relay precautions explain how load type and switching conditions affect contact performance and life.
For this bench workflow, use low-voltage loads with suitable protection. Mains equipment requires an appropriately designed and enclosed installation, not exposed prototype wiring. A rail-mount base is mechanical support, not a complete protective enclosure.
Finish by labelling the channel terminals and preserving the map, supply measurements and restart results. Comparing relay HATs then becomes a practical choice about verified behaviour, rather than simply counting how many relays fit beside the Pi.