Start Presentation

Slide 1: Setting up an IoT

Session 3: MQTT and Cayenne

Uli Raich

Formally CERN, Geneva, Switzerland

Slide 2: The Network Layers

The WeMos D1 mini has a built-in WiFi interface

In order to communicate with other IoT nodes we must therefore

connect to the WiFi network first

On top of WiFi we will run a TCP session

On top of TCP we will run the MQTT protocol

On top of MQTT we have dedicated topics and payloads imposed by Cayenne

Slide 3: Accessing the WiFi network

wifiDemoCode.png

Slide 4: Accessing the WiFi network from Micropython

wifiConnect.png

Slide 5: MQTT

MQTT (Message Queuing Telemetry Transport: a publish-subscribe based

message protocol running of top of TCP.

A processor can subscribe to messages of a certain “topic” and/or it can push its

results on a certain topic

mqttPostOfffice.png

Slide 6: MQTT Demo

mqttDemo.png

Slide 7: The Micropython library

micropython-lib.png

Slide 8: A MQTT example using umqtt.simple

umqttDemo.png

Slide 9: Sending dummy temperature data

mqttDummySensorDemo.png

Slide 10: Receiving commands

Receiving commands is a bit more tricky! We must:

  • Write a callback function and register it with the MQTT client
  • This function takes 2 arguments:
  • The topic
  • The payload
  • Subscribe to the topic
  • Wait forever. The callback function will be executed when a message with the
    topic we subscribed to, will arrive

Slide 11: Subscribe a callback

subscribeDemo.png

Slide 12: Callback result

-- Uli Raich - 2019-05-14

Comments

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatodp afnog19-ws-session3.odp r1 manage 5245.0 K 2019-05-15 - 19:13 UliRaich  
PNGpng micropython-lib.png r1 manage 75.2 K 2019-05-14 - 17:31 UliRaich  
PNGpng mqttDemo.png r1 manage 191.3 K 2019-05-14 - 17:23 UliRaich  
PNGpng mqttDummySensorDemo.png r1 manage 74.4 K 2019-05-20 - 18:40 UliRaich  
PNGpng mqttExample.png r2 r1 manage 73.2 K 2019-05-15 - 16:12 UliRaich  
PNGpng mqttPostOfffice.png r1 manage 50.2 K 2019-05-14 - 17:18 UliRaich  
PNGpng realData.png r1 manage 27.7 K 2019-05-15 - 17:12 UliRaich  
PNGpng subscribeDemo.png r1 manage 78.3 K 2019-05-20 - 18:45 UliRaich  
PNGpng umqttDemo.png r2 r1 manage 72.2 K 2019-05-14 - 17:38 UliRaich  
PNGpng wifiConnect.png r1 manage 128.4 K 2019-05-14 - 17:18 UliRaich  
PNGpng wifiDemoCode.png r1 manage 43.8 K 2019-05-15 - 16:14 UliRaich  
Edit | Attach | Watch | Print version | History: r9 < r8 < r7 < r6 < r5 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r6 - 2019-05-21 - UliRaich
 
  • Edit
  • Attach
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