A Comprehensive Guide in Designing a Minimalist ESP8266 Board

The ESP8266 Wi-Fi module has gained tremendous popularity over the last three years because of its compact size, affordability, and its compatibility with the Arduino software. Though it has many variants-i.e., from ESP-01 to ESP-14, all have the same general functionalities.

What makes it so appealing is that it could be used as a slave (for handling the wireless connection) to a main controller (like an Arduino) or as a standalone controller itself. Because it has a small footprint and is relatively cheap, one may find it convenient to use it for stand-alone embedded systems.

What we will be presenting in this article is the bare minimum, though self-contained, design of an ESP8266 controller using the ESP-12E version, to be specific. The difference between it and the ESP-12 is that the ESP-12E variant has SPI interface pins at the bottom which offers more option for the user.

Step 1: Supply adequate power

A mini buck regulator

Though the ESP8266 runs on +3.3 V (LVTTL), it is not a low power device. It could draw up to 300 mA of current during wireless transmission. And since we commonly use TTL/CMOS interfaces with main DC supplies at +5 V, a voltage regulator would be required to power the ESP. You could either use a small form factor buck regulator or an LDO.

Just make sure it could handle the current. The most common mistake people do is to get power from the +3.3 V pin of the Arduino board which could only handle 150 mA at most. Never get power also from the +5 V of the Arduino board to be connected to the input of the voltage regulator. It can only supply up to 850 mA. That is the point where all the problems start to show up through your code seems to be flawless. It is better to have a dedicated power supply with high amperage capability.

Step 2: Put a dedicated programming port

An FTDI USB-UART adapter

The ESP can be programmed either “over-the-air” (aka OTA) if configured as an access point or through serial. The most common though is to use the latter with the help of a USB-UART adapter. This converts the USB data into Serial TTL and vice-versa.

To program the ESP, you need to connect the RX, TX, VCC, and GND pins of the adapter to the ESP. However, if the ESP is still powered externally, then don’t connect VCC anymore. And before it can be programmed, there are a few hardware configurations to be made first.

ESP8266 Programming Guide

Shown above is a guide from the datasheet that I always attach to my CAD software every time I design ESP boards. But you can forget about this and just make sure that the CH_PD pin is connected to VCC = +3.3V and the GPIO0 is connected to GND during program mode.

Once the programming is done, just remove the GPIO0 from being grounded so you could run your program. Since this programming method is wired and needs to be physically invasive, in contrast with OTA which can be done remotely and wirelessly, it is rather a rigorous process. To at least lessen the burden during programming, we’ll share to you a hack that we have formulated.

Instead of manually connecting the GPIO0 pin to the ground during programming, let’s use a MOSFET to automatically pull that pin to ground every time an adapter is inserted in the programming port.

ESP8266 programming port

What this does is that the +5 V (or you can use the +3.3 V also) of the adapter will give enough potential difference at the gate which would then enhance the MOSFET channel and does allows the GPIO0 pin connected at the drain to be pulled to the source, which is connected to ground.

This method works every time. Just put a pull-down resistor between the gate and the ground to ensure the gate won’t float and will always be grounded when no adapter is inserted. A 10k value is very common in digital circuits since it is neither too strong nor too weak to be used as pull-up or pull-down.

It is has a good balance between having less current drawn and not being large enough (the impedance generally but the resistance is very much greater than the gate-to-source capacitance) where a noise voltage (proportional to resistance) will become an issue.

To add also, the FTDI adapter doesn’t need a driver to be installed on your PC unlike the cheap brands from China i.e., CH340G, CP2102, and PL2303HX modules to name a few. What we look for is that it must have at least a DTR (Data Terminal Ready control signal) pin so we could use it for stand-alone Arduino boards. This will to automatically reset the MCU during flashing of firmware.

Using header pins for programming may not last longer than you would expect. Plus there is a danger of connecting it reversely. To remedy this, use a mini USB B connector since it also has four connections. Choose the through-hole one for more rigidity.

USB connector used for serial programming

Step 3: Add custom functionalities

The modifications above are the basic requirements for the ESP. At this point, you may now add connectors or components for your specific application, like an LED or relay driver for example. Just don’t forget to put an isolation between sensitive analog signals or high voltage tracks and the main ESP circuitry.

Wrapping it up

So that’s all we can share for now. Basically all of these talks about the hardware. Maybe in the future, we will write another article on the basics of ESP8266 programming using either the Arduino software or Python.

So what do you think of this project? Leave your comments below!

Leave a Reply

Your email address will not be published. Required fields are marked *