---
title: "MQTT-driven IP-relay module"
url: "https://maker.wiznet.io/teju/projects/mqtt-driven-ip-relay-module/"
markdown_url: "https://maker.wiznet.io/teju/projects/mqtt-driven-ip-relay-module/md"
type: "UCC: User Created Content"
author: "iot4c"
author_url: "https://hackaday.io/project/170370/gallery#8a90f8bd80360a42329ccaf819fb34a7"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "iot4c"
original_url: "https://hackaday.io/project/170370/gallery#8a90f8bd80360a42329ccaf819fb34a7"
published: "2022-11-01"
language: "en"
hardware: ["WIZnet W5500"]
likes: 3
views: 924
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# MQTT-driven IP-relay module

> MQTT-driven IP-relay module, on which the variable part of the MQTT broker’ IP address is set by mechanical switches

Original author: iot4c (source: https://hackaday.io/project/170370/gallery#8a90f8bd80360a42329ccaf819fb34a7)

## Components

- **WIZnet W5500** x 1 ([docs](https://docs.wiznet.io/Product/Chip/Ethernet/W5500))

WIZnet parts: W5500 ([Datasheet](https://docs.wiznet.io/Product/Chip/Ethernet/W5500/datasheet?utm_source=maker&utm_medium=project&utm_campaign=w5500), [product hub](https://maker.wiznet.io/products/w5500/))

## Article

DESCRIPTION

MQTT is a 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 a home router (being a router will be replaced, in case of a failure with a router, or if a home NET's topology will be changed), or in case of the replacing a MQTT computer 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 was 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.

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.

DESCRIPTION

MQTT is a 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 a home router (being a router will be replaced, in case of a failure with a router, or if a home NET's topology will be changed), or in case of the replacing a MQTT computer 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 was 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.

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.

DESCRIPTION

MQTT is a 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 a home router (being a router will be replaced, in case of a failure with a router, or if a home NET's topology will be changed), or in case of the replacing a MQTT computer 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 was 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.

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.

DESCRIPTION

MQTT is a 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 a home router (being a router will be replaced, in case of a failure with a router, or if a home NET's topology will be changed), or in case of the replacing a MQTT computer 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 was 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.

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.![](https://maker.wiznet.io/upload/ckeditor5/1010957312%5F1667323005%2Epng)

![](https://maker.wiznet.io/upload/ckeditor5/1010957312%5F1667323025%2Epng)

---

Source: https://maker.wiznet.io/teju/projects/mqtt-driven-ip-relay-module/
