loader

Activity No. 10: Project: an indoor measuring station: temperature / humidity / pressure (IoT sensors kit)

Use the NUCLEO-IKS01A3 sensors to create a measurement station that is activated when the user passes by.

In this activity, we will use the LED matrix, the Time of Flight module and the extension NUCLEO-IKS01A3. 

The following connection must be made: 
- Connect the NUCLEO-Shield to the card connectors. 
- Connect, using the Grove cable, the LED matrix to one of the ports named I2C available.
- Fix the NUCLEO-IKS01A3 module over it.
- Connect the L476RG board to the computer using the mini-USB cable.


measure-station-EN

Let's get to the programming now! 

We are going to design a mini weather station using the temperature, hygrometry and pressure sensors of the NUCLEO-IKS01A3. The RGB LED matrix will display the measured values ​​in the form of an icon. 

You will therefore use several blocks for this program: blocks of functions, and of conditions, etc. This activity uses the different sensor programs of the IOT Sensors / Connected measurement station kit. 

First, you'll create an animation when the board starts: 
On Startup 
- Show logo ! from Vittascience
- Wait 1 second
- Erase the matrix


Then you will have to create the following program, which will repeat indefinitely:
Repeat indefinitely 
- If (Distance sensor in cm) > 1 and (Distance sensor in cm) < 50 then
- Function (Thermometer)
- Wait 5 seconds
- Function (Hygrometer)
- Wait 5 seconds
- Function (Barometer)
- Wait 5 seconds
- Otherwise
- Erase the matrix



The different functions will call to the sensors of the NUCLEO-IKS01A3 module and display an icon on the LED matrix according to the defined value. 
For the thermometer, we will choose 3 ranges: below 20°C - between 20 and 30°C and over 30°C. These values ​​can be changed freely. 

The (Thermometer) function is: 
Set Thermometer
- if STTS751 Thermometer < 20 then
- Show on matrix: thermometer gauge (lowest level)
 otherwise if TSTTS751 thermometer > 20 and TSTTS751 thermometer < 30 then 
- Show on matrix: thermometer gauge (at middle level)
 else if TSTTS751 Thermometer > 30 then 
- Show on matrix: thermometer gauge (at highest level)

 


For the hygrometer, we will use the following setting: it is considered that the ambient air is too dry below 35% and too humid above 65%. 
The (Hygrometer) function is as follows: 
Set Hygrometer
- if HTS221 Hygrometer < 35 then
- Show on matrix: hygrometer gauge (lowest level)
 else if HTS221 Hygrometer > 35 and Hygrometer HTS221 < 65 then 
- Display on matrix: Hygrometer gauge (at middle level)
 else if HTS221 Hygrometer > 65 then 
- Display on matrix: Hygrometer gauge (at highest level) 


The barometer, allows to measure the atmospheric pressure and to indicate a tendency in the weather to come. At sea level, the reference atmospheric pressure is 1013 hPa. If the measured pressure is higher than this value, then we speak of an anticyclonic situation. The weather will be calm and pleasant. If, on the contrary, it drops below 1013 hPa, it is the sign of the arrival of a depression. The weather will be unstable with clouds and precipitation to come. 
For the barometer, we will use the symbols: sun - cloudy - rain to represent the weather with the following range of values: 
< 995 hPa: rain
between 995 - 1025 hPa: cloudy
> 1025 hPa: sun

You can know the pressure value of the place where your programmable card is located by consulting the following address: https://www.meteo60.fr/ or https://barometricpressure.app/. The pressure changes according to the altitude, you may need to modify your program. 

The function (Barometer) is as follows: 
Define Barometer
- if Barometer LPS22 < 995 then
- Show on matrix: rain
else if Barometer LPS22 > 995 and Barometer LPS22 < 1025 then 
- Show on matrix: cloud + sun
else if Barometer LPS22 > 1025 then 
- Display on the matrix: sun



Use the following interface to program the board. Now it's up to you: 



Once the program has been created, it must be copied onto the card. To do this, you must use the "Upload" button (see Activity 0: Getting started with the board)


Did you succeed? Perfect, you now know how to program the different sensors using your NUCLEO-L476RG board!
Discover the other activities of the IoT Sensors kit by clicking on the icons below.

programme-station-FR

رخصة الاستخدام