Maker.io main logo

Use an Arduino IDE to Breadboard and Program an ESP

2017-10-09 | By All About Circuits

License: See Original Project Arduino

Courtesy of All About Circuits

ESP8266 Microcontroller/Wi-Fi Integrated Circuit

The ESP8266 is a popular microcontroller used by both professional designers and hobbyists. It consists of a 32-bit RISC processor along with what usually comes with a full-featured µC, and also a built-in 802.11 b/g/n Wi-Fi circuit that is ready to be connected directly to an antenna. Currently, it is only available in a 32-pin QFN package and there is only one IC in the family.

Espressif, located in Shanghai, China, chose to take full advantage of the efficiency of scaling the ESP8266 to be used on a variety of PCB assemblies.

There are currently around a dozen ESP PCB modules that differ in antenna styles and the number of available I/Os. Because ESP8266’s QFN package works with these modules, many users will appreciate that decision. Market prices for the ESP-01 start at less than $5USD. The ESP-01 can be seen in Figure 1 below.

The ESP-01

An ESP8266 community support forum exists and provides a plethora of ideas and information. Documentation was originally only available in Chinese, so application information can still be difficult to find. While there are some aftermarket suppliers selling development platforms and accessories, most DIY projects operate in "trial and error" mode. Trial and error works because, as you will soon see, it isn’t hard to get an ESP8266 working on a solderless breadboard.

Programming Options

Many of the ESP8266 modules are loaded with AT firmware, making the programming with a simple terminal program possible. This could be all you need to do if your plan is to use the module primarily for its Wi-Fi capabilities and controlling it with another µC.

Another more sophisticated option can be found at NodeLua. NodeLua offers open source firmware based on the Lua programming language, which is still in development but offers extensive capabilities. Other options are Python, BASIC, and the Arduino IDE. In this project, we will use the Arduino IDE.

ESP-01 Ins and Outs

Each ESP-01 module has the ESP8266 MCU and a flash memory chip. The modules also have two LEDs. The red LED indicates the power to the module is connected and a blue LED indicates data flow. The blue LED can also be controlled by user programming. The Wi-Fi antenna is a Meandered Inverted-F Antenna (MIFA). It is the PCB trace that covers the top of the ESP-01 and is efficient and only mildly directional.

Eight Connection Pads Near the Bottom of the ESP-01

The figure above shows the eight connection pads near the bottom of the ESP-01 and identifies their functions. Generally, two 4-pin male headers are inserted in the rear of the module and soldered on the front. While doing this makes the I/Os accessible, it does not make them breadboard-ready and it requires flywires from the module to the solderless breadboard. An alternative to this messy technique is shown below.

 Right Angle Pins and Extra Long Pins

Right angle pins are used for the header on the front of the PCB and no modifications are required. Extra long pins are used on the header on the rear and they have been bent in a right angle configuration to accomplish .3" of separation between the rows. This method allows the ESP-01 to be inserted in a solderless breadboard in the vertical orientation straddling the center gap, and makes all eight pins independently accessible.

Connecting Everything Together

The connections required to the ESP-01 can be seen in the schematic diagram below, and each picture below shows how the completed solderless breadboard assembly should look. The wire colors in the schematic match the wire colors in the pictures to keep things clear.

Assemble everything as shown, but wait to connect the cable from the USB to TTL convertor to the PC until the shunt on the converter PCB is set to the 3.3 V position and all wiring has been double checked. Note that using 5 V to power the ESP-01 module has the potential to damage it beyond repair.

ESP-01 Connection Diagram

 ESP-01 Solderless Breadboard Setup (Top View)

ESP-01 Solderless Breadboard Setup (Front View)

ESP-01 Solderless Breadboard Setup (Rear View)

The above schematic diagram and pictures should provide the majority of the information required to assemble the solderless breadboard setup, but here are some notes to help:

The USB to TTL converter seen in the pictures uses an FTDI 232 UART chip and works with a variety of operating systems including Windows, Mac, and Linux. This converter also provides the correct 3.3 VDC power source for the ESP-01. Again, double check that the shunt on the converter PCB is set to output 3.3 V. Checking the settings will save the ESP-01 from high voltage damage.

  • No matter what USB to TTL converter is chosen, it needs to be installed and tested before it is used with the ESP-01 breadboard setup.
  • The current needed for the ESP-01 during Wi-Fi operation has estimates that vary from 250 mA to 750 mA. The USB to TTl converter’s current should work for programming the ESP-01, but may be inadequate for long-term use. A filtered regulated 3.3VDC supply capable of 1A or more is a safer choice.
  • The DTR and CTS leads from the USB to TTL converter are not required so they are not connected.
  • The two switches shown are normally open (NO) single pole momentary contact pushbuttons.
  •  There are two schools of thought for the ESP-01 when it comes to whether CH_PD should be connected directly to +3.3V or connected through a 10k pull-up resistor. Both method work and have information backing their success. After you build and test the initial circuit as shown above with CH_PD connected directly to +3.3V, try using the 10k resistor connection. If the 10k pull-up resistor connection works, leave it in the circuit.

