Building the Product Nest Missed

How I quickly prototyped a smart thermostat controller using the Particle Photon

Kyle Stewart
6 min readJan 9, 2016
Have one of these wall mounted AC units? No Nest for you!

Last year I moved to sunny San Diego. With its almost year round wonderful weather, most apartments don’t have full AC units. Instead they opt for space and energy saving wall mounted units. There are actually quite a few of these installed in houses and apartments around the globe so I wondered why Nest had decided not to create a version of their product for this need. I had all the excuse needed to start hacking.

1st Hardware Prototype

WiFi + microcontroller + temperature sensor + IR transmitter = thermostat control

I’ve been seeing the ESP8266 WiFi-enabled microcontroller popup on tons of hobbyist electronics blogs. It’s cheap and has just enough horsepower to do simple tasks. The Sparkfun Thing dev board gave me a quick way to get programming with this chip. Everything was straight forward and plenty of sample resources are available on Sparkfun’s website and the internet in general. One thing that concerned me though was the need to hardcode my WiFi password into the firmware before I could connect to my local WiFi. I made a mental note that I would need to solve this problem before ever thinking about making a product with the ESP8266.

Once connected to WiFi, I added a temperature sensor and IR LED driver breakout to complete the thermostat hardware. Programming the microcontroller was easy using Arduino compatible libraries. Thankfully the community has provided the necessary core libraries to program the ESP8266 with the Arduino toolset.

The hardest part turned out to be cracking the proprietary IR code that the Fujitsu remote control uses to talk to my AC wall unit. I couldn’t find any solid resources online about this obscure format. I’ve worked with IR code before, reverse engineering TV remotes as well as creating my own data transmission format yet I had never seen any IR protocol that pushed this many bytes at once. The standard Arduino IR library couldn’t even handle the number of bytes needed, I had to setup my own code to perform the correct frequency and timing for driving the IR led. After spending quite a few hours trying to reverse engineer the protocol, I stumbled on a hidden corner of the internet with a one page PDF document containing everything I needed. Hacking the protocol was fun, but it was nice to finally be able to talk to the AC wall unit.

1st Software Prototype

TAAS — Thermostat as a Service

At this point the thermostat controller was connected to my local WiFi and could make calls out to the internet but was by no means considered to be “on the internet”. Time to level my little device up to IoT status. There are some solid examples for making HTTP calls on the internet using the ESP8266, so this is where I started. Now that my device had the ability to call out to a server, I needed a server to talk to. Using Meteor, I was able to quickly put together a website to visually display the temperature reading and allow setting the temperature and fan speed. Great! Now I have some UI for this project. How do I make it talk to the controller?

This turned out to be the biggest sticking point with the first prototype. The Meteor web app had no way to send data or call methods on the ESP8266. Instead I had to poll ever 12 seconds up to the server to see if the temperature settings had changed. Not only was this extra code, it was inefficient and would never scale if this were to become a product. There was also a long delay due to the polling interval and the device was constantly losing connection. The prototype worked but not enough to meet my needs. It was time for a second attempt.

2nd Hardware Prototype

Round II — Swapping out the microcontroller with a Photon

Recently a coworker built an LED illuminated sign that connects to our analytics data and flashes every time a specified event happens. The sign has been plugged into the wall for months and has just worked, no need to reset or diagnose problems. He was telling me how simple the microcontroller was to setup with a bit of Javascript and some basic Arduino code. I had to give it a try and I ordered the basic Particle Photon kit.

It only took a couple of hours to get the Particle up and running in place of the ESP8266, most of that time spent setting up a local dev environment. The online development environment Particle provides on their website works fine, I guess I’m just old school and wanted to use the Atom based IDE. Since the embedded code from the ESP8266 was already target towards Arduino compatible devices, it was almost as easy as copying and pasting the code into place. After getting my first transmission to be recognized by the AC unit, I was ready to upgrade the software.

2nd Software Prototype

Family means free design work — app design by Scott Stewart

I’ve been meaning to find a use for my Apple Watch, might as well have it control the temperature of my apartment. It was time to scrap the web server and make a native iOS app. I could do this because Particle provides internet services that my Photon device is always connected to. All I had to do was drop in the provided iOS library and send commands directly to the Photon. I no longer had to poll for updates on the temperature controller, which was half the embedded code. Making these pieces simpler let me focus on a better user experience in the iOS and Apple Watch app. The current prototype isn’t a shippable product, but it meets my needs. The original AC unit remote control is now sitting in a drawer collecting dust while I control my thermostat anywhere I want to!

Poor little guy!

Mission Accomplished

After using my new temperature controller for a couple of weeks, I’m still finding it useful and am glad I took the time to put it together. Whether or not it has legs as a product is up for debate, I’m well aware the difference between prototype and a shipped product. If you want to build your own version, start with the GitHub repo and let me know what improvements you make.

I really hope this blog post doesn’t make me sound like I’m on the Particle payroll. In general I couldn’t be more excited about all the products and progress in the hobbyist electronics market, but I really feel like Particle is taking things to another level.

  • Their platform does all the work necessary to do two-way communication between your IoT widget and app or website. Having tried to develop a small bit of this myself, I know how much work it can be to develop and support the backend infrastructure. If your core business is making and selling slick hardware, its nice to have someone supporting the necessary internet services.
  • Getting your IoT widget connected to the local WiFi is the biggest sticking point for customers excited to use your new product. My first attempt would have required the customer to reprogram the microcontroller! Particle has developed the simplest WiFi setup experience I’ve seen. It’s not perfect, but I can’t think of a better solution given the challenge.
  • Particle is focused on providing solid resources and support for that huge gap between prototyping and shipping a product. It makes me wonder if I can finally get into the hardware business. As they say, “hardware is hard”. I’m excited to see anyone who is trying to lower that barrier to entry.

--

--