loader

Activity No. 2: Measure the humidity and display the value in the serial console (IoT sensors kit)

Using the NUCLEO-IKS01A3 humidity sensor

 The humidity sensor of the NUCLEO-IKS01A3 is a module that measures the humidity of the ambient air over a range of 0 to 100%.
At 0% the air is dry, at 100% the humidity (water in suspension condenses) forms droplets, it is fog. 

The operating principle is simple. This MEMS (micro-electro-mechanical systems) sensor is made of a polymer capable of detecting variations in humidity. The information returned by the sensor is the percentage value.

IKS-humidite-EN

To measure the humidity using the NUCLEO-L476RG card, the following connection must be made: 
- Connect the NUCLEO-IKS01A3 to the connectors on the card. 
- Connect the L476RG board to the computer using the mini-usb cable

IKS+L476-FR

Let's move on to programming now! 

We are going to use two blocks:
- "write in the console", available in the Communication of the block locker to manage the display.
- "[HTS221 hygrometer] relative humidity", available in the Sensors, to retrieve the value of the module.
hygrometer-en


Use the following interface to program the module: 


The humidity will be displayed in the console, at the bottom of the interface.

iot-console-hydro-FR


To facilitate reading, a pause of 1 second can be inserted.
 wait-en


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

We are now going to create a text, to make it easier for the user to read, in particular by adding the symbol %

You must use the block "create the text ... ... ... " available in the Text part of the block locker, by combining it with the block ("...") which allows you to write. 

text-en

Here is an example of ready-to-use code:


This code includes:
- the display of a text consisting of the humidity value + the acronym %, in the console
- a 1 second pause to facilitate reading

Download the program to the card and launch the console to view the air humidity. 


You succeeded ? Perfect, you now know how to program the temperature sensor using your NUCLEO-L476RG board! 
Discover the other activities of the IoT Sensors kit by clicking on the icons below.

Licencia de uso

Licence Creative Commons

Este recurso está disponible bajo los términos de la licencia Creative Commons Attribution-Share Alike 2.0 France License.