ibp-project-0

Project 0: Getting Started with ESP32

Your first step into programming the ESP32 with Innovator Box Plus

Difficulty: Beginner
Time Required: 30-45 minutes

Tutorial Video

Objective

In this project, we'll connect an LED to an ESP32 using a breadboard and jumper wires to make it blink. This is a perfect beginner project to understand basic GPIO pin functionality on the ESP32.

Components Needed

  • ESP32 microcontroller (included in your Innovator Box Plus)
  • Breadboard (included)
  • LED (any color)
  • Jumper wires
  • USB cable (to connect ESP32 to your computer)

Step 1: Assembling the Circuit

ESP32 Pinout Diagram

ESP32 Pinout Diagram

Follow these steps while referring to the breadboard diagram:

  1. Connect the Jumper Wires First:
    • Take an orange jumper wire and connect one end to GPIO16 on the ESP32.
    • Take a black jumper wire and connect one end to GND on the ESP32.
  2. Place the LED on the Breadboard:
    • Insert the LED into the breadboard, ensuring its legs are in separate rows.
    • The longer leg (anode) is the positive side, and the shorter leg (cathode) is the negative side.
  3. Connect the Jumper Wires to the LED:
    • Attach the orange wire (from GPIO16) to the same row as the longer leg (anode) of the LED.
    • Attach the black wire (from GND) to the same row as the shorter leg (cathode) of the LED.
  4. Double-Check the Connections:
    • Ensure all connections match the breadboard diagram before powering the ESP32.
Complete LED Circuit with ESP32

Complete Circuit

Step 2: Writing the Code

Use the following code to make the LED blink:

#define LED 16   // GPIO16 is connected to the LED

void setup() {
  pinMode(LED, OUTPUT);    // Configure LED pin as output
}

void loop() {
  digitalWrite(LED, HIGH); // Turn the LED on
  delay(1000);             // Wait for 1 second
  digitalWrite(LED, LOW);  // Turn the LED off
  delay(1000);             // Wait for 1 second
}

Code Explanation:

  • #define LED 16: Assigns GPIO16 as the pin connected to the LED.
  • pinMode(LED, OUTPUT);: Sets GPIO16 as an output pin.
  • digitalWrite(LED, HIGH);: Sends a high signal (3.3V) to GPIO16, turning the LED on.
  • digitalWrite(LED, LOW);: Sends a low signal (0V) to GPIO16, turning the LED off.
  • delay(1000);: Waits for 1 second before toggling the LED again.

Step 3: Uploading the Code

  1. Open the Arduino IDE on your computer.
  2. Go to Tools > Board > ESP32 Arduino > Select your ESP32 board.
  3. Select the correct port under Tools > Port.
  4. Copy and paste the above code into the Arduino IDE.
  5. Click the Upload button (right arrow icon) to send the code to the ESP32.
  6. Once uploaded, the LED should start blinking with a 1-second interval.

Troubleshooting

LED Doesn't Blink

  • Check if the LED is connected in the correct orientation (longer leg to GPIO16).
  • Verify that you've selected the correct board and port in the Arduino IDE.
  • Ensure the ESP32 is properly connected to your computer.

Upload Errors

  • Make sure you have installed the ESP32 board manager in Arduino IDE.
  • Try pressing and holding the BOOT button on the ESP32 while uploading.
  • Check if you have the correct drivers installed for your ESP32 board.

Next Steps

Now that you've completed your first project with the ESP32, you're ready to move on to more complex projects. Try experimenting with:

  • Changing the blinking speed by adjusting the delay values
  • Adding more LEDs to different GPIO pins
  • Creating different blinking patterns

Ready for a bigger challenge? Check out Project 1: Traffic Light Simulation.