ESP-01 (01S) -> How to Program and Blink a LED

Here you will learn how to program the ESP-01 using the FTDI FT232RL (YP-05) programmer and Arduino IDE.

The ESP-01 has the ESP8266 as a microcontroller! In this way, the ESP-01 is the smallest development board that exists with this microcontroller.

ESP-01 has a different feature from most development boards like Arduino or ESP8266 Node MCU because it does not have a programmer attached and therefore an external programmer is needed. Several programmers can be used, such as simple USB to Serial converters or programmers for Arduino boards.
As you can see in the video, the flashing LED is blue and is present in the ESP-01.

Parts Required

  • ESP-01 or ESP-01S;
  • FTDI FT232RL Conversor USB Serial (YP-05);
  • 2 x 10 kΩ resistor (can be 10 kΩ +- 3 kΩ);
  • 2 Buttons;
  • Breadboard;
  • Jumper wires.

Programming Procedure

There are several ways to program the ESP-01, in this case, the circuit shown in the initial figure is used. This circuit has two buttons that allow you to enter the ESP-01 programming mode, to send the program from the computer to the ESP.
You can use any example code from blink to LED and you can use the code provided below.

Step 1: Enter programming mode by pressing the FLASH and RESET buttons;

Step 2: Release the RESET button and then release the FLASH button. You are in programming mode (first RESET button and then FLASH button);

Step 3: Upload blink program from Arduino IDE (code below);

Step 4: Click on RESET button to restart ESP-01.

Step 5: Enjoy!! But, if it didn’t work, see the next paragraph!

If the LED does not blink, you can change the pin on the first line of the code, because some ESP-01 boards have the LED connected to another pin. If you use ESP-01S you should change to Pin 2.
Note: Using INBUILT LED (LED on ESP Board), you cannot use Serial communication because this LED pin is used for TX serial communication.

Code

If you want to connect the led to another pin, you can change the first line of the code by placing the pin you want, replacing “1” with the number of the pin that you want. If you use ESP-01S you should change to Pin 2.

//You can modifiy the next line if your board has the LED connected to another Pin
#define LED 1 // ESP-01 -> Pin 1 or ESP-01S -> Pin 2
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000);
digitalWrite(LED, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}

Leave a Reply

Your email address will not be published. Required fields are marked *