ESP8266 Archives - CyberBlogSpot https://cyberblogspot.com/tag/esp8266/ Not just another blogspot site Mon, 20 Feb 2023 03:48:19 +0000 en hourly 1 https://wordpress.org/?v=6.5.5 https://cyberblogspot.com/wp-content/uploads/2018/08/cropped-iphone-iphone3gs-32x32.jpg ESP8266 Archives - CyberBlogSpot https://cyberblogspot.com/tag/esp8266/ 32 32 How to Use ESP-01 Wi-Fi Relay Module https://cyberblogspot.com/how-to-use-esp-01-wi-fi-relay-module/ https://cyberblogspot.com/how-to-use-esp-01-wi-fi-relay-module/#respond Wed, 15 Feb 2023 10:13:18 +0000 https://cyberblogspot.com/?p=6181 The ESP-01 Wi-Fi module shown in Figure 1 is a widely known member of the ESP8266 microcontroller board family. Because of its low cost and small size, it is usually used for applications where only a few GPIOs (General Purpose Input / Output) are needed. One such application is the ESP-01 Wi-Fi Relay Module shown… Read More »How to Use ESP-01 Wi-Fi Relay Module

The post How to Use ESP-01 Wi-Fi Relay Module appeared first on CyberBlogSpot.

]]>
The ESP-01 Wi-Fi module shown in Figure 1 is a widely known member of the ESP8266 microcontroller board family. Because of its low cost and small size, it is usually used for applications where only a few GPIOs (General Purpose Input / Output) are needed. One such application is the ESP-01 Wi-Fi Relay Module shown in Figure 2.

Did you know that there are two (2) versions of ESP-01 Wi-Fi modules? Check out the article:
Difference Between ESP-01 and ESP-01S

A picture of an ESP-01 Wi-Fi module used as a microcontroller for the ESP-01 Wi-Fi relay module.
Figure 1. ESP-01 ESP8266 Wi-Fi Module

The ESP-01 Wi-Fi relay module is used as a smart switch for remotely turning on and off any device connected to it. A pre-programmed ESP-01 module is inserted into the relay module to serve as a microcontroller for the relay. The attached ESP-01 module also provides the Wi-Fi capability to the relay module to enable a computer or a smartphone to control the relay module remotely or wirelessly.

Picture of an ESP-01 Wi-Fi relay module without the ESP-01 module.
Figure 2. ESP-01 Wi-Fi Relay Module
Picture showing the ESP-01 Wi-Fi relay module with the ESP-01 module.
Figure 3. ESP-01 Wi-Fi Relay Module with ESP-01 Module

ESP-01 Module Programmer

In order to use the ESP-01 Wi-Fi relay module, a programmer is needed to program the ESP-01 module. An example of an ESP-01 programmer is shown in Figure 3. If you do not a have an ESP-01 programmer module, you can make one if you have a USB-to-serial converter. Or simply use an Arduino board as an ESP-01 programmer if you have an available Arduino board. For details on how to make a DIY ESP-01 programmer, see the article: ESP-01 and ESP-01S Pinout and Configuration

Picture of an ESP-01 programmer module for use in pre-programming an ESP-01 module to be used on ESP-01 Wi-Fi relay module.
Figure 4. ESP-01 USB-to-Serial Converter Programmer

Schematic Diagram of ESP-01 Wi-Fi Relay Module

Before we start programming the ESP-01 module to be used on the ESP-01 Wi-Fi relay module, let us first study the schematic diagram of the ESP-01 Wi-Fi relay module. There are two (2) versions of ESP-01 Wi-Fi relay modules. Version 1 is shown in Figure 5 and Version 4 is shown in Figure 6.

Schematic diagram of the ESP-01 Wi-Fi relay module version 1.
Figure 5. Schematic Diagram of ESP-01 Wi-Fi Relay Module Version 1
Schematic diagram of the newer ESP-01 Wi-Fi relay module version 4 .
Figure 6. Schematic Diagram of ESP-01 Wi-Fi Relay Module Version 4

An examination of the two (2) schematic diagrams above will show that the difference in the two versions has something to do with the relay driver. On version 1, the relay is driven by an NPN junction transistor. On the other hand, on version 4, the relay is driven by an N-channel MOSFET transistor. Also, in version 4, the MOSFET driving the relay is in turn being driven by an opto-coupler.

In terms of programming, we should note that on both versions, the relay is activated by the ESP-01 module thru port GPIO0. However, on Version 1, the relay uses ACTIVE HIGH logic levels. That is, a logic HIGH on GPIO0 will activate the relay and a logic LOW will deactivate it. On the other hand, on a Version 4 model, the relay is activated using ACTIVE LOW signals. This means that a logic HIGH will turn OFF the relay and a logic LOW will turn it ON. In short, the two versions use opposite signals for activating the relay. These differing signals should be taken into account when programming the ESP-01 module. Or else, turning ON the relay may result to it being turned OFF instead. And vice versa, turning the relay OFF may cause the relay to turn ON.

How to Program the ESP-01 Module for Use with the Wi-Fi Relay Module

In this article, we will pre-program the ESP-01 module with NodeMCU or Lua program. Afterwards, we will create a smartphone app to control the ESP-01 Wi-Fi relay module remotely. It is also possible to program the ESP-01 module with the Arduino IDE. If you would prefer an Arduino IDE program for the ESP-01 module, please see – How to Control ESP-01 Without a Router.

Flashing the NodeMCU Firmware on ESP-01 Module

First, we need to install the NodeMCU firmware into the ESP-01 module. There are several ways to do this but we will use the one that I think is the easiest. Download the NodeMCU Flasher from Github. Extract the zip file and run the file “ESP8266Flasher.exe”. There are two versions of ESP8266Flasher.exe, a Win32 and a Win64 version. Select the appropriate version for your computer.

Screenshot of NodeMCU Flasher for installing NodeMCU firmware on an ESP-01 module.
Figure 7. NodeMCU Flasher

