Back from Vegas! MicroEJ Smart Home demonstration at CES 2017
A cool smart Home demonstration was showcased at MicroEJ booth during CES 2017 in Las Vegas. It is an example of what could be a smart home device controlling different connected things in the home: a smart thermostat, door sensors, and smart lights.
Let’s have a look at how MicroEJ can power and control these devices for the connected home.
This demonstration runs on an evaluation kit from STMicroelectronics. This STM32F746G-DISCO ARM Cortex-M7 MCU-based board is particularly adapted to smart connected devices as it provides cost-effective and low-power capabilities.
The board is running MicroEJ OS as an operating system. Despite the low-power capabilities of the board and a processor with performance far from what can be found in mobiles, MicroEJ OS offers a similar user experience to smartphones or tablets: smooth and fast applications with great animations, and the possibility for the user to dynamically download applications from MicroEJ Store, an online application store, start and stop them. Some software applications can also be pre-installed on the board.
The smart home demonstration includes a user interface used for remotely controlling all the devices in the home. This UI includes different views. Each view enables the user to control a device:
The 1st view gives information about the power consumption. The 2nd enables the user to change the temperature in the home and control the thermostat. With the 3rd panel, the user can control three Philips Hue lights remotely. He can also change their colors, or switch them on/off. On the last view, the user can detect whether the door is open or closed.
This demonstration was fully developed with MicroEJ Studio in a couple of weeks. But how does it work behind the scene?
The backstage of the MicroEJ Smart Home demonstration
For this demonstration, we developed 5 software applications using the Java language: Z-Wave, Thermostat, Door Sensor, Lights, and User Interface. The Java apps communicate with the BSP (Board Support Package, ie: the low-level software driving the physical equipment) through MicroEJ OS that provides a virtualization layer on top of it, making apps independant from hardware and low-level software. MicroEJ OS includes the MicroEJ Core and part of the C drivers, as displayed on the picture below. It allows apps to adopt a service-oriented architecture, offering modular and flexible development experience..
Headless apps and interfaces in a service-oriented architecture
In a service-oriented architecture, some apps, whether headless (i.e. with no GUI) or with GUI, rely on a common service interface defined by the MicroEJ OS, and either provide the defined services (i.e. implement the defined interfaces) or use the defined services.
In our demonstration, the apps Thermostat, Door Sensor, and Lights are considered as “Service Users” headless apps, whereas the Z-Wave app is considered as a “Service Provider” headless app.
MicroEJ offers a library that defines standard interfaces used by the “Service User” apps and implemented by the Z-Wave “Service Provider” app. These services define high level interactions between apps. They are fully independent from the communication protocols or the hardware implementation chosen, offering virtualization capabilities. As an example, in our Smart home demonstration, if the developer decides to replace Z-Wave by the ZigBee protocol, he would only have to replace the Z-Wave app by the ZigBee app. No change would be required on the Thermostat, Door Sensor, or User Interface apps, as long as the ZigBee app implements the same service as the Z-Wave app.
Z-Wave “Service Provider” app
The Z-Wave headless application enables to manage the Z-Wave protocol used by both Thermostat and Door Sensor apps. It uses the MicroEJ library called ECOM. ECOM enables to interact with a USB driver that controls a Z-Wave dongle.
Thermostat, Door Sensor, and Lights “Service Users” and Lights apps
These Thermostat and Door Sensor “Service Users” apps interact with the Z-Wave app to present high-level actions to the User Interface app. These actions are independent from the protocol.
The Philips Hue lights are controlled by the Lights app that manages the protocol (different from Z-Wave) used by the lights. They have to be paired with a bridge that uses the IP address and a unique identification code. Here, we used the MicroEJ File System library to store this pairing information and avoid having to input them each time the user launches the app.
In the Lights app, the libraries NET and FS are used to communicate with the NET and FS (file system) stacks that control the Philips Hue bridge.
The User Interface enables to control all the equipment of the demonstration. It interacts with the Lights, Thermostat, and Door Sensor apps. The UI app uses the MicroUI library to communicate with the UI stack that manages the hardware.