Getting Started With ESP32 & Arduino IDE: Blinking LED

ESP32 is a low-cost chip developed by Espressif Systems. It is perfect for beginners (such as myself) as a jumping off point into the world of Embedded Systems. Today, I'm going to walk you through setting up your ESP32 and running a simple "blinking" program using Arduino IDE. With that being said, let's get started!

Part one: Required Hardware

1. Development Board

As the title suggest, I am using an ESP32 but any development board will suffice. More info about ESP32 can be found here (https://www.espressif.com/en/products/socs/esp32)

2. Laptop or Personal Computer

This will be used as the power source for the board and to program the code to put into it. I am using a 2017 Macbook Pro running MacOS Monterey. Note that a few things might differ with different machines, but in general it shouldn't be a problem.

3. Micro USB Cable

This will be used to connect the board with your computer. Note that some micro USB cables can only transfer power and not data so it is important to be sure that your cable can transfer both.

4. Breadboard (optional)

a breadboard might come in handy to place your development board and other projects in the future, but for this project in particular, it would still be okay without one.


With all the tools in hand you can try and connect your ESP32 with your computer, A red light on the ESP32 should turn on indicating that it is connected to power.

Part two: Required Software

1. Arduino IDE

Arduino IDE (Integrated Development Environment) is a cross-platform IDE designed for Arduino microcontrollers, however other microcontrollers can also be used with this program.

Step 1: Download & Install Arduino IDE

you can download arduino for free from this link:  https://www.arduino.cc/en/main/software

Step 2: Install the corresponding board

go to tools > boards > boards manager then search the development board that you are using on the search bar, After you find the board you are using you can then install it

Step 3: Additional Tweaks

go to Arduino > prefrences and then paste this link (https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json) to the Additional manager board URL section

2. USB to UART Port Driver

In order to properly connect your ESP32 to your computer, you'll need a USB to UART port driver. the one that I'm using is from silicon labs and can be downloaded from this link: 

when installing the driver, you might need to give it permission from system preference > security & privacy (on mac), after that you restart your computer.

open arduino and connect your board with your computer, under tools > port you should be able to see the option /dev/cu.SLAB_USBtoUART (on mac). If you don't see this option, you can try and change the usb cable that you are using.

Part 3: Code and Compile

Step 1: Aquire code
For the first project we will not code the program ourselves and instead use a built in one from arduino.  open up arduino IDE and go to File > Examples > 01. Basics > Blink. Here you can see an already completed code that you can verify and upload (run). The code should be as follows:

// 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
}

2. Verify Code

Press the checkmark on the upper left side of the window to verify the code. The verify stage checks the code for errors, then compiles the ready-for-uploading code to the Arduino.

3. Upload Code

Press the right facing arrow next to the verify button to upload your code. The upload stage actually takes the binary data, which was created from the code, and uploads it to the Arduino via the serial port. Make sure to use the correct port settings under tools.

And you're done, after uploading your code there should be a blinking blue light on your board that indicates the program is running correctly. Congratulations! you just finished your first project and now are ready to move on and try more complex projects! how exciting!!















Komentar

Postingan populer dari blog ini

Formal Invitation Letter Analysis

Natural Phenomenon