/
Temperature & Humidity Sensors
Temperature & Humidity Sensors
The Temperature & Humidity sensors on the Pysense board are an excellent way to prototype applications. Because they are attached to a system board and enclosed in a case, they will not be very accurate. The humidity may be lower than it should be, and the temperature may be higher.
Although the sensors are not very accurate, they still work. In this lab you will combine readings from these sensors with ideas from other exercises. This example code shows you how to read the sensors.
# Temperature and humidity sensors (Si7006-A20) # https://www.silabs.com/documents/public/data-sheets/Si7006-A20.pdf # from pysense import Pysense from SI7006A20 import SI7006A20 import pycom import micropython import machine import time py = Pysense() tempHum = SI7006A20(py) while True: temperature = tempHum.temp() humidity = tempHum.humidity() print("Temperature: {} Degrees Humidity: {}".format(temperature, humidity)) time.sleep(1)
Exercise:
Write a program that will:
- read room temperature when started
- save the measurement with a time stamp
- display a blue light while the board remains near room temperature
- if the temperature drops 0.5 degrees below room temperature, log the measurement and change the LED to green
- if the temperature rises 0.5 degrees above room temperature, log the measurement and change the LED to red
Remember that when you want to use the LED in your application, you need to disable the system heartbeat.
, multiple selections available,
Related content
Reading Sensors with LoPy: Accelerometer
Reading Sensors with LoPy: Accelerometer
More like this
Detecting a Button Press
Detecting a Button Press
More like this
WS SANOG32 & BDNOG9 2-Day IoT Tutorial
WS SANOG32 & BDNOG9 2-Day IoT Tutorial
More like this
Hello World in Blinking Colour
Hello World in Blinking Colour
More like this
TTN + Cayenne Test Code
TTN + Cayenne Test Code
More like this
IoT Icebreaker
IoT Icebreaker
More like this