If you think I keep insisting on ESP8266/ESP32 modules... I guess I'm guilty. Surprisingly, these microcontrollers are an excellent starting point for anyone looking to dip their toes into the waters of DIY, Arduino code, and other compatible languages. There are many ways to program an ESP32, but today we decided to return to the channel of atomic14 who teaches us the bare minimum in terms of components...
I imagine someone must be thinking: “Lisandro, this doesn't make sense” Why follow that path when an ESP32 module with its own voltage regulator, reset buttons, soldered pins, and micro USB port costs less than 10 euros on Amazon? The answer is none other than “learning”. Yes, a ready-to-use ESP32 module will take you to a good port easily, but one day you'll have to extract it from another product, or your USB-to-serial adapter will fail without warning. Knowing the pinout and internal functions of any ESP / Arduino / ATtiny / STM32 module is always a good idea, and the latest video from “atomic14” points in that direction.
Programming an ESP32 Module with Minimal Components
The first thing to mention about the tutorial is that it only works with the models ESP32-S2 and ESP32-S3. The reason is simple: these are the only members of the ESP family that come with USB-OTG support (all others require an adapter). At the same time, we shouldn't lose sight of the fact that the ESP32 works at 3.3V, and any attempt to connect it directly to 5V will light it up like a Christmas tree... before destroying it. So, what exactly do we need?
- A 3.3V source (battery, adapter, your choice), connected to the corresponding pin (3v3 = +) and to one of the GND (-)
- The Enable pin, connected to 3.3V to set it to 'high'
- IO19 is 'Data -' of the USB port, while IO20 is 'Data +'
- IO0 must be connected to GND the first time we program the ESP32. It wouldn't be a bad idea to use a button here.
- The LED on IO2 and its resistor are optional, but very useful to check that everything works.
- And of course, any relevant driver for Windows (if you use it), accompanied by a compatible IDE (Arduino IDE, PlatformIO, etc.)
To finish, I'd like to add a detail that is barely mentioned in the video by atomic14: Many users report connectivity problems on some ESP32 modules, with the message “A fatal error occurred: Failed to connect to ESP32”. The YouTuber VoltLog suggests that this is due to an error caused by the jump of the Enable signal, which modifies the condition of IO0. The solution is to add a 1 microfarad capacitor between the Enable pin and GND. This makes Enable a bit slower and prevents the error from triggering.