Plug in your ESP-01 programmer with the ESP-01 module to your computer’s USB port. The NodeMCU Flasher should be able to detect the ESP-01 programmer and automatically change the COM Port setting. If this is your first time to use your ESP-01 programmer, you may have to install the device driver for it.

A picture of the NodeMCU Firmware Programmer for the ESP8266 modules like the ESP-01 module to be used for the ESP-01 Wi-Fi relay module.
Figure 8. NodeMCU Flasher Detects the Correct COM Port

Click on Config tab of the NodeMCU Flasher and verify that you have the settings INTERNAL://NODEMCU and hex 0x00000. The INTERNAL://NODEMCU setting tells the NodeMCU Flasher to use the NodeMCU firmware that comes with the NodeMCU Flasher installation (the firmware file can be found under the Resources/Binaries directory). Meanwhile, the setting 0x00000 is the memory starting location where the NodeMCU firmware will be installed. See Figure 9 for the correct settings.

A picture of the NodeMCU Flasher with the Config tab showing the correct settings.
Figure 9. NodeMCU Flasher with the Config Settings

Next, click on the Advanced tab of the NodeMCU Flasher. Change the Flash size to 1Mbyte and the SPI mode to QIO. These two (2) settings are specific to ESP-01 modules, see Figure 10 below.

NodeMCU Flasher with the Advanced settings changed for the ESP-01 Wi-Fi module
Figure 10. NodeMCU Flasher Advanced Settings

Click back on the Operation tab and click on the Flash(F) button to start flashing the NodeMCU firmware to the ESP-01 module. Please refer to Figure 11.

The NodeMCU Flasher ready to flash the NodeMCU firmware on an ESP-01 Wi-Fi module.
Figure 11. NodeMCU Flasher Prior to Flashing

Wait for the progress bar to be filled up and you should see a green checkmark at the bottom left of the NodeMCU Flasher screen as depicted in Figure 12.

Picture of the NodeMCU Flasher with the green checkmark indicating a successful firmware flashing.
Figure 12. NodeMCU Flasher with Green Checkmark

We have now successfully installed the NodeMCU firmware on the ESP-01 module, so we will go to the next procedure.

ESPlorer Integrated Development Environment

ESPlorer is an Integrated Development Environment (IDE) used for programming ESP8266 modules like ESP-01 with NodeMCU and Micropython. Download the ESPlorer from Github. Extract the zip file and run the file “ESPlorer.bat”.

The ESPlorer Integrated Development Environment for programming the ESP-01 module
Figure 13. The ESPlorer Integrated Development Environment

Make sure that the proper COM port for your ESP-01 programmer is selected and the baud rate setting is 9600 baud (see Figure 14). Then click on the Open button.

Picture of ESPlorer IDE showing the correct setting before opening the communication port
Figure 14. ESPlorer IDE with the Correct Settings

If the ESPlorer can’t autodetect the NodeMCU firmware, reset the ESP-01 module by pressing the reset button on your ESP-01 programmer. Or click on the RTS button on the ESPlorer IDE twice. When you click the RTS button on the ESPlorer IDE, it sends a RESET signal to the connected ESP-01 programmer module.

ESPlorer IDE showing the message can't autodetect firmware.
Figure 15. ESPlorer IDE with Error Message

After resetting the ESP-01 module, you should see a message with the NodeMCU firmware version. This verifies that you have successfully flashed the ESP-01 module with the NodeMCU firmware in the preceding procedure.

If the ESPlorer IDE cannot detect your NodeMCU firmware, see the article:
ESPlorer Can’t Autodetect Firmware

ESPlorer IDE showing a successful firmware detection signifying readiness to accept scripts for programming the ESP-01 module to used for the ESP-01 Wi-Fi relay module.
Figure 16. ESPlorer IDE with the NodeMCU Firmware Detected

The Lua Program

Copy and paste the following Lua program on the left pane of the ESPlorer IDE.

print("Ready to start soft ap")

local str=wifi.ap.getmac();
local ssidTemp=string.format("%s%s%s",string.sub(str,10,11),string.sub(str,13,14),string.sub(str,16,17));

cfg={}
cfg.ssid="ESP8266_"..ssidTemp;
cfg.pwd="12345678"
wifi.ap.config(cfg)

cfg={}
cfg.ip="192.168.1.1";
cfg.netmask="255.255.255.0";
cfg.gateway="192.168.1.1";
wifi.ap.setip(cfg);
wifi.setmode(wifi.SOFTAP)

str=nil;
ssidTemp=nil;
collectgarbage();

print("Soft AP started")
print("Heep:(bytes)"..node.heap());
print("MAC:"..wifi.ap.getmac().."\r\nIP:"..wifi.ap.getip());

led1 = 3
led2 = 4
gpio.mode(led1, gpio.OUTPUT)
gpio.mode(led2, gpio.OUTPUT)
srv=net.createServer(net.TCP)
srv:listen(80,function(conn)
    conn:on("receive", function(client,request)
        local buf = "";
        buf = buf.."HTTP/1.1 200 OK\n\n"
        local _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP");
        if(method == nil)then
            _, _, method, path = string.find(request, "([A-Z]+) (.+) HTTP");
        end
        local _GET = {}
        if (vars ~= nil)then
            for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do
                _GET[k] = v
            end
        end
        
        if(_GET.pin == "ON1")then
              gpio.write(led1, gpio.HIGH);
			  print("led1 on")
        elseif(_GET.pin == "OFF1")then
              gpio.write(led1, gpio.LOW);
			print("led1 off")
        elseif(_GET.pin == "ON2")then
              gpio.write(led2, gpio.HIGH);
			print("led2 on")
        elseif(_GET.pin == "OFF2")then
              gpio.write(led2, gpio.LOW);
			print("led2 off")
        end
        client:send(buf);
        client:close();
        collectgarbage();
    end)
end)
Figure 17 is a picture of the ESPlorer Integrated Development Environment showing a Lua script.
Figure 17. ESPlorer IDE with Lua Script

