mqtts-ethernet
This project is an example of integrating the ESP32 with the W5500 module to manage both wired and wireless network communication, providing a flexible display
This project demonstrates the use of an Ethernet driver with tcpip_adapter, utilizing the ESP32 microcontroller and the W5500 Ethernet module to set up network communication via MQTT and manage wireless communication through Bluetooth Low Energy (BLE). It is mainly used for configuring a display system to show vehicle license plates and direction indicators.
Main Components and Their Roles
ESP32: The microcontroller handles network connection management, runs the MQTT client, and manages BLE communication.
W5500 Ethernet Module: Connected to the ESP32, it provides wired network connectivity. It ensures a stable network connection and can be set up to obtain an IP address via DHCP or use a static IP address. The W5500 module is used as follows:
- Ethernet Driver Installation: Install the W5500 driver on the ESP32.
- DHCP Request and IP Address Allocation: Send a DHCP request for network connection and wait for the IP address to be allocated.
- IP Address Confirmation: Confirm the IP address and establish a network connection if assigned.
- MQTT Client Initialization: Initialize the MQTT client once the network connection is complete.
- MQTT Communication: Subscribe to topics and publish messages using the initialized MQTT client.
- BLE Initialization: Initialize the Bluetooth Low Energy (BLE) controller and start the Nordick service.
🖱️ Component Descriptions
Ethernet (ethe): This component sets up the Ethernet connection to ensure network connectivity. Initial pin values are as follows:
- SCLK - 18
- MOSI - 23
- RST - 21
- MISO - 19
- CS0 - 5
- INT0 - 4
- GND - GND
- 3.3V - 3.3V
MQTT (mqtts): Establishes a connection to the broker using the MQTT protocol, supporting both encrypted (MQTTS) and unencrypted (MQTT) connections. Security can be configured using a certificate file (CA).
UART (uart): Configures the UART ports for communication with the display. Uses UART2 with the following pins:
- UART2_PIN_RX - 16
- UART2_PIN_TX - 17
Communication (communication): A communication interface for sending data to the display. It processes messages received via BLE and MQTT and outputs them to the display.
BLE Manager (blemananger) and BLE UART Server (bleuartServer): Manages BLE connections with devices such as smartphones. The device name is set in the format DISPLAY_X.
Configuration and Message Handling
- IP Configuration: After establishing a network connection, IP, gateway, subnet mask, and DNS settings can be changed via MQTT messages. These settings can also be changed via BLE.
- Display Message Settings: Configures the messages displayed on the display through MQTT. This can include vehicle license plates and direction indicators.
- Restart and Reset: If the network connection or broker connection fails, the ESP32 and W5500 module can be restarted or reset.
This project is an example of integrating the ESP32 with the W5500 module to manage both wired and wireless network communication, providing a flexible display system that can be configured via BLE.