Introduction: Weather Monitoring Using Onion Omega and HIH7130
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.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Hardware Setup for Weather Monitoring
to make this project you will need these part.
1. Onion Omega
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.
Step 2: Sensor Specification
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.
Step 3: Onion Omega Setup
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 install python-light pyOnionI2C
after installing these commands run i2cdetect -y 0
you will see I2C address of HIH7130.
Step 4: Python Code for HIH7130
HIH7130 is an I2C communication based sensor, so writing code is really easy.
from OmegaExpansion import onionI2C
print 'Starting: onionI2C module testing...'
i2c = onionI2C.OnionI2C(0)
# set the verbosity
# 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 & 0x3F) * 256) + data) * 100.0) / 16383.0
temp = (((data & 0xFF) * 256) + (data & 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
Step 5: Review
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).