Save the file to your computer. Click the Save button on the top left pane (1). Name the file as “init.lua” (2). Then click on the Save button on the Save screen (3).

ESPlorer IDE annotated with instructions for saving a Lua script.
Figure 18. ESPlorer IDE Annotated on How to Save a Script

After saving the program to your hard disk, the ESPlorer IDE uploaded the file init.lua to your ESP-01 module and ran the program (dofile(“init.lua”)).

ESPlorer IDE with the Lua script or program executed successfully.
Figure 19. ESPlorer IDE After Running Script

Testing the ESP-01 Module Access Point

Before we proceed to building the smartphone app to control the ESP-01 Wi-Fi relay module, let us first check if we have successfully programmed the ESP-01 module.

Get your smartphone and scan for Wi-Fi devices. With my Android smartphone, I would go to the “Settings/Network and Internet/Wi-Fi” setting. See Figure 20. You should see the Wi-Fi SSID “ESP8266_XXXXXX” where XXXXXX is the last six digits of your ESP-01 module’s MAC address.

Picture of a smartphone showing the nearby Wi-Fi devices.
Figure 20. Smartphone Showing Nearby Wi-Fi Devices

Connect your smartphone to the ESP-01 access point by entering the password “12345678” (Figure 21).

Screenshot of a smartphone showing how to enter the password in order to connect to the ESP-01 Wi-Fi module.
Figure 21. Smartphone with Password Entry

Figure 22 below shows the smartphone connected to the ESP-01 module’s access point.

Smartphone showing a successful connection with the ESP-01 module access point.
Figure 22. Smartphone Connected to the ESP-01 Module

Click on the gear icon to display the network details. Your smartphone will be assigned an IP address of 192.168.1.2. The gateway is the IP address of the ESP-01 access point.

Smartphone showing the network details of the connection with the ESP-01 access point.
Figure 23. Smartphone Showing Network Details

Now we are ready to create the smartphone app to control the ESP-01 Wi-Fi relay module.

How to Create the Smartphone App to Control the ESP-01 Wi-Fi Relay Module

We are going to use the MIT App Inventor 2 to create a smartphone app to control the ESP-01 Wi-Fi relay module. First, we need to download the MIT App Inventor 2 Companion App to our smartphones. We will need it to facilitate installing the created controller app to our smartphones.

Screenshot of MIT App Inventor 2 Companion App to be used for downloading the completed ESP8266 Controller smartphone app for controlling the ESP-01 Wi-Fi relay module remotely.
Figure 24. MIT App Inventor 2 Companion App

Next, download the source code from Github – ESP8266 Controller. Extract the file ESP8266_Controller.aia.

Go to MIT App Inventor website and click on the Create Apps! button.

Screenshot of the MIT App Inventor website to be used for programming the ESP-01 Wi-Fi module.
Figure 25. The MIT App Inventor Website

Import the project ESP8266_Controller.aia (the file downloaded from Github).

MIT App Inventor 2 screen showing how to import a project file.
Figure 26. MIT App Inventor Project Import
MIT App Inventor screen showing how to export the project file ESP8266_controller.aia.
Figure 27. MIT App Inventor with Import Project Screen

The ESP8266 controller app designers view.

Picture of the MIT App Inventor showing the designer screen for the ESP8266 Controller app to be use for controlling the ESP-01 Wi-Fi relay module.
Figure 28. MIT App Inventor with the Imported ESP8266 Controller Project

If you want to modify how the program works, go to the Blocks view.

Screenshot of the MIT App Inventor in Blocks mode showing the ESP8266 Controller's program blocks.
Figure 29. MIT App Inventor Showing the Blocks Screen

Compile and build the app by clicking the Build/Android App(apk) item on the menu. Refer to Figure 30 below.

MIT App Inventor screengrab showing how to build the ESP8266 Controller app for the ESP-01 Wi-Fi relay module.
Figure 30. MIT App Inventor Showing How to Start the Build Operation

After a successful build, a bar code will appear on your computer’s screen (see Figure 31). Scan the bar code with your smartphone using the MIT App Inventor Companion app. Follow the instructions on your smartphone to install the ESP8266 Controller app.

Picture of MIT App Inventor screen display showing the bar code for downloading the ESP8266 Controller smartphone app for the ESP-01 Wi-Fi relay module.
Figure 31. MIT App Inventor with the Bar Code

How to Use the ESP8266 Controller App to Control the ESP-01 Wi-Fi Relay Module

Screenshot of the completed ESP8266 Controller smartphone app ready for use with the ESP-01 Wi-Fi relay module.
Figure 32. ESP8266 Controller App

Remove the ESP-01 module from the programmer module and insert it into the ESP-01 Wi-Fi relay module. Provide power to the relay module. Next, connect the smartphone to the ESP-01 access point as discussed above on testing the ESP-01 module access point. Then, open the ESP8266 Controller app and set the IP address to “192.168.1.1”.

You may now enjoy playing around with your new smart switch ESP-01 Wi-Fi relay module using the ESP8266 Controller smartphone app.

Related Articles on How to Use ESP-01 Wi-Fi Relay Module

How to Program ESP-01 with Arduino IDE
How to Set up Arduino IDE for ESP8266 Programming
How to Test an ESP-01 ESP8266 Module
How to Control ESP-01 thru a Router
How to Control ESP-01 Without a Router
ESP-01 with RTC and LCD Display
How to Save and Restore ESP8266 and ESP32 Firmware
NodeMCU V3 ESP8266 Pinout and Configuration
How to Test a NodeMCU V3 ESP8266 Dev Board
How to Use AT-09 BLE with Arduino and Smartphone

References on How to Use ESP-01 Wi-Fi Relay Module

