Foundations · Lesson 2 of 11 · about 15 min
Hardware basics for software developers
Voltage, current, resistors, and how not to burn a pin
Code can be undone; a burnt LED or a dead pin cannot. Three numbers explain almost every hardware mistake a beginner makes: voltage, current and resistance.
| Quantity | What it is | Unit | Water picture |
|---|---|---|---|
| Voltage (V) | The push that moves electrons | volt (V) | Water pressure |
| Current (I) | How much flows | ampere (A), usually mA | Litres per second |
| Resistance (R) | How hard it is to flow | ohm (Ω) | A narrow pipe |
Ohm’s law: V = I × R
Know two of the three and you get the third. It tells you how big a resistor must be, how much current a pin sends, and how hot a part gets (power = V × I).
An LED always needs a resistor
An LED drops an almost fixed voltage (about 2 V for red, about 3 V for blue and white). Whatever is left over must be taken by a resistor, or the current rises until the LED or the pin dies. Most pins are happy with 5 to 10 mA.
The real app, running in your browser: this lesson with its 3D preview on a simulated Raspberry Pi Pico. No install, nothing to plug in.
Pull-up resistors: a defined level
An input connected to nothing floats and reads random values. A pull-up resistor to 3.3 V makes it read HIGH until a button pulls it to GND. Most chips have weak internal pull-ups (INPUT_PULLUP); I2C needs real ones, because the bus must rise fast enough.
Voltage dividers
Two resistors in series split a voltage in the ratio of their values. This is how you read a 5 V signal on a 3.3 V pin, or measure a battery with an ADC.
5 V and 3.3 V do not mix
- ESP32, Pico, STM32 and nRF52 pins take at most 3.3 V (a few STM32 pins are 5 V tolerant: the board file says which).
- A 5 V signal going into a 3.3 V pin: use a divider (one direction) or a level shifter (I2C, both directions).
- A 3.3 V signal into a 5 V Arduino usually reads HIGH, but check the part: some need 0.7 × 5 V = 3.5 V.
- Always connect the grounds: a voltage only means something against a shared ground.
BoardPilot checks these for you: the wiring rules flag a 5 V part on a 3.3 V pin, a missing ground, and an output on an input-only pin, and the shopping list adds the divider or level shifter you need.
Reading a schematic and a datasheet
- A schematic shows connections, not positions: two wires that meet with a dot are connected; lines that cross without a dot are not.
- Labels with the same name (3V3, GND, SDA) are connected even when no line joins them.
- On a datasheet’s first page: the supply voltage range, the interface (I2C, SPI…) and the I2C address.
- Then look for “Absolute maximum ratings”: never go beyond them, not even for a moment.
Interview questions
- Why does an LED need a series resistor, and how do you choose its value?
- What happens if you leave a GPIO input floating?
- How do you connect a 5 V sensor output to a 3.3 V microcontroller?
- Why does I2C need pull-up resistors, and what goes wrong if they are too large?
- What is the difference between absolute maximum ratings and recommended operating conditions?
No answers here on purpose: try answering out loud first. In the BoardPilot app, the interview coach reads your own answer and tells you what was right, what is missing and what a senior interviewer would ask next (it uses the AI provider you choose in the app). Embedded systems interview questions →
Key terms
Logic level (HIGH and LOW) Pull-up resistor Pull-down resistor Floating input Brownout Ohm’s law Current-limiting resistor Voltage divider Level shifter Datasheet Absolute maximum ratings Schematic Breadboard Jumper wire (Dupont) Multimeter
In the app, the lessons come alive
The lessons have interactive demos and hands-on labs checked on your board in the app. These pages are the readable version: the demos are described in words, and the labs need the app.