Setiawan <stwn at unsoed.ac.id> Previous Week’s Material • Temperature monitoring – CPU w/ GPIO Zero – DHT11 w/ Adafruit DHT • Writing data to a CSV file • Displaying the data to a live graph with matplotlib • Actions: LED and buzzer Analog signal Compute Storage Digital signal Stallings, 2016 1 2 CSV +Humidity * https://components101.com/sensors/dht11-temperature-sensor DHT11* 3
Setiawan <stwn at unsoed.ac.id> Previous Week’s Material • Temperature monitoring – CPU w/ GPIO Zero – DHT11 w/ Adafruit DHT • Writing data to a CSV file • Displaying the data to a live graph with matplotlib • Actions: LED and buzzer Analog signal Compute Storage Digital signal Stallings, 2016 Communications +Humidity 1 2 3 5 6 CSV +Notification Simple * https://components101.com/sensors/dht11-temperature-sensor DHT11*
Setiawan <stwn at unsoed.ac.id> Previous Week’s Material • Temperature monitoring – CPU w/ GPIO Zero – DHT11 w/ Adafruit DHT • Writing data to a CSV file • Displaying the data to a live graph with matplotlib • Actions: LED and buzzer Analog signal Compute Storage Digital signal Stallings, 2016 Communications +Humidity 1 2 5 6 +Notification Cloud Compute Storage Simple * https://components101.com/sensors/dht11-temperature-sensor DHT11* 3 CSV
Setiawan <stwn at unsoed.ac.id> Objectives • Learn how to setup channels on an IoT platform • Learn how to send collected data from an IoT device to the channel • Learn how to display the data on a dashboard
Setiawan <stwn at unsoed.ac.id> Contents • Setting up a channel on ThingSpeak • Getting temperature and humidity data from DHT11 and sending the data to the channel • Displaying the data using a dashboard using Private and Public Views
Setiawan <stwn at unsoed.ac.id> IoT Cloud Platform • Data storing or aggregation – Live data streams via APIs – Time series database • Data visualization • Analytics • Apps – Transforming and/or visualizing data – Triggering actions
Setiawan <stwn at unsoed.ac.id> Creating a Channel • Login, and click My Channels – New Channel • Set the channel settings – Name: ACNT-X Monitoring, e.g. ACNT-10 Monitoring – Description: Temperature and humidity monitoring – Field 1: Temperature – Field 2: Humidity • Click Save Channel Channel ID
Setiawan <stwn at unsoed.ac.id> API Keys and Write/Read URLs • Click to API Keys tab • Take notes – Write API Key to write data to a channel (WAPIK) – Read API Key to read data from a channel (RAPIK) – API Requests: Write Feeds https://api.thingspeak.com/update?api_key=WAPIK&field1=A&field2=B – API Requests: Read Feeds https://api.thingspeak.com/channels/[Channel ID]/feeds.json?api_key=RAPIK&results=2 Temperature data Humidity data
Setiawan <stwn at unsoed.ac.id> Python Libraries • Adafruit DHT, a library for DHT11/DHT22 • urllib.request, a library for opening URLs * https://docs.python.org/3/library/urllib.request.html
Setiawan <stwn at unsoed.ac.id> Observation and Sharing • Observe the dashboard on Private View tab for 5 minutes and make sure that the channel on ThingSpeak received data from your IoT device • Click Sharing tab, select “Share channel view with everyone” • Click Public View tab and make sure that there is a dashboard with two charts shown
Setiawan <stwn at unsoed.ac.id> IoT Assignment 4 • Simulate a scenario similar to Assignment 3 number 3. Please observe: – your dashboard for the sent data to the channel on ThingSpeak – CSV file output via read data from the channel • Continue to run data collecting and storing to the cloud for 12 2 hours • Optional: Send an email on heat alert, temperature > 35°C – Add Apps – MATLAB Analysis, or – Add Apps – React
Setiawan <stwn at unsoed.ac.id> Results to be Uploaded 1. Experiment results: photos and explanations 2. Assignment 4 results – Attach you group’s Channel ID and CSV file – Photos and a demo video showing the results – Source code, screenshots/figures, and explanations Upload your experiment and assignment 4 results to Moodle • Using one PDF file • One group, one document • Upload your demo video somewhere, only attach the URL to the doc. 06/16 9pm code experiment
Setiawan <stwn at unsoed.ac.id> Resources • Circuit Basics, “Logging Sensor Data to the Cloud Using the Raspberry Pi,” 2020. [Online]. Available: https://circuitbasics.com/logging-sensor-data-to-the- cloud-using-the-raspberry-pi/ • N. Vemu, “The Naivest Way to Send and Retrieve Data from Cloud (Using Python),” 2021. [Online]. Available: https://medium.com/geekculture/the-naivest-way-to- send-and-retrieve-data-from-cloud-using-python- 52a3e4b5fe24