Onion Omega 2 is the fresh name in the list designed specifically for building connected hardware applications. Omega 2 combines the tiny form factor and power efficiency of the Arduino, with the power and flexibilities of Raspberry Pi. It comes with features like Wi-Fi, Bluetooth, Cellular connectivity, and Cloud-Integrated. Furthermore, it supports languages like Python, PhP, C++, Ruby. Most noteworthy, it is simple and affordable at the price of $5.
At DCUBE Store, we are providing a range of accessories for Omega2 which makes it even more simple to use. Today, I will be monitoring humidity and temperature with the help of Omega2 and SI7015 I2C Sensor.
Step 1: Hardware Required
- Onion Omega2
- SI7015 Humidity and Temperature I2C Sensor
- I2C Adapter for Onion Omega
- I2C Connecting Cable
- Mini USB Cable
Step 2: Hardware Connections
In general, making connections are the simplest part of this project. Follow the instructions and images, and you should have no problems.
1. Connection of Onion Omega and I2C Adapter
First of all, take the Omega2 and place it on the I2C Adapter/Shield (with Inward Facing I2C Port). Press the Omega2 gently into the I2C Adapter and we are done with this step (See picture below).
2. Connection of the Sensor and Onion Omega2
Take an I2C Cable and connect it to the Input port of the Sensor. For proper operation of this cable, please remember I2C Output ALWAYS connects to the I²C Input. Now, connect the other end of the same I2C Cable to the I2C Adapter with Onion Omega2 mounted over it.
Note: The brown wire should always follow the Ground (GND) connection between the output of one device and the input of another device.
3. Powering of the Circuit
Plug in the Mini USB cable into the power jack of Onion Omega2. Plug it in and voila, we are good to go!
Step 3: Code
The code for the SI7015 Humidity and Temperature Sensor is available on our GitHub repository.
Before going on to the code, make sure you read the instructions given in the Readme file and setup your Onion Omega2 accordingly. It will take just 5 minutes to set up the Onion.
For your convenience, you can also copy the working Onion Omega code for this sensor from here:
from OmegaExpansion import onionI2C import time # Get I2C bus i2c = onionI2C.OnionI2C() # SI7015 address, 0x40(64) # Select Configuration register, 0x03(03) # 0x11(17) Temperature, Fast mode enable, Heater Off i2c.writeByte(0x40, 0x03, 0x11) time.sleep(0.5) # SI7015 address, 0x40(64) # Read data back from 0x00(00), 3 bytes # Status register, ctemp MSB, ctemp LSB # Checking the status, Poll RDY in status until it is low(=0) data = i2c.readBytes(0x40, 0x00, 1) while (data & 0x01) != 0 : data = i2c.readBytes(0x40, 0x00, 1) data1 = i2c.readBytes(0x40, 0x01, 1) data2 = i2c.readBytes(0x40, 0x02, 1) # Convert the data to 14-bits ctemp = ((data1 * 256 + data2) / 4.0) / 32.0 - 50.0 ftemp = ctemp * 1.8 + 32 # SI7015 address, 0x40(64) # Select Configuration register, 0x03(03) # 0x01(01) Relative Humidity, Fast mode enable, Heater Off i2c.writeByte(0x40, 0x03, 0x01) time.sleep(0.5) # SI7015 address, 0x40(64) # Read data back from 0x00(00), 3 bytes # Status register, humidity MSB, humidity LSB # Checking the status, Poll RDY in status until it is low(=0) data = i2c.readBytes(0x40, 0x00, 1) while (data & 0x01) != 0 : data = i2c.readBytes(0x40, 0x00, 1) data1 = i2c.readBytes(0x40, 0x01, 1) data2 = i2c.readBytes(0x40, 0x02, 1) # Convert the data to 12-bits humidity = ((data1 * 256 + data2) / 16.0) / 16.0 - 24.0 # Output data to screen print "Relative Humidity : %.2f %%" %humidity print "Temperature in Celsius : %.2f C" %ctemp print "Temperature in Fahrenheit : %.2f F" %ftemp
Step 4: Working of the Code
Download (git pull) or copy the code in the Onion Omega Editor and save it.
Now, open the Terminal App in the Onion Omega Console. Type the command for running python codes in the Terminal. You will see the readings of humidity and temperature on your screen.
Step 5: Conclusion
The SI7015 humidity and temperature sensor series take sensor technology to an another new level with unmatched sensor performance, the range of variants, and new features. Hence, we can use it in medical industries, for a moment just say to control a ventilation in a patient room when humidity and temperature increases automatically. The medical staff can monitor the data online without going in the room.
As a result, it suitable for a wide variety of markets, such as home appliances, medical, IoT, HVAC, or industrial. With the help of Onion Omega, we can increase its capacity to a greater length. We can control our appliances and monitor their performance from our laptops and mobile devices.