In true maker spirit, Simon persevered through many project setbacks to create his amazing ESP-12 based garage door opener.
We last spoke to Simon in late 2017, when we published his PIC-based Badge of Horror Halloween project. What we didn’t know at the time, was that Simon was working on a wireless garage door opener, which could be operated using a smartphone.
After many years of perseverance, Simon has managed to get his door opener working, and wanted to share it with us.
You’ll read that Simon’s determination and ability to learn different coding languages, helped him to create a successful project, that even his wife approves of.
It’s great to hear from you again Simon. Can you remind our readers a little about yourself?
I’m a Dad, tinkerer and engineering manager in that order of preference :). I’ve been an Engineer for over 25 years, working with a large defence company, as well as smaller companies where we had to make professional looking products with hobby level equipment. As my work is more management than engineering, electronics is now my hobby. Along with wanting to get my shed sorted so I can work on my dream car.
It’s great to hear you find time to have electronics as your hobby. What got you on the path to electronics, coding and making?
I’ve always liked to make and fix things. As a kid I’d pull toys apart and then make other things from them, then as I grew older I started to tinker with cars. Electronics seemed to be the future when I was in school so I chose electronic engineering for my degree. As work moved to management my home projects became both my ‘fix’ and the opportunity to learn new things.
Great! And you’ve obviously used electronics in the garage with this project. Please give our readers a brief overview of your project.
It’s “Yet Another Internet of Things Garage Door Opener”. “Yet Another” because the IoT Garage Door Opener seems to be the “Hello World” of IoT / Home Automation projects.
Long story short, I wanted to be able to open my garage door with my mobile. But I did not want to use any cloud services – it had to be a stand alone device. The ESP8266 hit the market about the time I wanted to develop this and the community around it (and the ESP32) is just awesome.
When I started I didn’t know the first thing about HTML, CSS, Javascript or Websockets, and it was a steep learning curve. But a rewarding one!
The unit itself has 4 ‘dry contact’ relays and can be configured to open a door or run an external light. The red button is for the light, the left and right green buttons are for the left and right door. The middle button, now, does nothing but I might make it open both.
Wow! That was a serious learning curve. Thank goodness for the Internet and community groups willing to share their knowledge. What components have you used?
Only the best that Aliexpress can supply :). I use an ESP8266-12 module, an MCP23017 IO expander and LM2596 buck circuit to get a 3V3 rail. The IO expander was needed as the ESP8266 module soon runs out of IO. I also have an onboard Real Time Clock (DS1338Z) and a Temperature sensor (TCN75A). The clock is redundant as my plans to operate on timed events are now overtaken by my future plans to integrate the opener into a Node Red environment (on a Raspberry Pi).
Can you talk more about the ESP circuit and why you needed to clamp the VSUPPLY line?
In my work, I was caught out once with equipment in the field operating intermittently, all due to voltage drop on power supply cables (the equipment was far away from central power distribution). Ever since then, I’ve designed in the ability to measure the supply rail at each device. Of course, I’ve not actually implemented this in code... yet.
The clamping is there in case some noise is induced on the cable (if I fire up the stick welder in the garage for instance) and exceeds the 1V input allowed on the A2D on the ESP8266, or if I do something really stupid and try to run the unit off more than 12V (the LM2596 will cope with up to 30V but I’m guessing I’ll either destroy the A2D input or fry the ESP8266. Or both.).
It’s important not to let the smoke out. Did you need to add more IO using an MCP23017?
IO always adds up fast in these projects. 4 front panel status LEDs, 4 Relay Drives, 4 input buttons, 2 PWM outputs to control the illuminated button brightness, I2C lines, 4 slave button inputs... I may have over cooked it a bit :)
You’re right. It is easy to quickly run out of IO as we scope out our projects. Your temperature sensor is redundant?
It was added on a whim, but I was keen to understand how hot/cold it gets in the garage. I should write up about how I calibrated it one day on my blog.
It’s great to hear you’re sharing your learnings with the maker community. How did you select the relays to trigger the door motors?
They are nothing special, chosen for their cheap price and suitable size more than anything else. I did use 12V ones, so I can power them directly from the input power rail. If you look at the power supply schematic, you’ll see that I isolate the LM2596 (via diodes) and have a bulk reserve cap to keep the LM2596 happy should switching relays cause the supply rail to sag. Another lesson learnt the hard way in the past.....
A great tip, thanks! How is your project powered?
I have a ton of assorted DC wall warts. In this case I use a 12V one and then a LM2596 buck circuit to provide 3V3 for the ESP8266.
Can you give an overall explanation of how the circuit works, what each button does, and what the LED indicators show?
There are 4 front panel buttons. The green ones are used to trigger doors, the red to control the light. When a green button is pressed, a door control relay is triggered for 500ms and the light turns on for 5 minutes. You can choose to only operate the light with the red button, or turn it off with the red button after the green on is pressed.
There’s also 4 external button inputs on a terminal block that are driven from my home alarm panel. My alarm has a remote fob that turns the alarm on / off and has two spare outputs that I use to control the roller doors. Gives one fob on the key ring.
However, the real magic is the ESP8266 acting as webserver. If there isn’t a WiFi network present that it can connect to it will act as an access point. Otherwise it’s available on my WiFi network. Load the page, press the button, open the door. Very handy when I catch the train to work and leave my car keys at home.
There are 4 status LEDs on the front too. I always have a blinking LED to let me know it’s not locked up. Lesson learnt the third. Blinking Green and Steady Blue show’s it’s running and connected to my WiFi. Blinking Blue and Steady Green shows it’s running as an access point.
The yellow LED is active when an external input is active (button, terminal block) and red means I have power. Slow blink is for low supply voltage, and fast blink is for high supply voltage.
It’s great that you’ve learnt and done all of the coding yourself too. How did you approach that?
I did it exactly the wrong way! For anyone interested, they can read about that in detail on my blog. I did mention it was a steep learning curve. It also took me 4 years to get there. I wish the DIYODE articles on Web App building blocks were around when I started. They are really good.
Great to hear you persevered. Some people would have put it into the too hard basket. Your interface looks straightforward. How does it work?
The GUI starts off simple and then I over-complicate it. The first page is a simple page of buttons. Press the button, toggle the door / light state.
I eschew the traditional approach of using a simple get request, but use ajax (to stop cached URLs causing issues) for the button presses and websockets passing JSON files for all the configuration options.
Well done working out how to overcome the caching issues using AJAX. Do you have any safety measures in place for anything failing?
It’s fail safe. Relays are normally open, so if they fail, the doors wont trigger. Power supply is limited by a poly-switch, and the supply rail for the external inputs are current limited to only a few mA so dead shorts won’t burn the house down.
Yes, very important not to burn down the house. We read on your blog that you burnt your original motors. What happened?
I did a dumb thing. I’d configured the relays to switch 12V (not current limited!) to control some LEDs to represent the doors while I was developing the code. Then I installed the unit, without removing the 12V solder blobs and promptly destroyed my roller door control boards. Expensive! Still learning lessons....
Ouch! Lesson learned the hard way there. We see you’re also handy with PCB design. What software did you use to design it, and where did you source your boards?
I designed the boards in Circuit Maker. Boards were ordered from Elecrow. But I tend to use JLCPCB these days.
Great! We notice there’s a parts list there also if any of our readers were interested in building on for themselves. Were there any challenges you needed to overcome with your build?
Nothing too out of the ordinary. The alignment of the front indicator LEDs was a bugger (took a few spins to get that right), but I have access to a PCB mill at work (very handy for testing mechanical fitment), and when assembled there’s no chance of non-destructively taking the top board out again.
Always helps when you have access to the right equipment. We notice you have two designs. What are the main differences and why?
First design was simply two dry contacts to run in parallel with my alarm panel, and drive the converted hot water heater box that I used to control my doors and run a LED light. You can read about that here: http://ludzinc.blogspot.com/2013/07/ive-seen-light.html
The first design was my first steps with the ESP8266 - so it was worth it just for that. At the time the plan was to use the AT command set to control the ESP module, but then the whole thing was ported to Arduino and hosting of webpages was something I just had to learn about!
But that was ugly as sin and had to go. So the second design incorporates the ‘user interface’ (front panel buttons and LEDs) and drives an external LED to light up the garage in the dark.
Your project build and installation does look very neat. Are all of your projects this neat?
Lol, no! Sometimes it’s a case of just get it done, pretty it up later. But I do try to make things that pass my wife's Acceptance Factor.
Ha Ha. Yes, it's important to keep your wife happy. What else should our readers know about this project that we haven’t already covered?
If nothing else, it’s a lesson in perseverance. Life can be busy and often projects are start / stop in nature as family priorities take preference, but I got there in the end and learnt a lot!
Good advice. Life can get busy, particularly with work and family. If our readers want to build their own IoT garage door opener where can they get more details about the build?
Yes! My blog has the PCB design, cases used, firmware and details available.
Fantastic! Thanks for sharing. What other amazing projects have you made?
I was quite chuffed that you’d featured my Halloween pumpkin badge in the past! I have a few in queue that I’ve built and want to write up on my blog. 'Learn to Solder' projects (for the kids), my take on the classic Atari Punk, RGB LED colour mixer, Hand Held Game of Simon, and RetroPi with custom power hat and ‘console case’.
They all sound great. We hope they all passed the Wife Acceptance Factor test. What projects are you working on next?
An “Electro Sketch” - electronic version of the classic Etch-a-sketch, Temperature and Humidity monitoring nodes for the house, learning Node Red & MQTT, and automating my home lighting.
You certainly like to keep yourself busy, building and learning. We hope you have inspired our readers to do the same. Good luck with your projects and keep in touch.