Skip to content

TuEmb/mqtt-esp-rs-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MQTT ESP Rust Example

  • This repository provides an example of using MQTT on ESP32 with Rust, including TLS support for secure communication.
  • This repo only supports MQTT3 now. I'm planning for MQTT5 in the future.

Features

  • Connect ESP32 to an MQTT broker using Rust.
  • Secure communication with TLS support.
  • Lightweight and efficient implementation.

Requirements

  • Rust toolchain (nightly recommended)
  • ESP32 toolchain (esp-rs)
  • Cargo and cargo-espflash
  • An MQTT broker (e.g., Mosquitto, EMQX, or HiveMQ)

Installation & Setup

1. Install Rust for ESP32

Follow the official esp-rs setup guide to install the necessary tools.

2. Clone the Repository

git clone https://github.com/TuEmb/mqtt-esp-rs-example.git
cd mqtt-esp-rs-example

3. Setup MQTT client

  • put your certs at certs
  • Update your MQTT info at src/tasks/mod.rs

4. Build & Flash

Run the following command to build and flash the firmware:

SSID="your-wifi" PASSWORD="your-wifi-password" cargo r --release

Usage

Once flashed, the ESP32 will:

  1. Connect to the configured Wi-Fi network.
  2. Establish a TLS-secured MQTT connection.
  3. Publish to a topic.

Roadmap

  • Add support for all ESP variants (esp32c6 for now)

License

This project is licensed under the MIT License.

Contributions

Contributions are welcome! Feel free to open an issue or submit a pull request.

About

the example for MQTT on esp and Rust

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages