Blink for The First Time

Andreana Hartadi Suliman
6 min readFeb 1, 2022

Embedded System is one of my courses in the 4th semester of university. This course gives a foundation skill that applies across embedded computer system application areas.

For the first project, I have to run a program to change the LED indicator on the ESP-32 to flicker or blink. So, what are the required hardware? Let's check the list!

  1. ESP-32 Development board

This one is the most important, right?

2. Micro USB cable

3. Laptop/PC

4. Breadboard

The next thing that I need to do is download the Arduino IDE from https://www.arduino.cc/en/software. This application is compatible with your laptop or PC, for further information you can visit the site.

Then we need to install the correct board on Preferences. Fill the URL in the additional boards manager URLs with https://dl.espressif.com/dl/package_esp32_index.json.

After that we need to choose the package board at tools>board>boards manager, type ESP-32, and install it.

this is what you will see.

search for ESP32 and install it.

Then we need to change the default board to ESP-32. You need to select tools>board>ESP32 Arduino>DOIT ESP32 DEVKIT V1.

If we use the Arduino IDE and ESP32, the USB cable can not read it. So we need to install a software that convert USB to UART on https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers. Choose the software that compatible to your device specification.

Your Arduino IDE is ready to program the ESP-32 board !

Prepare your ESP-32 board. It’s better to put the ESP-32 into the breadboard. Because exposed foot on ESP-32 may shorten the board life.

ESP-32 already in the breadboard
The LED light (red) indicates that the ESP-32 is connected

Make sure the USB port from ESP-32 to the Arduino IDE application is installed. If it’s not there, then try changing the micro USB cable port.

The next step that we need to do is run the program via Arduino IDE so that the ESP-32 LED indicator blinks. Here are the steps.

Make the Sketch LED blink. It is quite easy because Arduino already provides template that you can choose to run the LED blink program. Choose File>Examples>01.Basics>Blink.

searching for the template
the blink program

Next, we need to verifying the sketch. It is better to verify the sketch beforehand so that the command is conveyed to the ESP-32 properly. Click the ✓ sign to Verify.

This aims to find out whether the sketch is running well or no. If there is still an error message, then it could be that the micro USB cable used can not send data or the port selected is wrong.

confirming the port
verified

Next, uploading the sketch to ESP-32. After finished verifying, Choose ➔ sign to edit and upload. It aims to send verified sketch commands to the ESP-32. Wait until the sketch is 100% uploaded.

sketch is uploaded

See the LED indicator on the ESP-32 whether it has changed or not.

it is changed!

The LED light will flicker according to the program we made earlier. In this program, the LED lights turn on and off at the interval of 1000 ms/1 second.

Blinking External LED

This additional step also needs additional components. Here are what you have to prepare.

  1. Male to Male Cable

2. Resistor 220/330 ohm

3. LED 3mm

Attach the ESP 32, LED, resistor, and male to male to the breadboard.

The longer leg from LED determines the positive pole, then attaches the resistor from the positive side of the LED to the positive side of the breadboard.

Plug the male to male cable from the pin on the ESP-32 that you want to the positive pole of the breadboard. Next, put another male to male cable from the negative pole LED to the ground (GND) pin on the ESP-32.

Then make a new file on ARDUINO IDE and paste this code.

const int ledpin = 32; // ledpin revers to the pin you're choosingvoid setup() {
// put your setup code here, to run once:
pinMode(ledpin, OUTPUT); // initialize digital pin ledpin as an output
}void loop() {
// put your main code here, to run repeatedly:
digitalWrite(ledpin, HIGH); // turn the LED on
delay(1000); // wait a second
digitalWrite(ledpin, LOW); // turn the LED off
delay(1000); // wait a second
}

Plug the ESP-32 with the micro USB cable. You should make sure that your board and port are right so there will not be any error.

Press the upload button.

Check if your code is right and uploaded.

If successful, your external LED will blink in interval of 1000 ms or 1 second.

the external LED is blinking

it works !

If you have any questions or advice about this tutorial, feel free to contact me through email at andreanahs29@gmail.com.

YEAYYY, you reached the end of this tutorial. Hope you enjoy it, good luck :)

--

--

Andreana Hartadi Suliman

If we are afraid of failure, it means we have limited our ability. — Hi, nice to see you here. Have a good day!