ESP8266 based WiFi Modules for IoT Projects

The Internet of Things (IoT) and the Industry 4.0. Distinct technological revolutions but with a common goal: To integrate equipment (digital or analog) to a computer network.

And to be part of this revolution, the developer goes out of its way to include wired ethernet modules or WIFI modules in its circuits. Which increases complexity, circuit size and development cost.

What if I told you that already has a built-in WIFI microcontroller? And that it fits in the palm of your hand? For just 1 US dollar?

Today I’m going to introduce you to the ESP8266 microcontroller, from Espressif. And for those of you who already program in 8Bit microcontrollers like the Atmega328 (one of the most common on Arduino) and struggle to build your code in the modic SRAM’s 2KB and Flash memory’s 32KB… The ESP8266 offers 32KB to RAM and 512KB to Flash Memory … expandable up to 4MB.

 Did I get your attention? So, let’s go to a summary of the specs, provided by the manufacturer itself:

  • 32-bit RISC architecture;
  • 80MHz processor (can be expanded up to 160MHz);
  • Operating Voltage of 3V;
  • 32KB of RAM memory for instructions;
  • 96KB of RAM memory for data;
  • 64KB of ROM memory to boot;
  • Flash memory preview by SPI (512KB to 4MB);
  • Wireless 11 b/g/n standard;
  • Operating modes: STA/AP/STA+AP;
  • WEP, WPA, TKIP, AES security;
  • Built-in TCP/IP protocol;
  • QFN encapsulation with 32 pins;
  • Main Peripherals: UART, GPIO, I2C, I2S, SDIO, PWM, ADC and SPI;
  • Architecture with prediction of operation in energy saving

At this point you may have noticed that I stated that the ESP8266 has a 512KB Flash memory, extendable up to 4MB, but then I said that the module only provides this memory per SPI. Before explaining this, I want to draw your attention to another important point: The ESP8266 has a WIFI module inside a QFN package. WIFI is radio frequency! And how does it work without an antenna? The answer is: It doesn’t work!

The ESP8266Ex chip (this is its full name) needs an antenna to be connected to your antenna’s specific pins as well as a FLASH memory IC.

Started to get complicated? Don’t worry. With the idea of making the chip more accessible, several modules were developed that already include an antenna and a memory chip.

Understanding the need to include an antenna for the WIFI, a memory IC in the SPI and making pins more accessible, several manufacturers started working on ore “friendly” ESP8266’s versions. Among the best known are the ESP-01, ESP-03, ESP-05, ESP-07, ESP-12E, ESP-12F and NodeMCU. All of them have the esp8266 microcontroller in common, but they vary in size, antenna availability, memory size and pin availability. There are others, but today we’ll talk a little about them.

Where To Buy?
No.ComponentsDistributorLink To Buy
1ESP8266AmazonBuy Now

ESP-01

It is the most common module in the ESP8266 range. It is compact (24.8 x 14.3 mm), the WIFI antenna is built in the board itself and has two GPIO pins that can be controlled according to programming. There are two significant drawbacks to this card:

  • The pins are not intended for connection to a breadboard. Although they fit well, they end up shorting So, they necessarily need wires to extend the pins.
  • The two available GPIOs play an important role in the board So it is necessary to pay attention to the level (high/low) when the board is initialized, or the board may mistakenly enter in programming mode. So, pins are safer operating as Outputs than as Inputs.

ESP-03

 

This version comes with a ceramic antenna, 7 GPIOs (two are those of the ESP-01 that require attention), a pair for UART, in size 17.4 x 12.2 mm. Smaller than 01? Yes! But that comes at a price: The encapsulation is another.

ESP-05

  • No GPIOs available, it actually doesn’t even have a built-in antenna.
  • This version was thought to incorporate WIFI to some other microcontroller (with the smallest possible size: 14.2 x 14.2 mm), so it has an external connector and UART pins to be manipulated by AT commands.

ESP-07

  • The ESP-07 has both a ceramic antenna and an external connector. Looks a lot like the ESP-03, but leaves the meager analog pin available.
  • In addition to incorporating a metallic cover that protects the circuit against magnetic interference.

ESP-12E and ESP-12F

Built-in antenna, 11 GPIOs, UART available, SPI available (not exactly, it’s still being used by the flash memory CI, but now you get the option to disable the memory and associate a larger one), an ADC pin (pause here to explain because it’s not that useful, The board operates with 3.3V, but the ADC is 0 – 1V. Low resolution, plus the big risk of damaging everything.).

The ESP-12E would be icing on the cake for the ESP8266’s boards, but the ESP-12F version handled an improvement in the antenna design and a little more pin protection.

NodeMCU

The NodeMCU module is to the ESP-12s as the Arduino UNO is to ATMEGA328s. A board with a protoboard compatible pinbus, all ESP-12 pins available, a 3.3V regulator to power the module (the VIN pin can receive 5V) and a UART – USB interface that turn the nodeMCU into a plug an play module.

There are versions with the ESP-12E (increasingly rare) and with the ESP-12F.

