Weather Monitoring Using Onion Omega and HIH7130

by Anil Bhaskar in Circuits > Electronics

2877 Views, 7 Favorites, 0 Comments

Weather Monitoring Using Onion Omega and HIH7130

IMG_5114.JPG
IMG_5122.JPG

Few days back we received Onion Omega. Its a wonderful small computer, it has ethernet, wifi, uart , I2C and lot of GPIO. it supports all the major languages so you can use your existing codes in it with a little modification. Since last few years i have been using Pi, Arduino and beaglebone but this small computer is just wonderful, its 1/4 in size in comparison to pi and almost equal to arduino nano.

Onion omega also supports cloud, so all your devices can be controlled and monitored from anywhere in the world.

Hardware Setup for Weather Monitoring

IMG_5120.JPG
IMG_5123.JPG
IMG_5121.JPG

to make this project you will need these part.

1. Onion Omega

2. HIH7130

3. Connecting cables

4. I2C adapter

connecting the hardware is really simple, all you will need to do is plug your Onion omega into the I2C adapter and connect with a HIH7130 mini module. If you are not comfortable with soldring the wires then getting an adapter is the best solution.

Why I2C adapter:: lot of time people connect wrong wires and they kill there sensor as well as there onion omega. so with I2C adapter you can save your sensor as well as your onion omega.

Why Mini module:: wiring could be a long and difficult process, it takes lot of time but using mini module you can connect your sensor with onion omega in 5sec and you can start writing your own application.

Sensor Specification

IMG_5124.JPG
IMG_5119.JPG

we are using HIH7130 sensor for measuring the humidity and temp. Honeywell HumidIcon Digital Humidity/Temperature Sensors are digital output-type relative humidity and temperature sensors combined in the same package. These sensors provide an accuracy level of ±3%RH. With industry-leading long-term stability, true temperature-compensated digital I2C, Industry-leading reliability, Energy efficiency and Ultra-small package size and options. Other accuracies which are available: ±1.7 %RH (HIH9000 Series), ±2.0 %RH (HIH8000 Series), ±3.0 %RH (HIH7000 Series), and ±4.0 %RH (HIH6100 Series).

Why I2C :: I2C protocol is so easy to use and we can chain lot of different different devices with it as long as address don't conflict with each other.

Onion Omega Setup

Screen Shot 2016-05-13 at 10.13.33 PM.png
Screen Shot 2016-05-13 at 10.18.56 PM.png

Onion omega is so easy to setup. if you are new to onion omega you can follow this guide. Getting started with onion omega

make sure you install python I2C lib in you onion omega using these commands

opkg update
opkg install python-light pyOnionI2C

after installing these commands run i2cdetect -y 0

you will see I2C address of HIH7130.

Python Code for HIH7130

Screen Shot 2016-05-13 at 10.14.20 PM.png
Screen Shot 2016-05-13 at 10.16.02 PM.png

HIH7130 is an I2C communication based sensor, so writing code is really easy.

HIH7130 Python code

#https://www.controleverything.com/content/Humidity

from OmegaExpansion import onionI2C

import time

import sys

print 'Starting: onionI2C module testing...'

i2c = onionI2C.OnionI2C(0)

# set the verbosity

i2c.setVerbosity(1)

# HIH7130 address, 0x27(39)

# Read data back from 0x00(00), 4 bytes

# humidity MSB, humidity LSB, temp MSB, temp LSB

data = i2c.readBytes(0x27, 0x00, 4) # Convert the data to 14-bits

humidity = ((((data[0] & 0x3F) * 256) + data[1]) * 100.0) / 16383.0

temp = (((data[2] & 0xFF) * 256) + (data[3] & 0xFC)) / 4

cTemp = (temp / 16384.0) * 165.0 - 40.0

fTemp = cTemp * 1.8 + 32 # Output data to screen

print "Relative Humidity : %.2f %%" %humidity

print "Temperature in Celsius : %.2f C" %cTemp

print "Temperature in Fahrenheit : %.2f F" %fTemp

Review

IMG_5125.JPG
IMG_5126.JPG

The code is pretty simple, still if you have any doubts please let me know.

Onion omega is a great computer, its really easy to use. Just in few minutes you can make your own IOT project(make sure you remove white protective layer off the sensor for accurate results).