Skip to content

Simple example of secure mqtt connection with root CA/fingerprint for ESP32/ESP8266 boards

License

Notifications You must be signed in to change notification settings

flespi-software/ESP32-ESP8266_mqtts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

ESP32/ESP8266 MQTTs

Simple example of secure mqtt connection with root CA/fingerprint for ESP32/ESP8266 boards (send data to mqtt.flespi.io via MQTT over TLS)

Prerequisites:

Install library:

Sketch -> Include Library -> Manage Libraries... -> Type PubSub in Search field -> PubSubClient by Nick O'Leary -> Install.

Build Setup

install additional board to Arduino IDE

Arduino board project Howto

Official Arduino IDE info on how to install additional cores

Select board

Arduino IDE: Tools -> Board -> Your board type (ESP32 Dev Module in my case ESP32 DevkitC v4)

Get FlespiToken

register on flespi platform, create a Token in a tokens Tab and paste token in credentials.h file definitions:

#define FLESPI_TOKEN "FlespiToken REPLACE_WITH_YOUR_FLESPI_TOKEN"

Test

compile the project and flash the board

To test it works you can use flespi online MQTT client:

Paste yout token and subscribe to topic "hello/world"

Troubleshooting

If you get an error when uploading a sketch:

A fatal error occurred: Could not open /dev/ttyACM0, the port doesn't exist
Failed uploading: uploading error: exit status 2

Try running the commands:

sudo adduser $USER $(stat --format="%G" /dev/ttyACM0 )
sudo chmod a+rw /dev/ttyACM0

License

MIT license.

About

Simple example of secure mqtt connection with root CA/fingerprint for ESP32/ESP8266 boards

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published