loader

Activity No. 6: Measuring temperature (Starter kit Vittascience)

Using the temperature sensor with the NUCLEO-L476 board.

The Grove temperature sensor is a module that measures air temperature ambient over a range of -40°C to +125°C.

The operating principle is simple. This sensor consists of a thermistor, a small resistor, which lets the current flow more and more easily as the temperature increases. The information returned by the sensor is the temperature value in degrees Celsius.
zoom-temperature

To measure the temperature using the NUCLEO-L476RG card, the following connection must be made: 
- Connect the Shield Grove to the connectors on the card. 
- Connect, using the Grove cable, the screen to one of the ports named I2C available.
- Connect the temperature module using the Grove cable to one of the analog ports. We will choose port A1.

temperature-EN

Be careful to respect the direction of connection of the Grove cable (4 wires in 1 with polarizing slot).

Be careful to check the position of the 3V slider on the Grove shield to obtain good values.

Let's get to the programming now! 

We will use two blocks:
- " [LCD] display text ... on line 0 position 0 ", available in the Display of the block locker to manage the screen.
- "[T° sensor] temperature in °C on pin A1", available in the Sensors, to retrieve the value of the module.


therm-en
Use the following interface to program the module: 

To facilitate reading, you can insert a pause and clear the screen. 
clear-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. 

You must use the "create the text ... ... ... " block available in the Text of the block locker, 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 the word "Temperature:" on the first line of the screen
- display of a text consisting of the rounded temperature value + the symbol °C, on the second line of the screen
- a 1 second pause
- cleaning of the screen to facilitate reading

Launch the simulator to check the correct execution of your program or download it to the card. 


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

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