ESP8266 microcontroller: connection and setup

Many users have already managed to turn their attention to the ESP8266-12 chip released by Espressif. Its cost is much cheaper compared to the standard board of the Bluetooth adapter, and even with smaller dimensions it has much wider capabilities. Now all home lovers have the opportunity to work on a Wi-Fi network in two modes at once, that is, connect your computer to any access points or turn it on as such a point.

On the other hand, you need to correctly understand that such boards are not just shields designed only for Wi-Fi communication. By itself, the ESP8266 is a microcontroller that has its own UART, GPIO and SPI interfaces, that is, it can be used as a completely autonomous equipment. After the release of this chip, many called it a real revolution, and over time, such devices will begin to be built into even the simplest types of equipment, but so far the device is relatively new and there is no stable firmware on it. Many experts around the world are trying to invent their own firmware, because uploading them to the board is not really difficult, but despite various difficulties, the device can now be called quite suitable for work.

At the moment, only two options for using this module are considered:

  • Using the board in combination with an additional microcontroller or a computer that will control the module via UART.
  • Self-writing firmware for the chip, which then allows you to use it as a self-contained device.

It is natural that we will not consider independent firmware in this case.

Looking at usability and good features, many people among the many microcontrollers give their preference to the model ESP8266. Connecting and updating the firmware of this device is extremely simple and affordable, and is done on the same hardware on which the equipment is connected to the computer. That is, also through a USB-TTL converter, or if someone prefers other connection options, it can be done via RPi and Arduino.

How to check?

esp8266 firmware

In order to check the operability of the device you just bought, you will need to use a special source of stabilized voltage, designed for 3.3 volts. It is immediately worth noting that the real supply voltage range of this module is from 3 to 3.6 volts, and applying an increased voltage will immediately lead to the fact that you simply disable your ESP8266. Firmware and other software after a similar situation may start to work incorrectly, and you will need to repair the device or somehow fix it.

To determine the performance of this microcontroller model, you just need to connect three pins:

  • CH_PD and VCC are powered by 3.3 volts.
  • GND connects to earth.

If you are using not some ESP-01, but some other module, and the GPIO15 output is already present on it, then in this case you will need to be additionally connected to the ground.

If the factory firmware started normally, then in this case you can see the red LED, and then the blue blinks a couple of times. However, it is worth noting that not all ESP8266 series devices have a red power indicator. The firmware on some devices does not provide for the red indicator to light up if it is not in the module (in particular, this applies to the ESP-12 model).

After connecting to your wireless network, a new access point is activated, which will be called ESP_XXXX, and it can be detected from any device that has Wi-Fi access. In this case, the name of the access point directly depends on the manufacturer of the firmware you are using, and therefore may be some other.

If the dot really appears, you can continue the experiments, otherwise you will need to re-check the power, as well as the correct connection of GND and CH_PD, and if everything is connected correctly, then most likely you are still trying to use a broken module or it simply installed firmware with non-standard settings.

How to connect it quickly?

arduino ide

The standard kit required to connect this module includes the following:

  • the module itself;
  • solderless breadboard;
  • a complete set of wires for mom-dad, designed for a breadboard, or a special cable DUPONT MF;
  • USB-TTL converter based on PL2303, FTDI or some similar chip. The best option is if RTS and DTR are also output to the USB-TTL adapter, since this allows you to achieve fairly fast firmware downloads from some UDK, Arduino IDE or Sming, without even having to manually switch GPIO0 to ground.

If you use a 5-volt converter, then in this case you will need to purchase an additional power stabilizer based on the 1117 chip or some similar one, as well as a power source (for standard 1117 even ordinary charging from a smartphone with 5 volts is quite good). It is recommended not to use the Arduino IDE or USB-TTL as a power source for the ESP8266, but to use a separate one, as this can eliminate the end of a lot of problems.

An expanded set to ensure comfortable and continuous operation with the module requires the use of additional power connectors, resistors, LEDs and DIP switches. In addition, you can also use an inexpensive USB monitor, which allows you to constantly monitor the amount of current consumed, as well as provide little protection for the USB bus from a short circuit.

What do we have to do?

First of all, it is worth noting that in the ESP8266 control can be slightly different depending on which particular model you are using. There are a lot of such modules presented today, and the first thing that will be needed is to identify the model you are using and determine its pinout. In this manual, we will talk about working with the ESP8266 ESP-01 V090 module, and if you are using some other model with the output pin GPIO15 (HSPICS, MTDO), you will need to pull it to the ground for both the standard start of the module and to use the firmware mode.

After this, double-check that the supply voltage for the connected module is 3.3 volts. As mentioned above, the permissible range is from 3 to 3.6 volts, and in case of increase the device fails, but the supply voltage can even be significantly lower than 3 volts, which are stated in the documents.

If you use a USB-TTL converter at 3.3 volts, then in this case, connect the module in the same way as on the left side of the picture below. If you use exclusively five-volt USB-TTL, then pay attention to the right side of the figure. It may seem to many that the right circuit is more efficient due to the fact that it uses a separate power source, but in fact, if you use a USB-TTL 5-volt converter, it is highly advisable to also make an additional divider on the resistors to ensure matching of three-volt and five-volt levels of logic, or just use the level conversion module.

Connection Features

esp8266 module

In the right figure, there is a connection of UTXD (TX), as well as URXD (RX) of this module to the five-volt TTL logic, and such procedures are carried out only at your own peril and risk. To ESP8266, the description suggests that the module only works effectively with 3.3-volt logic. In the overwhelming majority of cases, even in the case of working with five-volt logic, the equipment does not fail, but occasionally such situations occur, so such a connection is not recommended.

If you do not have the opportunity to use a specialized USB-TTL converter for 3.3 volts, you can use a divider on the resistors. It is also worth noting that in the right figure, the 1117 power regulator is connected without additional strapping, and this is really a working technology, but still it is best to use the 1117 connection circuit with a capacitor strapping - you need to check it with the ESP8266 datasheet on your stabilizer or use a completely ready module based on 1117.

To start the module, you need to break the GPIO0-TND circuit, after which you can supply power. It should be noted that everything needs to be done in this order, that is, first make sure that GPIO0 is "hanging in the air", and only then apply power to CH_PD and VCC.

How to connect correctly?

esp8266 arduino

If you can take more than one evening to properly connect the ESP8266 module, you can use a more stable option. In the diagram above, you see a connection option with automatic firmware download.

It is worth noting that the use of free GPIO or ADC is not shown in the image above, and their connection will directly depend on what exactly you want to implement, but if you want to ensure stability, do not forget to draw all the GPIO to power, and ADC to ground using pull-up resistors.

Resistors at 10k, if necessary, can be replaced with any others in the range from 4.7k to 50k, excluding GPIO15, since its nominal value should be no more than 10k. The value of the capacitor, smoothing the high-frequency ripple, may be slightly different.

The connection of RESET and GPIO16 through the use of a 470 ohm deep sleep resistor may become necessary when using the appropriate mode, since in order to exit the deep sleep mode, the module performs a complete reboot by supplying a low level to GPIO16. In the absence of this connection, the deep sleep mode for your module will last forever.

At first glance, it might seem that GPIO0, GPIO1 (TX), GPIO2, GPIO3 (RX), and GPIO15 are busy, so you can’t use them for your own purposes, but in reality this is far from the case. A sufficiently high level on GPIO0 and GPIO2, as well as a low level on GPIO15, may be required only for the initial launch of the module, and later on you can use them at your discretion. The only thing worth noting is do not forget to provide the necessary levels before performing a complete reboot of your equipment.

You can also use TX, RX as an alternative to GPIO1 and GPIO3, but do not forget that after the start of the module, each firmware starts to “twitch” TX, while simultaneously sending debugging information to UART0 at a speed of 74480, but after a successful download will be carried out, they can be used not only as UART0 in order to exchange data with another device, but also as standard GPIOs.

For modules that have a small number of diluted pins (for example, ESP-01), you do not need to connect undiluted pins, that is, only ESP-01 is wired: GND, CH_PD, VCC, GPIO0, GPIO2 and RESET, and these are for you will need to be pulled up. There is no need to solder directly to the ESP8266EX, and then pull undiluted pins, if you really need to.

Such connection schemes were used after a large number of experiments conducted by qualified specialists and collected from many different information. It is worth noting that even such schemes cannot be considered ideal, since a number of other, equally effective options can be used.

Connection via Arduino

If for some reason you did not have a 3.3-volt USB-TTL converter, then in this case, the WiFi ESP8266 module can be connected via Arduino with a built-in converter. Here you will need to first turn your attention to three main elements:

  • When used in working with the ESP8266, the Arduino Reset was initially connected to GND to exclude the possibility of the microcontroller starting up, and in this form it was used as a transparent USB-TTL converter.
  • RX and TX were not connected “to the cross”, but directly - RX-RX (green), TX-TX (yellow).
  • Everything else connects in exactly the same way as above.

What to consider

esp8266 management

This scheme also requires matching TTL levels of 5 volts Arduino, as well as 3.3 volts on the ESP8266, but it can work quite well.

When connected to the ESP8266, the Arduino can be equipped with a power regulator that does not withstand the current that is required for the ESP8266, which is why before you activate it, you need to check the one you are using. Do not try to connect any other power-consuming elements together with the ESP8266, as this can lead to the fact that the power regulator built into the Arduino simply fails.

There is also another connection scheme for the ESP8266 and Arduino, which uses SoftSerial. Since the port speed of 115200 is too high for the SoftSerial library and cannot guarantee stable operation, this connection method is not recommended, although there are some cases in which everything works quite stably.

Connection via RaspberryPi

If you don’t have any USB-TTL converters at all, then you can use RaspberryPi. In this case, for the ESP8266, programming and connection are almost identical, but at the same time everything is not so convenient, and in addition you will also need to use a 3.3 volt power supply stabilizer.

To begin, we connect the RX, TX and GND of our device to the ESP8266, and take the GND and VCC from a stabilized power source rated at 3.3 volts. Here, special attention should be paid to the fact that you need to connect all GND devices, that is, the RaspberryPi stabilizer and ESP8266. If the stabilizer built into your model of the device can withstand up to 300 milliamps of additional load, then in this case the connection of the ESP8266 is quite normal, but all this is done only at your own peril and risk.

Customize options

esp8266 datasheet

When you figured out how to connect the ESP8266, you need to make sure that the drivers for your devices are installed correctly, as a result of which a new serial virtual port has been added to the system. Here you will need to use the program - the serial port terminal. In principle, the utility can be selected to your liking, but you must correctly understand that any command that you send to the serial port must have trailing CR + LF characters at the end.

The CoolTerm and ESPlorer utilities are quite widespread, and the latter allows you to not enter the ESP8266 AT commands yourself, and at the same time makes it easier to work with lua scripts under NodeMCU, so it can be used as a standard terminal.

For a normal connection to the serial port, you will have to do a lot of work, since the firmware for the ESP8266 for the most part is diverse and activation can be carried out at different speeds. To determine the best option, you will need to sort out three main options: 9600, 57600 and 115200.

How to sort it out?

First, connect to the serial virtual port in the terminal program by setting the parameters 9600 8N1, then reboot the module completely, disconnecting the CH_PD (chip enable) from the power supply, and then activate it again by distorting the CH_PD. You can also short-circuit RESET to ground in order to restart the module, and monitor the data in the terminal.

First of all, the LEDs of the device should be displayed exactly as shown in the description of the verification procedure. You should also observe a set of different characters in the terminal, which will end with the ready line, and if it is not, reconnect to the terminal at a different speed and then reboot the module.

When you see this line on one of the speed options, you can consider the module prepared for work.

How to update firmware?

esp8266 description

After you install ESP8266, connecting the device will take only a few seconds, and then you can proceed to update the firmware. To install new software you need to do the following.

To get started, download the new firmware version from the official website, and also download a special firmware utility. Here, special attention should be paid to which operating system is installed on the machine with which the ESP8266 works. Connecting your device is best done on systems older than Windows 7.

For standard Windows operating systems, it is quite optimal to use a program called XTCOM UTIL, which is especially convenient if the firmware consists of only one file. The best multi-platform option is the esptool utility, which, however, requires python, as well as the need to specify parameters through the command line. , ESP8266 Flash Download Tool, , .

, CH_PD , GPIO0 GND, CH_PD . ESP8266 .

115200, , 9600, ESP8266. Arduino USB-TTL – , , .


All Articles