
ESP32 W5500 MQTT
Simple example of using Arduino Ethernet library with ESP32 and W5500 to subscribe and publish to MQTT broker.
Physical connection between ESP32 and W5500
- GPIO23 <–> MOSI
- GPIO19 <–> MISO
- GPIO18 <–> SCLK
- GPIO5 <–> SCS
- GPIO11 <–> RESET
It is possible to change pins used for chip-select and reset in include/MasterConfig.h
file.
Configuration
Fixed IP address of the device (ETHERNET_IP
) and MQTT hostname (MQTT_HOSTNAME
) should most probably be changed in include/MasterConfig.h
to fit your setup. Changing other configurations in MasterConfig.h
is optional.
Running the test
It has been prepared as PlatformIO project. All dependencies will be automatically downloaded if run with PlatformIO.
Script for publishing messages (so ESP32 has something to read) has been prepared with Bash and Docker. That means it Docker is required for it and it is simple to run on Linux. It may also work with Windows Subsystem for Linux but it has not been tested.
- Load and run project on ESP32
- Start script
scripts/mqtt_pub_test.sh [MQTT_HOST]
- Observe serial output from ESP32
COMMENTS