ESP8266 on Wikipedia
ESP-01 Wi-Fi Relay Module on Shopee

The post How to Use ESP-01 Wi-Fi Relay Module appeared first on CyberBlogSpot.

]]>
https://cyberblogspot.com/how-to-use-esp-01-wi-fi-relay-module/feed/ 0
ESPlorer Can’t Autodetect Firmware https://cyberblogspot.com/esplorer-cant-autodetect-firmware/ https://cyberblogspot.com/esplorer-cant-autodetect-firmware/#respond Mon, 13 Feb 2023 09:55:54 +0000 https://cyberblogspot.com/?p=6194 The ESPlorer error “can’t autodetect firmware because proper answer not received (maybe unknown firmware)” appears on the right pane of the ESPlorer IDE screen. This happens right after flashing an ESP8266 module such as ESP-01 module with NodeMCU firmware. See Figure 1. By following the message on the screen to reset the module, the result… Read More »ESPlorer Can’t Autodetect Firmware

The post ESPlorer Can’t Autodetect Firmware appeared first on CyberBlogSpot.

]]>
The ESPlorer error “can’t autodetect firmware because proper answer not received (maybe unknown firmware)” appears on the right pane of the ESPlorer IDE screen. This happens right after flashing an ESP8266 module such as ESP-01 module with NodeMCU firmware. See Figure 1.

Screenshot of ESPlorer IDE showing the ESPlorer cant autodetect firmware error.
Figure 1. ESPlorer IDE Screen Showing the Error Message

By following the message on the screen to reset the module, the result is a gibberish message with the words “MEM CHECK FAIL” at the end. See Figure 2.

Screenshot of ESPlorer IDE showing the ESPlorer can't autodetect firmware error and the mem check fail error
Figure 2. ESPlorer IDE Screen with Gibberish Message

Cause of the Error Can’t Autodetect Firmware

This error can often be mistaken for a failed NodeMCU firmware flashing. But whether you used the NodeMCU Flasher or the Espressif Download Tool or manually used ESPTool.py to flash the NodeMCU firmware, you will get the same error.

The error is caused by a wrong BAUD rate setting on the ESPlorer IDE and NOT on a defective firmware flashing. See Figure 3. The baud rate setting is at 115200 baud when it should be only 9600 baud.

Picture of ESPlorer IDE showing the baud rate setting that is causing the  ESPlorer Cant Autodetect Firmware
Figure 3. ESPlorer IDE with Annotated Baud Rate Setting

How to Fix the Error Can’t Autodetect Firmware

To fix the error “can’t autodetect firmware”, close the connection and change the baud rate to 9600 baud. Then reset the ESP8266 module by pressing the reset button or simply click the RTS button on the ESPtool IDE twice. Figure 4 shows the fixed error and with the NodeMCU firmware being detected correctly.

Picture of ESPlorer IDE with the fixed error ESPlorer Can't Autodetect Firmware
Figure 4. ESPlorer IDE with Baud Rate Setting Fixed

Important Note on ESPlorer Can’t Autodetect Firmware

If you flash your ESP8266 board with the newer NodeMCU firmware, the correct BAUD rate to use is 115200 baud. See Figure 5 that shows the ESPlorer IDE with NodeMCU firmware version 1.5 and Figure 6 with NodeMCU firmware version 3.0. Both are using 115200 baud rates.

Screenshot of ESPlorer IDE with the NodeMCU firmware version 1.5 but without Cant Autodetect Firmware
Figure 5. ESPlorer IDE with NodeMCU Firmware Version 1.5
Screenshot of ESPlorer IDE with the NodeMCU firmware version 3.0 but without Cant Autodetect Firmware
Figure 6. ESPlorer IDE with NodeMCU Firmware Version 3

What is ESPlorer?

Screenshot of ESPlorer IDE showing the different IDE panels for the article ESPlorer Can't Autodetect Firmware
Figure 7. ESPlorer IDE Panels

ESPlorer is a multi-platform Integrated Development Environment (IDE) for programming ESP8266 modules. It is primarily used for programming ESP8266 modules with NodeMCU (Lua) and MicroPython. It can also be used to program ESP8266 modules with AT commands. Additionally, it can also program RN2483 LoRa modules.

Related Articles

How to Program ESP-01 with Arduino IDE
How to Set up Arduino IDE for ESP8266 Programming
How to Test an ESP-01 ESP8266 Module
How to Control ESP-01 thru a Router
How to Control ESP-01 Without a Router
ESP-01 with RTC and LCD Display
How to Save and Restore ESP8266 and ESP32 Firmware
NodeMCU V3 ESP8266 Pinout and Configuration
How to Test a NodeMCU V3 ESP8266 Dev Board
How to Use AT-09 BLE with Arduino and Smartphone

References

esp8266 – Developer Community
NodeMCU Documentation

The post ESPlorer Can’t Autodetect Firmware appeared first on CyberBlogSpot.

]]>
https://cyberblogspot.com/esplorer-cant-autodetect-firmware/feed/ 0
ESP-01 and ESP-01S Pinout and Configuration https://cyberblogspot.com/esp-01-and-esp-01s-pinout-and-configuration/ https://cyberblogspot.com/esp-01-and-esp-01s-pinout-and-configuration/#respond Mon, 06 Feb 2023 19:59:12 +0000 https://cyberblogspot.com/?p=4635 ESP-01 and its latest version ESP-01S are popular microcontrollers with Wi-Fi networking capabilities. They are part of the ESP8266 family of microcontrollers manufactured by Espressif Systems. In this article, we will learn the ESP-01 and ESP-01S pinout and configuration in actual applications. ESP-01 Wi-Fi Module Specifications Power Supply:Voltage 3.0V ~ 3.6VCurrent >300mA Current Consumption: Continuous… Read More »ESP-01 and ESP-01S Pinout and Configuration

The post ESP-01 and ESP-01S Pinout and Configuration appeared first on CyberBlogSpot.

]]>
A picture of an ESP-01 module showing the pinout.
Figure 1. ESP-01 ESP8266 Microcontroller Board Pinout

ESP-01 and its latest version ESP-01S are popular microcontrollers with Wi-Fi networking capabilities. They are part of the ESP8266 family of microcontrollers manufactured by Espressif Systems. In this article, we will learn the ESP-01 and ESP-01S pinout and configuration in actual applications.

ESP-01 Wi-Fi Module Specifications

Power Supply:
Voltage 3.0V ~ 3.6V
Current >300mA

Current Consumption:
Continuous Transmission: Average: ~ 71mA, Peak: 300mA
Modem Sleep: ~20mA
Light Sleep: ~2mA
Deep Sleep: ~0.02mA

SPI Flash Memory:
Default 8Mbit (1MB)

Interface:
UART/GPIO

IO Port:
2

UART Baud Rate:
Support 300 ~ 4608000 bps
Default 115200 bps

Frequency Range:
2412 ~ 2484MHz

Transmit Power:
802.11b: 16±2 dBm (@11Mbps)
802.11g: 14±2 dBm (@54Mbps)
802.11n: 13±2 dBm (@HT20, MCS7)

Receiving Sensitivity:
CCK, 1 Mbps : -90dBm
CCK, 11 Mbps: -85dBm
6 Mbps (1/2 BPSK): -88dBm
54 Mbps (3/4 64-QAM): -70dBm
HT20, MCS7 (65 Mbps, 72.2 Mbps): -67dBm

For a complete specifications, you may refer to the ESP-01 Product Specification PDF.

ESP-01 and ESP-01S Pinout

Have you just bought a new ESP-01 Wi-Fi module? Take a look at
How to Test an ESP-01 ESP8266 Module


Learn how to differentiate between ESP-01 and ESP-01S Wi-Fi modules, see:
Difference Between ESP-01 and ESP-01S

Figure 2. ESP-01 Module Pinout A
Pinout of ESP-01 and ESP-01S with the male header pins on the right.
Figure 3. ESP-01 Module Pinout B
Picture showing the pinout of ESP-01 and ESP-01S with the board oriented so that the header pins are at the bottom.
Figure 4. ESP-01 Module Pinout C

ESP-01 Pin Descriptions

TX – UART0 data send (transmit) pin, also known as GPIO1.
RX – UART0 data receive pin, also known as GPIO3.
CH_PD – Chip Power Down (also known as CH_EN or Chip Enable) – Chip enable pin, active high
RST – External reset pin, active low
GPIO2 – General Purpose Input / Output
GPIO0 – General Purpose Input / Output
VCC – +3.3 Volts Supply Positive
GND – Ground – Supply negative

ESP-01 Module Breadboarding and Adapters

When breadboarding, you can not insert the ESP-01 module as it is. A few years ago, you do all sort of tricks to breadboard an ESP-01 module, from bending the header pins to making your own DIY adapter. Luckily, now you can buy a cheap breadboard adapter for the ESP-01 module. See Figure 5.

A picture of an ESP-01 and ESP-01S adapter module with an ESP-01 board inserted into it.
Figure 5. Breadboard Adapter for ESP-01 Module

If you will be connecting the ESP-01 board to an Arduino board, you must remember two (2) things:

  • Do not supply the ESP-01 module with the 3.3V output from the Arduino board – the ESP-01 module, as per specification above, may require up to 300mA of current. The 3.3V regulator on the Arduino board may overheat and may become damaged.
  • Provide logic level translation between the ESP-01 and the Arduino board – the Arduino board uses 5V logic while the ESP-01 module uses 3.3V logic.

A good ESP-01 adapter that can satisfy the requirements for interfacing with Arduino boards is shown in Figure 6. It has a built-in 3.3V regulator and two (2) bi-directional logic level converters for the RX and TX pins. The schematic diagram for the adapter is shown in Figure 7.

Picture of another ESP-01 and ESP-01S adapter that is complete with a 3.3V voltage regulator and bi-directional logic level converters.
Figure 6. ESP-01 Adapter with Voltage Regulator and Logic Translator
Schematic diagram of the ESP-01 and ESP-01S Wi-Fi modules adapter shown in Figure 6.
Figure 7. Schematic Diagram of ESP-01 Adapter

ESP-01 Programmers

ESP-01 USB-to-Serial Converter Programmer Module

Unlike the other ESP8266 boards, ESP-01 boards need a programmer to be uploaded with programs or sketches from the Arduino IDE. An inexpensive programmer is shown below in Figure 8. The programmer uses a Silabs 2104 serial to USB converter chip. With this programmer, you just plug it into your computer’s USB port, select the proper COM port and start uploading sketches.

A USB-to-serial converter programmer for the ESP-01 and ESP-01S modules.
Figure 8. ESP-01 Programmer or Flasher

DIY USB-to-Serial Converter Programmer

If you do not have a programmer module but you have an available USB-to-serial converter, you can wire it up as an ESP-01 programmer. The schematic diagram of a DIY programmer is shown in Figure 9. With this programmer, you need to put the ESP-01 module into programming mode before uploading a sketch. This is done by holding down the Flash switch, pressing and releasing the Reset switch, and then releasing the Flash switch.

Schematic diagram of a DIY USB-to-serial converter programmer for the ESP-01/ESP-01S.
Figure 9. DIY USB-to-Serial Converter Programmer

Shown below in Figures 10, 11, and 12 is my DIY ESP-01 programmer. The USB-to-serial converter connects to the programmer board via the 4-pin male header on the board.

Picture of an assembled DIY programmer for the ESP-01 ESP8266 Wi-Fi modules.
Figure 10. My DIY ESP-01 Programmer
Picture of a DIY USB-to-serial converter programmer with an ESP-01 module inserted on the female header.
Figure 11. My DIY ESP-01 Programmer with an ESP-01 Module
Picture of an USB-to-serial converter for use with ESP-01 DIY programmer.
Figure 12. USB-to-serial Converter

