Introduction: Weather Monitoring Using Onion Omega and HIH7130

Picture of 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.

Step 1: Hardware Setup for Weather Monitoring

Picture of Hardware Setup for Weather Monitoring

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.

Step 2: Sensor Specification

Picture of 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

Picture of 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 update
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

Picture of Python Code for HIH7130

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

Step 5: Review

Picture of 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).

Comments

phennes (author)2017-10-05

hi.am having a lot of trouble using i2c via a raspberry pii with python2 Your code looks simple.Your code just shows reads of humidity and temp. Is the measurment request command not required as per link below!

https://sensing.honeywell.com/i2c-comms-humidicon-...

vcampos2017 (author)2017-04-22

Here is the file on GitHub:


OnionOmegaProjects/MiniWeather.py

vcampos2017 made it! (author)2017-04-21

Thanks for sharing your project!

Ordered more parts for it- OLED expansion screen from Onion and Dock to CE bridge from ControlEverything. Then, modified your code to use the OLED to display the temperature and humidity. Might add barometric sensor too, options are endless!

Thanks for

it looks great.. yes a barometric pressure sensor will be a great addition.

how about interfacing a thermocouple with it and monitoring grill temperature while cooking outside... i will see if i can build that..

Thanks, I will post the code online.

Anxious to see your new project with the thermocouple!

vcampos2017 made it! (author)2017-03-09

Thanks for the project. Took me a while longer as a newbie, but it's working. Now, just to figure running it every few minutes automatically.

this looks great... well done sir...

you can connect an onion omega relay shield with it and control relays based on temp humidity...

https://www.instructables.com/id/WebApp-Controlled-Relay-Using-Onion-Omega-2-1/

vcampos2017 (author)2017-03-05

Thanks for the project! Do you have a sample of it running? Would you expand it to monitor barometric pressure?

you can find the working python script over here

https://github.com/bhaskar-anil429/Onion-Omega-HIH...
and if you are looking for onion omega lib you can find them over here
https://github.com/ControlEverythingCommunity
you can also find biometric pressure lib over there..

Muzear (author)2016-12-15

It looks cool project, congratulations..

How much does it cost?

Where do you supply the components?

Is there video to explain how it works with power supply and digital display?

bhaskar.anil429 (author)Muzear2016-12-15

it usages the usb supply. hte usb is connected to onion omega usb pins. so this usb does two things 1. provides power 2. provides usb access to onion omega
its real easy to use. you can follow this instructable to make it work.
You can get parts from here.
https://www.controleverything.com/content/I2C-Master?sku=OOI2C
https://www.controleverything.com/content/Temperature?sku=HIH9130_I2CS
Thanks

DIY Hacks and How Tos (author)2016-05-14

Cool monitoring system