Hacking A Pebble Watch To Brew IoT Coffee

The OrlandoJS Meetup gave me the opportunity to present on the Pebble watch app that I created in the form of a 5-minute lightning talk. I created this app using the Pebble IDE. Basically, it’s an “On” and “Off” button that makes an HTTP request to an Arduino with a WiFi shield, which then turns on a coffee pot. Very Goldberg Machinesque.

I ran through my slides in about three minutes, so I overshot that one! But that gave me some time to answer a question or two. In any case, if you want to know a little more about how I connected my Pebble watch to Tyler Petresky’s coffee pot, just watch the video and see the slides below, or check out the code on GitHub. It’s public domain, so happy hacking.

Video

Slides

slide1

Self-explanatory.

A diagram showing a coffee pot, arduino, router, and watch. The watch contacts the router which switches on the arduino which turns on the coffee pot.

The watch (far right) is actually connected to my phone via bluetooth. There’s no phone on the slide, so whoever made these slides is probably not very good at life. Anyway, the phone is then connected to the router via WiFi (which stands for Wiffle Fiddlesticks, from what I understand). From there, it connects to an Arduino with a WiffleFiddlesticks shield over WiffleFiddlesticks. The Arduino then does some magic with electricity and then turns on the coffee pot.

The Pebble website offers info on SDKs and tuturials for development.

This is Pebble’s development homepage as of September 2016. It’s an extremely beautiful site, beautiful to the XTREME, but the information provided is a bit disorganized. It took a while to figure out what I needed to do. For example, my first-gen Pebble watch couldn’t use that SDK 4.0 that is prominently featured. Well, it can, but it doesn’t have the 4.0 firmware. It just happens to use some of the same functions. Honestly, I don’t even remember – I just hacked until the thing worked. Thank goodness for Pebble.js, which is an abstraction over their hardware (and don’t confuse that with Rocky.js, which is another Pebble JavaScript abstraction but it only applies to newer stuff). Confused yet? Me too.

Pebble offers many choices for creating apps for Pebble watch, including with C and JS.

Apparently a Watch face shows information and a Watch app manipulates information. Want to press buttons? Watch app. Want to see information? Watch face. As for JS vs. C, I started making the app in C but found out my older watch wouldn’t run the newer compiled code. So, I took a shot in the dark and tried JS and it worked well enough for this demo. As for companion apps, if you really want to get crazy you can make an iPhone or Android app that talks to your Pebble watch.

Pebble has an IDE in the cloud called CloudPebble.

This is the Pebble Cloud IDE. It’s on the web, or in the cloud, depending on who you ask. It really made it nice for me as a Windows user, because you can’t compile Pebble code without some sort of Linux box. Thanks, The Cloud!

This code holds the global dependencies and imports libraries necessary for using JS on a Pebble watch.

This code pulls in necessary libraries for making ajax calls and seeing menus and such. It also sets up a couple of global variables that I knew could easily change, which are just the URL and parameters that I’m calling in the “On” and “Off” buttons.

Code to create a menu that calls functions to turn the coffee pot on and off.

Code to make a menu. So cute.

Code to make "Cards," which is Pebble's way of showing a window or screen.

Code to make “cards,” which is Pebble’s version of new windows or tabs or whatever. How fun!

Functions to turn the coffee pot on and off.

Some functions that make HTTP calls to turn the coffee pot on and off once buttons are pressed. Mmmmm…. coffee.

Functions to clean up code if the Pebble watch messes up.

Some functions in case things go wrong. BORING!

Contact info for Jared. My Twitter handle is @jporcenaluk.

And some contact info. You can also go to that handy “Contact” tab at the top of this page. No, not there. To the right. A little further. Yep!

August Orlando IoT MeetUp Recap

August’s meetup was full (chock-full, even) of lightning talks. We had some great and varied projects discussed. In order:

“Bats on the Web” by Jerry Reed

Jerry Reed, a professor at Valencia University, introduced us to a project he and his pupils have been working on, which is a method of tracking bats in real time over the internet by listening for clicks. Since clicks are at such a high frequency, they were able to hack an ultrasonic rangefinder (one like the kind easily found at on Amazon and the like) to record the sounds. Pretty cool!

“Dense Networks” by Peter Murray

Peter Murray Explains Dense Networks

Bored with retirement, Peter Murray decided to jump back in the technology fray after having been successful in wireless tech for years. Now, he’s creating a website with curated content from various markets. His vision is to have a website with curated information, to filter all the “crap” on the internet and have good, solid news, information, and white papers for your industry available with little hassle.

“Controlling Lights with a Raspberry Pi” by Warren Macchi

Warren Macchi

Warren Macchi is an interesting guy. Owner of Abamis IT Solutions, he has some big plans for the Maker Faire this year, including a creative use of a Kinect, a Raspberry Pi, and lightbulbs. A Maker Faire veteran, this year he’s stepping it up – kids will be able to jump around and the Kinect will take that movement and translate it into equivalent electrical energy through the Pi. The lights he’s attached will light up, and show kids that LEDs light up before halogens, which light up before traditional tungsten bulbs. This will show kids a direct correlation between energy use and light output between the different technologies, and show them they need to turn off the lights when they leave a room.

“MiNiFi” By Bryan Rosander

Bryan Rosander

Blowing everyone’s minds, Bryan described how their team is using MiNiFi and it’s big brother, Apache NiFi, to take data management to a whole other level. Trust me, this is the realm of serious data. Basically, it helps you take data from a lot of different sources and track how it moves through a system, combining it as necessary regardless of the source and keeping a record of where it has been. It’s high-level stuff, and if I was being honest, I’m still not 100% sure I understand all that it can do.

“Building Your Own” by David Leithauser

David Leithauser explains the ins and outs of his book series about Arduinos and upcoming series about IoT.

Last, and with little time (sorry, David!), Mr. Leithauser explained he has a book series (one such book is “Building Your Own Arduino Shields”) about electronics. He also teased that he is considering creating an IoT book. Do it, David. I’ll write the forward.