Wednesday, 30 May 2018

Using the CH340 USB dongle as ESP-01S Programmer

Note the add-on push-button switch

Some time ago I bought a cheap (RM6.50) CH340-based USB to serial 3V3 TTL dongle with a socket for the ESP-01S. It was described as a development board, and I assumed it will also program the ESP-01.

That assumption turned out to be quite unwise, as 'programming' was not mentioned:

It most certainly would not program an ESP-01S. What is needed was a switch to pull GPIO0 low when the ESP-01S is powered up or reset. AndyS19 has a nice writeup on this.

ESP-01S pinout

I happened to have a cheap (RM0.80) small push-button switch very popular here for use in car, autogate or garage remotes. The distance between the leads (ie pitch) almost exactly fits the pins GPIO0 and GND of the CH340 ESP-01S USB dongle, on the solder-side of the PCB.

Push-button switch for remotes

Solder-side of the CH340 ESP-01S adapter

I simply glued the switch to the PCB and soldered the leads onto the GND and GPIO0 header pins, and presto, I have an ESP-01S programmer.

To program, hold down the button as you insert the dongle in your laptop. Release the button and fire up your Arduino sketch. Use the 'ESP8266 Generic' setting. Some ESP-01S I bought would only work with 9600 baud, others are fine with 115200.

It will be especially handy to have an ESP8266 board to run my code on those train rides on my daily commute.

Life is good. Happy Trails.


  1. I do exactly this - works great

  2. I did this, and tested by uploading the basic ESP8266 "blink" example sketch from the Arduino IDE. It worked. But only once! No matter what I do, the upload won't work. Any idea about what's going wrong?

    1. Sometimes if you reconnect the ESP-01S with the Serial Monitor window open, the programming port number will change. I found the ESP-01S very sensitive to input voltage; supply voltage spikes will often cause permanent failure. Hope this helps - good luck!

    2. Also some ESP-01S comes with different programming baud rate. Some used 9600baud, some 115200