This tutorial will help you set up your microcontroller and run your first tiny script that makes your LED blink.
- Here is the list of components needed:
| Quantity | Component |
|---|---|
| 1 | ESP32 |
| 1 | LED |
| 1 | Breadboard |
| 1 | 1K Resistor |
| 2 | Wires |
| 1 | USB Cable |
- If you use a small microcontroller like RP2040, Arduino Nano, or ESP32, this step is essential. If you use an Arduino Uno, skip this step.
- First, align your microcontroller pins with the breadboard holes.
- Now gently push the microcontroller down.
- Now the microcontroller is attached to the breadboard. Congrats!
- Before that, we need to understand how a breadboard and a resistor work.
- This is a breadboard. It is good for prototyping before making a real design.
- The breadboard has 3 main parts: power rails, terminal strips, and a center notch.
- The power rails are on the left and right sides. They are usually connected to a power source like a battery.
- The terminal strips are the small holes where your electronic components go. They are connected horizontally.
- The notch divides the terminal strips so you can plug in components like LEDs or microcontrollers more easily.
-
Resistors protect your components, such as LEDs.
-
They come in many shapes and values.
-
In this project, we will use a 1kΩ resistor.
-
After plugging in the microcontroller, find two holes to place the 1kΩ resistor. It should look something like this:
- Now it’s time to place the LED.
- If you didn’t know, the longer leg is positive (anode) and the shorter one is negative (cathode).
- Before placing the LED, bend the legs like this:
- Let’s cut the positive leg so it is the same length as the negative one.
- Now connect the positive leg to the closest hole that contains one end of the resistor.
- Connect the negative leg to the negative power rail.
- Now let’s connect the LED to the microcontroller.
- First, connect a wire from the negative power rail to a GND pin on the microcontroller.
- Second, connect a wire from the resistor to a GPIO pin (GPIO 26 in my case).
https://www.arduino.cc/en/software/
-> Open File -> Preferencesrences
A window will open where you will find "Additional Board Manager URLs.""
Paste: https://espressif.github.io/arduino-esp32/package_esp32_index.json
Click OK.
Click on the Board Manager button on the left and search for "ESP32." Install the library from Espressif.
Wait for the board to install.
Tools -> Board -> ESP32 Arduino -> ESP32C3 Dev Module (or the board you use) you use)
Tools -> Port -> Choose the COM port your ESP32 is connected to.ed to.
- Upload this to your microcontroller:
const int ledPin = 26;
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop() {
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(ledPin, LOW);
delay(500);
}}And you're done! 🎉