
| Line: 1 to 1 | ||||||||
|---|---|---|---|---|---|---|---|---|
MQTT and CayenneIntroduction | ||||||||
| Line: 45 to 45 | ||||||||
![]() | ||||||||
| Changed: | ||||||||
| < < | 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". | |||||||
| > > | 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 | ||||||||
| Line: 1 to 1 | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
MQTT and CayenneIntroduction | |||||||||||||
| 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 | ||||||||||||
| > > | 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
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 stepsBefore being able to do anything in Cayenne you have to sign up at https://mydevices.com/cayenne/signup.
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"
This will show you the Cayenne credentials for your new project (my own MQTT user code and password are partially blanked out):
As you can see, Cayenne supplies you with 3 code numbers
| ||||||||||||
|
-- | |||||||||||||
| Line: 52 to 79 | |||||||||||||
| |||||||||||||
| Added: | |||||||||||||
| > > |
| ||||||||||||
| Line: 1 to 1 | ||||||||
|---|---|---|---|---|---|---|---|---|
MQTT and CayenneIntroduction | ||||||||
| Line: 34 to 34 | ||||||||
Cayenne | ||||||||
| Changed: | ||||||||
| < < | 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 measurement in a plot and allows you you 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 measurement. Control widgets are also available. You can also run a Cayenne app on your smart phone and visualize your sensor data or control your actuators from there. | |||||||
| > > | 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. | |||||||
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 | ||||||||
| Line: 1 to 1 | ||||||||
|---|---|---|---|---|---|---|---|---|
MQTT and CayenneIntroduction | ||||||||
| Line: 32 to 32 | ||||||||
which can be used to control the builtin LED on the ESP32 CPU board.
![]() | ||||||||
| Added: | ||||||||
| > > | CayennemyDevices 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 measurement in a plot and allows you you 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 measurement. Control widgets are also available. You can also run a Cayenne app on your smart phone and visualize your sensor data or control your actuators from there. 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 CayenneCayenne supplies libraries for many programming languages giving access to its broker. The Cayenne language binding for Python | |||||||
|
-- | ||||||||
| Line: 1 to 1 | ||||||||
|---|---|---|---|---|---|---|---|---|
MQTT and CayenneIntroduction | ||||||||
| Changed: | ||||||||
| < < | myDevices Cayenne | |||||||
| > > | myDevices Cayenne | |||||||
MQTTMQTT (Message Queuing Telemetry Transport: a publish-subscribe based message protocol running of top of TCP. A broker takes subscriptions for messages of a certain “topic” and it sends messages, coming from publishers to everyone having subscribed to the topic.![]() | ||||||||
| Changed: | ||||||||
| < < | We can easily test the mechanism using the mosquitto MQTT broker. Install mosquitto and mosquitto-clients using apt. mosquitto is the broker and mosquitto_sub allows you to subscribe to a topic while mosquitto_pub will publish a topic. | |||||||
| > > | We can easily test the mechanism using the mosquitto MQTT broker. Install mosquitto and mosquitto-clients using apt. mosquitto is the broker and mosquitto_sub allows you to subscribe to a topic while mosquitto_pub will publish a topic, see the screen dump below:
Accessing the MQTT broker from MicroPythonUp to now the communication between the MQTT broker and its client happened on the PC and on the same machine. In micropython-lib you will find a module umqtt.simple with methods
It is not much more difficult to write a client equivalent to mosquitto_sub. Here we register a callback routine which MQTTClient will call when a message for the subscribed topic has arrived. After registration of the callback and subscription to the topic we simply wait for messages to come in, messages which will be treated in the callback. In the callback below the messages are simply printed but it would also be possible to control hardware in the callback routine. Imagine messages like
![]() | |||||||
|
-- | ||||||||
| Line: 20 to 41 | ||||||||
| ||||||||
| Added: | ||||||||
| > > |
| |||||||
| Line: 1 to 1 | ||||||||
|---|---|---|---|---|---|---|---|---|
| Added: | ||||||||
| > > |
MQTT and CayenneIntroductionmyDevices CayenneMQTTMQTT (Message Queuing Telemetry Transport: a publish-subscribe based message protocol running of top of TCP. A broker takes subscriptions for messages of a certain “topic” and it sends messages, coming from publishers to everyone having subscribed to the topic.
We can easily test the mechanism using the mosquitto MQTT broker. Install mosquitto and mosquitto-clients using apt. mosquitto is the broker and mosquitto_sub allows you to subscribe to a topic while mosquitto_pub will publish a topic.
-- Comments
| |||||||