The OmnIoT SoftHub Platform turns your Raspberry Pi 2, 3, 4, or Zero/W device into a powerful IoT edge hub/gateway. It incorporates an object based rule engine as well as a pre-supported library of sensors so you can create typical IoT edge applications in minutes time and with no programming required. Recently the SoftHub's BLE beacon support has been enhanced and in this project we show a simple scenario where the SoftHub has been configured to capture and analyze advertisements from multiple EnOcean sensors. The EnOcean sensors used in our example are energy harvesting (batteryless). The EMSIB multi-sensor, which we use to detect proximity and light levels, gets its power from the ambient light. The EDRPB rocker switch derives power from the physical act of depressing the switch.
The scenario illustrated in the video below show's the following -
- We'll monitor all advertising packets from both sensors.
- As packets arrive from the EMSIB, we'll publish it's temperature, humidity, light, and proximity (reed) values to a cloud based ThingsBoard dashboard.
- When the EMSIB's proximity sensor detects a transition where a magnet has moved away (simulating a door or window opening) we'll turn on a lamp via one of the Raspberry Pi's GPIO's.
- When the magnet returns (simulating the door or window closing) we'll turn the lamp off.
- Further, when the door or window is open we'll allow the lamp to be controlled by the EDRPB. Each time the upper left rocker switch is depressed we'll toggle the GPIO controlling the connected lamp.
Configuring the SoftHub to perform the tasks show in the video took roughly 30 minutes from start to finish.
The pseudocode for the logic required to configure our example consists of the following -
*On SoftHub start -
- Turn the lamp GPIO off
- Create/initialize a flag keeping track of the lamp state
*On New Packet from the EMSIB multisensor -
- If transitioning to "open door", turn on GPIO, update lamp flag, publish lamp status
- If transitioning to "closed door", turn off GPIO, update lamp flag, publish lamp status
- Publish the packet data to the ThingsBoard Dashboard
*On New Packet from EDRPB rocker switch sensor -
- If upper left button press, toggle GPIO
- If light is on, publish "light on" event to ThingsBoard
- If light is off, publish "light off" event to Thingsboard
*On SoftHub exit -
- Turn off GPIO
So with the definition of 9 simple rules, and the objects required to support those rules, we were able to create and deploy our configuration file in about a half an hour. A link to a zip file containing the RuleFile and supporting files (for publishing data to the ThingsBoard dashboard) is below. There's also a link to the SoftHub's FAQ page and YouTube channel for lots more information and "how to" videos (our example only scratches the surface of the SoftHub's functionality). The SoftHub is completely free to download and use and the full installation package is available at the OmnIoT webpage. Lastly we've included a link to the SoftHub Hackster.io product page.
If you have any questions or need help with a project please let us know!
Comments
Please log in or sign up to comment.