Hackathon Project by Juan Benavides
Have you ever wanted to get into mobile apps development but didn't have the time to learn other programming languages?
In this blog I will show you how to create your own mobile app that connects to your Bluetooth Low Energy device.
As part of a Hackathon project, I was interested in creating my own mobile app to connect to a Zigbee-based Light that doubles as a BLE Device. In other words, it is a Light that supports two protocols; Zigbee and BLE over the same radio.
I wanted to support Android and iOS and I only had a background in Embedded Systems and a couple of days to get it done. So, after a quick Google search I was lucky to find a solution that only takes 10 minutes to develop (that's including the time spent installing the tools).
One of the most amazing things is that the mobile app runs live on mobile devices while you develop and you can instantly see code changes on your apps.
The process of developing the mobile app can be summarized as follows:
Step-by-step guide to reproduce the project
Getting a Bluetooth Device running
If you already have a BLE Device running, then the only thing you need to do in this step is make note of the following Unique Identifiers (UUID):
If you don't have your BLE Device ready to go, then you can use the same one that I used from the Dynamic Multiprotocol (DMP) Light/Switch Demo. Click here and follow steps 1-5 to get it running.
Once you get it running, open the Light Project in Simplicity Studio, open the file DynamicMultiprotocolDemoLightSoc.isc, select the Bluetooth GATT tab and make note of the BLE Unique Service Identifier and the BLE Characteristic Unique Identifier as illustrated in the image below:
Installing the Evothings Tools
In this step you need to install both, the Evothings Studio application in your PC and the Evothings Mobile App in your phone. Click here to install the Evothings tools and verify that everything is operational by running their Hello World example.
Select a Mobile App BLE example as a starting point
Once you verified that you can run their Hello World example, locate the example Arduino101 LED On/Off BLE and click the button Copy as shown in Figure 2:
A window will be displayed for you to edit the project's name. You can call it dmp-light as shown in the following image:
Modifying the Mobile App BLE example with your own UUIDs
The next step is to edit the code. Select the tab MyApps in Evothings Studio to display your newly created example and click the button Edit and your text editor will open the folder where your example is located.
First edit the file evothings.json and replace the property uuid with your own BLE Device Service UUID as shown in Figure 4:
Similarly, open the file index.html and replace the uuids in the functions to turn the LED On and Off, with your own BLE Device Characteristic UUID as shown in the image below:
Finally, find out what's the advertised name of your BLE Device by scanning all the BLE devices within range from your phone as shown in Figure 6:
Open the file index.html, locate the function app.connect and replace the advertised name of the BLE device with your own name as illustrated in Figure 7:
Connecting your new mobile app to your BLE device
To connect to your BLE device you need to follow the same steps you made when trying their Hello World example; Start Evothings Workbench and under the Connect tab paste your Cloud Token and get a connect key using the GET KEY button. Launch Evothings Viewer on your phone, enter the connect key to hook up with your Workbench. On your computer, click the RUN button on your new DMP Light example in the Workbench.
Now you can turn the Light On/Off from your phone as shown in the image below:
For more information on how to deploy your mobile app to an app store check the following page: https://evothings.com/doc/build/build-overview.html
For more information on how to get started developing your own Bluetooth Low Energy devices visit our website at: https://www.silabs.com/products/wireless/bluetooth
Hackathon project by Manasa Rao, Stephen To and Juan Benavides
Would you like to learn an easy way to control a Zigbee-based Light with Alexa voice commands?
Or how about controlling a Zigbee-based Light automatically with an Occupancy Sensor?
Furthermore, how would you like to learn how to easily create your own Bluetooth mobile application to control a Zigbee-based Light and access the Internet?
In this Hackathon project we demonstrate how to easily accomplish all of these cool features.
Silicon Labs released on November 2017 the new Dynamic Multiprotocol Software (DMP) for our Wireless Geckos. In summary, the DMP software enables the simultaneous operation of Zigbee and Bluetooh Low Energy (BLE) on a single radio chip.
The best example to showcase this technology is by controlling and monitoring a Zigbee-based Light directly over Bluetooth with a smartphone mobile application. This example is actually available with the DMP SDK and our Hackathon project is based on it.
The following image illustrates the scope of this blog:
The Demo featured in this blog is based on the official DMP Light/Switch Demo that consists of two devices:
Light: it runs Micrium OS to switch between Zigbee and Bluetooth on a single radio.
Switch: it supports Zigbee to provide wireless control of the Light.
Click here to get started with this demo.
In the original demo, users press a push button on the wireless Switch device, which in turn, sends a Zigbee Light Link (ZLL) command to toggle the Light On or Off.
The Light device runs Micrium OS to switch between Zigbee and Bluetooth while sharing the same radio. This allows a mobile application to connect to the Light via Bluetooth.
Users tap the mobile application to toggle the Light On/Off.
The Light device receives the Bluetooth notification and not only toggles the Light On/Off but also updates the corresponding ZLL Cluster Attribute so the Switch remains in sync.
This blog shows you how to add an Occupancy Sensor to the Switch device by connecting the Silicon Labs Optical Sensor Expansion Board (Si1133/Si1153) to the Switch's EXP Header (I2C).
The Optical Sensor Expansion Board has a series of optical sensors to detect the presence of a person in the room. The occupancy sensor is used by the embedded application to control the light automatically.
Click here to see Stephen's blog on how to add this occupancy sensor to the DMP Light/Switch Demo.
This blog is also going to show you how to control the Light with Alexa Voice Commands.
To enable Alexa Voice Commands, we are also going to show you an easy way to create your own Bluetooth Mobile Application. This mobile application will use the smartphone as a gateway to access the Internet.
Click here to see Juan's blog on how to create your own BLE mobile app to control the DMP Light/Switch Demo.
Users will get to control the Light with Voice Commands and this blog will describe how to setup the system in Amazon Web Services (AWS).
Click here to see Manasa's blog on how to add Alexa capabilities to the DMP Light/Switch Demo.