Now that we know a little more about the hardware, let’s take a look at how to program it.

There are different ways to programming the ESP8266. Different methods, different languages, among the most common, we have the ESP-IDF (manufacturer’s official. C programming) and others recommended, also, by the manufacturer: NodeMCU (Lua Script), Arduino (C++), MicroPython (you get one candy if you guess the language). It is possible to work with it in PlatformIO as well.

ESP-IDF

The ESP-IDF is the official Espressif solution. The SDK has a number of precompiled libraries and works with the Xtensa GCC compiler.

For a long time, the company has released RTOS and NON-OS versions in parallel. But since 2020 no NON-OS versions have been released (except minor bug fixes). Other modules from Espressif were born exclusive to RTOS versions, probably this was already part of the decision to bury the NON-OS. IN 2019, the company released a note stating that it would keep the main version, but that it would only operate in the correction of critical bugs. It even released some new features after that, but it doesn’t compare in quantity to the RTOS version.

This is without any doubt the most specialized tool that allows for the greatest customization at a low level. Drivers and libraries are customized for company modules. And specialization directly reflects on performance.

But the ESP-IDF lacks in complexity and size of the active community. Which ends up making the solution’s development a little slower. How does this happen? The programming is done in C- ANSI, in some cases with the directly treatment of registers, creating a more verbose code. More verbose? More chances for bugs. Also, active community is something that needs to be looked at when using any technology. Whether for creating new libraries or for sharing issues and solutions. The ESP-IDF user community exists, but it is much smaller than the others that will be presented here.

NodeMCU

The NodeMCU is an ambiguous term, it can either be used to indicate the NodeMCU module (hardware) or the NodeMCU development environment (software), both can be used together. But not necessarily. Let’s go to the software one.

The NodeMCU is a Lua-based firmware specific to the ESP8266 and uses a SPIFF (SPI Flash File System) based file system. This firmware is installed directly in FLASH memory, which allows the code’s execution in real time, without the need for compilation.

It offers a library structure for native functionality and for sensor’s integration, such DS18B20 or BME280, which make programming more dynamic.

The NodeMCU has been popular for quite some time. But it has three serious problems that have started to reduce its use.

  • The Firmware NodeMCU, installed in FLASH, takes up a lot of Especially if the full version is included.
  • It was developed based on the NON-OS version, so, firmware bugs started to get more complex to
  • The memory management is quite complex in some cases. Because it didn’t compile, some memory overflow issues could only be noticed at runtime. (This was the reason I stopped using this method).

Arduino

The Arduino platform, undoubtedly the best known in the world when it comes to microcontrollers, is also on the manufacturer’s list of nominees.

The Arduino was built as software-hardware relationship that makes microcontroller’s development more accessible to non-specialists. The hardware complexity was minimal (in some cases none) and the software started to be treated in a high-level language (C++), allowing even object orientation.

Because it is so accessible, some members of the software’s community have started to be collaborators in building libraries (Only to control LCD displays, I know four), some sensor’s manufacturers offer official versions as well. Constantly updated material. Etc. Etc.

The Arduino architecture started with the Arduino Uno board (which uses an ATMEGA328), expanded support to other boards and… for some time now, it has support for ESP8266 in different modalities. There is good compatibility with standard Arduino libraries and it has its own.

MicroPython

I Don’t know the MicroPython in practice (yet), but as the name advertises, it allows programming in Python. Like NodeMcu, it deploys a firmware to FLASH memory and has well- defined libraries for hardware usage.

The space occupied in Flash is well optimized (not even compared to NodeMCU chaos). It seams to have a very active community. As for programming complexity I don’t have much information. But if you program in Python, I think it’s worth the experience.

PlatformIO

The PlatformIO is not really a development platform, but it allows an integration with other platforms to simulate the board. If you don’t have an ESP8266 on dang yet, it might be a good choice for your first steps.

However, there is a natural limitation when simulating a module whose flagship is WIFI.

Don’t you know where to start?

Personally, I think that the Arduino environment is perfect for prototyping. It’s easy to get results pretty quickly to validate a proof of concept. But in some cases you can go beyond that. If your project doesn’t demand maximum performance from the ESP8266, even the production version can be built here.

For a project that requires a lot of hardware precision, I don’t recommend intermediaries. Nothing will perform better than IDF.

For educational purposes, our next articles will use the NodeMCU board programmed on the Arduino platform.

Introduction to ESP-01

I hope you all are doing great. In today's tutorial, we are gonna have a look at detailed Introduction to ESP-01. ESP-01 is an inexpensive, small-sized WiFi module, which consists of TCP/IP stack along with a built-in microcontroller. So, we can directly program this small chip and can bring WiFi capability in our Embedded projects. When first time this ship came into the market in August 2014, it got a lot of attention by users. The main reason for it to seek attention is that this module allows the microcontroller to connect with a WiFi available (and programmed to connect) and it follows Hayes Style Commands and develops a TCP/IP network. ESP-01 chip integrates an antenna, RF balun, power amplifier, filters, and power arrangement module. ESP-01 is used in industry and many projects as a WiFi module. In today's post, we will have a look at its circuit diagram, working, pinout, etc. I will also share some links where I have interfaced it with other microcontrollers. If you have any question about it please ask in comments I will resolve your problems. So, let's get started with a basic Introduction to ESP-01.