Arduino Board as ESP-01 Programmer
Another option for an ESP-01 programmer is to use an Arduino board. You may use any available Arduino board such as Arduino Uno, Arduino Nano, etc.

Schematic diagram of Arduino Uno used as an ESP-01 programmer that includes the pinout of both the ESP-01 and the Arduino Uno board.
Figure 13. Schematic Diagram of Arduino Uno as ESP-01 Programmer

The idea here is to use the Arduino board’s built-in USB-to-serial converter. The schematic diagram in Figure 13 is the same as the DIY ESP-01 programmer in Figure 9, but the USB-to-serial converter was replaced with an Arduino Uno.

As previously discussed above, the 3.3V output from the Arduino board should not be used. Instead, a 3.3V voltage regulator was provided for the ESP-01 module. Also, a logic level converter was used consisting of a 2.2K resistor in series with a 3.3K resistor acting as a voltage divider. This protects the RX pin of the ESP-01 module from being exposed to a 5V signal from the Arduino board. Note that the TX pin of the ESP-01 module was connected directly to the TX pin of the Arduino board. We can do away with the logic level converter because the TX pin is acting as an output (outgoing signal).

You may have noticed that the TX and RX pins of the Arduino board are connected to the corresponding TX and RX pins of the ESP-01 module. But in the DIY programmer in Figure 9, the TX and RX terminals are cross-wired. That is, the TX pin of the USB-to-serial converter is connected to the RX pin of the ESP-01 module and ,vice versa, the RX pin of the USB-to-serial converter is connected to the TX pin of the ESP-01 module.

If you want to find out why the Arduino board’s RX and TX pins are wired straight thru and not crossed over with the ESP-01 board, consult an Arduino board schematic and look at how the MCU chip and the USB-to-serial converter chip are wired. I am leaving this one as an exercise for the reader.

Related Articles on ESP-01 and ESP-01S Pinout and Configuration

How to Program ESP-01 with Arduino IDE
How to Set up Arduino IDE for ESP8266 Programming
How to Test an ESP-01 ESP8266 Module
How to Control ESP-01 thru a Router
How to Control ESP-01 Without a Router
ESP-01 with RTC and LCD Display
How to Save and Restore ESP8266 and ESP32 Firmware
NodeMCU V3 ESP8266 Pinout and Configuration
How to Test a NodeMCU V3 ESP8266 Dev Board
How to Use AT-09 BLE with Arduino and Smartphone

References on ESP-01 and ESP-01S Pinout and Configuration

ESP-01 Specification
ESP-01 Datasheet

The post ESP-01 and ESP-01S Pinout and Configuration appeared first on CyberBlogSpot.

]]>
https://cyberblogspot.com/esp-01-and-esp-01s-pinout-and-configuration/feed/ 0
Difference Between ESP-01 and ESP-01S https://cyberblogspot.com/difference-between-esp-01-and-esp-01s/ https://cyberblogspot.com/difference-between-esp-01-and-esp-01s/#comments Sun, 05 Feb 2023 05:44:18 +0000 https://cyberblogspot.com/?p=6118 The ESP-01 Wi-Fi module is one of the most popular ESP8266-based microcontroller board. It is very inexpensive and widely available. If you are new with ESP-01 modules, or are contemplating on buying one, you are lucky for visiting this page. We have here all the necessary information on the difference between ESP-01 and ESP-01S Wi-Fi… Read More »Difference Between ESP-01 and ESP-01S

The post Difference Between ESP-01 and ESP-01S appeared first on CyberBlogSpot.

]]>
Picture of ESP-01 module showing the names of the different pins
Figure 1. ESP-01/ESP-01S ESP8266 Wi-Fi Module Pinout

The ESP-01 Wi-Fi module is one of the most popular ESP8266-based microcontroller board. It is very inexpensive and widely available. If you are new with ESP-01 modules, or are contemplating on buying one, you are lucky for visiting this page. We have here all the necessary information on the difference between ESP-01 and ESP-01S Wi-Fi modules.

The ESP-01 module and the ESP-01S module are functionally the same. However, knowing the difference between the two is very important because it can affect how you wire them to external circuits. Also, the boards have different current consumption owing to their difference in the number of onboard LEDs.

ESP-01S is a Newer Version

First off, the ESP-01 module was the original version that was popularized almost a decade ago. The ESP-01S is the newer version. At the time of this writing, circa 2023, the original ESP-01 module is still widely available. Most online stores would allow you to choose between an ESP-01 or an ESP-01S. But some stores may sell you an ESP-01 for an ESP-01S, or vice versa.

Difference in Physical Appearance

At first glance, the two modules look the same. However, a close examination of the boards will show the difference in the number of LEDs (Light Emitting Diodes). Please see Figure 2 below. In the original ESP-01, there are two (2) small LEDs. On the other hand, the ESP-01S has a single, bigger LED.

The difference becomes more apparent when you supply power to the boards. The ESP-01 board will have a red LED light turned on indicating the presence of power. On the ESP-01S board, you will only see a blue LED flash for a while when the power is applied.

A picture comparing the ESP-01 module with the ESP-01S module highlighting the difference in the indicator LEDs.
Figure 2. Physical Comparison of ESP-01 and ESP-01S Modules

The Blue LED Wiring Difference Between ESP-01 and ESP-01S

Although both boards have a blue serial-activity LED, the blue LEDs are wired differently. See Figure 3. In the ESP-01 board, the blue LED is connected on the VCC and the TX pins, while on the ESP-01S, it is connected on the VCC and the GPIO2 pins. On both boards, a 2.2K ohms resistor is used in series with the blue LED as a current limiter.

Picture of the ESP-01 board side by side with the ESP-01S board showing the internal connections of the LEDs and the pull-up resistors
Figure 3. Internal Wiring Comparison of ESP-01 and ESP-01S Modules