The use of fly wires from the USB to TTL converter (as seen in the pictures above) is not the best solution. Another option available is replacing the six right angle pins on the converter along with the six straight pins on the bottom of the PCB. This modification allows the USB to TTL converter to be plugged into the solderless breadboard, which results in a neater, less fragile assembly. You can see this modification in action in the picture below.

ESP-01 Solderless Breadboard Alternate Setup (Top)

Power it Up!

Before you connect the USB to TTL converter to you PC, you need to check a few things. First, check that the voltage selection shunt is at the 3.3V position. Second, make sure all the wiring on the ESP-01 breat setup is correct and secure. After those things are double checked, plug the USB cable. Once it’s plugged in, the red LED on the ESP-01 will light up and stay on. You should see the blue LED flicker whenever signals are passing between the EXP-01 and your PC. Now, you need to test the reset button simply by holding it down. Keep an eye on the blue LED. It should flash twice when you release the reset switch. If that works, you can disconnect the circuit from your PC and move on to the next section!

Arduino IDE

For ESP8266 modules, it is recommended you use version 1.6.5 of Arduino IDE. You can always see if an old version works but if it doesn’t, upgrading to 1.6.5 is quick and painless.

  • With the Arduino IDE version 1.6.5 is installed, you can start up the program. Click File, go to preference, and find the Additional Board Manager URLs entry box. Enter the following URL: http://arduino.esp8266.com/stable/package_esp8266com_index.json and click ok.
  • Click Tools, Board Manager, and scroll to find “esp8266 by ESP8266 Community.” Once you find this entry, click Install. The installation process will take a few minutes. When the installation is complete, click Close.
  • Click Tools, highlight Board Selector, and select “Generic ESP8266 Module.”
  • Click Tools again and make sure that you did, indeed select the Generic ESP8266 Module.
  • Click File, Examples, scroll to ESP8266WiFi and select WiFiScan. Another window will open with the WifiScan sketch.

Connect your circuit to your PC and double check that it is connected by confirming the red LED on the ESP-01 is lit. Click Tools, Port, and select the port the ESP-01 is connected to. Now you are ready to program!

Next, press and hold the Reset button and then the Flash button so you are holding both buttons down. Release the Reset button and, while you are still holding the Flash button down, click the Upload arrow in the Arduino IDE. It should take about a minute for the sketch to compile and once it is down, you can release the Flash button. Your compiled code will now send to the ESP-01 module. While it’s sending, you can see the blue LED flicker on the ESP-01.

To view the progress from the previous steps, click Tools, Serial Monitor, and in the lower right corner of the Serial Monitor window set the baud rate to 115200. The baud rate on earlier versions of the ESP-01 is most likely 9600.

You should see the ESP-01 scanning for Wi-Fi networks and results are reported in the Serial Monitor window. You can see what this looks like in the image below.

Serial Monitor Window

The report should include your own network, along with any network in range of the ESP-01. The numbers in parentheses show the signal strength of each network. Because the number is negative, the lower the number the stronger the signal.

Conclusion

By learning to program the ESP8266 with the Arduino IDE, you expand your ability to use these Wi-Fi enabled chips. One of the most attractive features of the ESP-01 and its cousins is the capability of the hardware platform at a low cost. Once you include the Arduino IDE, designing a variety of applications is available to users.

制造商零件编号 2680
KIT FEATHR HUZZAH W/ESP8266 WIFI
Adafruit Industries LLC
制造商零件编号 2491
RF TXRX MOD WIFI TH SMD
Adafruit Industries LLC
制造商零件编号 2821
ESP8266 FEATHER HUZZAH LOOSE HDR
Adafruit Industries LLC
制造商零件编号 3213
ESP8266 FEATHER HUZZAH STACK HDR
Adafruit Industries LLC
制造商零件编号 3046
ESP8266 FEATHER HUZZAH FIXED HDR
Adafruit Industries LLC
Add all DigiKey Parts to Cart
TechForum

Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.

Visit TechForum