---+ MQTT and Cayenne ---++ Exercise 1: Install mosquitto on your machine. On Ubuntu Linux this can very easily be accomplished with apt. Try the _mosquitto_ communication: * <p>Start the mosquitto broker</p> * <p>Start mosquitto_sub subscribing to the “DCSIT” topic</p> * <p>Start mosquitto_pub publishing some message to the topic “DCSIT</p> * <p>observe the message being seen in mosquitto_sub</p> ---++ <a name="Exercise_2"></a> Exercise 2: Write you own MQTT client in Python publishing a message to “DCSIT” every 2 s. Have a look at the <a href="https://github.com/micropython/micropython-lib/tree/master/umqtt.simple" target="_blank">umqtt.simple class<img alt="" border="0" height="12" src="%PUBURL%/TWiki/TWikiDocGraphics/external-link.gif" width="13" /></a> to see how to accomplish this. Write the program and start it with thonny. You must know the IP address of the machine on which your mosquitto broker is running. Use _ifconfig_ to find out. Subscribe to the “DCSIT” topic with mosquitto_sub and observer that the messages are arriving. Write an MQTT client that subscribes to the “DCSIT” topic and that prints messages coming in. Write a program controlling a LED as we did during the lectures. ---++ <a name="Exercise_3"></a> Exercise 3: Register a user on <a href="https://mydevices.com/cayenne/signup" target="_blank">https://mydevices.com/cayenne/signup<img alt="" border="0" height="12" src="%PUBURL%/TWiki/TWikiDocGraphics/external-link.gif" width="13" /></a>. Watch the introductory film and have a look at the documentation pages. Add a device by clicking on “Bring Your Own Thing”. Have a look at your Cayenne credentials. ---++ <a name="Exercise_4"></a> Exercise 4: Write a program connecting to Cayenne. Observe that the dashboard is coming up. ---++ <a name="Exercise_5"></a> Exercise 5: Write a program that sends a dummy voltage value to Cayenne on channel 0. The voltage values should range from 0 to 3300 mV (the voltages on the ESP8266). Wait for 2 s minimum between each value. Observe the widget coming up on the dashboard. Fix the widget on the dashboard and change the widget parameters (e.g. the name). ---++ <a name="Exercise_6"></a> Exercise 6: Add a gauge widget with ranges 0 .. 1V, 1V .. 2V, 2V .. 3.3V. Run your program sending the dummy voltages and observe how the dashboard displays them. ---++ <a name="Exercise_7"></a> Exercise 7: Add a dummy measurement on atmospheric pressure to your program. The normal air pressure is around 950 hPa (hecto Pascal). ---++ <a name="Exercises_8"></a> Exercises 8: Create a slider and a push button on your dashboard. -- %USERSIG{UliRaich - 2020-09-02}% ---++ Comments %COMMENT%
This topic: IoT_Course_English
>
WebHome
>
Exercises
>
IoTViaMQTTAndCayenne
Topic revision: r1 - 2020-09-02 - UliRaich
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback