ComputersEquipment

Microcontroller ESP8266: connection and setup

Many users have already turned their attention to the chip ESP8266-12, released by Espressif. Its cost is much cheaper in comparison with the standard Bluetooth adapter, and even with smaller dimensions, it differs significantly more features. Now all home lovers have the opportunity to work in a Wi-Fi network in two modes at once, that is, to connect their computer to any access points or to include it as such a point.

On the other hand, you need to understand correctly that such cards are not just machines designed only for Wi-Fi communication. The ESP8266 itself is a microcontroller with its own UART, GPIO and SPI interfaces, that is, it can be used as an absolutely autonomous equipment. Many after the release of this chip called it the most real revolution, and over time such devices will be built in even the simplest forms of technology, but so far the device is relatively new and there is no stable firmware on it. Many specialists around the world are trying to invent their own firmware, because it is not really difficult to fill them in the pay, but despite the various difficulties, the device can now be called quite usable.

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

  • Use the card in combination with an additional microcontroller or computer, which will be controlled by the module through the UART.
  • Self-writing firmware for the chip, which allows you to later use it as a self-contained device.

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

Looking at ease of use and good characteristics, many people among the many microcontrollers give their preference to the ESP8266. Connecting and updating the firmware of this device is extremely simple and affordable, and is performed on the same hardware as the hardware is connected to the computer. That is, also via USB-TTL-converter or, if someone prefers other options for connection, can be implemented through RPi and Arduino.

How to check?

In order to test the efficiency of the device you just bought, you will need to use a special stabilized voltage source rated at 3.3 volts. It should be noted right away that the actual voltage range of this module is 3 to 3.6 volts, and the supply of high voltage will immediately lead to the fact that you simply disable your ESP8266. Firmware and other software after a similar situation can start to work incorrectly, and you already need to repair the device or somehow correct it.

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

  • CH_PD and VCC are connected to 3.3V power supply.
  • GND is connected to ground.

If you are not using ESP-01, but some other module, and it already has a GPIO15 output from the beginning, then you and it will need to be additionally connected to the ground.

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

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

If the point really does appear, 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 still try to use the broken module or It simply installed the firmware with non-standard settings.

How can I quickly connect it?

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

  • The module itself;
  • Solderless prototyping board;
  • A full set of mama-dad wires, designed for the breadboard, or a special cable DUPONT MF;
  • USB-TTL converter based on PL2303, FTDI or any similar chip. The most optimal option is if the RTS and DTR are also output on the USB-TTL adapter, because it allows fast downloading of the firmware from any UDK, Arduino IDE or Sming, without even having to manually switch the GPIO0 to ground.

If you use a converter for 5 volts, then you will need to purchase an additional power regulator based on the chip 1117 or any similar, as well as a power supply (for a standard 1117, even a normal charge from a smartphone to 5 volts is not bad at all). It is recommended not to use the Arduino IDE or USB-TTL as a power source for the ESP8266, but use a separate one, as this can ultimately get rid of a lot of problems.

An extended set for providing comfortable and permanent operation with the module provides the need for additional power connectors, resistors, LEDs and DIP switches. In addition, you can also use an inexpensive USB monitor, which will allow you to constantly monitor the amount of current consumed, and also provide little protection to the USB bus from the occurrence of a short circuit.

What do we have to do?

First of all it is worth noting the fact that the ESP8266 control may be slightly different depending on which particular model you are using. There are a lot of such modules 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 a pin-out GPIO15 (HSPICS, MTDO), you will need to pull it to ground for both the standard module start and To use the firmware mode.

After that, double-check that the power supply voltage for the connected module is 3.3 volts. As mentioned above, the allowable range is 3 to 3.6 volts, and in the event of an increase, the device fails, but the supply voltage can even be well below 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 exactly as on the left side of the picture below. If you only use a five-volt USB-TTL, then pay attention to the right side of the picture. Many may think that the right circuit is more efficient due to the fact that it uses a separate power supply, but in fact, in the case of using a USB-TTL converter of 5 volts it is highly desirable to make an additional divider on the resistors to ensure matching of three-volt and five-volt Logic levels, or simply use the level conversion module.

Connection Features

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

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

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

How to connect correctly?

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

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

Resistors at 10k can be replaced, if necessary, by any others in the range from 4.7k to 50k, excluding GPIO15, since its rating should be no more than 10k. The nominal capacitor, smoothing high-frequency pulsations, can be somewhat different.

