Introduction: Humidity and Temperature Observer Using Raspberry Pi With SHT25 in Python

About: We are a group of makers. We work in IoT, IOS app, android app, embedded design, sensor design, raspberry pi, arduino, beaglebone, particle electron, particle photon, Bluetooth.

Being an enthusiast for Raspberry Pi, we thought of some more spectacular experiments with it.

In this campaign, we will be making a Humidity and Temperature Observer that measures Relative Humidity and Temperature usingRaspberry Pi and SHT25, Humidity and Temperature sensor. So let's have a look at this journey to create a homemade Humidity and Temperature Observer to achieve the perfect environment at home. The Humidity and Temperature Observer is a pretty quick project to build. What you have to do is collect the components, assemble and follow the instructions. Then in no time you can enjoy it being the owner of this setup. Come on, Cheer Up, Let’s get Started.

Step 1: Imperative Apparatus We Need

The problems were less for us since we’ve got a lot of stuff lying around to work from. However, we know how it's difficult for other to gather the right part in right time from the right place for a worth of a penny. So we would assist you in all areas. Read the following to get a complete parts list.

1. Raspberry Pi

The first step was obtaining a Raspberry Pi board. The Raspberry Pi is a single-board Linux-based computer that many hobbyists have used in their projects. The Raspberry Pi is herculean in computing power, fertilising the imaginations of the public in spite of its small size. Thus, it is used in hot trends like Internet of Things(IoT), Smart Cities, School Education and other forms of useful gadgetry.

2. I2C Shield for Raspberry Pi

In our opinion, the only thing the Raspberry Pi 2 and Pi 3 are truly lacking was an I²C port. No worries. The INPI2(I2C adapter) provides the Raspberry Pi 2/3 an I²C port for use with multiple I2C devices. It's available on Dcube Store.

3. SHT25 Humidity and Temperature Sensor

The SHT25 high-accuracy humidity and a temperature sensor provide calibrated, linearized sensor signals in digital, I²C format. We purchased this sensor from Dcube Store.

4. I2C Connecting Cable

We used the I²C connection cable available at Dcube Store.

5. Micro USB cable

The least complicated, but most stringent in terms of power requirement is the Raspberry Pi! The easiest way to power the Raspberry Pi is via the Micro USB cable.

6 . Ethernet(LAN) Cable/ USB WiFi Dongle

The internet is becoming the town square for the global village of tomorrow. Get your Raspberry Pi connected with an Ethernet(LAN) cable and plug it into your network router. Alternative, look for a WiFi adapter and use one of the USB ports to access the wireless network. It's a smart choice, easy, small and cheap !

7. HDMI Cable/Remote Access

With HDMI cable on board, you can hook it up to a digital TV or to a Monitor. Want to save money! Raspberry Pi can be remotely accessed using different methods like-SSH and Access over the Internet. You can use the PuTTY open-source software.

Money often costs too much.

Step 2: Making Hardware Connections

In general, the Circuit is pretty straight forward. Make the circuit as per the schematic shown. Following the above image, the layout is relatively simple, and you should have no problems.

In our forethought, we had gone through the basic of electronics just to refurbish the memory for hardware and software. We wanted to draw up a simple electronics schematic for this project. In electronics, schematics are like foundation. Circuit design requires a structural foundation built to last. When you have your electronic schematics for what you want to build, the rest is all about just following the design.

Raspberry Pi and I2C Shield Bonding

Take the Raspberry Pi and place the I²C Shield on it. Press the Shield gently onto the GPIO pins. When you know what you're doing, it's a piece of cake(see the pic).

Sensor and Raspberry Pi Bonding

Take the sensor and Connect the I²C cable with it. Make sure that I²C Output ALWAYS connects to the I²C Input. The same to be followed by the Raspberry Pi with the I²C shield mounted over it.
Using the I²C shield and cable is a simple plug and play alternative to the often confusing and error prone direct solder method. Without it you would need to read diagrams and pinouts, solder to the board, and if you wanted to change up your application by adding or changing out boards you'd need to remove all this and start again. This makes troubleshooting less complicated(You’ve heard of plug-and-play. This is a plug , unplug and play. It’s so simple to use, it’s unbelievable).

Note : The brown wire should always follow the Ground (GND) connection between the output of one device and the input of another device.

Networking, USB, and Wireless is important

