ESP 32 - Project 1: Blink

Muhammad Raihan Aulia
4 min readFeb 4, 2022

--

Blink is one of the things we want to learn on how to use ESP32 microcontroller. In this article, we will learn on how to make our microcontroller blink the built-in and external LED.

Before we start making the blinking project *wink*, we need

  • ESP 32 (in this article, I’m going to use DOIT DEVKIT V1)
  • Breadboard (put the ESP 32 on the breadboard all time to avoid damage on the micro controller)
  • Micro USB cable
  • Personal Computer

And for the external LED blink, we need to add

  • LED
  • Male-to-male Jumper Cable
  • 300 Ω Resistor

Setting up Arduino IDE

if your pc doesn’t have Arduino IDE, then here’s step-by-step on how to install it.

Download the IDE. Follow the instruction.

Open the IDE, then open file

Open File, then go to preference. Paste this link in the Additional Boards Manager URL. https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

Go to Tools → Board → Board Manager.

In the Board Manager, search for esp32 then install the first one

In the Tools → Board, under the Board Manager, look for your ESP 32.

After you connect the ESP32 with your computer using micro USB cable, choose the port you’re using. I’m using port 8.

Then we just completed the set up.

Blink Program

for the blinking program, Arduino IDE has given us the library for default blink program. To access it, go to File → Example → Basics → Blink.

then it would look like this

After that you can check the code by pressing the verify button (the one with check mark ). If you’re sure about the code, you can press the upload button.

When you’re uploading the code, some ESP 32 will make you stuck like this

if that happen, press the boot button on the ESP 32.

Wait until the upload finished. You’ll know it finished when this is the message it give to you.

Finally, check your ESP 32. It should be blinking like this.

External LED Blink

After you finished the built-in LED blink, you can edit the blink program from before. Choose the pin you want to use as the output (I’m using pin 23 as the output) and follow this code.

If you’re never use breadboard, then here is the mapping. The line means the dot connected.

Connect the output pin that you choose with LED (I’m using jumper cable so it would be easier to put the LED anywhere I want) and then connect the LED with the resistor. This resistor will act as some-sort of dam so the LED won’t broke. Connect the resistor with the “Ground” pin of ESP 32. The Ground pin is the one with “GND”.

Then voila, your external blink is done.

This article is part of a series of project that used for a course named Embedded System guided by Dr. Kusprasapta Mutijarsa, S.T., M.T.

--

--