Difference: IoTViaMQTTAndCayenne (1 vs. 4)

Revision 42020-09-05 - UliRaich

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

MQTT and Cayenne

Exercise 1:

Line: 33 to 33
 Write a program connecting to Cayenne. Observe that the dashboard is coming up.

Exercise 5:

Changed:
<
<
Write a program that sends dummy temperature values to Cayenne on channel 0. The temperature values should range from 0 to 50°C . Wait for 2 s minimum between each value.
>
>
Write a program that sends dummy temperature values to Cayenne on channel 0. The temperature values should range from 25°C to 35°C (typical Ghanaian temperatures). Use the random number generator in MicroPython to make the values vary. 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).

Exercise 6:

Changed:
<
<
Add a gauge widget with ranges 0 .. 50 °C. Run your program sending the dummy temperatures and observe how the dashboard displays them.
>
>
Add a gauge widget with ranges 0 .. 50 °C. Run your program sending the dummy temperatures and observe how the dashboard displays them.
Here is a screen dump showing the result:

cayenneDummy.png

 

Exercises 7:

Create a slider and a push button on your dashboard.

Line: 55 to 57
  dashboard.png
Changed:
<
<
As you can see, the LED is currently switched on
>
>
As you can see, the LED is currently switched on.
 

Exercise 10:

Changed:
<
<
Create 4 sliders on the dashboard. The first one will select one of the 7 LEDs on the WS2812 RGB LED chain while the other 3 will select the red, green and blue component for the LED selected.

Exercise 11:

>
>
Create 4 sliders on the dashboard. The first one will select one of the 7 LEDs on the WS2812 RGB LED chain while the other 3 will select the red, green and blue component for the LED selected. With the settings in the screen dump below we will get a light blue color on LED1 (top LED in the ring).
 
Changed:
<
<
Connect the GPS receiver to the ESP32 and send GPS position information to Cayenne.
>
>
ws2812Cayenne.png
  -- Uli Raich - 2020-09-02
Line: 70 to 71
 
<--/commentPlugin-->

META FILEATTACHMENT attachment="dashboard.png" attr="" comment="" date="1599224312" name="dashboard.png" path="dashboard.png" size="70247" user="UliRaich" version="1"
Added:
>
>
META FILEATTACHMENT attachment="ws2812Cayenne.png" attr="" comment="" date="1599314346" name="ws2812Cayenne.png" path="ws2812Cayenne.png" size="27644" user="UliRaich" version="1"
META FILEATTACHMENT attachment="cayenneDummy.png" attr="" comment="" date="1599317251" name="cayenneDummy.png" path="cayenneDummy.png" size="27659" user="UliRaich" version="1"

Revision 32020-09-04 - UliRaich

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

MQTT and Cayenne

Exercise 1:

Revision 22020-09-04 - UliRaich

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

MQTT and Cayenne

Exercise 1:

Line: 10 to 10
 
  • Start mosquitto_sub subscribing to the “DCSIT” topic

  • Start mosquitto_pub publishing some message to the topic “DCSIT

  • observe the message being seen in mosquitto_sub

Changed:
<
<

Exercise 2:

>
>

Exercise 2:

  Write you own MQTT client in Python publishing a message to “DCSIT” every 2 s.
Line: 20 to 20
  Write an MQTT client that subscribes to the “DCSIT” topic and that prints messages coming in.
Changed:
<
<
Write a program controlling a LED as we did during the lectures.

Exercise 3:

>
>
Write a program controlling a LED. Use messages “LED on” and “LED off” to control the LED.

Exercise 3:

  Register a user on https://mydevices.com/cayenne/signup.

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.

Changed:
<
<

Exercise 4:

>
>

Exercise 4:

  Write a program connecting to Cayenne. Observe that the dashboard is coming up.
Changed:
<
<

Exercise 5:

>
>

Exercise 5:

 
Changed:
<
<
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.
>
>
Write a program that sends dummy temperature values to Cayenne on channel 0. The temperature values should range from 0 to 50°C . 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).

Changed:
<
<

Exercise 6:

>
>

Exercise 6:

 
Changed:
<
<
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.

Exercise 7:

Add a dummy measurement on atmospheric pressure to your program. The normal air pressure is around 950 hPa (hecto Pascal).

Exercises 8:

>
>
Add a gauge widget with ranges 0 .. 50 °C. Run your program sending the dummy temperatures and observe how the dashboard displays them.

Exercises 7:

  Create a slider and a push button on your dashboard.
Added:
>
>

Exercise 8:

Create a temperature and a humidity widget on the Cayenne dashboard. Write a program that connects to Cayenne and sends temperature and humidity values read from the SHT30 to Cayenne every 5s. Observe the measurements on the dash board.

Add two line charts for temperature and humidity and observe how the plots evolve over time. You may also try to download the measurements saved on the plots.

Exercise 9:

Add a push button to the dashboard and connect it to the built-in LED on the ESP32 CPU board. Try to switch the LED on and off using this button. The dashboard should now look like this:

dashboard.png

As you can see, the LED is currently switched on

Exercise 10:

Create 4 sliders on the dashboard. The first one will select one of the 7 LEDs on the WS2812 RGB LED chain while the other 3 will select the red, green and blue component for the LED selected.

Exercise 11:

Connect the GPS receiver to the ESP32 and send GPS position information to Cayenne.

  -- Uli Raich - 2020-09-02

Comments

<--/commentPlugin-->
Added:
>
>
META FILEATTACHMENT attachment="dashboard.png" attr="" comment="" date="1599224312" name="dashboard.png" path="dashboard.png" size="70247" user="UliRaich" version="1"

Revision 12020-09-02 - UliRaich

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="Exercises"

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:

  • Start the mosquitto broker

  • Start mosquitto_sub subscribing to the “DCSIT” topic

  • Start mosquitto_pub publishing some message to the topic “DCSIT

  • observe the message being seen in mosquitto_sub

Exercise 2:

Write you own MQTT client in Python publishing a message to “DCSIT” every 2 s.

Have a look at the umqtt.simple class 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.

Exercise 3:

Register a user on https://mydevices.com/cayenne/signup.

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.

Exercise 4:

Write a program connecting to Cayenne. Observe that the dashboard is coming up.

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).

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.

Exercise 7:

Add a dummy measurement on atmospheric pressure to your program. The normal air pressure is around 950 hPa (hecto Pascal).

Exercises 8:

Create a slider and a push button on your dashboard.

-- Uli Raich - 2020-09-02

Comments

<--/commentPlugin-->
 
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