Connecting RESET and GPIO16 through the use of a deep sleep resistor of 470 ohms may become necessary when using the appropriate mode, because in order to exit deep sleep mode, the module performs a full reset, providing a low level on the GPIO16. If this connection is not present, the deep sleep mode for your module will last forever.

At first glance, it may seem that GPIO0, GPIO1 (TX), GPIO2, GPIO3 (RX) and GPIO15 are busy, so you can not use them for your purposes, but in fact it 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 in the future it is already possible to apply them at your own discretion. The only thing that is worth noting is - do not forget to provide the required levels before you fully reboot your hardware.

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 "pull" TX, while simultaneously sending debugging information to UART0 at 74480, but after Will be successfully downloaded, they can be used not only as a UART0 in order to make the exchange of data with another device, but also as a standard GPIO.

For modules that have a small number of diluted pins (for example, ESP-01), there is no need to connect undiluted pins, that is, only GND, CH_PD, VCC, GPIO0, GPIO2 and RESET are bred on ESP-01, and it's you Will need to pull up. There is no need to solder directly to the chip ESP8266EX, and then attract undiluted pins, if only you really need it.

Such connection schemes were used after a large number of experiments conducted by qualified specialists and collected from a variety of different information. It should be noted that even such schemes can not be considered ideal, because you can use a number of other, equally effective options.

Connecting via Arduino

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

  • When used in conjunction with the ESP8266, the Arduino Reset is initially connected to GND to exclude the possibility of starting the microcontroller, and in this form it was used as a transparent USB-TTL converter.
  • RX and TX were not connected "on the cross", but directly - RX-RX (green), TX-TX (yellow).
  • All the rest is connected in exactly the same way as above.

What you need to consider

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

When connected to the ESP8266, the Arduino can be equipped with a power regulator that does not withstand the current required for the ESP8266, so before you activate it, you need to check the datasheet for the one that is used by you. Do not try to connect any other energy-consuming elements together with the ESP8266, as this can cause the built-in Arduino power regulator to simply fail.

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

Connecting via RaspberryPi

If you do not have any USB-TTL converters at all, then you can use RaspberryPi. In this case, for ESP8266 programming and connection is almost identical, but here everything is not so convenient, and in addition you will also need to use a power regulator of 3.3 volts.

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

Configure settings

When you figured out how to connect the ESP8266, you need to make sure that the drivers to your devices are installed correctly, so that a new serial virtual port was added to the system. Here you will need to use the program - serial port terminal. In principle, the utility can be chosen any to your taste, but you should understand correctly that any command that will be sent to you on the serial port, in the end should have the trailing CR + LF symbols.

CoolTerm and ESPlorer utilities are quite widespread, and the latter allows not to enter ESP8266 AT commands independently, and thus 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 ESP8266 is mostly diverse and activation can be performed at different speeds. To determine the best option, you will need to go through three main options: 9600, 57600 and 115200.

How to sort out?

First, connect in the terminal program to the serial virtual port, setting parameters 9600 8N1, after which perform a full reset of the module, disconnecting CH_PD (chip enable) from the power, and then activate it again, distorting CH_PD. Also, you can short-circuit the RESET to ground to reboot 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. Also, you should see a set of different characters in the terminal that will end with the ready line, and if it does not, reconnect to the terminal at a different speed with the subsequent reboot of the module.

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

How to update the firmware?

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

To begin, download the new firmware version from the official website, and download a special utility for the firmware. Here, special attention should be given to which operating system is installed on the machine with which the ESP8266 works. It is best to connect the device to systems older than Windows 7.

For standard Windows OS, it is quite optimal to use a program called XTCOM UTIL, which is especially convenient in the work, if the firmware consists of only one file. The best multiplatform option is called the utility esptool, which, however, requires python, as well as the need to specify parameters via the command line. In addition, in ESP8266, connecting basic functions makes it convenient to make Flash Download Tool, which has a lot of settings, as well as a convenient technology for installing firmware from several files.

Then disconnect your terminal program from the serial port, and completely disconnect the CH_PD from the power supply, connect the GPIO0 module to GND, and then CH_PD can be returned. In the end, just run the program for the modular firmware and load it into the ESP8266 relay.

In the majority of cases, the firmware is loaded into the module at a speed around 115200, but the special mode provides for automatic speed distribution, so that the firmware can be run at a speed of more than 9600, updating the available ESP8266 functions. Arduino was used for connection or USB-TTL - here does not play a special role, and here the limiting speed already depends on the length of the wires, the converter used and a number of other factors.

Similar articles

 

 

 

 

Trending Now

 

 

 

 

Newest

Copyright © 2018 en.birmiss.com. Theme powered by WordPress.