geraicerdas / ESP32-Cam-Programmer

This is external programming for ESP32-Cam that you can simple attach it for easy upload your code to ESP32-Cam
GNU General Public License v3.0
36 stars 10 forks source link

U0R at 5V? #1

Closed liudr closed 2 years ago

liudr commented 2 years ago

@geraicerdas thanks for sharing your design! I was reviewing it and noticed that you supplied 5V to CH340, which according to the spec sheet causes it to use 5V logic level. Won't this expose ESP32's U0R pin to 5V? I've looked at my esp32-cam programming board I bought on amazon.com and it comes with a 3.3V regulator and that powers CH340 instead of 5V from USB. That board has issues with programming the esp though. Thanks.

geraicerdas commented 2 years ago

The correct way to connect ESP32 is using 3V3 lines. It will be saver and won't damage anything. However, many of makers reported that they were able to upload code into esp32-cam module and more stable after using 5V lines. That's why in this schematic we supplied CH340G with 5V instead of 3V3.

liudr commented 2 years ago

Thanks @geraicerdas ! Could be other issues than the voltage level. I made my own programmers for my custom ESP32-WROVER boards and have only used 3.3V logic to program it. I thought about adding a resistor voltage divider on your board but it's pretty full. I'm thinking, why not using the 3.3V pin from the esp32-cam board to power your CH340? That pin is powered by a decent 1117-3.3 regulator on the esp32-cam board and CH340 doesn't consume much. But then I thought, wait a minute. If you are toggling the GND on the esp32-cam board as a way to mimic RESET, it would cause the 1117-3.3 to lose power and then CH340 to lose power and you get a USB disconnect. It's like a chicken-egg problem. Probably best just to add some resistors somewhere.

An alternative is to use FT321X. It's more expensive but comes with an integrated 3.3V regulator to run 3.3V logic even when supplied with 5V. You probably already know that. It's indeed a few times more expensive than CH340.

geraicerdas commented 2 years ago

I tried to keep the cost as low as possible. I just thinking another way to solve the voltage level by using 3.3V zener at U0R. What do you think?

liudr commented 2 years ago

Yeah, if you can find a spot to fit on your board ;)

Maybe moving your transistor further to the right, near the single row of headers?

I'm using a old version or EAGLE. I would otherwise be happy to do this.

If you're interest, you could sell on tindie.com. There is a similar design someone is selling but it has no schematics and I can only infer from bits and pieces of their schematic parts shown in a video that they don't have level shifting but do have a regulator.

https://www.tindie.com/products/bitluni/cam-prog/

liudr commented 2 years ago

BTW, if you sell them to USA, I might be able to buy a few for a project. The currently available programming board on amazon.com isn't working. They use a couple of diodes and don't actually have a working reset mechanism. I made out most of the traces of the power supply (those parts make sense) but was a bit confused how their reset button would ever work, not like there's a low-side transistor switch like yours. Here is an example on amazon. It's all over the place yet it's not really working:

https://www.amazon.com/Frienda-ESP32-CAM-ESP32-CAM-MB-Compatible-Raspberry/dp/B092ZXT1XG/

geraicerdas commented 2 years ago

Btw, last month I faced an issue with ESP32 cam that came with programmer as link you provided. It seems a little bit different with some older ones I had before. There are an additional resistor closest to GND/R pin. It makes cannot programmed with this ESP32-Cam Programmer. But it solved by removing the additional resistor. Please check this video : https://youtu.be/RgoVah8pPh4

For your concern about voltage level, I will try a new design by adding zener or maybe bidirectional logic level converter between CH340 and the serial lines ESP32-cam. Will let you know the results.

Also thanks for remind me about tindie. I will follow up it soon with current version.

liudr commented 2 years ago

This is just great stuff! I left a detailed comment on your video. Found the why! GND/R was the ESP32 reset pin! Someone heard the complaints!

geraicerdas commented 2 years ago

Thank you for your details analysis. Hahaha.. finally found the why. Besides adding voltage level, I'll trying to add compatibility for both esp32-cam design in the next version. Please let me know, when you have any ideas.

liudr commented 2 years ago

What about disconnecting that top-right GND/R pin from the rest of your ground net so that the GND/R pin is just left alone? This way your low-side power toggle will still reset the board by power-cycling it but won't hold the reset pin low. Like I said in the youtube comment, you'll have to put that tiny shunt resistor back on the board to try.

As for now, you can use a pair of pliers to remove the plastic of the top female header, then use a flush cutter to cut out the fork-shaped pin and then put the plastic female header back on. Indeed if you have more boards of your current revision, you can just use pliers to pull out that female pin before soldering it or tell your buyer about this when they assemble their board. This way your existing programmer will not be connected to that GND/R pin. I checked on my older esp32-cam board. All its GND pins are connected together (as I expected). So not having one of the three GND pins is fine. Let me know if this works. If it does, you can easily modify your future board to be compatible with both old and new esp32-cam.

Hey, now to think about it, why that tindie.com seller from Germany has his boards out of stock, maybe that's when the revision changed and his board stopped working?! Just a wild guess. I found his board and was gonna buy his but it was out of stock and I later found your git repo from a project team member searching for reliable cam programmer boards. It's all a pretty rewarding adventure. We solved a problem together even though physically live on the opposite sides of the globe. I'm in midwest USA BTW.