Intro to Embedded Systems with ESP32 [Getting Started — LED Blink]
Hi, I’m an Information System and Technology student and this is my journey in Embedded Systems as I am taking II2260 this semester. In this blog, I want to share my experience using ESP32 and do some experiments with it.
Getting Started
ESP32 is a low-cost and low-power SoC microcontroller that includes a dual-core 32-bit processor with WiFi and Bluetooth capabilities. In this project, I will be sharing how to set up the environment for ESP32 development and blinking ESP32 LED.
Hardware Required
- ESP32 DOIT DEVKIT V1
- MicroUSB to Type-A
- PC/Laptop
Software Required
- Arduino IDE
Setup Environment: Arduino IDE
Download Arduino IDE then installs the software by following the installation guide. Follow the steps below after installing the IDE on your PC/Laptop :
- Configure Arduino IDE
2. Setting Communication Port
ESP32 uses UART to handle serial communication with the PC. Universal Asynchronous Receiver/Transmitter (UART) is a serial communication protocol that handles communication (transmit and receive serial data) using widely-adopted asynchronous serial communication interfaces. We need to download then install drivers for hosting communication between PC and ESP32.
3. Connecting ESP32 Board
Plug the MicroUSB (or your Android charger cable🤖) into your PC and ESP32. Then go to select board and choose DOIT ESP32 DEVKIT V1 and available port.
Blinking my first LED!!!
The Arduino IDE already had some built-in basic example codes for practicing and testing the development board. I’ll use the “Blink” example code from Arduino IDE for blinking ESP32 LED in this first test.
// Blink
// This example code is in the public domain.
// https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink
// 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_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
The first thing to do is verify the code.
Then Upload.
After uploading success, the ESP32 will be blinking repeatedly with a 1-second delay because of the loop()
and delay(1000)
function. The loop()
function performs exactly like its name, looping consecutively and delay()
function delaying the LED blink. Those two functions combined make the LED lights blink at the desired interval. To understand more about the Arduino Programming Language I suggest reading the documentation at:
https://www.arduino.cc/reference/en/
This might be helping for some people that encounter some problems with the ESP32 when doing this project:
I hope this blog can be useful for those who are learning and getting started using ESP32. That’s all for this project, stay tuned for the next experiment with ESP32 !!