Introduction to ESP-01

  • ESP-01 is a WiFi module which allows Microcontroller easily access to WiFi network. It is one of the primarily incorporated WiFi chip in the industry, it assimilates the antenna switches, Radiofrequency balun, power amplifier, low noise receiver amplifier, and power executive elements.
Download ESP01 Datasheet
  • This module requires minimum internal circuitry, its entire solution, including the front end module is designed to occupy minimum PCB area.
  •  ESP-01 module is termed as a system on chip (SOC) because it acts as a standalone Microcontroller itself, so we don't need to interface it with any other microcontroller (i.e. Arduino, Atmel, PIC Microcontroller, etc.) in order to use its I/O Pins.
  • ESP-01 also integrates an advanced version of Tensilica's L-106 diamond series 32 SRAM with the WiFi functionalities. It also integrated with specific devices through its GPIOs and code for such applications are provided in SDK.
Now, Let's discuss ESP-01 pinout with a detailed description.

ESP-01 Pinout & Description

  • The pinout of ESP-01 is described below with a detailed description.
Pin# Type                                         Parameters
Pin#1 VCC This pin is used for input power supply 3.0 to 3.6V.
Pin#2 GND  This pin is used for Ground.
Pin#3 RESET This pin is used for the external reset signal (Low voltage level: Active).
Pin#4 ADC(TOUT) This pin is analog to digital converter.
Pin#5 CH_PD It is Chip Enable. High: On, the chip works properly; Low: Off, small current.
Pin#6 GPIO0(FLASH) It is a general purpose I/O, If low while reset/power on takes chip into serial programming mode.
Pin#7 GPIO1(TX) It is a general purpose I/O and Serial TXd.
Pin#8 GPIO3(RX) It is a general purpose I/O and Serial RXd.
Pin#9 GPIO4 It is a general purpose I/O.
Let's see the pinout diagram. Now, we discuss the features of ESP-01.

Features of ESP-01

  • These are the main features of ESP-01. Which are described below.
    • It is a low power 32-bit microcontroller unit.
    • It uses TCP/IP protocol for transmission.
    • ESP-01 consists of integrated switch, balun, power amplifier, LNA and matching network.
    • It works on 802.11 b/g/n WiFi with a frequency of 2.4 GHz and WPA (Wi-Fi Protected Access) or WPA2.
    • It also consists of 10 bit ADC 2.0, (H) SPI, UART, I2C, I2S, IR remort control, PWM and GPIO.
    • Its deep sleep power is less than 10uA and Power down leakage current is less than 5uA.
    • Its wake up and transmit packets is less than 2ms.
    • Its stand by power consumption is < 1.0mW (DTIM3).
    • Its output power is +20 dBmin 802.11b mode.
    • Its operating temperature range is -40C to 125C.
    • This module is FCC, TELEC, CE, WiFi Alliance, and SRRC certified.
Now, we discuss Its Arduino interfacing.

ESP-01 Arduino Interfacing

The project of Arduino with ESP-01 which we are going to explain in the next few lines will explain how we can read time, date, temperature and humidity from the internet using an API with ESP-01. Then send these values to an Arduino and show these values on the LCD screen.
  •  Components of Project
    • Arduino Board i.e. Arduino UNO.
    • ESP-01 Module.
    • 16×2 or 20x4 simple LCD.
  • Explanation of This Project
    • In this project, we are using Arduino IDE in order to upload code in ESP-01 and will write code by using the APIs and will send an HTTP request to the server and will read a JSON file.
    • It's a big JSON file and we just need small info from it, so we are gonna read the whole file and will only get our desired values from this JSON file.
    • After getting these values, we are simply printing it on Arduino Serial Monitor.
    • Than these serial lines will be connected with Arduino so that Arduino can read the information received from ESP-01.
    • After this process information processed and show on LCD. We can get our desired output on the LCD screen.

  • For further information, let's see a circuit diagram.

Memory of ESP-01

  • There are two types of memories which is integrated into the ESP -01 modules. First is internal SRAM and ROM, second is  External SPI flash. Let's discuss them with detail.
  • Internal SRAM and ROM
    • ESP-01 is integrated with memory controller including SRAM and ROM. A microcontroller can access to memory unit by iBus, dBus, and AHB interfaces.
  • External SPI Flash
    • ESP-01 module can be integrated with a one MB external SPI flash to store programme. If larger sized storage is required SPI flash with a larger size will be preferred. 16 MB memory capacity can be supported by this external flash.

Applications of ESP-01

  • ESP-01 is wifi module which can be used in different industrial and commercial projects for sending and receiving data.
So, that was about  ESp-01, if you have any question please ask in comments. I will resolve your problems. Thanks for reading. Take care...
Syed Zain Nasir

I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

Share
Published by
Syed Zain Nasir