Tutorial: Simple Weather Station using Arduino
Hardware Used in This Tutorial
In this example, we show how to build a simple weather station using the Arduino Uno board and Sensirion's SHTC1 sensor.
- Arduino Uno
- Atmel SHTC1 extension board
- Jumper wires
|Signal||Pin on Sensor Extension Board||Pin on Arduino|
The first step is to install the "Arduino IDE", a program that runs on your computer, which is used to develop code and download firmware to the Arduino board. To do so, please follow the instructions on the Arduino webpage here.
Once you have the Arduino IDE installed, it's time to set it up for your board.
Arduino Software Setup
Before we can install the Sensirion software, we have to prepare the Arduino IDE for the Arduino board. To do so, first connect the Arduino to your computer using an USB cable. Then, start the Arduino IDE. Afterwards, select the "Tools" menu, and select "Arduino/Genuino Uno" from the "Boards" submenu:
This defines for which board the code is compiled.
Next, we have to tell Arduino IDE to which port the Arduino is connected. This can also be done in the "Tools" menu, where you have to select the corresponding port from the "Port" submenu. Note that this can look differently than the screen shot, depending on the operating system you're using and the USB port it is plugged in:
Download Sensirion's SHT Sensor Library for Arduino
The next step is to get the software library that supports Sensirion's humidity and temperature sensors. To install the current version, download the archive using this link and import the .ZIP archive by running "Sketch > Include Library > Add .ZIP Library".
Load the Humidity and Temperature Example
The Sensirion library comes with two examples, one for the I2C sensors, and one for the analog SHT3x chips. Since we're using the SHTC1 board in this example, we'll use the I2C example, which is called 'sht-autodetect'. To open the example program, select "File > Examples > arduino-sht-1.0.0 > sht-autodetect".
Build and Upload the Firmware
To compile the firmware, we use the "Verify" button shown below:
Afterwards, we can use the "Upload" button to upload the code to Arduino:
This will upload the code, and reboot the Arduino. After the reboot, the Arduino will start communicating with the sensor board.
Display Temperature and Humidity Values
In order to see the values read from the sensor board, open the "Serial Monitor" from the "Tools" menu. This will show a new window, which displays values for "RH" (relative humidity) and "T" (temperature). Try holding the sensor board over a cup of coffee to see if the values raise.