Four Years Of Learning ESP8266 Development Went Into This Guide

The ESP8266 is a great processor for a lot of projects needing a small microcontroller and Wi-Fi, all for a reasonable price and in some pretty small form factors. [Simon] used one to build a garage door opener. This project isn’t really about his garage door opener based on a cheap WiFi-enabled chip, though. It’s about the four year process he went through to learn how to develop on these chips, and luckily he wrote a guide that anyone can use so that we don’t make the same mistakes he did.

The guide starts by suggesting which specific products are the easiest to use, and then moves on to some “best practices” for using these devices (with which we can’t argue much), before going through some example code. The most valuable parts of this guide especially for anyone starting out with these chips are the section which details how to get the web server up and running, and the best practices for developing HTML code for the tiny device (hint: develop somewhere else).

[Simon] also makes extensive use of the Chrome developers tools when building the HTML for the ESP. This is a handy trick even outside of ESP8266 development which might be useful for other tasks as well. Even though most of the guide won’t be new to anyone with experience with these boards, there are a few gems within it like this one that might help in other unrelated projects. It’s a good read and goes into a lot of detail about more than just the ESP chips. If you just want to open your garage door, though, you have lots of options.

20 thoughts on “Four Years Of Learning ESP8266 Development Went Into This Guide

  1. Thanks for post :-)
    Raises the question have many since the early days started with the esp8266 then felt pressure subsequently gravitating to esp32 or variants versus digging in with the first esp version to get as much out of it as possible resisting the upgrade path reminiscent of Microsoft patterns ?

    1. Mike I think the ESP32 has gotten so much attention because it offers much more opportunities to do things. To use a car analogy it is like going to the dealership and finding out that there are 2 similar cars one with a V6 in it and V8 in it. The surprising thing is that there is little cost in going to the V8 and the fuel efficiency is about the same as the V8 is newer.

      For guys just getting into it the V8 makes sense. Has more power, similar engine to the V6, cost difference isnt all that much more and they have never driven the thing. However the fleet manager that bought a BUNCH of these cars and has a lot of time fixing them know that yea, it makes sense to just to keep buying the V6. They know how to use it. Sure it cant hit the same top speeds the V8 can and cant do all the features but when are you going to have a taxi maxed out? Just keep buying the V6 and go with it since you can make it hum.

      ESP modules are effectively the same. ESP8266 (from what I understand) was never really expected to be some awesome little microcontroller. It was designed differently. But it worked. And it was the first there so a LOT of folks bought in. Imagine taking the Taxi from above and turning it into a basic racecar. Taxi isn’t supposed to be a racer but by golly that engine performs and they can be had cheap. Then the car company comes out and is all ‘hey we saw what you all wanted to do and made a new engine that is designed to be raced and has track day tuning built in.” That was the ESP32. Powered up and ready to handle more.

      So the guys that know and use the old ESP devices still use them. Heck there was a smart bulb that was using the bare chip (not module) recently. When you need price and basic performance the ESP8266 still has a lot to give. Proven performance. But for us new guys tinkering around we like the raw horsepower potential and newer tech on the ESP32 and figure that we probably wont be doing 1000s of these in the future so a few bucks wont matter.

      TL;DR: Some stick with what they know and make it go fast, others like the fancy new faster stuff and figure it is the future.

  2. This seems to be mostly an HTML tutorial. What I’d really like to see is some detailed instructions for using the ESP8266 AT command interface and for writing native C software with the SDK.

    The former is poorly documented and the details of getting the AT firmware loaded less than clear. I’ve managed to piece it together, best thing is to get a USB adapter for a couple of bucks which makes loading the right firmware easy. I still need to check the requirements for SMD versions of the ESP range.

    Oh yeah, the ESP8266 and ESP-XX relationship. So the ESP8266 is the chip, and the ESP-XX are a range of boards using it. The ESP-01 is the most common and probably the cheapest, and comes with the AT firmware loaded. Performance isn’t great, it’s not even got a metal can. Other ESP range boards have antenna connectors, more I/O, different soldering arrangements etc.

    For writing your own native firmware in C there is an official SDK. You can run your code direct or you can use FreeRTOS. The official getting started guide tells you to use a VM for compilation, but I think it can be done under WSL. You are on your own for an IDE.

    The SDK is not well documented, and neither is the ESP8266 hardware.

    Then to actually flash your firmware you need to combine it with a bunch of other binaries using some Windows software.

    Not ideal by any means.

    There is also Arduino, if you feel like punishing yourself with that. My current preference is to use a different MCU with decent documentation and IDE, with the ESP8266 running AT command firmware. It would make more sense to write native code for the ESP8266 but there are high barriers.

      1. Sadly not, they are all terrible.

        Well, there is plenty of good info for FreeRTOS. Just look at some examples or the official web site, it’s a very simple system. It’s the ESP8266 part that is the problem.

    1. I stopped reading when they recommended w3schools. I have found their tutorials to be simplistic and in a lot of cases bad practices. I remove them from my searched so I don’t have to deal with them.

    2. It may be that the SDK is not well documented, but I think you will find that there is a TON of practical knowledge out there on how to get the most out of the ESP8266. You certainly will NOT get the most out of it with the default AT firmware, though!

      By all means, combine it with another processor if you need interfaces that the ESP8266 doesn’t have, like more ADC, DAC, etc, etc. But you will still benefit enormously by using custom firmware on the ESP to do precisely what your communications requirements dictate.

      1. The info probably is out there, but scattered over various blogs and forum posts.

        Unfortunately all the tutorials concentrate on getting Arduino code working, which is the downfall of many products.

  3. Just to add a little advice for people thinking of using the WiFi via the AT command set: this is only really a viable way to go if you have a very simple use case and you don’t have a need for high reliability. I started out that route, then pretty quickly realised that (a) the firmware that supports the AT command interface is an extremely archaic version; and (b) the AT commands available really don’t support anything useful beyond the very basic stuff. Far better to code in ‘C’ and to use either the official SDK or the very good open(ish) source alternative ‘OpenSDK’ (see https://hackaday.io/project/160006-esp8266-sdk-tutorials).

    Incidentally I was able to get the OpenSDK toolchain up and running successfully under Mac/OSX after a bit of faffing about, and it works very well.

    1. Thanks MartinC, that was helpful. I got the SDK compiled and working under WSL.

      The other issue is the lack of peripherals. You can bit bang SPI but it gets more fiddly with UART and I2C. Also no USB. That’s why I like the AT mode and a separate MCU. It does enough for the kind of IoT stuff I want, like NTP time sync and reporting data.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.