Project 1: Getting Started with the ESP32 — LED Blink

Faiza Kamilah
5 min readFeb 6, 2022

Was in the middle of my Embedded Systems class when a lecture about microcontrollers started. A small computer on a single integrated circuit chip. An example about one of it shows up, ESP32. This ESP32 called thingy is a series of low-cost, low-power system on a chip microcontrollers with integrated WiFi and dual-mode Bluetooth.

Will it be fun and exciting? Or will it be intimidating and full of struggles? No one really knows before we really get into it.

I. Getting (stuffs) Ready
Beside getting the ESP32 DEVKIT, we also need to prepare MicroUSB cable to connect. I got them hands down from other project, but both were bought from online stores (which you can get it very easily)

II. Installation
The very first step is to do installation of the Arduino software. Newest version of Arduino IDE is available to be downloaded in this link, pick your own operating system and download & install.

III. Preparing the environment
Arduino IDE doesn’t come with the ESP32 board, this way we need to install ESP32 add-on manually to our software.
The first step is to open Arduino IDE’s Preferences, here. :>

Next one, we enter https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json into the “Additional Board Manager URLs” field as shown in the figure below. Then, click the “OK” button.

Then, go to Tools → Board → Boards Manager, find ESP32 and press install button for the ESP32. After it’s installed it will be shown as this.

IV. Testing
After all this installation steps that we’ve been through, plug the ESP32 board to computer and try more of these.

Select our Board in Tools → Board menu (in my case it’s the ESP32 Dev Module)

Select the Port (if you don’t see the COM Port in your Arduino IDE, you need to download and install the CP210x USB to UART Bridge VCP Drivers)

We’re almost there! Lets try on some basic programs to see what can this ESP32 do. For today’s project, we’ll be trying the Blink program which will make the LED inside the ESP32 blinked. We can coded on ourselves, but ArduinoIDE have it’s example codes that we can try on.

Open the following example under File → Examples → Basics → Blink

A new sketch opens in our Arduino IDE, just like this.

This may not happen in all esp32, but for my case, i need to add a definition of where the LED is located. So i add #define LED_BUILTIN 2 in the code. Just like this.

After we think out code will goes well, compile by pressing the checkmark icon, and upload it to the ESP32 by pressing the right arrow icon.

If everything goes well, the message Done Uploading will be shown and the LED inside our ESP32 will blinked! In my case, I need to always press the boot button everytime I’m to upload the program to my ESP32 so that it works.

V. Get Creative
There are some numbers in our program that shows how long do we need to wait until the next blink, blinked. Let’s try changing the delay into 100 and see what will happen.

delay changed into 100 (1/10 seconds)

It blinked faster! Go try on other numbers and see what it does to the LED.

The next thing I tried was turning on another LED but this time, externally. It’s actually kinda similar but with some kind of twists. Llllets get into it!

We’ve got most of the stuffs ready from our last project but let’s add 330 Ohm Resistor, Jumper (Male to male), LED, and make sure your Breadboard is ready this time.

There’s some kind of circuit that we need to build before operating. The sketch is shown below, the resistor needs to be parallel with the LED, connect the jumper with the pins and breadboard, and we can just follow for how it is.

Then, the code we use to run this external blink project should looked like this:

ESP32 Code for External Blink

Notice that the number for ledPin may varies based on what pin are we using for this project.

--

--