Introduction: Ultimate ESP8266-01 Programmer & USB Adapter
Hi folks,
have you heard of the REAL capabilities of the small and inexpensive ESP8266-01 module? It was launched on the market saying that it should be your choice if you want to add IOT capabilities to your project. Actually this small module could BE YOUR PROJECT, not only a communication device.
It could became a wifi-repeater, very useful. It could be a "funny" tool to mess with your friends' wifi, disconnecting their devices or creating dozens of fake networks (please don't be a lamer and keep the things funny, not to mention legal). It can be plugged to a relay module, becoming an IOT actuator, or it can be plugged to a sensor module, becoming an IOT sensor.
I'm testing these stuffs and i'll probably publish further tutorials because i'm really surprised of the huge potential.
Stay tuned for more to come, today's tutorial is all about the programmer (mandatoriy to easily test all the different softwares).
Step 1: Components & Materials
Unluckily the ESP8266-01 is NOT breboard friendly, and it's quite annoying and time consuming to disconnect/reconnect wires everytime you want to change something. Nevermind, there's a really cheap usb-serial converter designed to power and connect the ESP to your PC.
How can it flash the ESP? Well, actually, it can't... (⊙_☉)
Embarassing, isn't it? The original one is... quite a nonsense. They then made a second version, with a slider switch, to allow the ESP to be set in flashing mode. I guess they thought that -for some reasons- the standard ESP user needed to have the device set in flash mode for a really long time, not only to flash the new firmware (FW). If you forget to switch back on not-flashing mode after you've plugged in the USB, you'd have to unplug and replug it to let it run the code. They then made a third version with a simple momentary pushbutton. Good idea! It seems to be small and difficult to press button, especially with the ESP module on top, but whatever... What bothers me is that, apparently, they thought the standard ESP-01 user is on a desperately low budget and he can't afford a second momentary button to reboot -in place- the MCU (the ESP's processor). Any reasonable people would do that, since it likely costs a single $cent. Nope... They decided that if you want to reboot the MCU, MAYBE to set it in flash mode, you have to unplug and replug the USB.
Are you kidding me? (ಠ_ಠ)
Come on, we aren't that poor! We would have spent that additional $cent! Why can't you copy this, this, this or this design and let us live happy??? (ノ☉ヮ☉)ノ
Fear not, if we can't buy the smart programmer we can still build the definitive ESP-01 programmer, with just two pcb button and two wires!
Adding a nice 3D printed case we can evolve the dumb first-version programmer into a nice and really comfortable device. The case is designed for the "basic" (cheapest) USB programmer and for the classic 6x6mm pcb pushbuttons, aka tactile push buttons. If you look carefully you can see that i'm using different buttons in different photos. That's simply because i've decided to use buttons with longer shaft, that's only for my comfort. Every button works fine.
Now, links (affiliated, btw):
ESP8266-01: Bangood, Amazon, Amazon.
ESP8266-01 programmer: Bangood, Amazon, Amazon.
Buttons: Bangood, Amazon, Amazon.
You'll only need minimal soldering tools, if you think you are missing something you can look here.
Step 2: Wiring and Assembly
That's easy: download this file, fire up your 3D printer, load any material you like (i recommend PLA for better tolerances) and start the print.
Now, the wiring. Solder two cables on the GND pin, one cable on the RST one and the last one on the Gpio0 pin.
These wires must be cut to measure (approx.) and soldered to the pushbuttons pins. Choose two pins on the same side, usually the pins on the opposite side of the button are bridged so you'll create a simple always-closed connection. Don't worry, if you choose the wrong one you won't damage anything. A continuity measure made with a multimeter can surely sort out which pins are the right ones. Put few drops of hot glue on the exposed button pins, to avoid any risk of short circuit. Then glue the buttons in place, be careful not to drop glue INSIDE the buttons because otherwise they won't work anymore. I've used some hot glue from the inside, to keep them in place, and some strong glue from the outside.
Now, if you are confident in your soldering skills, you can directly proceed to glue the case, but i'd perform a little flashing test in advance (read the next step).
To glue the case you need some kind of strong glue, epoxy are fine, i've use cyanoacrilate glue (the same i've used to cement the buttons).
Step 3: How to Use It
Just plug the USB programmer in and install the drivers, the programmers uses the CH340 serial chip, there are many tutorials about that (for windows).
The usage is simple, one button resets the MCU, the other one set the MCU in flash mode if kept pressed during the MCU (re)boot.
- Do you want to reboot your project? Push the reset button.
- Do you want to upload a modified firmware? Keep the flash button pressed, push & release the reset button, release the flash button. The MCU will be ready to have some code uploaded and after that it will run the code.
Whichever firmware you want to upload, whichever software you'd like to use to upload it, you'll have a proper COM port to use as target and a nice plug&play physical connector for the ESP and you don't need to mess with cables and you don't need to harass the USB for no reason. Oh, finally!
I'll write separate tutorial to show some useful firmwares for this tiny wifi device, the upload software toolchain and their configuration aren't trivial, this -ible is for the programmer. Stay Tuned!