How to Blinking LED on ESP32 with Arduino IDE [FIND 2 ERRORS]

Hello, future engineers!

Welcome to my blog. 

My name is Muhamad Fariz Ramadhan from STI 2020 ITB. I made this blog for help you guys out about embedded system especially setting up ESP32 to get some condition. The first tutorial is setting up and blinking LED on ESP32 with Arduino UNO

STEP 1 : Required Hardware



1. ESP32 Development Board
2. Laptop / PC
3. Micro USB cable

*Urgent*
Make sure that you use micro USB cable that work properly because it's so sensitive, you can use your cable phone charger or buy the new one.


STEP 2 : Required Software

1. Download and install Arduino IDE


You can download Arduino IDE from this link: https://www.arduino.cc/en/software and choose suitable version for your laptop / PC. After that, please install the app by following the instructions.

2. Open Arduino IDE and set up for ESP32 microcontroller
After Arduino get installed then we have to set up the app to suitable for ESP32 microcontroller.

a.  Add boards manager URL by go to File > Preferences then add this link: https://dl.espressif.com/dl/package_esp32_index.json to Additional Boards Manager URLs and click OK.


b. Now, we're going to install the ESP32 board package. Go to Tools > Boards > Boards Manager. Then, search ESP32 by Espressif Systems and install it.

Now, change the board to DOIT ESP32 DEVKIT V1.


c. Install a USB to UART Port Driver.. One of the alternatives, you can get the driver from this link: https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers. Choose the CP210x VCP type.
For windows user you will get the zip folder that consist of these files. 
then install the execution file until the completed and the display looks like this.


STEP 3 : Connect the ESP32 to Laptop/PC

1. Connect the ESP32 with our laptop / PC using the micro USB cable.
After you connect the ESP32 with laptop/PC, the red LED will turn on that indicate the ESP32 is already powered on.




2. Change the port
We can choose the USB to UART Port under Tools > Port and choose COM 3.

*FIND ERROR*
In my condition, the port cannot change to COM 3 and display none like this. It is because my micro USB cable isn't capable to do that even the red LED turned on that indicate the ESP32 is already powered on.



But, after I use the other micro USB cable, finally the port can be changed.






So, in conclusion beware of the hardware property, is it work well or not.

STEP 4 : Code and Compile

1. Go to File > Examples > Basics > Blink.



Click the "Checklist" button on top left.
Then, click the arrow beside the checklist button.

*FIND ERROR*
If there is a problem like this A fatal error occurred : Failed to connect to ESP32: Timed out waiting for packet header. What you have to do is push and hold the boot button on your ESP32 while it is connecting.


That's all the step we need to make the ESP32 blinks. This is how it looks like :





Bonus : 

How to Blinking External LED using ESP32

Beside from the internal LED, we can also blink external LED using the ESP32. Here I'm going to show you how to do it. But first we need to understand the ESP32 pinout guide.
Source : randomnerdtutorials.com
Source : randomnerdtutorials.com

Source : randomnerdtutorials.com

Now, we need some parts to blink the external LED. Here's the list of parts that we need :
- 5mm LED
- 330 Ohm resistor
- Jumper wires (male to male)
- Breadboard (optional but highly recommended)

After you have all of the parts, connect an LED to your ESP32 by following the next schematic diagram.
Source : randomnerdtutorials.com

Note : You don't have to connect the LED to port 23, you can connect it to any port you want, but make sure to read the pinout guide first.

If you use a breadboard, it will look like this : 


For the code, you can follow this script :


const int ledPin=23;  // You can change 23 to the port you use

void setup() {
  pinMode(ledPin, OUTPUT);
}

void loop() {
  digitalWrite(ledPin, HIGH);
  delay(1000);
  digitalWrite(ledPin, LOW);
  delay(1000);
}

After following these steps, your circuit should look like this :




That's it. Thank you guys
- Fariz STI'20 

Komentar

Postingan populer dari blog ini

ESP32 with Multiple I2C Devices

ESP32 Web Server : Turn on LED using WiFi from Your Mobile or Desktop

Displayed cute picture of cat with OLED Display on ESP32 + PWM