32-Channel SPDT Relay Shield with an IoT Interface: Seeking Guidance and Firmware

Last year, my company purchased an Industrial 32-Channel SPDT Relay Shield with an IoT Interface, not realizing that it wasn’t a plug-and-play device. Additionally, the ESP32 module came without any firmware. Now, I’ve been tasked with figuring out how to establish communication between the ESP32 and the 32 relays to control them.

Hardware details:

  • Relay Board: MCP23017 PER32G5LE Rev.B
  • Microcontroller: ESP32 IoT WiFi BLE Module with USB (ESP32-WROOM-32D)

For now, my initial goal is simply to toggle all 32 relays on and off as a starting point (baby steps). Later, I plan to implement USB or perhaps Bluetooth or WiFi control.

Since this is all new to me, any guidance would be greatly appreciated! If you have existing firmware that can be loaded onto the ESP32 and supports switching all 32 relays, that would be a great starting point for me to learn from.

Thanks in advance for your help!

The controller you have has two MCP23017 ICs on it for controlling the 32 relays, one IC for the first 16 relays and one for the second 16 relays.

With no jumpers installed on the address lines the address of the first MCP23017 will be 0x20 and the address for the second will be 0x21.

We have some sample code available here:

Thanks for your prompt response, Travis. However, I’m still a bit confused. I successfully uploaded the code to the ESP32-WROOM module via Arduino IDE and can see the output data on the Serial Monitor. But for some reason, the relays aren’t switching at all. Interestingly, when I use a Nano board to control the 32-channel relay board, the relays switch as expected.