---
title: "Bluepill + W5500 Ethernet MQTT Client using PlatformIO"
url: "https://maker.wiznet.io/louis_m/projects/bluepill-w5500-ethernet-mqtt-client-using-platformio/"
markdown_url: "https://maker.wiznet.io/louis_m/projects/bluepill-w5500-ethernet-mqtt-client-using-platformio/md"
type: "UCC: User Created Content"
author: "Maximilian Gerhardt"
author_url: "https://github.com/maxgerhardt/pio-bluepill-w5500-ethernet-mqtt-client"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "Maximilian Gerhardt"
original_url: "https://github.com/maxgerhardt/pio-bluepill-w5500-ethernet-mqtt-client"
published: "2024-02-29"
language: "en"
hardware: ["WIZnet W5500"]
likes: 0
views: 1525
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# Bluepill + W5500 Ethernet MQTT Client using PlatformIO

> This project uses a "W5500 lite" board (also called DEVMO USR-ES1) connected to a standard BluePill board (STM32F103C8).

Original author: Maximilian Gerhardt (source: https://github.com/maxgerhardt/pio-bluepill-w5500-ethernet-mqtt-client)

## 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

<https://github.com/maxgerhardt/pio-bluepill-w5500-ethernet-mqtt-client#description>

This project uses a "W5500 lite" board (also called DEVMO USR-ES1) connected to a standard BluePill board (STM32F103C8).

[![W5500 Module](https://github.com/maxgerhardt/pio-bluepill-w5500-ethernet-mqtt-client/raw/master/w5500_modules.png)](https://github.com/maxgerhardt/pio-bluepill-w5500-ethernet-mqtt-client/blob/master/w5500_modules.png)

The code is a slight extension of the original `ArduinoEthernetShield.ino` (<https://github.com/256dpi/arduino-mqtt/blob/master/examples/ArduinoEthernetShield/ArduinoEthernetShield.ino>) sketch with the addition of reading out the supply voltage of the board.

No changes to the Ethernet or arduino-mqtt library have been made.

## Wireup

<https://github.com/maxgerhardt/pio-bluepill-w5500-ethernet-mqtt-client#wireup>

Refer module datasheet for details.

[![Pinout](https://github.com/maxgerhardt/pio-bluepill-w5500-ethernet-mqtt-client/raw/master/pinout.png)](https://github.com/maxgerhardt/pio-bluepill-w5500-ethernet-mqtt-client/blob/master/pinout.png)

- Power pins: All GNDs to Bluepill's GNDs, all VIN3.3 pins to Bluepill's 3.3V
  - since the module is power-hungry, extra decoupling capacitors on the 3.3V rail are recommended

- SPI: use default SPI1 (SCK = PA5, MISO = PA6, MOSI = PA7) and arbitrary chip select (here CS = PA4)

- nRESET of W5500 module **must** be tied to 3.3V, otherwise the chip won't start

- INT and POWERDOWN are not used

## Expected output

<https://github.com/maxgerhardt/pio-bluepill-w5500-ethernet-mqtt-client#expected-output>

The `Serial` UART output is on PA9 at 115200 baud.

The sketch should start with detecting the W5500 chip and getting an IP address via DHCP. It then connects to a public MQTT broker, subscribes to the "/hello" topic and regularly publishes a dummy message in the topic.

```

```

```plaintext
W5500 detected
Local IP is  192.168.1.237
connecting...
connected!
Incoming: from topic "/hello" Payload "01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
Incoming: from topic "/hello" Payload "world"
Incoming: from topic "/hello" Payload "world"
Incoming: from topic "/hello" Payload "world"
Incoming: from topic "/hello" Payload "world"
Publishing message to /hello: "world"
Incoming: from topic "/hello" Payload "world"
Incoming: from topic "/hello" Payload "world"
Incoming: from topic "/hello" Payload "world"
Incoming: from topic "/hello" Payload "world"
Incoming: from topic "/hello" Payload "world"
Incoming: from topic "/hello" Payload "world"
Incoming: from topic "/hello" Payload "world"
```

## Technical Documents

<https://github.com/maxgerhardt/pio-bluepill-w5500-ethernet-mqtt-client#technical-documents>

- Datasheet W5500 Module: https://www.usriot.com/download/ES1/USR-ES1-EN-V1.0.pdf

- Datasheet W5500 chip: http://wizwiki.net/wiki/lib/exe/fetch.php/products:w5500:w5500_ds_v109e.pdf

- STM32Duino Bluepill pinout: https://stm32duinoforum.com/forum/wiki_subdomain/index_title_Blue_Pill.html

---

Source: https://maker.wiznet.io/louis_m/projects/bluepill-w5500-ethernet-mqtt-client-using-platformio/
