Difference: MQTTAndCayenne (4 vs. 5)

Revision 52020-09-08 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

MQTT and Cayenne

Introduction

Line: 36 to 36
  myDevices Cayenne supplies an MQTT broker and an application to visualize data sent to it in nice graphical widgets. It can also save a history of measurements in a plot and allows you to download the historic data to your PC as a csv file for further analysis. It supplies a dash board on which you can create the Graphical User Interface objects most suited for your measurements. Control widgets are also available. The WEB site with the dash board can also be run on your smart phone and you can visualize your sensor data or control your actuators from there.
Changed:
<
<
You may want to have a look at the slides from the IoT workshop ( session 3 and session 4) at the African Internet Summit 2019 in Kampala, Uganda where access to Cayenne from an ESP8266 was explained.
>
>
You may want to have a look at the slides from the IoT workshop ( session 3 and session 4) at the African Internet Summit 2019 in Kampala, Uganda where access to Cayenne from an ESP8266 was explained.
 

Interfacing to Cayenne

Changed:
<
<
Cayenne supplies libraries for many programming languages giving access to its broker. The Cayenne language binding for Python unfortunately depends on the Eclipse Paho MQTT library, which is not available in MicroPython. Since this library is OpenSource however, it was not too difficult to adapt it to MicroPython's umqtt library and thus making it work on MicroPython as well. The adapted library uses the same API as the original code which means that the example programs remain unchanged. The library is available in our MicroPython binary.
>
>
Cayenne supplies libraries for many programming languages giving access to its broker. It uses its own dedicated MQTT messages. The Cayenne language binding for Python unfortunately depends on the Eclipse Paho MQTT library, which is not available in MicroPython. Since this library is OpenSource however, it was not too difficult to adapt it to MicroPython's umqtt library and thus making it work on MicroPython as well. The adapted library uses the same API as the original code which means that the example programs remain unchanged. The library is included in our MicroPython binary.

The screen dump below shows a typical Cayenne dashboard, which is in fact the solution of one of the last exercises in this course.

cayenneSHT30andLED.png

On the left hand side it shows the IoT projects on which I had been working with the IoT course SHT30 project selected. There are two number widgets for temperature and humidity values coming from the SHT30 with an icon for temperature and another one for relative humidity. Then you see the history of temperature and humidity measurements over the last few minutes and finally a push button used to control the built-in LED on the ESP32 CPU board. As you can see, the LED is currently "on".

The rest of this chapter will lead you to such a result.

The first steps

Before being able to do anything in Cayenne you have to sign up at https://mydevices.com/cayenne/signup.

cayenneSignUp.png

Once you are logged into Cayenne you will have to define your first project. Since none of the devices proposed corresponds to the ESP32 WeMos D1 mini, select: "Bring your own thing"

bringYourOwn.png

This will show you the Cayenne credentials for your new project (my own MQTT user code and password are partially blanked out):

cayenneCredentials.png

As you can see, Cayenne supplies you with 3 code numbers

  • one number corresponding to your MQTT user ID
  • another one corresponding to your user's password
  • and a device ID corresponding to your IoT project.
These three numbers will be needed in your ESP32 Cayenne client to be able to connect to the Cayenne dashboard corresponding to this IoT project. You can also see that Cayenne is now waiting for the device to connect.
  -- Uli Raich - 2020-08-31
Line: 52 to 79
 
META FILEATTACHMENT attachment="mqttClient.png" attr="" comment="" date="1599338940" name="mqttClient.png" path="mqttClient.png" size="36549" user="UliRaich" version="1"
META FILEATTACHMENT attachment="mqttSubClient.png" attr="" comment="" date="1599339312" name="mqttSubClient.png" path="mqttSubClient.png" size="56534" user="UliRaich" version="1"
META FILEATTACHMENT attachment="mosquittoDemo.png" attr="" comment="" date="1599340210" name="mosquittoDemo.png" path="mosquittoDemo.png" size="534522" user="UliRaich" version="1"
Added:
>
>
META FILEATTACHMENT attachment="dashboard.png" attr="" comment="" date="1599590521" name="dashboard.png" path="dashboard.png" size="70247" user="UliRaich" version="1"
META FILEATTACHMENT attachment="cayenneSHT30andLED.png" attr="" comment="" date="1599591400" name="cayenneSHT30andLED.png" path="cayenneSHT30andLED.png" size="182914" user="UliRaich" version="1"
META FILEATTACHMENT attachment="cayenneSignup.png" attr="" comment="" date="1599592729" name="cayenneSignup.png" path="cayenneSignup.png" size="125087" user="UliRaich" version="1"
META FILEATTACHMENT attachment="cayenneSignUp.png" attr="" comment="" date="1599592762" name="cayenneSignUp.png" path="cayenneSignUp.png" size="24231" user="UliRaich" version="1"
META FILEATTACHMENT attachment="bringYourOwn.png" attr="" comment="" date="1599593307" name="bringYourOwn.png" path="bringYourOwn.png" size="201816" user="UliRaich" version="1"
META FILEATTACHMENT attachment="cayenneCredentials.png" attr="" comment="" date="1599594102" name="cayenneCredentials.png" path="cayenneCredentials.png" size="66894" user="UliRaich" version="1"
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback