Tidy breadboard with LEDs, potentiometer, push button, buzzer and ESP32-C3, notebook with circuit sketches

Beginner

Electronics Starter Lab — Learn the Fundamentals

ComponentsFundamentalsEducation

Five hands-on exercises that teach the basics behind every electronics project: light an LED, read a button, read a knob, dim an LED with PWM, and switch a larger load with a transistor. Not one finished build, but the skills every build uses.

What you'll learn

  • Wire an LED safely with a current-limiting resistor
  • Read a push button and handle contact bounce
  • Read an analog knob with the ADC
  • Dim an LED with PWM
  • Switch a larger load with an NPN transistor

9 real parts included

Total for this kit: 2,059.00 ฿

Doesn't include any order discount you may get at checkout.

What you'll need

Project Goal

This isn't one build -- it's the set of fundamental skills nearly every other project depends on. Working through these exercises with a breadboard and a handful of basic components teaches you to read a simple schematic, wire it correctly the first time, and actually trust your own connections before you move on to combining parts into a real project.

Exercise 1: Your First LED Circuit

Wire a single LED in series with a resistor to a GPIO pin and ground, then turn it on and off from code. The resistor isn't optional: an LED without current limiting will draw far more current than either the LED or the controller's pin is rated for, and can damage both. This is your first hands-on look at Ohm's law -- the resistor value you choose sets how much current flows once you know the LED's forward voltage and the controller's pin voltage.

Exercise 2: Reading a Digital Input

Wire a push button so the controller can read whether it's currently pressed. A mechanical button doesn't transition cleanly between open and closed -- its contacts physically bounce for a few milliseconds, which can register as several rapid presses instead of one. Debouncing means dealing with that in software (or hardware) so a single physical press reads as a single logical press.

Exercise 3: Reading an Analog Input

Wire a potentiometer so its wiper feeds a variable voltage into one of the controller's analog-capable pins, and read that as a changing number in code. This is your first look at the ADC (analog-to-digital converter): the controller doesn't see a smooth voltage, it sees that voltage converted into a discrete numeric range, and the resolution of that range is a property of the specific controller you're using.

Exercise 4: Dimming an LED with a Knob (PWM)

Combine what you have learned: the potentiometer's analog reading sets how bright an LED glows. The controller reads the knob with its ADC, then drives the LED with PWM -- switching it on and off thousands of times a second, with the share of time spent on setting the brightness you see. It is your first complete input-to-output loop: an analog input directly controlling an output.

Exercise 5: Switching a Bigger Load with a Transistor

A GPIO pin can only safely source a small amount of current -- enough for an LED, not enough for a motor, a larger light, or most real loads. Wiring a transistor as a simple switch lets a small signal from the GPIO pin control a much larger current flowing through a separate part of the circuit, without that larger current ever passing through the controller pin itself. This is the same basic concept behind relay and MOSFET modules used in bigger projects in our larger projects.

Testing and Troubleshooting

  • Check power and ground connections first, before suspecting any single component -- most "dead circuit" problems trace back to a missing or swapped power/ground wire.
  • Change and test one new part at a time. Adding several new components to a breadboard at once and debugging them all together is much harder than proving each one works on its own first.
  • Double-check polarity on parts that have it -- LEDs, and some capacitors and transistors, only work one way round even though they may fit into the breadboard either way.
  • If something doesn't behave as expected, isolate it: strip the circuit back to the smallest version that still shows the problem, rather than guessing at the full assembly.

Optional Future Upgrade

Once these fundamentals feel comfortable, any of our other project builds is a natural next step -- each one combines this same small set of skills (reading inputs, driving outputs, and structuring a simple control loop) with real sensors and displays to build something you can actually use.

Wiring

Exercise 1: Blink an LED

  • LED anode (long leg) → 220–330Ω resistor → ESP32-C3 GPIO4
  • LED cathode (short leg) → GND

Confirm LED polarity before powering up — the flat edge on the LED's rim (or the shorter leg) is the cathode. This is the simplest possible bring-up test for your board and breadboard wiring.

Exercise 2: Read a Button to Light an LED

  • LED anode → 220–330Ω resistor → ESP32-C3 GPIO4 (same as Exercise 1)
  • LED cathode → GND
  • Push button leg 1 → ESP32-C3 GPIO5
  • Push button leg 2 → GND

`INPUT_PULLUP` means the pin reads HIGH when the button is untouched and LOW when pressed (the button just connects the pin to GND) — no external resistor is needed. This is the standard low-cost way to wire a momentary button on any microcontroller.

Exercise 3: Read a Potentiometer

  • Potentiometer outer leg 1 → ESP32-C3 3V3
  • Potentiometer outer leg 2 → GND
  • Potentiometer wiper (middle leg) → ESP32-C3 GPIO0 — ADC-capable pin