One of the first things that you will want to do is to get your Raspberry Pi connected up to the Internet. You have two options: connecting using an Ethernet (LAN) cable or an alternative but impressive way to use a WiFi adapter.

Powering of the Circuit

Plug in the Micro USB cable into the power jack of Raspberry Pi. Light it up and voila, we are good to go!

Connection to Screen

We can either have the HDMI cable connected to a monitor/TV or we can we be a little bit creative to make a headless Pi which is cost effective using remote access methods like-SSH/PuTTY.
Remember, college is the only time in which being poor and drunk is acceptable.

Step 3: Python Programming Raspberry Pi

The Python code for the Raspberry Pi and SHT25 Sensor is in our Github repository.

Before going on to the program, make sure you read the instructions given in the Readme file and Setup your Raspberry Pi accordingly.
Moisture refers to the presence of a liquid, especially water, often in trace amounts. Small amounts of water may be found, for example, in the air (humidity), in foods, and in various commercial products.

Below is the python code. You can clone and edit the code in any way you prefer.

<p># Distributed with a free-will license.<br># Use it any way you want, profit or free, provided it fits in the licenses of its associated works.
# SHT25
# This code is designed to work with the SHT25_I2CS I2C Mini Module available from
#</p><p>import smbus
import time</p><p># Get I2C bus
bus = smbus.SMBus(1)</p><p># SHT25 address, 0x40(64)
# Send temperature measurement command
#		0xF3(243)	NO HOLD master
bus.write_byte(0x40, 0xF3)</p><p>time.sleep(0.5)</p><p># SHT25 address, 0x40(64)
# Read data back, 2 bytes
# Temp MSB, Temp LSB
data0 = bus.read_byte(0x40)
data1 = bus.read_byte(0x40)</p><p># Convert the data
temp = data0 * 256 + data1
cTemp= -46.85 + ((temp * 175.72) / 65536.0)
fTemp = cTemp * 1.8 + 32</p><p># SHT25 address, 0x40(64)
# Send humidity measurement command
#		0xF5(245)	NO HOLD master
bus.write_byte(0x40, 0xF5)</p><p>time.sleep(0.5)</p><p># SHT25 address, 0x40(64)
# Read data back, 2 bytes
# Humidity MSB, Humidity LSB
data0 = bus.read_byte(0x40)
data1 = bus.read_byte(0x40)</p><p># Convert the data
humidity = data0 * 256 + data1
humidity = -6 + ((humidity * 125.0) / 65536.0)</p><p># Output data to screen
print "Relative Humidity is : %.2f %%" %humidity
print "Temperature in Celsius is : %.2f C" %cTemp
print "Temperature in Fahrenheit is : %.2f F" %fTemp</p>

Step 4: Performance Mode

Now, download (or git pull) the code and open it in the Raspberry Pi.

Run the commands to Compile and Upload the code on the terminal and see the output on the Display. After few moments, it will display all the parameters. After making sure that everything works as flat as a pancake, you can improvise and move further with the project into more interesting ones.

Step 5: Applications and Features

The new SHT25 humidity and temperature sensor takes sensor technology to a new level with unmatched sensor performance, a range of variants, and new features. Suitable for a wide variety of markets, such as Home Appliances, Medical, IoT, HVAC, or Industrial. Also, available in automotive grade.

For e.g. Keep calm and go to Sauna !

Love Sauna ! Saunas have been a fascination of many. An enclosed area — usually wooden, heated in order to produce body heating of the person inside it. It's a known that body heating has high beneficial effects. In this campaign, we will be making a Sauna Jacuzzi Observer that measures Relative Humidity and Temperature using Raspberry Pi and SHT25. You can create a homemade Sauna Jacuzzi Observer to achieve the perfect environment for a mesmerizing Sauna bath every time.

Step 6: Conclusion

Hope this project inspires further experimentation. In the Raspberry Pi realm, you can wonder about the never ending prospects of Raspberry Pi, its effortless power, its uses and how can you mend your interests in electronics, programming, designing, etc. The ideas are a lot. Sometimes the outcome takes to you a new low but doesn't give up. There may be another way around or a new idea might evolve from the failure(Even might form a win). You can challenge yourself by making a new creation and perfecting every bit of it. For your convenience, we have an interesting video tutorial on Youtube which might lend a hand to your exploration and if you want further explanation of every aspect of the project.

Keep dreaming and Keep your dreams alive & Hit the Snooze Button!