publish
and subscribe
happen.
I have used an actuator system here. All things related to my demonstration are described in the documentation. You can see my concept below :
The system consists of three gadgets like a LED,BULB,and FAN in the Cayenne
dashboard.Which sends its digital values to ESP8266 via MQTT.
- Arduino IDE for Windows, Linux or Mac OS.
-
Download the repo.
-
For those who don't have a cayenne dashboard 😇 download the CAYENNE IOT WITH ESP8266 named pdf from the DOC folder and carefully read it. Create a dashboard with at least one gadget and make simulation possible with ESP8266.Create your Cayenne account at https://www.cayenne-mydevices.com.
-
Open LIB folder from the downloaded repo then extract the
ZIP
file and place theCayenneMQTT
(version 1.3.0) folders into your Arduino local directory folder (libraries). You have an alternate option to download the library from the Arduino library manager. But before that, you must read the MQTT Status section. -
The source code for our ESP8266 simulation can be found in the CODE folder. Open source code from the downloaded repo and make some changes as mentioned below :
- Open global.h and provide your wifi router's
ssid
andpassword
:
- Open cmqtt.cpp and fill your credentials here 👇 .For more info refer the document page number 3
If you download the library from arduino library manager
you should comment one of the function in the given source code to avoid compilation error.
Open cmqtt.cpp and comment:
Better use my library 👍 from the LIB folder because I have included some changes in the Cayenne library
for knowing the Cayenne MQTT connection status
and its serial print acknowledgment in Arduino IDE like the below image. It will really help us to know whether the ESP8266 connected or not to the Cayenne dashboard and also it will rectify he above mentioned issue😃.
- If you go for direct library download you gonna miss this acknowledgment. But there is no issue with working on the source code.
This library was tested with the NodeMCU V1.0 ESP8266 development board. It should also work with other standard ESP8266 that are compatible with the Arduino IDE.
ESP8266 core version that I have tested is 2.4.2
Demonstration of publish
and subscribe
between ESP8266 and Cayenne dashboard described in the documentation from page No:7 onwards and good luck!!!✌️.