Tutorial: Weather Station with SHTC1 Using the Linux Kernel Driver

In this example, we show how to build a simple weather station using the Raspberry Pi 2 Model B and Sensirion's SHTC1 sensor.
1. Hardware Used in this Tutorial
- Raspberry Pi 2 Model B (available on element14)
- Atmel SHTC1 extension board (available on Mouser)
- Jumper wires (available on Mouser)
2. Hardware Assembly
Connect the pins of your sensor board to Raspberry Pi using the jumper wires as described in the schematic below.
Signal | Pin on Extention Board | Pin on Raspberry Pi |
---|---|---|
SDA | 11 | 3 |
SCL | 12 | 5 |
VDD | 20 | 1 |
GND | 19 | 6 |
3. Software Setup
Enable I2C on Your Raspberry Pi
$ sudo raspi-config # Select Advanced options, A7 I2C, and Enable I2C $ sudo reboot $ ls -l /sys/bus/i2c/devices # This should output: i2c-1
Check if SHTC1 is Wired Correctly (Optional)
$ sudo apt-get install i2c-tools $ i2cdetect -y 1 # should output # # 10: -- -- # # ... # # 60: -- -- # # 70: 70 -- --
Load the SHTC1 Driver
$ sudo modprobe shtc1 $ echo shtc1 0x70 | sudo tee /sys/bus/i2c/devices/i2c-1/new_device $ ls /sys/bus/i2c/devices/1-0070/ # The listing should include a 'hwmon' directory.
Read Temperature and Humidity Values
# The following commands read the most recent temperature and humidity values: $ cat /sys/bus/i2c/devices/1-0070/hwmon/hwmon1/temp1_input # ... $ cat /sys/bus/i2c/devices/1-0070/hwmon/hwmon1/humidity1_input # ...