Lights Out! is a project that leverages the SmartEdge Agile's visible light sensor and the Brainium platform to alert you when lights have been turned off or on in a room. This can be a great solution for either immediate confirmation when lights are turned off or a backup confirmation in case your current smart bulb situation has an issue. Anyways, let's dive into Brainium and the SmartEdge Agile!
What Is Brainium?Before diving into the project it is probably worth understanding what is the Brainium platform and why it's a cool and awesome solution (and easy to use!) for IoT projects. So here's a quick overview of what even it Brainium:
Brainium is a hardware-plus-software combo for IoT, ready to use from prototyping to industrialization. With Brainium, there are 3 layers of software from edge to Cloud (device, gateway, server), you can benefit from both Meta Sensing and AI capabilities.
Meta-sensing features
- Real-time visualization of Agile data (acceleration / air humidity/ angular velocity / atmospheric pressure / infrared lightness / magnetic field / proximity distance / sound level / temperature / visible lightness / world acceleration)
- Real time visualisation of Agile state (battery state, alerts from rules configured, pattern detection)
- Data export of recorded data session in csv
AI features
- Train your motion or your vibration model
- Visualize your training sets
- Generate models
- Push a model to the edge for its immediate execution
Basically, the Braiunium platform aims to be a one stop shop for developing IoT projects that want to leverage AI and data to enhance their solutions. All with little to no coding too! The Braiunium Portal provides a UI to facilitate its usage. You can check out more here.
What Is SmartEdge Agile?So speaking briefly about Brainium, it would be worth covering the hardware that will be used in this project, and that is the SmartEdge Agile! More detailed info can be found here for anything about the device I don't cover within this project.
The SmartEdge Agile is a certified hardware solution, embedded with a full software stack featuring Edge Intelligence with a hardware and software combo that provides AI and security at the Edge. It comes packing a wide array of sensors and features such as:
- Accelerometer + gyroscope
- Magnetometer
- Pressure sensor
- Temperature & humidity
- Proximity/ambient light sensor
- Microphone
The light sensor will be the focus for the project but I will highlight other sensors as we progress through. It can also connect over Bluetooth (BLE 5.0) and built for Braiunium!
Awesome, so with the introductions out of the way let's dive into the project and start setting things up!
Brainium SetupFirst things first, you should go make sure you have a Braiunium account created and ready to go, head here if you haven't. If you would like to go off on your own for the setup feel free to check out the Braiunium Doc and meet back in the Create Project section of this project, otherwise I will be covering the setup process here as well.
Once you have your account created, you should be able to login into the Brainium Portal.
Next we will setup the Brainium Gateway. This layer will allow us to connect the SmartEdge Agile to the Brainium Platform and further add it to a Brainium project later on, among other things.
For this project I will be using an Android device for setting up my gateway, feel free to download the app from the Google Play Store, if you are using an iOS device check out the app here. Instructions should be very similar, so feel free to continue along!
Alright, once the app is installed go ahead and open the app and login using the Brainium account you have just created.
After you've logged in your gateway should be created and hopefully you see something like the screenshot below:
You should be able to login to the Portal and verify that the gateway is there and connected. (I renamed my gateway to Test Gateway, by default the name will match the ID, feel free to change if you'd like.)
We have Brainium Portal and the Gateway both ready to go and all that's left is to get the SmartEdge Agile connected and setup.
Make sure you have the gateway app open on your mobile device and it is connected to Brainium (Connected status).
Turn on the Agile device and make sure that it is ready for pairing. Hold down the power button until the blue light starts blinking.
Now head on over to the Brainium Portal and under the Devices tab, click the plus button to add a new device.
You should see a pop over with a gateway dropdown.
Select your gateway (same name that shows on your mobile device). Once the gateway is selected Brainium will start the discovery process, this should take a few seconds to a minute. When a device is discovered it will appear underneath.
Select your device and click on Connect. You should see the pairing process start, this part can also take about a minute, once pairing is complete you should see the following screen:
Back under the Devices tab in the portal you should now see your newly linked device!
And if you check back on the mobile app you should see it also added.
Now we have a device setup in Brainium which means we can now create a project and use it!
Go ahead and navigate to the Projects section (click on the Projects tab on the top or the Projects button on the side nav).
Click on Create Project and for the Project Name enter "Lights Out!" or any name you want :) and click Finish.
You should now see a new project created.
Go ahead and click on the project and you should see a new view for your project. (It is probably going to look pretty empty too but we'll fix that next)
Click on the plus button at the bottom right and let's add the Agile device we linked earlier to the project.
Select the correct device and then click Add to the Project. You should see the device now populate your project view like so:
And you might immediately notice the group of icons on the right, these are the different sensors and capabilities of your Agile device. To the left of that you'll notice AI Rules and then Smart Rules.
Setup a WidgetAlright we've come a long way so far and we have a project with a device linked up. Now we're ready to start doing things with it, collecting data and setting up all kinds of neat rules and AI features.
So first lets go ahead and see how we can go about to easily collect data (which can be used later on for coming up with Smart & AI rules later on).
Brainium provides a ton of capabilities out of the box and with no coding required. A major feature of that is a widget, Brainium offers all kinds of widgets for collecting and tracking all kinds of data from all the sensors on the device. For this project we will deal with the light sensor, but feel free to explore the same for other sensors.
From the Devices tab in your project view, click on the Data Tracking / Recording tab.
Click on Create Widget to get started here. You should see a pop over and you'll notice some options available. For this project we will setup a tracking widget but you may notice you can create AI widgets from here too.
Be sure to select Visible Lightness and Line Chart, then click Next. Select your device and click Finish.
You should see your newly created widget in the view now.
A widget is good, but a widget with data is great! (especially live data)
Go ahead and click on Start Tracking, you should get a pop over now where you select which device you want to use with the widget.
You'll notice that the Visible lightness sensor is turned off for the widget, we're going to need to enable that so that the widget can track data. Select the device and then click on the Off text (it's a button I swear :) )
You should see a list of sensors (and they are turned off for now). The Light sensor is the one we care about here, so let's go ahead and turn that on by click on the Low setting and clicking Save.
You should now see that the sensor has not been enabled and the widget can start tracking, go ahead and click Start Tracking to finish up.
The widget will now take a minute to load up real-data and communicate with the Agile device.
Feel free to cover up the light sensor on the Agile device (the indented area towards the other end of the device, opposite the power button) and change the lighting. You'll see the chart update in real time as the lighting changes. Pretty cool right?!
Setting up AlertsSadly, we're nearing the end of this project, but so far we've learned how we can setup a widget and track data (specifically the light sensor, and with that the amount of visible light). Having data is great, but acting on that data is where the power of it really shines (pun absolutely intended).
Setting up alerts is a great way to know what is going on with your data and what actions can be taken, or sometimes they help reassure assumptions.
Head on back to the Device tab in the project view and click on the number under Smart Rules.
This should open up a new pop over where we can create a new rule.
Go ahead and click on Add New Rule.
We want to create a rule that will simply let us know when the lights have gone out. So we want to track if "Visible lightness Equals to 0 lux" then raise an alert. The default values above determine if the Alert will be within the Brainium Portal (Alert) or an email (Email) and will trigger every so often, in this case we will setup an Alert that triggers every minute. Click Save and you should see your new rule created.
Awesome, now let's try out the new rule and see it working. Navigate to the Alerts section of the portal.
Go ahead and cover the light sensor on your Agile device to ensure absolute darkness. If the rule is setup correctly, you should almost immediately see your alert take action.
And that's it! Congrats you've successfully created a project with Brainium and the Smartedge Agile! Now while this walk-through has been fairly simple, it can easily be combined with other things like smart bulbs or even voice assistants like Alexa to add even more value (perhaps I will create another project to show this off ;) ). With this though you are now armed with the knowledge for how Brainium and Agile work and hopefully can see how it can used within other projects.
Thanks for checking out this project and feel free to reach out with any questions or issues you may run into.
Comments
Please log in or sign up to comment.