Turning the knob sweeps the wiper voltage between 0V and 3.3V; `analogRead()` reports that as a raw value (0–4095 on the ESP32-C3's 12-bit ADC). Watch the Serial Monitor while turning the knob to see the full range before moving to Exercise 4.

Exercise 4: Potentiometer Controls LED Brightness (PWM)

  • Potentiometer outer leg 1 → ESP32-C3 3V3
  • Potentiometer outer leg 2 → GND
  • Potentiometer wiper → ESP32-C3 GPIO0
  • LED anode → 220–330Ω resistor → ESP32-C3 GPIO4 (must be a PWM-capable output — all GPIOs on the ESP32-C3 support PWM via the LEDC peripheral)
  • LED cathode → GND

PWM is how a pin that is only ever fully on or fully off can make an LED look dimmer: the pin switches faster than the eye can follow, and the share of time it spends on sets the brightness. This uses the `ledcAttach()`/`ledcWrite()` pin-based LEDC API from current Arduino-ESP32 core versions (3.x); if your installed board package is an older 2.x core, swap in `ledcSetup()` + `ledcAttachPin()` + `ledcWrite(channel, duty)` instead.

Exercise 5: NPN Transistor as a Digital Switch

  • ESP32-C3 GPIO7 → 1kΩ resistor → NPN transistor base (e.g. 2N2222/BC-series, from the transistor kit)
  • NPN transistor emitter → GND
  • NPN transistor collector → LED group cathode side — the transistor forms the low-side switch for a small parallel LED group
  • LED group anodes → individual 220–330Ω resistors → 3V3 — each LED in the group gets its own resistor even though they share one transistor switch

This is a low-side switch: the GPIO never touches the LED group's power directly, it only switches a small base current that lets the transistor pass a larger current from 3V3 through the LEDs to GND. This is the same principle used to switch loads a GPIO can't safely drive on its own, scaled up here with LEDs since that's what's in the kit — swap the LED group for a heavier load later using the same base-resistor arrangement.

Wiring Diagram

Exercise 1: Blink an LED anode GPIO4 cathode ESP32-C3 220–330Ω resistor LED GND Exercise 2: Read a Button to Light an LED anode GPIO4 cathode leg 1 → GPIO5 leg 2 ESP32-C3 220–330Ω resistor Push button LED GND Exercise 3: Read a Potentiometer leg 1 → 3V3 leg 2 wiper → GPIO0 ESP32-C3 Potentiometer GND Exercise 4: Potentiometer Controls LED Brightness (PWM) leg 1 → 3V3 leg 2 wiper → GPIO0 anode GPIO4 cathode ESP32-C3 Potentiometer 220–330Ω resistor GND LED Exercise 5: NPN Transistor as a Digital Switch GPIO7 base emitter collector ESP32-C3 1kΩ resistor NPN transistor GND LED group cathode side LED group anodes individual 220–330Ω resis… 3V3

Starter Code

// ===== Exercise 1: Blink an LED =====
// Exercise 1: Blink an LED
#define LED_PIN 4 // adjust to match your wiring if different

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

void loop() {
  digitalWrite(LED_PIN, HIGH);
  delay(500);
  digitalWrite(LED_PIN, LOW);
  delay(500);
}

// ===== Exercise 2: Read a Button to Light an LED =====
// Exercise 2: Button controls an LED
#define LED_PIN 4
#define BUTTON_PIN 5 // adjust to match your wiring if different

void setup() {
  pinMode(LED_PIN, OUTPUT);
  pinMode(BUTTON_PIN, INPUT_PULLUP);
}

void loop() {
  bool pressed = (digitalRead(BUTTON_PIN) == LOW);
  digitalWrite(LED_PIN, pressed ? HIGH : LOW);
}

// ===== Exercise 3: Read a Potentiometer =====
// Exercise 3: Read a potentiometer and print to Serial
#define POT_PIN 0 // adjust to match your wiring if different

void setup() {
  Serial.begin(115200);
}

void loop() {
  int raw = analogRead(POT_PIN);
  Serial.print("Pot raw value: ");
  Serial.println(raw);
  delay(200);
}

// ===== Exercise 4: Potentiometer Controls LED Brightness (PWM) =====
// Exercise 4: Potentiometer controls LED brightness via PWM
#define POT_PIN 0
#define LED_PIN 4 // adjust to match your wiring if different

const int PWM_FREQ = 5000;
const int PWM_RESOLUTION = 8; // 0-255 duty range

void setup() {
  Serial.begin(115200);
  // Arduino-ESP32 core 3.x pin-based LEDC API:
  ledcAttach(LED_PIN, PWM_FREQ, PWM_RESOLUTION);
}

void loop() {
  int raw = analogRead(POT_PIN);           // 0-4095
  int brightness = map(raw, 0, 4095, 0, 255); // scale to 8-bit PWM duty
  ledcWrite(LED_PIN, brightness);

  Serial.print("Pot: "); Serial.print(raw);
  Serial.print("  Brightness: "); Serial.println(brightness);
  delay(50);
}

// ===== Exercise 5: NPN Transistor as a Digital Switch =====
// Exercise 5: NPN transistor switches an LED group from a digital pin
#define SWITCH_PIN 7 // adjust to match your wiring if different

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

void loop() {
  digitalWrite(SWITCH_PIN, HIGH); // transistor conducts, LED group ON
  delay(1000);
  digitalWrite(SWITCH_PIN, LOW);  // transistor cuts off, LED group OFF
  delay(1000);
}

Not sure about a step? Ask us