Bridging the Gap Between Pebble and Arduino

There are tons of Arduino and Arduino compatible microcontrollers on the market. An especially notable board is the ESP8266. The ESP8266 has 10 GPIO pins, is about the size of a fingernail, and best of all, costs about $5. The Arduino IDE supports this board and it has gotten a lot of attention from makers since it's release due to it's IoT capabilities. Being Pebble Smartwatch owners, we wanted to see if we could use our watches to control these boards. Before we started, there was no documented way to do this, but we've created a great proof-of-concept that changes that. The best part is that all of our code is compatible with other WiFi-capable Arduino boards with just a slight modification.

What it does

The ESP8266 can be programmed through a slightly modified Arduino WiFi library to connect to a wireless network and perform network functions. We used an Adafruit Huzzah ESP8266 Breakout during our testing because it's easy to mount on a breadboard and also features built-in serial port logic level shifting, making it easy to program with a standard FTDI serial interface. The ESP8266 is configured to connect to a WiFi network, run a simple HTTP server, and await commands from clients. Using Pebble.js, we wrote a Pebble timeline application that can send commands to the HTTP server. This all works only if the Pebble is paired to a cell phone that is on the same WiFi network as the microcontroller. This code should work on other WiFi-enabled Arduinos and shields, so long as you replace "ESP8266WiFi.h" with the proper WiFi library for the board.

How we built it

We wanted to test a few different concepts with this project. We put our microcontroller on a breadboard and wired it to an FTDI FT232RL serial programmer, a servo, and an LED. After writing a simple webserver to run on the microcontroller, we wrote some other functions that can be executed by HTTP commands. We tested concepts like turning LEDs on and off, and rotating servos to simulate the action of locking a door. Writing the microcontroller-side software was fairly simple to write, but the Pebble-side was a little more complicated.

Challenges we ran into

At the time of writing, we couldn't find a single example of a wifi-enabled Arduino-compatible microcontroller interfacing with a Pebble smartwatch. As mentioned earlier, the microcontroller code was fairly easy to handle. The Pebble code was much more complicated. Native Pebble C code doesn't have access to the internet connection of the cell phone it's paired to. In order to gain web access, you must use the experimental Pebble.js suite, which doesn't currently work on first-generation watches (at least for now, Pebble is promising support). Having no experience with JavaScript, all three of our members had to learn it in order to write the application. We also ran into the issue of connecting all of the required devices to a WiFi network. The Drexel guest WiFi doesn't support microcontrollers connecting, so we had to configure one of our phones to act as a wireless hotspot to conduct testing. Since the Pebble SDK is cloud-based, we found ourselves switching between networks fairly often. Once we successfully established communication between the Pebble and the ESP8266, we than began polishing our communications protocol and developing a Pebble app to control various devices connected to the microcontroller. Overall, there was a lot of time spent reading over confusing Pebble documentation and troubleshooting issues that may have never been solved before. One issue that we still haven't been able to establish useful communication from the microcontroller to the Pebble, that would allow us to monitor the state of whatever you're controlling.

Some Milestones

We proved that you can use a Pebble to control a WiFi-enabled Arduino As far as we know this hasn't ever been successfully done. We were able to do this with almost no reliability issues We never experienced a glitch in our code that caused erratic or dangerous behavior.

What we learned

JavaScript, lots of JavaScript We also learned a lot about web-server programming and how to make different platforms interact.

What's next for ArduPebble

This is a cool concept, with some refinement it could develop into a platform for controlling devices within your home or wherever else you go. There's no limit to how many microcontrollers you can control from your Pebble or how many things each microcontroller can do. The Pebble itself is an incredibly convenient tool.

Built With

Share this project: