Robotics · Step 2 of 8 · 6 min

Electronics basics and microcontrollers

You can wire an LED safely and make a microcontroller blink it.

01 · Voltage, current, resistance

Voltage is the push, measured in volts. Current is the flow, in amps. Resistance slows the flow, in ohms. Ohm's law links them: voltage equals current times resistance.

That one rule explains why an LED needs a resistor in series. Without it, too much current flows and the LED or the pin burns out. Around 220 to 330 ohms is a common starting value on 5 V.

02 · Microcontrollers

A microcontroller is a tiny computer on one chip. It runs one program, starts in a blink and talks directly to pins. That makes it ideal for reading sensors and driving motors.

Arduino Uno boards use 5 V logic and are the classic way to start. ESP32 boards are cheap, faster and add Wi-Fi and Bluetooth, but use 3.3 V logic. Feeding 5 V into an ESP32 pin can damage it.

03 · Pins and code

Digital pins are on or off. Analog inputs read a range, like a knob or a light sensor. PWM pins switch on and off very fast, which lets you dim an LED or set a motor's speed.

An Arduino program has two parts. setup() runs once. loop() runs forever. You will write almost all robot code inside that forever loop.

04 · Power and safety

Never power a motor straight from a microcontroller pin. Pins give only a few tens of milliamps. Motors get their own supply and a driver, with the grounds connected.

Lithium batteries, especially LiPo packs, store a lot of energy. Use a proper charger, never charge them unattended, and retire any pack that is puffed or damaged. Disconnect power before you change wiring.

05 · Try it

06 · Check yourself

Why do you add a resistor in series with an LED?