loading

Is it humid today ? It feels a bit humid to me.

Sometimes for us, high humidity proves to be really uncomfortable as well as unhealthy. For householders, it can cause potential damage as well. For a home, high humidity ruins wooden floors and furniture with encouraging mustiness growth around us. By good fortune, there are methods that allow you to monitor and control home humidity.

In this crusade we will be making a Hygrometer, a system used for measuring the moisture content in the atmosphere, using a Raspberry Pi and SI7021, Humidity and Temperature sensor. Our aim was to check the relative humidity and temperature in the apartment(ideal relative humidity is about 40-50%, ideal room temperature is approximately between 15 °C (59 °F) and 30 °C (86 °F) ) and one way is to use a hygrometer. We could, of course, have bought one, but having a Raspberry Pi and Humidity & Temperature sensor in hand, we thought we would make one (Why not!).

Step 1: Needy Imperative Gear

Without knowing exact parts, their value and where on earth to get them, it's really annoying. Don’t worry. We have that sorted that for you. Once you've got the parts all squared away, it should be a snap to do this project.

1. Raspberry Pi

The first step was obtaining a Raspberry Pi board. The Raspberry Pi is a single-board Linux based computer. This little PC packs a punch in computing power, used in electronics projects, and simple operations like spreadsheets, word processing, web browsing and e-mail, and games.

2. I²C Shield for Raspberry Pi

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

3. SI7021 Humidity and Temperature Sensor

The SI7021 I²C Humidity and 2-Zone Temperature Sensor is a monolithic CMOS IC integrating humidity and temperature sensor elements, an analog-to-digital converter, signal processing, calibration data, and an I²C Interface. We purchased this sensor from ControlEverything.com.

4. I²C Connecting Cable

We had the I²C connecting cable available at ControlEverything.com.

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 Adapter

Do you ever look at your life and think, What has the internet done to me ?

The classic way to get your Raspberry Pi connected is to use an Ethernet cable and plug it into your network router. Alternatively, WiFi connection can be made via plugging in a WiFi dongle and left-click the network icon to bring up a list of available WiFi networks.

7. HDMI Cable/ Remote Access

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

I hate math, but I love counting money.

Step 2: Making Hardware Connections

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

In our case, we revised some basics of electronics just to refurbish the memory for hardware and software. We wanted to draw up a simple electronics schematic for this project. Electronic schematics are like a blueprint for electronics. Draw up a blueprint and follow the design carefully.

Raspberry Pi and I²C Shield Connection

First of all take the Raspberry Pi and place the I²C Shield on it. Press the Shield gently onto the GPIO pins. Do what is right, not what is easy(See the pic above).

Sensor and Raspberry Pi Connection

Take the sensor and Connect the I²C Cable with it. For proper operation of this cable, please remember I²C Output ALWAYS connects to the I²C Input. The same had to be followed for the Raspberry Pi with the I²C shield mounted over it.

The big advantage of using the I²C Shield/Adapter and the connecting cables is that we have no more wiring-fixing issues that can cause frustration and time consumption to fix, especially when you are not sure where to begin troubleshooting. Just the simple process that we have mentioned. It's plug and play option.

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

Internet Connection is important

To make our project a success, we need an internet access for our Raspberry Pi. You have two choices here. Either You can connect the Raspberry Pi to the network using an Ethernet cable or use a USB to WiFi Adapter for WIFI Connectivity. Either way, as long as it is connected to the internet you're covered.

Powering of the Circuit

Plug in the Micro USB cable into the power jack of Raspberry Pi. Power it on and we are off to the road.

Our generation is better prepared for a Zombie apocalypse than an hour without electricity !

Connection to Monitor

We can either have the HDMI cable connected to a new monitor/TV or we can remotely connect Raspberry Pi using remote access tools like-SSH/PuTTY which is cost effective. It’s a bit of creative approach if you find the use the surrounding resources.

Step 3: Programming Raspberry Pi in Python

You can view the Python code for Raspberry Pi and SI7021 in our Githubrepository.

Before going on to the program, make sure you gave a look for the instructions given in the Readme file and Setup your Raspberry Pi according to it.

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. Moisture also refers to the amount of water vapor present in the air.

Below is the python code and you can clone it and can make improvisation if needed.

# Distributed with a free-will license.
# Use it any way you want, profit or free, provided it fits in the licenses of its associated works. # SI7021 # This code is designed to work with the SI7021_I2CS I2C Mini Module available from ControlEverything.com. # https://www.controleverything.com/content/Humidity?sku=SI7021_I2CS#tabs-0-product_tabset-2

import smbus import time

# Get I2C bus bus = smbus.SMBus(1)

# SI7021 address, 0x40(64) # 0xF5(245) Select Relative Humidity NO HOLD master mode bus.write_byte(0x40, 0xF5)

time.sleep(0.3)

# SI7021 address, 0x40(64) # Read data back, 2 bytes, Humidity MSB first data0 = bus.read_byte(0x40) data1 = bus.read_byte(0x40)

# Convert the data humidity = ((data0 * 256 + data1) * 125 / 65536.0) - 6

time.sleep(0.3)

# SI7021 address, 0x40(64) # 0xF3(243) Select temperature NO HOLD master mode bus.write_byte(0x40, 0xF3)

time.sleep(0.3)

# SI7021 address, 0x40(64) # Read data back, 2 bytes, Temperature MSB first data0 = bus.read_byte(0x40) data1 = bus.read_byte(0x40)

# Convert the data cTemp = ((data0 * 256 + data1) * 175.72 / 65536.0) - 46.85 fTemp = cTemp * 1.8 + 32

# 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

Step 4: Working 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 Monitor. After few moments, it will display all the variables. Start out with a few thoughts or themes and see what you can come up with.

Step 5: Applications and Features

The SI7021 offers an accurate, low-power, factory-calibrated digital solution ideal for measuring humidity, dew point, and temperature, in applications like HVAC/R, Thermostats/Humidistats, Respiratory Therapy, White Goods, Indoor Weather Stations, Micro-Environments/Data Centres, Automotive Climate Control and Defogging, Asset and Goods Tracing and Mobile Phone and Tablets.

For e.g. You can improve this project into an HVAC Indicator for Indoor and Vehicular Environmental Comfort. It maintains the thermal environment determining temperature control, oxygen replenishment, and removal of moisture, odors, smoke, heat, dust, airborne bacteria, carbon dioxide, and other gasses. Apart from Humidity and Temperature sensors, you can assist this project with sensors ranging from pressure, Air Quality, Smoke Detector to Light & Proximity sensors. You can make improvements in the code according to the desired hardware applied and then you can have your own setup for making yourself thermally comfort. This project is great for kids, and you want to show them some awesome stuff, you know learning while playing. A small project like this can be more pretty awesome for kids.

Step 6: Conclusion

If you've been wondering to look into the world of the Raspberry Pi, then you can amaze yourself by making used of the electronics basics, coding, designing, soldering and what not. In this process, there might be some projects that may be easy, while some may test you, challenge you. But you can make a way and perfect it by modifying and making a creation of yours. For your assistance, we have an amazing video tutorial on YouTube which might help in your exploration and for further explanation of every aspect of the project. We hope you find this amazing and helpful. Please reply us for any amendments.

I’m sorry. I don’t take orders. I barely take suggestions.

About This Instructable

1,469views

9favorites

More by Dcube Tech Ventures:Home Automation with Raspberry Pi using Relay board Motion Control with Raspberry Pi and LIS3DHTR, 3-Axis Accelerometer, using Python 3-Axis Accelerometer, ADXL345 with Raspberry Pi using Python 
Add instructable to: