Exp#1
Exp#1
Materials Required
■ ESP32 development board
■ USB cable
■ Breadboard
■ LED (any color)
■ 220-ohm resistor
■ Jumper wires
■ Computer with Arduino IDE installed
Procedure
1. Setup Arduino IDE for ESP32:
○ Open Arduino IDE.
○ Go to File > Preferences.
○ In the "Additional Boards Manager URLs" field, add the following URL:
https://dl.espressif.com/dl/package_esp32_index.json.
○ Go to Tools > Board > Boards Manager.
○ Search for "ESP32" and install the "esp32" package by Espressif Systems.
2. Connect ESP32 to Computer:
○ Connect the ESP32 board to your computer using the USB cable.
○ Select the correct board and port in Arduino IDE:
■ Go to Tools > Board and select your ESP32 board model.
■ Go to Tools > Port and select the port to which the ESP32 is connected.
3. Circuit Setup:
○ Place the LED on the breadboard.
○ Connect the longer leg (anode) of the LED to a digital pin (e.g., GPIO 2) on the
ESP32 using a jumper wire.
○ Connect the shorter leg (cathode) of the LED to one end of the 220-ohm
resistor.
○ Connect the other end of the resistor to the GND pin on the ESP32.
4. Write the Code:
○ Open a new sketch in Arduino IDE and write the following code:
// Start of program
// Define the LED pin
const int ledPin = 2;
void setup() {
// Initialize the digital pin as an output
pinMode(ledPin, OUTPUT);
}
void loop() {
// Turn the LED on (HIGH is the voltage level)
digitalWrite(ledPin, HIGH);
// Wait for a second
delay(1000);
// Turn the LED off by making the voltage LOW
digitalWrite(ledPin, LOW);
// Wait for a second
delay(1000);
}
// End of program
Discussion
● Explain the significance of each part of the code, such as pinMode, digitalWrite, and
delay.
● Discuss how this basic experiment can be extended to control other devices or
integrate with sensors.
Conclusion
This experiment introduces students to the basics of programming the ESP32 using Arduino IDE
and demonstrates how to control an output device (LED) using simple code.
Rubrics
Needs Improvement
Criteria Excellent (2) Good (1)
(0)
Correctly installed
Installed Arduino IDE and Did not install
Arduino IDE, added
Setup and added ESP32 board but had Arduino IDE or add
ESP32 board, and
Preparation minor issues with ESP32 board
selected the correct
board/port selection. correctly.
board and port.
LED blinks as expected LED blinks with minor timing LED does not blink
Functionality
with correct timing. issues. as expected.