Version 1.0.0 Released 2014-08-24
After the success of my previous MikroElektronika GPS Click, and Thumbstick Click board blog posts, I thought I'd write up a tutorial on reading temperature and humidity with a MikroE SHT1x Click board and a Raspberry Pi. This blog post includes a python script that reads the SHT1x Click board data using I2C and displays the temperature, humidity, and dew point results from the sensor.
The SHT1X Click board is connected to a Raspberry Pi using the MikroE Pi Click Shield. This shield connects to the Raspberry PI GPIO header pins and lets you attach MikroBus format Click boards.
If you don't have a Pi Click Shield or a SHT1x Click board, you can get one from the MikroElektronika Webstore, or from Digikey, or Farnell.
The SHT1x Click board uses an I2C based Sensiron SHT11 module for reading the temperature and humidity. The temperature sensor measures a range of -40°C to +100°C in half degree increments. The board is powered on 3.3 Volts from the GPIO header on the Raspberry PI.
For more details on the sensor, take a look at the included SHT1x PDF datasheet.
The SHT1X board connects to the Raspberry Pi using the following connections:
You can download the latest release of the ACH-SHT1x-Click-RPi-Demo.zip example from the Libstock site:
http://www.libstock.com/projects/view/1084/ach-sht1x-click-rpi-demo
Scripts that use the GPIO and I2C hardware interfaces need to be run with sudo since GPIO reading requires admin privileges on Linux.
That means you need to run the sht1x_click.py demo python script using:
sudo python sht1x_click.py
Step 1. Download the Library
cd ~/
wget https://pypi.python.org/packages/source/r/rpiSht1x/rpiSht1x-1.2.tar.gz
Step 2. Expand the file in the Raspbian File Manager using the right click "Expand Here" contextual menu item.
Step 3. Install the rpiSht1x library using:
cd rpiSht1x-1.2
sudo python setup.py install
Step 4. To verify the library is installed correctly check if the SHT1x module is listed in the python interactive help section:
python
>>> help('sht1x')
To quit the python interactive session type:
>>> exit()
Step 5. Now, let's run the sht1x_click.py script from the terminal:
sudo python sht1x_click.py
If the script runs correctly you will be presented with the following output in the terminal:
You can quit the python script by pressing the Control+D hotkey.
Email: andrew@andrewhazelden.com
Blog: http://www.andrewhazelden.com
Twitter: https://www.twitter.com/andrewhazelden
Based upon the code and library from the pypi.python.org website:
https://pypi.python.org/pypi/rpiSht1x/1.2
rpiSht1x Created by Luca Nobili (lunobili):
https://bitbucket.org/lunobili/rpisht1x