Friday, 12 July 2019

My ESP-8266 Programmer

Easier ESP-8266 Programming

When I started developing my ESP8266 based projects, I started with ESP-01 modules and built a programming jig to help put the ESP-01 into programming mode. 

And this got tedious, fast.  When your Arduino code was ready to be uploaded, you have to hold down GPIO_0, hit RESET and then hit upload.  Never mind the fact with this ESP-01 unit you have to then unplug it an place it back in your main board afterwards.

So to overcome the tedium, I cooked up this!


When looking for a better way to develop, I came across the Wemos D1-Mini.  

This little board is a beauty, and simply connects to your PC via a Micro-USB cable and code is uploaded aromatically when you compile.  Nice, but how?

Looking at the Wemos schematic:

It's not that obvious what's going on.

There is some connection between the CH340G and the dual transistor package, and unsure as to how it works, I googled it.  From the AI_Thinker manual on  the ESP modules, there's this reference:

  Ah ha!  This drawing makes it's operation seem much clearer, where the DTR and RTS lines set GPIO_0 low and pulse EN (reset) as required, and then go 'HI-Z' to allow normal operation of the pins.  Nice.  

So, I decided to make my own board that carried a CH340G and some transistors - like this:

It's pretty simple - it takes 5V from the USB socket, adds a 3V3 regaultor for the CH340G and some Rx / Tx blinkenlights.  

Then I knocked this up in Circuit Maker.  

Boards were then ordered, built and tested.  To make it work, I simply set the Arduino IDE to think it's using a Wemos D1-Mini.

Although I haven't tested it but I'd suspect that selecting NodeMCU would work too as they also show the transistor network in their schematic.
So I collected my bits:

And built my board, plus a cable to hook it up to my target. 

In development, the programmer could hook up to to my board via the onboard header, but in the final installation I added a 5 pin socket to allow me to plug in for firmware upgrades should the OTA updater fail. 

Programmer and Cable

5 Pin Socket Wired to Garage Door Opener


And Field Installation of Programmer for Upgrades

This little programming adaptor  makes programming my designs  much less tedious, and also helps reduce parts count as I don't need anything on board except a 5 pin header.  Neat!

1 comment: