DIY: Making & Programming Your Own ESP8266 Boards From Scratch

by CLClab306 in Circuits > Microcontrollers

1629 Views, 3 Favorites, 0 Comments

DIY: Making & Programming Your Own ESP8266 Boards From Scratch

Espprogrammer GIF - Find & Share on GIPHY

The ESP8266 is a versatile, inexpensive microcontroller with Wi-Fi capability. I first became interested in this device after reading an Instructable about 7 yrs ago. Since then, I've used it often and I continue to come back to it when creating new IoT devices. Over time, I've purchased many commercially available ESP8266 development boards that vary widely in price (and quality), ranging from $2-3 up to $15. As I became more interested in creating battery operated IoT devices, I discovered that many of the less expensive boards do not work well with 3.7 V Li-ion rechargeable batteries due to their use of voltage regulators with a high "dropout voltage" (i.e., smallest difference between input and output voltages of a regulator needed to maintain output voltage regulation). For example, the 1117-3.3 regulator used on many of the inexpensive NodeMCU clones has a 1 V dropout voltage (at 100 mA), which means the input voltage must be at least 4.3 V. Although such boards work fine from 5 V power sources (like the USB connection to your computer), they will not work reliably with 3.7 V Li-ion batteries by failing to maintain the regulated 3.3V needed by the ESP8266 and the high current needed for Wi-Fi operation. The commercially available boards that do work well with batteries (and actually have battery connectors) are more expensive.

I eventually discovered it was possible to make my own ESP8266 board with a battery-friendly voltage regulator from readily available parts costing about $3. However, since this bare-bones board lacks the built-in circuitry needed to upload program sketches, I also had to design a separate "programmer" board. The Instructable describes how to make your own ESP8266 boards from scratch as well as how to wire a programmer that allows you to easily upload program sketches with the Arduino IDE (2.1). My approach was gleaned from reading dozens of Instructables and other online tutorials from the Maker Community over many years. My intent here is to offer a fresh perspective for Makers who have only recently become interested in using the ESP8266.

This project involves soldering and assumes a general familiarity with using the Arduino IDE for uploading program sketches to microcontrollers like the Arduino Uno.

Supplies

  1. ESP8266-ESP-12F Module ($2.36) or ESP8266-12E Module ($1.80)
  2. ESP8266 Module Adapter Plate for ESP-12 ($0.24)
  3. Two (2) 1 x 8 straight male header (these usually come with Adapter Plate)
  4. 3.3V 600MA Voltage Regulator (AP7215-33YG-13) ($0.51)
  5. FTDI Friend ($14.75)
  6. 5V-1A Power Supply with 8 DC plugs ($7.19)
  7. Adafruit Perma-Proto Half-sized Breadboard PCB ($4.50
  8. 5V 1.5A Voltage Regulator (L7805) ($0.32)
  9. SPST Vertical Slider Switch for PCB (2.54 mm pitch) ($0.09)
  10. One (1) 1 x 6 right-angle male header
  11. Two (2) 1 x 8 straight female header
  12. Two (2) pushbutton switches for PCB ($0.25 each)
  13. Two (2) 330-ohm resistors
  14. Two (2) 10K-ohm resistors
  15. Two (2) 3-mm LEDs (different colors) ($0.07 each)
  16. solid core hookup wire (24 ga); solder; tape; binder clips

Optional. If you have access to a 3D printer and want to mount your programmer board on a 3D-printed base, the following parts are also needed (see Step 3):

  1. [Optional] 5.5mm x 2.1mm DC Power Jack Socket Female Panel Mount Connector ($0.60)
  2. [Optional] Two (2) 3/8" 4/40 screws
  3. [Optional] PLA filament

Tools

Tools used for this project are listed below.

  1. soldering iron with pencil tip
  2. wire stripper
  3. wire cutter
  4. needle nose pliers
  5. multimeter

Optional:

  1. 3D printer
  2. 4/40 tap & tap wrench

Solder ESP8266 Board

1.ESP.parts.jpeg
2.Remove_jumper.jpeg
3.Regulator_Taped.jpeg
4.Regulator_soldered#1.jpeg
5.Back_Final.jpeg
6.Clamped_ESP.jpeg
Holder_ESP.jpeg
7.ESP_Solder.jpeg
Holder-solder.jpeg
Headers_breadboard.jpeg
8.Solder_Header.jpeg
ESP final.jpeg
9.ESP_Final.jpeg

The parts needed for creating the ESP8266 circuit board are shown in the first picture: the ESP 8266 module, the 3.3 V voltage regulator, the adapter plate and two (2) 1 x 8 straight male headers (clockwise from right). It took some trial and error to find a really good 3.3 V regulator for the adapter plate so I strongly recommend using the one listed in the Supplies list. This regulator (AP7215-33YG-13) has a very low dropout voltage (about 0.4 V at 400 mA), which means it can efficiently provide a well-regulated 3.3 V output from a 3.7 V li ion battery or a 5 to 5.5 V power source. Importantly, it consumes very little current and provides up to 600 mA output at 3.3V. Initially, I tried some other 3.3 V regulators that provided adequate current for offline functions, but they became less reliable when Wi-Fi was on.

  1. Remove the R2 jumper from the adapter board: There are 3 surface mounted components at the bottom of the front side of the adapter board labeled R1, R2 and R3. R1 and R3 are 10 K ohm resistors. However, R2 is simply a 0-ohm jumper that allows voltage connected to the Vcc pin on the adapter plate to go directly to the Vcc pin on the ESP8266, bypassing the voltage regulator solder pads on the backside of the adapter plate. Since we want to attach a voltage regulator to the backside, the R2 jumper must be removed, thereby inserting the regulator in the circuit between the Vcc pin on the adapter plate and the Vcc pin on the ESP8266. Remove R2 from the adapter by using the needle nose pliers to scrape away the black part between the solder pads (see picture). Then, use the hot tip of your soldering iron to clear away anything left on the solder pads, making sure there is no connection between the two pads.
  2. Tape the 3.3 V regulator over the solder pads on the back of the adapter: Use a piece of masking or artist's tape to position the regulator over the solder pads as shown in the picture. The middle leg should be centered over the middle solder pad, but leaving some of the solder pad visible below that leg. The outer legs will barely reach the inner edge of the outer solder pads.
  3. Solder the 3 regulator legs to the adapter: Carefully place the hot tip of the soldering iron so that it makes simultaneous contact with the bottom of the middle leg and solder pad. Then, touch your solder to the middle leg and allow the heat of the leg to melt the solder, covering both the leg and the solder pad. Repeat this process for the outer legs, touching the hot tip of your iron to the solder pads and outer sides of the legs. The picture shows the soldered connections for all 3 legs. Remove the tape and solder the tab at the top of the regulator to the solder pad below it (see picture).
  4. Solder ESP8266 to adapter: First step is to temporarily secure the ESP8266 so that its castellated mounting holes are properly aligned with the solder pads on the adapter board. I've done this two different ways. One way uses binder clips (see picture) and the other way uses a simple 3D-printed holder designed with Fusion 360 (see picture--download the STL file below). Working from the side, place the tip of your hot iron so that it touches both the solder pad and the inner wall of the adjacent mounting hole.Touching solder to the top of the heated mounting hole should result in solder flowing over the hole and soldering pad as shown in the pictures. Once you've made a few solder connections, you'll be able to move the binder clips or 3D-printed holder around so that you can access and solder all 16 of the mounting holes. A more thorough tutorial on soldering castellated mounting holes can be found here.
  5. Solder the adapter plate to the 1 x 8 male header pins: To keep the headers correctly spaced and perpendicular to the adapter plate, insert the headers into a breadboard, leaving 8 empty rows between each header (see picture). Place the adapter plate over the headers and solder each of the 16 header pins to the adapter (see picture). The last two pictures show the ESP8266 fully soldered to the adapter board. At this point, it's a good idea to to check for continuity between each ESP8266 pin and its associated header pin using an ohmmeter to make sure all of your solder connections are good.

Assuming all the solder connections are good, you now have an ESP8266 board that is ready to be programmed using the programmer and Arduino IDE (Step 4).

Downloads

Wire the Programmer

Programmer_Parts.jpeg
Schematic.jpg
ProtoBoard.jpg
Parts_soldered.jpeg
power_wires.jpeg
Final.noBase.jpeg
ESP8266_ProgrammerBase v2.png
Final.base.jpeg

The first picture shows the parts used in this step. Starting clockwise from the bottom, these parts include: 330- and 10K-ohm resistors, LEDs, 7805 voltage regulator, (optional) panel mount power jack connector, pushbutton switches, slide switch, and 1 x 8 female headers. The Adafruit PCB is shown in the center.

The second and third pictures show the overall circuit diagram and a wiring diagram for the Adafruit PCB, respectively. The suggested steps for wiring the PCB are as follows:

  1. Solder all of the parts to the PCB in the locations shown in the wiring diagram (see picture). The black rectangles in the diagram indicate where each part should be placed. The green connections show placement of the LEDs, with the arrows pointing toward the cathode (typically indicated by a shorter lead and flat flange at the base of the LED). The orange connections show placement of the 330-ohm resistors whereas the yellow connections show placement of the 10K-ohm resistors. The picture shows yellow heat shrink over the longer legs of the 10K resistors. Note that the 7805 regulator is bent over to allow clearance for the top of the ESP8266 adapter card when it is inserted in the 1 x 8 headers.
  2. Solder all of the power connections (i.e., black and red wires) shown in the wiring diagram (see picture). Note that the bent voltage regulator in the picture covers two of the power connections shown in the wiring diagram.
  3. Solder all of the remaining connections (i.e., blue wires) shown in the wiring diagram (see picture).

If you do not plan to mount the PCB on a 3D-printed base:

  1. Attach the red and black power wires to a DC Barrel Jack to 2-Pin Terminal Block Adapter. This adapter is included with the 5-V power supply in the Supplies list above or it can be purchased separately (see picture).
  2. To protect the solder connections on the back of the board (and to prevent scratching your desktop), attach the programmer to a piece of cardboard or block of wood, or simply cover the back of the board with electrical or duct tape.

If you plan to mount the PCB on a 3D-printed base (see picture):

  1. Download and print the STL file for the base (see below).
  2. Use the tap wrench and 4/40 tap to cut threads in the holes in the 3D-printed base.
  3. Solder the red and black power wires to the 5.5mm x 2.1mm DC Power Jack Socket Female Panel Mount Connector.
  4. Attach panel mount connector to the base (see picture).
  5. Attach PCB to the base with 4/40 screws.

Upload a Sketch to the ESP8266 Using the Programmer

Espprogrammer GIF - Find & Share on GIPHY

This step is included to provide a quick check that the ESP8266 Board and Programmer are operating as expected. In addition to downloading the Arduino IDE 2.1 to your computer, you will need to install the files for controlling ESP8266 boards using the IDE's Boards Manager.

  1. Download/Install Arduino IDE: HERE and install on your computer (Windows or Mac OS).
  2. Install ESP8266 Boards Manager: Open the IDE and click on the Boards Manager icon (just below the folder icon in the left column). Search for and install ESP8266 Boards (3.02).
  3. Download/Open Triple_Blink sketch: Download Triple_Blink.ino (see below) and open it by double-clicking on the sketch file icon. You may need to add the suffix to the filename after downloading. The first time you try to open the .ino file, the IDE will ask you to put this sketch in a folder, which you should do.
  4. Attach FTDI Friend to the right-angle header on the Programmer.
  5. Connect FTDI Friend to your computer with USB cable.
  6. Connect 5 to 12V power supply to the 2-pin terminal adapter or the panel power connector.
  7. Push Slide Switch toward the ESP8266 to turn on power. The ESP8266's built-in LED will blink briefly when power is turned on.
  8. Select Board and Port: Click the downward caret to open the dropdown menu on the IDE menu bar, then click "Select other board and port...". Select "Generic ESP8266 Module" and the appropriate USB port in the pop-up menu. Click OK when finished.
  9. Verify sketch to check for errors: Click the "Verify" icon in the IDE menu bar. The IDE will then attempt to compile the sketch, which should result in no error messages. Correct any errors before continuing.
  10. While holding Flash Button down, press and release Reset Button. Then, release the Flash Button. At this point, the LED closest to the Reset button should be turned on, indicating that the Programmer is ready to upload a program sketch.
  11. Upload sketch from computer to ESP8266: Click on the "Upload" icon in the IDE menu bar. The IDE will compile the sketch again and upload the compiled code to the ESP8266 via the FTDI Friend.
  12. Press Reset Button to begin program. The Triple_Blink sketch will blink the two LEDs on the Programmer as well as the ESP8266's built-in LED at different rates (see animation)..

Downloads

Final Thoughts

StackingHeader.jpeg

The DIY ESP8266 boards described here can be used for a wide variety of IoT projects, including those powered by rechargeable 3.7V li-ion batteries. By soldering 1 x 8 stacking female headers to the adapter board instead of 1 x 8 male header pins (see picture), it is also possible to use the board and programmer in conjunction with standard breadboards during project and program development. For example, male breadboard jumper wires can be use to connect GPIO pins on the ESP8266 (via the stacking header) to input or output components located on the breadboard. Moreover, with the FTDI Friend connected to your computer, the Serial Monitor in the Arduino IDE can be used for program debugging.

I've incorporated these DIY boards into my IoT projects in two different ways. One way is to create a project-specific PCB using 1 x 8 female headers for the ESP8266 board, just like the Programmer board. The other way involves simply connecting the male header pins on the adapter plate to external components using breadboard jumper wires. One advantage to using a PCB with female headers is that it's quite easy to temporarily remove the ESP8266 board from my project PCB and insert it in the Programmer for editing or updating program sketches.

I really like using the ESP8266 because I can scratch my DIY itch by making my own ESP8266 board from scratch. There’s something I find especially satisfying about creating an IoT project entirely from a pile of parts.