ESP32 CH340 Programmer Schematic

ESP32 CH340C programmer schematic for Espressif ESP32 and ESP8266

For your design reference, here is an ESP32 CH340 programmer schematic. The Chinese WCH CH340 series of USB to UART bridge ICs are a very popular low-cost alternative to the CP2102 and FT232 USB-UART chips. You will find the CH340 chips being used in Arduino knock-offs and a bunch of ESP32 and ESP8266 development boards too. Even though we do not recommend using this chip for various reasons, here is how you can make it work with your ESP32 or ESP8266.

Also, you can use this ESP32 CH340 programmer schematic to make an ESP8266 programmer. Just make sure that the bootstrap pins like IO2 and IO15 are configured right on the ESP8266.

ESP32 CH340 Programmer Schematic

ESP32 CH340C programmer schematic for Espressif ESP32 and ESP8266

Viewing from the top-left, moving towards top-right corner, we have the microUSB connector (you can also use USB-C connectors). We have used a common 1117-3.3 LDO to derive 3.3V for the ESP32 or ESP8266 to use.

On the bottom half of the schematic, we have the CH340C USB to UART bridge driving the UART TXD and RXD pins of the target ESP32 or ESP8266. There are two transistors, Q1 and Q2, that toggle the enable and IO0 pins to put the ESP32 or ESP8266 in programming and run modes as required.
The ESP32 CH340 programmer schematic shown above assumes that the other bootstrap pins of the ESP32 or ESP8266 are all configured properly. Failing to do so will prevent proper operation.

CH340C power configuration options

The CH340C has 2 pins. The VCC pin and the V3 pin.

The VCC pin can take in either 5V or 3.3V. The V3 pin should be left connected to a decoupling capacitor only to enable the internal 3.3V LDO when VCC = 5V is used.

If VCC is tied to V3, then the CH340 must be powered by and external 3.3V source only.

In the example schematic, the CH340 is powered directly from the USB bus. The problem here is that the CH340C output logic levels are referenced to VCC input. Therefore, we have the TX and RX pins working at 5V instead of 3.3V.
Under normal circumstances, directly connecting the TX and RX lines to ESP32 or ESP8266 will kill the ESP chips because they are not supposed to work with 5V UART devices.
However, in this case the CH340C pin output current is limited to 3mA only and the input logic-high threshold is low enough to allow the ESP to use 3.3V CMOS logic levels on the UART pins.

This is the reason for connecting a 5V UART system directly to the ESP32 in the ESP32 CH340 programmer schematic. The clamping diodes on the ESP IOs can handle 3mA as per the datasheet.

Advertisement:

How auto-reset logic works

The auto-reset and auto-program circuit works in a rather non-conventional way. You must have at least 100nF of capacitance on the ESP32 or ESP8266 EN pin with a pull-up resistor weaker than 10K to guarantee proper auto-program circuit operation.
Wondering why? We have discussed that in the CP2102 ESP32 programmer design article.

Change Log
  • Initial Release: 27 December 2020
References

Related posts

Simple ESP32 Ethernet Example with ESP32 Gateway

Notes on ESP32-C3 GPIO – Strapping Pins, Flash Pins, etc

W25N01 with ESP32 and STM32 – 5 Notes

10 comments

gerard April 18, 2021 - 2:57 am
hi guys, Thank you for the article about CH340C, I found it very useful. You state that "we do not recommend using this chip for various reasons". Are they still hold true today? Can you elaborate?
Pratik (PCBArtist) April 18, 2021 - 5:59 am
Hi Gerard, There is no serious reason to not want to use it. The only issue with these chips is that the sourcing is almost always questionable because these are not usually available from reliable distributors. We have come across a LOT of fakes. If you bought a few thousand of those, that would be a bad day!
Raul December 2, 2021 - 7:48 pm
Hello, congrats for the project. I understand that the ESP can handle the 5 V logic level due the curret limit, but is there any particular reason to power the CH340 with 5V in instead of 3V3?
Julien September 10, 2022 - 9:36 am
Hello PCB Artists, I have the same question, could you please give us some information on this ? why not 3V3 ?
Daniels June 14, 2022 - 1:33 am
Hi. This circuit doesn't work, there Is no oscillator crystal for ch340 drivers and there Is no communication between esp8366 and ch340.
Pratik (A PCBArtist) June 15, 2022 - 4:55 am
Hi Daniels, the ESP_GPIO net contains 4 pins that go to the ESP - reset, IO0, TxD and RxD. They are the lines connecting ESP to CH340C. As for the crystal, please note the CH340 variant that you are using. They are not all the same! These schematics are from one of our designs that works, so I can confirm that this is from a fully functioning PCB design.
Victor Freitas September 27, 2022 - 10:51 pm
Hi, I really liked the explanation, a question. if I connect the V3 of the CH340C to a 1uF capacitor in series with GND, can there be any problems? need to be one of 0.1uF precisely?
Christopher Cooper May 14, 2023 - 9:24 am
Hi, Very helpful articles, really appreciate them. My question concerns this design and your other USB interface based on the CP2102. When referencing other designs online, some include ESD diode protection on the USB Tx and Rx lines. When designing circuit, is this needed in your opinion? Thanks.
Pratik (A PCBArtist) May 14, 2023 - 11:10 am
Always good practice to have ESD protection on devices you want to use or sell. Make sure you pick the right ESD diode and place it close to the USB connector in layout. You can leave the diode unpopulated for prototyping purposes - it isn't really compulsory.
LUIS April 23, 2024 - 5:23 am
Thank you very much for sharing this information, it has been very helpful to me, I recently had a problem when removing an ESP WROOM 32 SOC from its development board and the board became unusable, I had an Arduino nano board (its ATMEGA328P chip suffered damage due to overvoltage only the CH340 was useful) with the CH340 and I didn't know "how to generate a RESET and a BOOT from the same programmer?", until I found this video I had to do it manually, It has worked for me!
Add Comment