Internet of Things
TinkerforgeCode in ActionAbout Me
  • Course Outline
  • 1 - Getting Started
    • Overview
    • Connect to the LED
    • Getting Started
      • Glitch
      • The Application Template
    • Concepts in Programming
      • What is Programming?
      • Variables
      • Functions and Commands
      • Control Structures
      • Loops
      • Objects and Libraries
    • Programming Simple Web Apps
    • Exercises
      • 1.1 Buttons and Inputs
  • 2 - Internet of Things
    • Overview
    • IoT in our Apps
      • Getting Started
        • Hardware Kit
        • Brick Viewer and Daemon
      • Connect to the Devices
        • The Tinkerforge Device Manager
      • Program the Devices
        • RGB LED
        • RGB LED Button
        • OLED Display
        • Sensors
          • Humidity Sensor
          • Ambient Light Sensor
    • Components and Use Cases
    • Exercises
      • 2.1 Lights and Buttons
      • 2.2 Sensors
      • 2.3 Display
  • 3 - Artificial Intelligence
    • Overview
    • AI in our Apps
      • Google's Teachable Machine
      • Face Recognition
      • Training a Custom Model
    • Rules vs. Learning
    • Learning from Data
    • Use Cases
      • Computer Vision
        • Image Classification
        • Handwriting Recognition
    • Machine Learning Algorithms
      • Artificial Neural Networks
      • Decision Trees
      • Logistic Regression
    • Exercises
      • 3.1 Rules vs. Learning
      • 3.2 Fruits and Vegetables
      • 3.3 Face Recognition
      • 3.4 A Classifier for Iris
  • 4 - Cloud & APIs
    • Overview
    • APIs in our Apps
    • Cloud and APIs
      • Weather API
      • NASA Open APIs
      • EDAMAM Nutrition and Recipes API
    • Push Notifications
    • Exercises
  • 5 - App Project
    • Overview
    • Summer 2021
    • Summer 2022
  • Appendix
    • Other Devices
      • Motorized Linear Poti
      • Sound Pressure Sensor
      • NFC Reader
      • Motion Detector
    • UI Features
      • Realtime Charts
      • Countdown Timer
    • Digital Computers
      • Overview
      • The Binary System
      • Code Systems
      • Logic Gates
      • Binary Addition
      • From Analog to Digital
    • Cheat Sheets
    • Projects
      • IoT @ Pickup-Boxes
Powered by GitBook
On this page
  • a) Read the temperature
  • b) Read the temperature and humidity
  • c) Temperature warnings with threshold
  • d) Threshold requires human interaction
  • e) Human interaction
  • f) Traffic light warning system

Was this helpful?

  1. 2 - Internet of Things
  2. Exercises

2.2 Sensors

This exercise builds upon the hardware setup from the previous, but now we add a temperature and humidity sensor to the ensemble.

Previous2.1 Lights and ButtonsNext2.3 Display

Last updated 3 years ago

Was this helpful?

a) Read the temperature

Again, we start easy. After the website button is pressed, read the temperature sensor information every five seconds and print it to the console!

Possible solution:

b) Read the temperature and humidity

Now also print the humidity sensor value to the console. Let the user know which value is currently printed, including a short sentence with the correct unit.

Possible solution:

c) Temperature warnings with threshold

We slowly become familiar with the sensors. Let’s try to light up the LED in red when the temperature exceeds a threshold - say 30° Celsius. Let the user enter the threshold.

Optional: Add a permanent display area for the temperature that changes its background color from green to red as the threshold exceeds the limit.

Possible solution:

d) Threshold requires human interaction

Possible solution:

e) Human interaction

Possible solution:

f) Traffic light warning system

Possible solution:

Build upon the result of , but now also make the button blink slowly in white color when the threshold exceeds a limit. This is to indicate that we need some user interaction to fix the situation.

Build upon the result of and turn the light off again when the hardware button is pressed. The button should stop blinking, too. Make sure that the LED only turns red again when the temperature falls below the threshold and exceeds it again afterwards. When the temperature stays > 30° C and the hardware button was already pressed, the LED should not turn red again.

Now, instead of turning red, make the LED light up in green (OK), yellow (WARNING), and red (CRITICAL) depending on the temperature. Find useful ranges for the thresholds and assign the colors accordingly. The human interaction from should only be prompted when the critical threshold is exceeded!

c)
d)
e)
Exercise 2.2 - Sensors | a) Read the temperature
Exercise 2.2 - Sensors | b) Read the temperature and humidity
Exercise 2.2 - Sensors | c) Temperature warnings with threshold
Exercise 2.2 - Sensors | d) Threshold requires human interaction
Exercise 2.2 - Sensors | e) Human interaction
Exercise 2.2 - Sensors | f) Traffic light warning system