Introduction: MQTT-driven IP-relay Module, on Which the Variable Part of the MQTT Broker’ IP Address Is Set by Mechanical Switches

MQTT is perfect lightweight protocol for managing home electronic devices. The only thing that is not very convenient is the need to know the IP of the MQTT broker for all MQTT clients. Meanwhile this IP may well change in the home router (being the router will replaced, in case of a failure with the router, or if the home NET's topology will be changed), or in case of replacing the computer with the MQTT server with a new one.

It’s not very difficult to change the IP of the MQTT broker within MQTT clients codes (talking about DIY devices), but if this device been deployed a long time ago, it’s not so easy to recall all program code for making changes and restore all programming toolchains.

Described the MQTT-driven IP-relay module, on which the variable part of the MQTT broker’ IP address is set by mechanical switches, and in case of changing this address it is not necessary to change the program of the relay module.

Step 1: Details

Main components:
- 8 Channel DC 12V Relay Module with ULN2803 driver and 12V to 5V DC-DC converter installed;

- STM32F103C8T6 aka Blue Pill module;

- Wizchip Ethernet W5500 module;

- two 8-dip switches;

- prototype printed circuit panel (green colored about having metalized holes).

The toolchain: MinGW, GNU-ARM-GCC, VSCode, STM32CubeMX and STM32 ST-LINK Utility.

This IP-relay module is wired to the home router, that is located in the same cabinet with AC contactors for end devices. As this module intended for the management of the DIN AC relays with the electric latching, the "IPRelay/Pulse" MQTT message was programmed within the sketch. Of course, any MQTT messages can be programmed.

See "Diary" for details.