The Cayenne MQTT ESP Library provides functions to easily connect to the Cayenne IoT project builder. This library is designed to work with ESP8266 and ESP32 WiFi modules. With it you can send data to and receive data from Cayenne.
Adafruit HUZZAH ESP8266 image by lady ada is licensed under CC BY-SA 3.0
SparkFun ESP32 Thing image by SparkFun is licensed under CC BY 2.0
- An ESP8266 or ESP32 module, e.g. the Adafruit HUZZAH ESP8266 or SparkFun ESP32 Thing.
- A USB to Serial FTDI or console cable.
- Arduino IDE for Windows, Linux or Mac OS.
- This library.
- Download and install the Arduino IDE.
- Install the Board Package.
- For ESP8266:
- Under File -> Preferences add
http://arduino.esp8266.com/stable/package_esp8266com_index.json
to the Additional Boards Manager URLs field. - Install the esp8266 platform from Tools -> Board -> Boards Manager.
- Under File -> Preferences add
- For ESP32, manually install the board package by following the instructions here: https://github.com/espressif/arduino-esp32/blob/master/README.md#installation-instructions.
- For ESP8266:
- Download this library as a zip file here.
- Install the downloaded zip library from Sketch -> Include Library -> Add .ZIP Library.
- Connect your ESP module to your computer using a USB to Serial FTDI or console cable.
- Select your ESP module and port from the Tools menu.
- Create your Cayenne account at https://www.cayenne-mydevices.com.
- Add a new device using the Bring Your Own Thing API selection.
- Open the included example sketch from File -> Examples -> Cayenne-MQTT-ESP.
- Modify the included sketch with your network info, and the Cayenne authentication info you received when adding your device.
- Compile and upload the sketch to your device. Uploading may require setting the device into bootload mode. For the Adafruit HUZZAH ESP8266 module this is done with the folowing steps:
- Hold down the GPIO0 button.
- Click the Reset button.
- Let go of the GPIO0 button.
- The red LED should light up, indicating the device is ready for uploading.
- Upload your sketch.
- Check the Cayenne dashboard to ensure it is receiving sample data from your device.
This library was tested with the Adafruit HUZZAH ESP8266 breakout module and an Espressif ESP32 development board. It should also work with other standard ESP8266 and ESP32 modules that are compatible with the Arduino IDE.
- This library includes the Eclipse Paho MQTT C/C++ client.
Additional libraries are available for connecting to Cayenne on other platforms and devices. These can be found at https://github.com/myDevicesIoT.