Pull-up Resistors on ESP-01S

Another difference between ESP-01 and ESP-01S is the presence of three (3) pull-up resistors on the ESP-01S module. Pull-up resistors are used to provide a logic HIGH signal to a circuit. As shown on the right side of Figure 3 above, three (3) 12K-ohm resistors are connected from the VCC to the RESET, GPIO0, and CH_PD pins on the ESP-01S board.

Prior to the availability of the ESP-01S module, a popular ESP-01 wiring scheme for adding a reset switch and a programming switch is shown below in Figure 4. First of all, in order to power up the ESP-01 board, you need to pull up the CH_PD (Chip Enable/Power Down) pin. Next, you connect the RESET pin to the VCC because you do not want the RESET pin hanging and be vulnerable to noise causing unexpected resets. And third, pulling up the GPIO0 pin to VCC will automatically run the program or sketch loaded on the ESP-01 module after a power up or a reset.

Schematic diagram of an ESP-01 with reset and programming switches.
Figure 4. Schematic Diagram of ESP-01 with Reset and Programming Switches

On the newer ESP-01S module, the circuit shown above will be a lot more simple. There is no need to externally supply the three (3) pull-up resistors. See Figure 5.

Schematic diagram of the board with reset switch and programming switch.
Figure 5. Schematic Diagram of ESP-01S with Reset and Programming Switches

Summary on Difference Between ESP-01 and ESP-01S

The ESP-01 and the ESP-01S Wi-Fi modules are functionally the same. The ESP-01S module is a newer version of the original ESP-01 module. The ESP-01 module has a red power indicator LED that is absent on the ESP-01S. Both modules have a blue LED that indicates serial activity. However, the blue LED is wired differently on each module’s version. And finally, the ESP-01S module has three (3) on board pull-up resistors that are missing on an ESP-01 module.

Related Articles

How to Program ESP-01 with Arduino IDE
How to Set up Arduino IDE for ESP8266 Programming
How to Test an ESP-01 ESP8266 Module
How to Control ESP-01 thru a Router
How to Control ESP-01 Without a Router
ESP-01 with RTC and LCD Display
How to Save and Restore ESP8266 and ESP32 Firmware
NodeMCU V3 ESP8266 Pinout and Configuration
How to Test a NodeMCU V3 ESP8266 Dev Board
How to Use AT-09 BLE with Arduino and Smartphone

References on Difference Between ESP-01 and ESP-01S

ESP8266 on Wikipedia
ESP8266 Boot Process

The post Difference Between ESP-01 and ESP-01S appeared first on CyberBlogSpot.

]]>
https://cyberblogspot.com/difference-between-esp-01-and-esp-01s/feed/ 1
How to Test an ESP-01 ESP8266 Module https://cyberblogspot.com/how-to-test-an-esp-01-esp8266-module/ https://cyberblogspot.com/how-to-test-an-esp-01-esp8266-module/#respond Wed, 01 Feb 2023 19:31:54 +0000 https://cyberblogspot.com/?p=4652 When you buy a new ESP-01 ESP8266 module, the very first thing to do is to test it. That is, you need to make sure that you have a good and working ESP-01 module. We will take a look at the different methods of testing the ESP-01 ESP8266 Wi-Fi module. Differences Between ESP-01 and ESP-01S… Read More »How to Test an ESP-01 ESP8266 Module

The post How to Test an ESP-01 ESP8266 Module appeared first on CyberBlogSpot.

]]>
A picture of an ESP-01 ESP8266 module that is ready for testing
Figure 1. ESP-01 ESP8266 Module

When you buy a new ESP-01 ESP8266 module, the very first thing to do is to test it. That is, you need to make sure that you have a good and working ESP-01 module. We will take a look at the different methods of testing the ESP-01 ESP8266 Wi-Fi module.

Differences Between ESP-01 and ESP-01S ESP8266 Module

Before we proceed, be aware that there are two (2) versions of ESP-01 modules. The older ESP-01 module and the newer ESP-01S module. Both modules are functionally the same. However, there are two points worth mentioning here.

Picture showing the differences between an ESP-01 and ESP-01S ESP8266 modules prior to testing
Figure 2. ESP-01 Module and ESP-01S Module Comparison

First, the ESP-01 has two (2) LEDs, a red LED power indicator and a blue LED that indicates serial activity. On the other hand, the newer ESP-01S has only one (1) LED, the blue LED light (see Figure 2 above). Moreover, the blue LED serial activity indicator light is wired differently on each module. That is, on an ESP-01 module, it is connected on the TX pin (GPIO1) while on the ESP-01S module, it is connected on the GPIO2 pin. And as a side note, pins GPIO0 and GPIO1 are both serial TX capable pins (refer to the ESP-01S schematic diagram at the end of this article).

Second, the ESP-01S module has three (3) additional on-board resistors used as pull-up resistors. These pull-up resistors are 12K-ohm resistors each connected on the GPIO0, the RESET, and the CH_PD pins. You may also want to refer again to the ESP-01S schematic diagram included at the end of this article.

Quick and Dirty Test

The ESP-01 module is shipped with a program called AT firmware. The firmware will let you send AT commands to configure and program the module. More important, the module is configured as a Wi-Fi Access Point (AP) when shipped. Therefore, a quick and dirty test is to power the ESP-01 module and use a smartphone to connect to the Access Point.

Power up the ESP-01 module as shown in Figure 3. Notice that we need to connect the ESP-01 module to a 3.3V power supply. Do not connect the ESP-01 module to the 3.3V output of an Arduino board. Provide a separate 3.3V power supply with sufficient current capacity. Also, note that a 10K ohms resistor is connected from the CH_PD pin to the VCC or the 3.3V supply. The CH_PD (Chip Power Down / Enable Pin) pin has to be pulled up to the VCC for the module to function. If you have the ESP-01S module, you do not need to connect a 10K ohm resistor on the CH_PD pin. As per discussion above on the differences between the ESP-01 and the ESP-01S modules, the ESP-01S already has a 12K-ohm pull-up resistor on the CH_PD pin.

