So when it rains it pours, but is a good way. I have felt like the last couple years I have been rather dry of projects. I wanted to do something, but could never come up with an idea. Well now I feel like I have too many projects and no where near enough time. Some of this might also be having more than enough motivation to actually work on them all.
So the new project… I always forget if I have closed the garage door, so I wanted to hook up a small computer and camera to let me see if the door is open and then close it. Hopefully I should be able to figure out how to controller the lights on the Garage Doors easily. And lastly if at all possible, I want to power the whole thing off of the Garage door itself to make it small and easier to hook up.
Understanding the Garage Door
Step 1 was clearly to understand the garage door opener and understand how to control it. I poked around online a little and saw very little information. The one piece of information I did find was that it was a 24v system and that you needed to send certain width pulses at specific frequencies. And that the light button and door button it sent slightly different patterns. Because there wasn’t enough information out there I figured I needed to at least test for myself.
After measuring everything it looks like when the default buttons are attached, the voltage is around 5v. But when they aren’t, the open voltage is closer to 20v. So that is different. I calculated back and found the source impedance was around 1.2kΩ. After a little more digging it turns out that my system just uses a simple voltage signal. Anything greater than 3v is “do nothing”, 1.2-3v is “turn the light on/off”, and everything below 0.5v is “open/close the garage door”. (Note: those are slightly rounded as the accuracy I had with setting the resistance was about ±0.2v.)
Also to get to the 5v that the normal buttons were at, it was drawing about 10mA. So since I have 2 garage doors, I might be able to draw up to 20mA total. So if I had some super capacitors, I could set it up to handle more than 20mA burst as long as the majority of the time I am below 10mA or so.
WiFi Boards
I don’t really want to run cables all through my house to do this, and I really want it accessible remotely. This leads me to logically thinking that I want something that can either connect via WiFi, Bluetooth, or RF to my server. Looking at what boards are our there I found a bunch of different Bluetooth and RF boards, but I could get a whole WiFi board for just as cheap. So I settled on trying out the Photon and the ESP8266 based ESP-12F board.
Photon
The photon board showed up first. It took me a second to get everything powered on and connected. They did an amazing job getting that ecosystem very easy to use. The base firmware lets you connect from your phone, register the device to your account, and then you can do everything from their website to write and program your device.
But that then got me thinking. Everything I was doing was going through their servers. From compiling, to programming, to even telling it to turn on the LED was going up to the cloud and back.This seems really inefficient. I played with it a little more and was able to program directly from my PC, but I still needed to compile in the cloud.
So I then measured the current draw… It was hovering around 100mA! That was way higher than I expected. Apparently when they said deep sleep, they meant off. I was used to from the MSP430 days that deep sleep meant that you could wake up on interrupts and get back to things. I was hoping with a really simple software like what I was running we could get down to 12mA, or at least something around 50mA that I could then work on getting the power settings right.
Poking at trying to get the device to sleep revealed some bugs or at least non-obvious design patterns around low-power modes. There is a sleep command that just messes up the WiFi, It doesn’t appear to actually sleep the processor itself. So I have yet to find a way to say sleep the processor and wait until I get a packet.
ESP8266
I am not sure what to call the board. It looks like the ESP-12F board is part of a family of boards all based around the same general layout with the same processor, but all slightly different. This also took much longer to get my environment setup and running. Which I expected to some point because it doesn’t have a built it USB programmer/serial port.
I struggled to find good documentation on how to get started with Arduino and the ESP8266 boards. And by that I mean I found a ton of blog posts and instructables, but nothing seemed too concrete. After I got it all up and running, well it felt exactly like the Photon except for how you program it. It seems very obvious that Photon was heavily based on Arduino (or the other way around, I don’t know which one came first). After playing with it for a while, it seems like https://github.com/esp8266/Arduino is the best reference. Again the current is way higher than I would like, but maybe I can remove the Arduino layer and write directly for the processor and then get the power down.