An open API service indexing awesome lists of open source software.

https://github.com/gemesa/esp32-mqtt

ESP32 MQTT sandbox
https://github.com/gemesa/esp32-mqtt

aws aws-iot certificate embedded esp32 mqtt psk ssl-certificate ssl-psk wifi

Last synced: 2 months ago
JSON representation

ESP32 MQTT sandbox

Awesome Lists containing this project

README

          

# esp32-mqtt

esp32-mqtt is a sandbox to explore the MQTT capabilities of the ESP32, for example:
- connect to AWS IoT broker using ssl transport with client certificate, see [example 1](/ssl_mutual_auth/)
- connect to local broker using ssl transport with PSK, see [example 2](/ssl_psk/)

## Toolchain installation, firmware building and flashing

### Prerequisites

- [ESP-IDF](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/)

Note: ESP-IDF is added as a submodule mainly for reference (to browse the ESP32 libraries if necessary). You can use it to install the toolchain or clone the [original repo](https://github.com/espressif/esp-idf). If you use the submodule you need to initialize the submodules recursively first:

```
$ git submodule update --init --recursive
```

TLDR installation steps (Fedora 38):

```
$ sudo dnf upgrade --refresh
$ sudo dnf install git wget flex bison gperf python3 cmake ninja-build ccache dfu-util libusbx
$ mkdir -p ~/esp
$ cd ~/esp
$ git clone --recursive https://github.com/espressif/esp-idf.git
$ cd ~/esp/esp-idf
$ ./install.sh esp32
$ . $HOME/esp/esp-idf/export.sh

```

### How to build

```
$ cd
$ idf.py menuconfig
# configure Wi-Fi under "Example Connection Configuration" menu (WiFi SSID and WiFi Password), save and quit
$ idf.py build
```

### How to flash

```
$ sudo usermod -a -G dialout $USER
# restart your terminal
$ cd
$ idf.py flash
```

If you encounter the following problem:

```
$ idf.py flash
Executing action: flash
Serial port /dev/ttyUSB0
/dev/ttyUSB0 failed to connect: Could not open /dev/ttyUSB0, the port doesn't exist
No serial ports found. Connect a device, or use '-p PORT' option to set a specific port.
```

Unplug and replug your ESP32 board, then:

```
$ sudo chmod a+rw /dev/ttyUSB0
$ idf.py flash
```

### How to monitor ESP32 logs

```
$ sudo screen /dev/ttyUSB0 115200
```

If you want to quit press `Ctlr+A` then `D`.