A picture depicting how to supply power to the ESP-01 ESP8266 Wi-Fi module in order to do a quick test
Figure 3. ESP-01 8266 Module with Power Supply

After powering up, you should see the ESP-01 access point when you scan for Wi-Fi devices. The default SSID of the ESP-01 module I am using is ESP_7B0F95. See Figure 4.

Screenshot of a smartphone Wi-Fi settings showing the SSID of nearby Wi-Fi devices.
Figure 4. Smartphone Wi-Fi Scan

Connect to the ESP-01 Access Point.

Screenshot of an Android smartphone Wi-Fi settings showing the module as connected to the smartphone.
Figure 5. Smartphone Wi-Fi Connected to ESP-01 Access Point

Click on the Settings icon (gear icon) and see the network details of the ESP-01 module Access Point.

Screenshot of a smartphone Wi-Fi settings showing the network characteristics of the ESP-01 ESP8266 module acting as an access point.
Figure 6. The ESP-01 Access Point Network Properties

AT Command Test

For the next test, you need an ESP-01 programmer or flasher. An inexpensive programmer/flasher is shown below in Figures 7. In Figure 8, the ESP-01 module is shown inserted into the programmer/flasher. If you do not have a programmer/flasher, it is possible to use an Arduino board as a programmer/flasher. Also, if you have a USB-to-serial(TTL) converter, you could wire it up as an ESP-01 programmer/flasher.

Picture of an inexpensive ESP-01 ESP8266 programmer/flasher for testing the ESP-01 module.
Figure 7. An ESP-01 Programmer/Flasher
Picture showing the ESP-01 ESP8266 module inserted on an ESP-01 programmer/flasher.
Figure 8. ESP-01 Module on a Programmer/Flasher

Insert the ESP-01 module to the programmer as shown in Figure 8 and plug the programmer to the computer. If it is your first time to use your programmer/flasher, you may have to install its device driver. Open the Arduino IDE and set the appropriate COM port for your programmer (Figure 9). For the meantime, there is no need to set the Board type.

Picture of the Arduino IDE showing how to select the proper COM port.
Figure 9. The Arduino IDE Showing How to Select COM port

Open the Serial Monitor and change the settings as shown in Figure 10. The line ending setting must be set to both newline and carriage return, “Both NL & CR”. Additionally, the baud rate setting must be set to “115200 baud”.

Screenshot of Arduino IDE serial monitor annotated with the proper line ending setting and baud rate setting.
Figure 10. The Arduino IDE Serial Monitor Settings

Now type “AT”, press the return key and the ESP-01 module should reply “OK”.

To view the ESP-01 module firmware version, type “AT+GMR”.

Type “AT+CIFSR” to view the Access Point’s IP address and network MAC address. See Figure 11 for the output display.

Screenshot of the Arduino IDE serial monitor showing the results of testing an ESP-01 8266 module with AT commands.
Figure 11. The Arduino IDE Serial Monitor Showing the Results of AT Commands

For a complete guide on the ESP-01 module AT commands, see ESP8266 – AT Command Reference.

Programming with Arduino IDE

In the next test, we will upload a modified version of the sample sketch Blink from the Arduino IDE. The sketch should make the blue LED on the ESP-01 module turn on and off.

IMPORTANT
Uploading an Arduino sketch to the ESP-01 module will erase the AT firmware. The AT commands will not work anymore after the upload. If you want to be able to restore the original firmware, please see the article
How to Save and Restore ESP8266 and ESP32 Firmware.

With the ESP-01 module still in the programmer/flasher, open the Arduino IDE and change the Board setting to “Generic ESP8266 Module” as shown in Figure 12.

Screenshot of the Arduino IDE showing how to set the board prior to testing the ESP-01 ESP8266 Wi-Fi module.
Figure 12. The Arduino IDE Showing How to Set the MCU Board

Create a new sketch, copy and paste the blink program shown below. Upload the sketch to the ESP-01 module. The blue LED should start blinking after successfully uploading the sketch.

/*
 * cyberblogspot.com 01Feb2023
 */

#define LED_BUILTIN 1                // GPIO1 for ESP-01, GPIO2 for ESP-01S
                                     // Change to 2 for ESP-01S module
void setup() {
  pinMode(LED_BUILTIN, OUTPUT);   
}

void loop() {
  digitalWrite(LED_BUILTIN, LOW);   // Turn the LED on (ESP-01 LED is active low)
  delay(1000);                      
  digitalWrite(LED_BUILTIN, HIGH);  // Turn the LED off 
  delay(1000);                     
}

Schematic Diagram of ESP-01S ESP8266 Wi-Fi Module

Schematic diagram of ESP-01S ESP8266 Wi-Fi module that can be used for reference purposes especially when testing the module
Figure 13. ESP-01S Wi-Fi Module Schematic Diagram

Related Articles on How to Test an ESP-01 ESP8266 Module

How to Set up Arduino IDE for ESP8266 Programming
How to Program ESP-01 with Arduino IDE
How to Control ESP-01 thru a Router
How to Control ESP-01 Without a Router
ESP-01 with RTC and LCD Display
ESP-01 ESP8266 NTP Clock with LCD Display
How to Test NodeMCU V3 Using Esptool
NodeMCU V3 ESP8266 Pinout and Configuration
How to Use AT-09 BLE with Arduino and Smartphone

References on How to Test an ESP-01 ESP8266 Module

ESP8266 on Wikipedia

The post How to Test an ESP-01 ESP8266 Module appeared first on CyberBlogSpot.

]]>
https://cyberblogspot.com/how-to-test-an-esp-01-esp8266-module/feed/ 0