Motivation

Smartwatches are gaining in popularity as they are more affordable and offer good and easy APIs for developers. Moreover, they are easier to use in everyday actions. I published some time ago Open Sesame project that aims to enable the control of the doors using a Smartphones. In this project, I propose an application for pebble watches to control this system.

Now, when I back home from the grocery store with bags in my hands, I just use the watch while keeping my mobile device in my pocket :D

Description

Let's start with a video as it worst a 1000 words!

I will skip the details regarding the hardware setup and the Raspberry Pi configuration as they are explained in this project. The security aspect of this project is discussed in this article.

As illustrated in Figure 1, the application deployed in Pebble watch uses Bluetooth connection to the smartphone in order to access to the network. Nevertheless, this complication is mitigated by the Pebble SDK.

Figure 1

Software setup

The CLOUDPEBBLE IDE is a cool platform to develop Pebble applications. First you need to create a project and configure it. As illustrated in Figure 2, you need to specify the target platform. I used both aplite and basalt in this project.

Figure 2

One you project setting is complete, copy/paste the source from the github repository into your application sources.

The application is composed from a menu with two options. The first one is to open the door. the second one is to close it. this menu is available when you click on the "UP" button. When you click on the "Select" button, the application shows the status on the lock (Open or Close).

The application uses a WebSocket connection to access to the server deployed in the Raspberry Pi. The code below illustrate the WebSocket connection to the Raspberry Pi server.

... menu.on('select', function(e) { console.log('Selected item #' + e.itemIndex + ' of section #' + e.sectionIndex); console.log('The item is titled "' + e.item.title + '"'); var card = new UI.Card({ title:'Door Action', subtitle: e.item.title + ' operation in progress ...' }); card.show(); ws = new WebSocket('ws://YOUR-RASPBERRY-PI-IP:1337'); ws.onopen = function () { card.body( 'You are connected to Open Sesame System Server.'); if(e.itemIndex===0){ ws.send('22'); card.subtitle( "Door Opened"); status = "Open"; }else{ ws.send('2'); card.subtitle( "Door Closed"); status = "Close"; } }; ws.onerror = function (error) { card.body( 'Sorry, but there\'s some problem with your connection or the server is down.') ; }; }); menu.show(); }); ...

Conclusion

It is nice to have play with multiple technology to automate our homes. This project shows that the wearable devices may be used in a simple way to control stuffs in our modern smart homes.