Practical 7 - Cloud Service
Practical 7 - Cloud Service
Practical 7
Objective
Establish connection and communication between embedded system and cloud services
Procedure
Step 1: Register an account at https://firebase.google.com/, refer to Setup - Firebase.pdf
* Do not use the TAR UMT student gmail account: it doesn't have Google Firebase features.
* Recommend to create a new Gmail account to be used among team members
(the gmail password could be used as part of log in procedure to be shown in your python code)
Step 3: In Thonny Python (IDE), create a new python file named “test07.py”.
For using Grove Base HAT:
BAIT2123 INTERNET OF THINGS Jul 2024
1. Get the Firebase credential from the Firebase site > Project Overview> Project
Setting, modify the program code with the following codes, replace the details with
your own Firebase credentials, i.e., [API_KEY], [PROJECT_ID],
[DATABASE_NAME].
* Please follow the latest way of setting up the firebase credentials content
Task 1: Test your temperature and humidity sensor by facing it with a few breaths and
show it in your firebase’s database. Modify the code to display the values
without adding a new “child” (updating the same child values for every 2
seconds).
Task 2: Adjust the database table and add additional sensors to store more data
(besides humidity and temperature) from different Raspberry Pi, with time
stamps.
Step 3: Upload the compiled code to NodeMCU ESP32 Module and observe the result.
- Click Sketch > Verify / Compile and Sketch > Upload to compile this modified code and
upload to the NodeMCU ESP32 module.
- Check if the firebase status are sent to the Serial Monitor display
- Check if the Firebase content is updated accordingly
Task 1 : Modify the code to upload the temperature, humidity from DHT sensor, and
Ultrasonic distance values to the firebase.
Task 2 : Read the value from Firebase and turn on the Buzzer if the read value is = 1.
Reference: https://randomnerdtutorials.com/esp32-firebase-realtime-database/
BAIT2123 INTERNET OF THINGS Jul 2024
1. Connect a sound sensor to port A0, a Grove Light sensor to port A1 and a Grove
DHT sensor at port A2. Connect a green LED to port D3.
* Port A0, A1, A2 are analog ports
* Port D3 is the Pulse Wave Modulation (PWM) port, responding to the light conditions.
Step 2: In Thonny Python (ID), click “New” to create a new python file and Save As “test07.py”.
Type the following codes:
BAIT2123 INTERNET OF THINGS Jul 2024
Step 4: Replace the api_key with your own one. Run the code.
* Explore the other way to display data (line graph, gauge chart, etc) by selecting
different visualization features in Thingspeak.com
* Attach with another display device (*Tips: setRGB is for ______, refer to Practical 4)
Task 2: Modify the code to make LED brightness responses to the changes of input
sensors (e.g., sound sensor / light sensor)
BAIT2123 INTERNET OF THINGS Jul 2024
Step 1: We use Beebotte.com, that is a simple IOT dashboard display, pre-installed in our
Raspberry Pi module
* If you are using your own Raspberry Pi, do install Beebotte by typing:
sudo pip3 install beebotte
* Reference: https://beebotte.com/tutorials/quick_start
Step 2: In Thonny Python (ID), click “New” to create a new python file and Save As “test08.py”.
Type the following codes:
2. Get the Beebotte credential from the Beebotte site > Account Setting > Access
Management (refer to Setup - Beebotte.pdf file), replace the content with your own
API Key and Secret Key.
BAIT2123 INTERNET OF THINGS Jul 2024
Task 2: Extend the module to online reporting using one of these visualization
websites.
https://www.thethingsnetwork.org/forum/t/visualize-and-push-your-iot-data/1788