ESAP Robotics · Summer 2026
Thirteen days, from a loose resistor to an orchestra.
This is a record of Penn's Engineering Summer Academy Robotics program — the summer a room full of us learned to turn a pile of parts into machines that play music — and a place to walk back through every piece of it. If you were here, read it as a keepsake. If you're coming next, read it as a map of what's ahead. Either way, it's all here: the ideas, in the order they hit us, with the interactive bits we wish we'd had.
Where the week actually gets hard
Thirteen days, and the load never spread evenly. Here's the shape of the program — what each day covered, and where it hit hardest, which doubles as a guide to what's worth reviewing most:
| Day | Topic | Prep value | Why |
|---|---|---|---|
| 1 | Circuits & measurement | High | Pure physics. Fully learnable at home. |
| 2 | Diodes & LEDs | High | One calculation, used constantly. |
| 3 | Programming | Critical | A semester of C++ in one morning. |
| 4 | Motors & servos | Medium | Needs hands on hardware, but the math preps. |
| 5 | CAD & fabrication | Medium | CAD fluency takes hours you can bank now. |
| 6 | Inputs & sensors | High | Switches, pull-ups and the ADC — all learnable ahead. |
| 7 | Mechanisms & design | Medium | Linkages and design method preview well; the build is hands-on. |
| 8 | Motor drivers | High | Transistors and the H-bridge are pure concept — learn them cold now. |
| 9 | Pins & I²C | High | The pin-count problem and serial buses are fully learnable ahead. |
| 10–13 | The finale: FSM, timing, Wi-Fi | Medium | The software architecture previews well; the rest is building your robot. |
If you only do one thing on this site, do . Students who arrive unable to write a for loop spend the rest of the program debugging syntax instead of designing robots.
Walk back through it
The whole arc in order — each step builds on the one above. Tick them off as you revisit, or, if you're getting ready to arrive, as you get ahead. Progress saves in this browser.
Task Zero is the important one
Installing the toolchain at home is worth more than it sounds. On Day 2 the class installs Arduino IDE and ESP32 board support together, and driver problems, wrong board selections and missing USB permissions routinely eat an entire lab afternoon. Arrive with a board that blinks and you skip all of it.
About this. It's an unofficial record and review of ESAP Robotics 2026, written from scratch by a student who was there — part study guide, part keepsake. Every explanation is in our own words, not a copy of any course material, and it deliberately holds no rosters, staff contacts or assignment answers. The real course was the lectures, the labs, and the people; this is just where some of it got written down.
Day One
Voltage, current, and learning to trust a meter
Everything electrical for the next three weeks rests on three quantities and one equation relating them. Get genuinely comfortable here and Days 2 and 4 become bookkeeping.
The water picture
Electricity is invisible, so nearly everyone reasons about it by analogy to water in pipes. The analogy is imperfect but it will carry you a long way.
Voltage — pressure
How hard the system pushes. Measured in volts (V). Always measured between two points — there's no such thing as the voltage at a place, only relative to somewhere else.
Current — flow rate
How much actually moves, in amps (A). Milliamps (mA) are what you'll live in — a thousandth of an amp.
Resistance — narrowness
How much the path fights the flow, in ohms (Ω). A narrow pipe passes less water for the same pressure.
Here is the whole analogy as one moving loop. The pump is your battery, the narrow spot is a resistor, and the moving water is the current. Work both sliders and watch what the flow does:
Three things to notice while you drag. Push harder and the flow speeds up everywhere at once. Narrow the pipe and the flow slows everywhere at once — including before the narrow spot, which surprises most people. And the water is never used up: exactly the same flow passes every point in the loop. That last one is a real law of circuits, not a quirk of the analogy — in a series loop, current is identical at every point. What gets "spent" along the way is pressure. Voltage drops; current circulates.
The point about voltage being relative is the one that trips people up, so sit with it. When someone says "this pin is at 3.3 volts," they mean 3.3 volts above ground. Ground is just the point everyone agrees to call zero. This is why, later, connecting two power supplies without joining their grounds produces circuits that make no sense — the two halves don't agree on where zero is.
Ohm's law
One equation, three forms, and you will use it hundreds of times:
V = I × R I = V / R R = V / I
Push harder (more V) and more flows. Narrow the pipe (more R) and less flows. Everything on Day 1 and Day 2 is this equation wearing different hats.
Watch your units. Volts, amps and ohms work together directly; but currents in this course are usually milliamps, so 3.3 V ÷ 10 mA is 3.3 ÷ 0.010 = 330 Ω, not 0.33. Getting this wrong by a factor of 1000 is the single most common arithmetic slip in the first week.
Resistors in series and parallel
Series — add them up
R_total = R1 + R2 + R3 …
One path. All the current goes through every resistor in turn, so the obstacles accumulate. Total is always larger than the biggest one.
Parallel — add the reciprocals
1/R_total = 1/R1 + 1/R2 …
Multiple paths. Current splits and takes all of them, so it gets easier. Total is always smaller than the smallest one — a useful sanity check.
Shortcut worth memorising
Two equal resistors in parallel give exactly half the value. Two 100 Ω in parallel = 50 Ω. This comes up constantly and saves you reaching for a calculator.
The voltage divider
Two resistors in series across a supply. The junction between them sits at a voltage partway between the two ends — and where exactly depends on the ratio of the resistors, not their absolute size.
V_out = V_in × R2 / (R1 + R2)
This is how nearly every sensor you meet will report itself. A potentiometer is a divider whose ratio you turn with your fingers. A light sensor is a divider whose ratio changes with brightness. Drag the wiper below and watch the output track it.
Power, and why resistors sometimes smoke
A resistor turns electrical energy into heat. How much heat is:
P = V × I (also P = I²R and P = V²/R )
Every physical resistor has a power rating — typically 1/4 W for the ones in a classroom bin. Exceed it and it discolours, smells, and eventually fails. The calculator above warns you when a divider crosses that line, which is exactly the mistake that produces the smell.
Design consequence
This is why dividers use resistors in the kilohm range rather than tens of ohms. Two 10 Ω resistors across 5 V burn 625 mW and cook. Two 10 kΩ resistors give the identical output voltage while burning 0.6 mW. Same ratio, same answer, no smoke. When in doubt, scale both resistors up.
The multimeter
A digital multimeter (DMM) is the instrument you'll reach for whenever something doesn't work. Three modes cover almost everything:
| Mode | How to connect | What it tells you |
|---|---|---|
| Voltage | Across — probes on two points, circuit powered and running | The pressure difference between those points. Your default diagnostic. |
| Resistance | Across — circuit powered off, component ideally lifted out | Component value. Meaningless on a live circuit. |
| Continuity | Across — powered off | Beeps if connected. Finds broken wires and accidental shorts. |
| Current | In line — break the circuit, meter becomes part of it | Flow rate. Awkward, so measure voltage across a known resistor and compute instead. |
Blow a fuse this way
Current mode puts a near-short between the probes. Leave the leads in the current jacks, then absent-mindedly measure a voltage, and you connect the supply straight to ground through the meter. The fuse dies. Habit that prevents it: put the leads back in the voltage jacks the moment you finish a current measurement.
Continuity mode is underrated. Most first-week bugs are not subtle theory failures — they're a jumper in the wrong row or a wire that looks seated but isn't. Before you question your understanding of the circuit, beep out your connections.
Reading a breadboard
A breadboard is a grid of clips hidden under plastic. The pattern of what's connected to what is not obvious from the top, and misreading it causes more confusion than any concept on this page.
- The long rails down the outside edges run horizontally, the full length of the board. These are for power and ground.
- The main field is connected in short vertical runs of five holes. Anything in the same run of five is the same electrical point.
- The centre channel breaks the connection. The five holes above it and the five below are separate — which is precisely why chips straddle it, so each pin lands on its own run.
Two habits worth forming now
First, the outer rails are often split in the middle on larger boards — the left half and right half of the same-looking rail may not be joined. Beep them with continuity before trusting them. Second, colour-discipline your jumpers: red for power, black for ground, everything else for signals. It costs nothing and makes every later debugging session faster.
Check yourself
Day Two
Diodes, LEDs, and the resistor that saves them
One component, one calculation. You will do this calculation more times in three weeks than any other, so it's worth making automatic before you arrive.
A diode is a one-way valve
Back to the water pipes: a diode is a check valve. Push one way and it opens; push the other and it seals. In electrical terms it conducts when voltage is applied in its forward direction and blocks in reverse.
But it isn't a perfect valve. It takes a certain minimum pressure to crack it open — the forward voltage, written Vf. Below Vf, essentially nothing flows. Above it, the diode conducts hard and clamps at roughly that voltage no matter how much current passes.
That clamping behaviour is the whole story. It's why LEDs need protection, and it's why the calculation below works.
Why an LED can't be connected directly
An LED is a diode that emits light, and its brightness follows the current through it, not the voltage across it. Here's the trap:
Above its forward voltage, an LED barely resists current at all. Connect a 2.0 V LED straight across a 3.3 V pin and the circuit has almost nothing limiting flow — current runs away, and the LED, the pin, or both die. Often within a second.
So you add a resistor in series to absorb the leftover voltage and set the current deliberately. The LED takes its Vf; the resistor takes the rest; Ohm's law fixes the flow.
R = ( V_supply − V_forward ) / I_target
Worked example, using the numbers you'll actually meet — a 3.3 V microcontroller pin, a red LED with Vf ≈ 2.0 V, and a target of 10 mA to stay inside the pin's safe limit:
R = (3.3 − 2.0) / 0.010
= 1.3 / 0.010
= 130 Ω → nearest standard value: 133 Ω
Resistors only come in standard values, so you round to a real one. Always round up — a slightly larger resistor means slightly less current, which is the safe direction to be wrong in.
LED resistor calculator
Notice what the colour selector does
Blue and white LEDs have a forward voltage above 3.0 V. On a 3.3 V supply that leaves you almost no headroom — the arithmetic gives a tiny resistor and unreliable brightness, and if Vf drifts above the supply the LED simply won't light. Try it. This is a real constraint on a 3.3 V board, not a quirk of the calculator.
Several LEDs at once
In series — same current, voltages add
Every LED carries the identical current, so they match in brightness. But their forward voltages stack: two 2.0 V LEDs need 4.0 V before anything happens at all, which is more than a 3.3 V pin can offer. Series works on higher supplies.
In parallel — same voltage, current splits
Tempting, and a trap. Real LEDs vary slightly in Vf, and the one with the lowest Vf hogs the current — it burns brightest and dies first while its neighbours stay dim. Give each parallel LED its own resistor.
Sharing one resistor is the classic error
A single resistor feeding several parallel LEDs looks efficient and behaves badly. The mismatch is not theoretical — LEDs from the same bag differ enough to make it obvious. One resistor per LED, every time.
Reading a datasheet
Every component has a PDF describing it. They're dense, but you only ever need a handful of lines. What to look for:
- Absolute maximum ratings. Not a design target — a destruction threshold. Staying under these keeps the part alive; it does not make it work well. Design comfortably below.
- Typical operating conditions. These are the numbers you actually design to.
- Forward voltage (for LEDs), often given as a range at a stated test current.
- Pinout. Which leg is which. On a through-hole LED the longer leg is the anode (positive side) and the flat notch on the rim marks the cathode.
Practical habit
Datasheet values are typical, and reality has tolerance. A resistor marked 10 kΩ might genuinely be 9.6 kΩ. This is why the fix for a misbehaving circuit is to measure rather than to assume — the meter tells you what's true, the datasheet tells you what was promised.
Check yourself
Day Three · the wall
Enough C++ to stop being the bottleneck
This is the day the program compresses hardest — variables, types, conditionals, loops and functions in a single morning. Nothing here is difficult on its own. It's difficult at that speed. Read this section twice.
The shape of every program
Arduino programs are called sketches, and they're C++ with some conveniences. Every sketch has exactly two functions, and the board handles calling them:
// runs once, when the board powers up or resets void setup() { Serial.begin(115200); } // runs over and over, forever, as fast as it can void loop() { Serial.println("still here"); delay(1000); }
setup() is for one-time preparation: opening the serial connection, declaring which pins are inputs or outputs. loop() is the actual behaviour. When loop() reaches its closing brace it immediately starts again from the top — there is no "end" to a sketch. A robot that stops doing anything is usually a robot whose loop is stuck.
The serial monitor is your only window
A microcontroller has no screen. The one way to see what it's thinking is to have it print text back over the USB cable, which you read in a panel in the Arduino IDE called the Serial Monitor. This is your print statement, your debugger, and your sanity check.
Serial.begin(115200); // in setup — opens the channel Serial.print("x is: "); // prints, stays on the line Serial.println(x); // prints, then starts a new line
The bug that will happen to you
The number in Serial.begin() is the baud rate — how fast the two sides talk. There is a matching dropdown in the corner of the Serial Monitor. If they disagree, your output is not missing, it's garbled — screens of random symbols. Students lose real time assuming the board is broken. Set both to 115200 and stop thinking about it.
Variables and types
C++ makes you declare what kind of thing every variable is before using it, and it will not quietly change its mind later. The main ones:
| Type | Holds | Notes |
|---|---|---|
| int | Whole numbers | Your default. No fractional part, ever. |
| float | Decimals | Approximate. Fine for physical quantities. |
| bool | true / false | Flags and switch states. |
| char | A single character | Single quotes: 'A'. |
| String | Text | Double quotes. Convenient, memory-hungry — use sparingly. |
int ledPin = 4; float targetAngle = 90.5; bool isPlaying = false;
Name things for what they mean. servoAngleDegrees costs a few keystrokes and saves you an hour on the day your teammate reads your code — which, on a group project, is every day.
Integer division — the trap that gets everyone
When you divide two ints, C++ gives you an int. It doesn't round — it throws the remainder away. So 5 / 3 is 1, not 1.67. And 1 / 2 is 0, which silently zeroes out whatever you multiply it by.
The fix is to make at least one side a decimal: 5.0 / 3.0 gives 1.667. Write the .0 even when it looks unnecessary. This bug produces no error message — your robot just doesn't move, and the cause is invisible.
Predict the output, then check
int a = 7, b = 2; Serial.println(a / b); Serial.println(a / 2.0); Serial.println((float)a / b);
3, then 3.50, then 3.50. The first is integer division and loses the remainder. The second works because 2.0 is a float, which promotes the whole expression. The third uses a cast — (float)a forces a to be treated as a decimal for that one calculation, without permanently changing it.
#define — find and replace before compiling
#define SERVO_PIN 4 #define MAX_ANGLE 180
This is not a variable. Before compiling, the toolchain performs a literal text substitution — every SERVO_PIN in your file becomes 4. It costs no memory, and it means the pin number lives in exactly one place. When you rewire the board at 11pm, you change one line instead of hunting through the file.
Because it's blind text replacement, it's also happy to substitute nonsense, which is why #define is conventionally reserved for constants and written in CAPITALS so readers know it isn't a normal variable.
Making decisions
if (temperature > 30) { Serial.println("hot"); } else if (temperature > 15) { Serial.println("fine"); } else { Serial.println("cold"); }
| Operator | Means | Watch for |
|---|---|---|
| == | Is equal to | Two signs. One sign assigns. |
| != | Is not equal to | |
| > < >= <= | Comparisons | |
| && | AND — both must hold | Two ampersands, not one. |
| || | OR — either will do | Two bars, not one. |
| ! | NOT — flips it |
= versus ==
Writing if (x = 5) instead of if (x == 5) doesn't compare anything. It sets x to 5, and then treats that as true — so the branch always runs, and your variable has been quietly overwritten. It usually compiles without complaint. When a condition behaves as though it's always true, check this first.
Same shape of confusion with & vs &&: the single character does bitwise arithmetic, not logic. It compiles. It gives wrong answers.
Repeating yourself
// for — when you know how many times for (int i = 0; i < 10; i++) { Serial.println(i); // prints 0 through 9 } // while — when you're waiting for a condition while (digitalRead(BUTTON) == HIGH) { // keeps going until the button is pressed }
The three parts of a for loop, separated by semicolons, are: start at i = 0; keep going while i < 10; after each pass do i++ (add one). Read them in that order and the syntax stops looking cryptic.
Note that i < 10 starting from 0 runs exactly ten times, ending at 9. Counting from zero feels wrong for about a week and then becomes invisible. It matters because arrays are numbered the same way.
Infinite loops
If a while condition never becomes false, your program stops there forever. The board looks frozen — no serial output, no response. It isn't crashed; it's obediently waiting for something that will never happen. When a sketch goes silent, suspect a loop before you suspect the hardware.
Functions
A function is a named piece of behaviour you can invoke from elsewhere. It's how you stop copy-pasting, and how a five-person team divides work without collisions.
// void = returns nothing. (int note) = takes one int. void playNote(int note) { Serial.print("playing "); Serial.println(note); } // this one hands a value back int doubleIt(int x) { return x * 2; } void loop() { playNote(60); int result = doubleIt(21); // result is 42 }
The word before the name is the return type — what kind of answer it gives back, or void for none. Inside the parentheses are the parameters it accepts.
Scope, briefly
A variable declared inside a function exists only inside that function; the moment it returns, that variable is gone. Two functions can each have their own i without interfering. Variables declared at the top of the file, outside every function, are global — visible everywhere, and the usual way to share state between setup() and loop().
Exercise — write an odd/even printer
Write a function that takes one int and prints ODD or EVEN, then call it for the numbers 1 to 10. Try it before opening this.
void printOddEven(int n) { if (n % 2 == 0) { Serial.println("EVEN"); } else { Serial.println("ODD"); } } void loop() { for (int i = 1; i <= 10; i++) { printOddEven(i); } delay(5000); }
The key is %, the modulo operator — it gives the remainder after division. Any number divisible by 2 leaves remainder 0. Modulo is genuinely useful beyond this: it's how you wrap a counter around, cycle through a list, or trigger something every Nth pass of the loop.
Arrays
An array is a numbered row of values sharing one name — the natural way to store a sequence of servo positions, or a melody.
int positions[] = {90, 80, 90, 140, 90}; for (int i = 0; i < 5; i++) { moveServo(positions[i]); delay(200); }
Arrays start at index 0. In a five-element array the valid indices are 0, 1, 2, 3, 4 — there is no index 5. Asking for one doesn't raise an error; C++ hands you whatever memory happens to sit there, so you get a garbage value or a mysterious crash later. Off-by-one errors are a rite of passage. Expect them.
The board itself
You'll be using an ESP32-based microcontroller — Wi-Fi capable, which is how the orchestra stays in time. A few of its properties are hard limits worth internalising now, because violating them destroys hardware rather than producing an error message.
| Property | Limit | Consequence |
|---|---|---|
| Logic voltage | 3.3 V | HIGH is 3.3 V, not 5 V. Feeding 5 V into a pin can kill the chip. |
| Current per pin | ~10 mA | Safe working figure. Enough for one LED. Nowhere near a motor. |
| Absolute max per pin | ~25 mA | Damage threshold, not a target. |
Two ESP32 specifics that waste the most time
1. analogWrite() is unreliable on ESP32. Whether it works depends on which version of the ESP32 board package is installed — on older cores it silently does nothing, and either way it's a wrapper, not real analog output. The course standard (and what homework expects) is the ledc family — ledcAttachChannel() to configure, then ledcWrite() to set the level. Covered on . If a dimming sketch compiles but the LED never fades, this is the first suspect.
2. Some pins are already taken. On these boards one GPIO drives the onboard RGB LED and others are reserved for boot behaviour. Wire something to a claimed pin and it will misbehave in ways that look like a code bug. Check the pinout diagram for your specific board before choosing a pin — and when a circuit that should obviously work doesn't, moving to a different pin is a cheap thing to try early.
How to debug
This is the actual skill. Everything above is vocabulary.
- Read the first error, not the last. One missing semicolon generates a cascade. The top message is usually the real one, and it names a line number.
- Print your way inward. Put
Serial.println()at the start of each function and before each branch. Watching which messages appear tells you exactly where execution stops matching your mental model. - Print the values, not just the labels. "Got here" tells you less than "angle = 187", which immediately reveals the number is out of range.
- Change one thing at a time. Changing three and re-testing teaches you nothing about which mattered.
- Separate hardware from software. Load the simplest possible blink sketch. If that fails, stop reading your code — the problem is wiring, power or the board.
- Say the bug out loud to a person. You will frequently solve it mid-sentence. The TAs know this and won't mind.
Check yourself
Day Four
Making things move without letting the smoke out
Motors are where a circuit stops being an exercise and starts being a robot. They're also where the current draw jumps by two orders of magnitude, which is where most hardware gets destroyed.
PWM — a digital pin faking an analogue one
A pin can only be fully on or fully off. So how do you get a half-bright LED or a half-speed motor?
You switch it on and off very fast, and vary the fraction of time it spends on. That fraction is the duty cycle. At 50 % the LED receives half the energy and — because your eye can't track the flicker — simply looks dimmer. This is Pulse Width Modulation, and it drives LED brightness, motor speed, and servo position alike.
On ESP32, PWM comes from the ledc peripheral. You attach a pin to a channel with a frequency and a resolution, then write duty values to it. Dedicated hardware generates the waveform, so it keeps running perfectly while your code does other things — you are not toggling the pin by hand in a loop.
DC motors
The simplest actuator: apply a voltage and the shaft spins. Reverse the voltage and it spins the other way. No controller needed.
- Torque follows current. The harder the motor works, the more current it pulls.
- Speed follows voltage. More volts, faster spin.
- These are coupled. Load the motor down, it slows, and current climbs.
That last point has a sharp edge. A spinning motor generates a voltage of its own that opposes the supply — back-EMF — and this is what limits the current at speed. When the shaft is stalled, there's no back-EMF at all, and current spikes to its maximum. Stall current is the number you design for, because a jammed mechanism is exactly when you need the circuit to survive.
Motors are electrically filthy
The brushes inside a DC motor make and break contact continuously, throwing electrical noise back down the power wires. That noise can reset your microcontroller or corrupt readings on a nearby sensor. If your board reboots the instant a motor starts, you're not looking at a code bug — you're looking at a power problem.
Hobby servos
A servo is a small DC motor packaged with gears, a position sensor and a control circuit. You don't tell it how fast to spin — you tell it what angle to hold, and it works out the rest and stays there.
Three wires, and the colours are near-universal:
Brown / black
Ground
Red
Power, typically 5–6 V — not from a GPIO pin
Orange / yellow
Control signal, a PWM pulse
The control signal is the interesting part, and it's a strange one. It repeats at about 50 Hz — every 20 ms — and what encodes the angle is not the duty cycle in any intuitive sense but the width of the pulse, in a narrow band:
| Pulse width | Position | Duty cycle at 50 Hz |
|---|---|---|
| 1.0 ms | One extreme of travel | 5 % |
| 1.5 ms | Centre | 7.5 % |
| 2.0 ms | Other extreme | 10 % |
Note how small that window is — the entire range of motion lives between 5 % and 10 % duty. Everything outside it does nothing, or worse. Drag the slider:
Two things nobody warns you about
Deadband. A servo ignores changes smaller than some threshold. Command 1.500 ms then 1.501 ms and it very likely won't twitch. Servos are not precision instruments — design mechanisms that tolerate a degree or two of slop rather than depending on exactness.
Range varies by model. Some servos accept a wider window than 1–2 ms; others shut off entirely outside it. Sweep gently to find your servo's real limits before writing code that assumes them, and stop as soon as you hear it buzzing at the end stop — that's a stalled motor drawing stall current.
The power budget — where boards die
Here is the arithmetic that matters most on Day 4. A GPIO pin supplies about 10 mA. A small hobby servo draws hundreds of mA running and can exceed 1 A stalled. That's a factor of a hundred or more.
| Typical servo class | Running | Stalled |
|---|---|---|
| Micro (9 g class) | ~120 mA | ~800 mA |
| Standard | ~300 mA | ~1200 mA |
| High-torque metal gear | ~600 mA | ~2500 mA |
So servos get their power from a supply, never from the microcontroller. The controller only sends the signal wire. Budget for stall, and assume everything could stall at once — because during testing, it will.
Will my supply hold up?
If you use a second power supply, join the grounds
Powering servos separately from the board is normal and correct. But the two supplies must share a common ground — a wire joining their negative sides. Without it, the two halves have no agreed reference for zero, and your carefully timed control pulse is measured against nothing. Symptoms are bizarre: servos jitter, twitch, or ignore commands entirely. It is the single most common wiring mistake in the second week, and the fix is one wire.
MOSFETs — letting a small signal switch a big load
Your pin can't drive a motor or a solenoid directly. A MOSFET solves this: it's an electrically operated switch, where a tiny voltage on one terminal controls a large current between the other two.
Back to the water system one last time, because this is the analogy's best moment. A MOSFET is a valve in the main pipe, worked by a lever. The main pipe carries the big flow — supply, through the load, to ground. The lever is the gate, and here is the part that makes the whole trick work: moving the lever takes almost no effort and diverts almost no water. A finger's touch on the handle controls a fire hose.
The three terminals, in water terms:
Gate — the lever
Where your pin connects. It's worked by voltage, not flow — essentially no current goes in. This is why a 10 mA pin can command a 5 A load.
Drain — pipe in
The heavy current arrives here, having already passed through your motor or solenoid from the supply.
Source — pipe out
The current leaves here, to ground. For the common N-channel setup, source sits at ground.
The lever needs a minimum push before the valve starts to crack open — the threshold voltage. Past that, more gate voltage opens it wider, until it's fully open and behaves like plain pipe with a tiny residual resistance called RDS(on). That number is the one to read on a datasheet: it's milliohms on a good part, and it decides how much the switch itself heats up.
And heat is the whole game. A fully open valve barely resists, so it stays cool. A fully shut valve passes nothing, so it stays cool. But a half-open valve is a constriction with a torrent forced through it — the MOSFET has real resistance while carrying real amps, and P = I²R turns it into a heater. Cooking itself in the half-open zone is how drivers actually die. Work the lever below and watch where the heat appears:
Now switch the type to Standard and leave the gate at 3.3 V — the most instructive failure on this page. Your pin swings 0 to 3.3 V, the valve barely cracks open, the motor barely turns, and everything the motor isn't getting is being dissipated in the half-open switch. Nothing is broken, nothing reports an error; the part just runs hot until it dies. This is why the shopping rule is one phrase: buy MOSFETs described as "logic level."
Reading a MOSFET datasheet, fast
Two lines matter for this course. VGS(th) — but note the fine print: it's where the valve first cracks, not where it's usefully open, so look for an RDS(on) figure quoted at VGS = 2.5 V or 3.3 V. If the RDS(on) rows only start at 10 V, that part is not for a 3.3 V pin. RDS(on) itself — milliohms is comfortable; whole ohms means heat at any real current.
There are two flavours: N-channel (the one above — sits between the load and ground, turns on when the gate goes above the source) and P-channel (sits between supply and load, turns on when the gate is pulled below the source). N-channel parts are cheaper, better, and simpler to drive from a pin, which is why the standard beginner wiring — called open drain or low-side switching — puts the MOSFET on the ground side of the load. Default to N-channel low-side unless you have a specific reason not to.
Last connection: feed the gate a PWM signal instead of plain HIGH/LOW and you have proportional control of the big load — the valve flutters faster than the water can care, and the motor sees the average. PWM from , MOSFET here, and suddenly a 10 mA pin is smoothly throttling an amp-scale device. That stack — pin → PWM → gate → load — is most of what a robot's muscle actually is.
Inductive kickback
Anything with a coil — motors, solenoids, relays — stores energy in a magnetic field while current flows. Cut that current abruptly and the field collapses, and the coil responds by generating a large voltage spike trying to keep the current going. It can be many times your supply voltage, and it lands directly on whatever just switched it off.
The fix is a flyback diode across the coil, installed backwards relative to normal current flow. In ordinary operation it blocks and does nothing. When the field collapses and the voltage reverses, it conducts, giving the energy a harmless loop to circulate in until it dies away.
When you need one
Driving a bare solenoid, relay or motor with a transistor: yes, fit a flyback diode. Commercial hobby servos already contain their own protection, so a servo's control wire won't do this to you. The rule of thumb: if you are switching a coil yourself, protect the switch.
Check yourself
Day Five
Turning a drawing into a part
The last piece: designing physical parts and getting a machine to cut them. CAD fluency is the one thing on this site that genuinely rewards hours rather than reading — every hour you spend before arriving is an hour you're not spending during.
Laser cutting thinks in two dimensions
A laser cutter moves a beam across a flat sheet and burns through it. That single sentence implies everything else:
- Every part is a flat profile of constant thickness. There is no shaping in the third dimension.
- You can round corners in the plane of the sheet. You cannot round or bevel the cut edge — it comes out square, always.
- Three-dimensional objects are built by cutting flat pieces and joining them, like a puzzle. Designing well means thinking in slices.
3D printing is the complement: slower, but genuinely three-dimensional. The instinct to develop is knowing which tool a part wants. Brackets, plates, linkages and gears are usually laser work. Anything with a curve out of plane wants printing.
Kerf
The beam has width. It doesn't cut along your line — it vaporises a narrow channel centred on it. That channel is the kerf, and on a typical machine it's roughly 0.007", about 0.18 mm.
Small, and it matters. Every cut part comes out marginally smaller than drawn, and every hole marginally larger — because material is removed from both sides of the line. Draw a slot exactly as wide as your tab and the joint will be loose, every time.
Do not calculate this. Test it.
Kerf varies with material, thickness and machine settings, so the reliable method is empirical: cut a small test piece with several slots at slightly different widths, find the one that fits, use that number. Ten minutes of test cutting saves you re-cutting an entire assembly. Experienced people in the lab do this as a matter of course — it isn't a beginner's crutch.
Press fits
A press fit joins two parts by making the peg slightly larger than the hole and forcing them together. Friction holds it. No screws, no glue, and it comes apart again — ideal for prototyping, where you will be taking things apart constantly.
- The overlap needed is tiny — thousandths of an inch. Too much and the material splits instead of gripping.
- Chamfer or taper the leading edge so the parts start to engage before they're under full interference.
- Roughly, the force to pull it apart equals the force it took to push together. If it assembled easily it will fall apart easily.
Press fits creep
In acrylic and MDF, a press fit is a temporary connection. Repeated assembly wears the joint, and it loosens. A fit that was perfect on the bench in week two may be sloppy on demonstration day. For anything that has to survive the final project, plan on screws or adhesive at the joints that carry real load.
Choosing a material
Acrylic
Clear or coloured, glossy, cuts to a polished edge. Brittle — it snaps rather than bends, like chalk. Excellent where you want to see the mechanism, poor where a part will take impact or repeated flexing.
MDF
Wood fibre and adhesive pressed into board. Cheaper, more forgiving, absorbs shock instead of shattering. Edges char and it's cosmetically plain. The sensible default for structure you're still iterating on.
Thickness is part of your design, not an afterthought: every tab, slot and finger joint is dimensioned around it. Decide early, and if you change thickness later, know that you're re-cutting every mating part.
Fasteners and adhesives
Machine screws are specified by diameter and thread pitch. Small numbers you'll meet regularly are 2-56, 4-40, 6-32 and 1/4-20 — smaller first number means thinner screw. Check what the lab actually stocks and design around those sizes rather than choosing an ideal one and discovering it doesn't exist in the drawer.
| Adhesive | Good for | Watch out |
|---|---|---|
| Acrylic cement | Acrylic-to-acrylic; chemically welds it | Needs tight, clean, flat mating faces |
| Cyanoacrylate | Fast, strong small joints | Brittle; bonds fingers instantly |
| Hot glue | Fills gaps, fast, reversible | Weak, and softens when warm |
| Epoxy | Strong, fills gaps, structural | Slow cure; mix ratio must be right |
Joint geometry matters as much as the adhesive. Glue is strongest in shear — loaded across a broad overlapping face — and weakest in peel, where the load starts at one edge and unzips. Design overlapping faces, not butted edges.
CAD, and how to actually prepare
This is the highest-value thing you can do with spare weeks. You'll likely use SolidWorks; the specific package matters less than the mental model, which transfers between all of them:
- Sketch a 2D profile on a plane.
- Constrain it with dimensions and relations until nothing can wobble.
- Extrude it into a solid.
- Cut further sketches into it.
- Assemble parts by mating faces to each other.
Search for a beginner tutorial series and follow along building actual parts — three or four hours will take you from lost to functional, and that's the difference between spending Day 5 learning the interface and spending it designing your robot.
Fully define your sketches
The habit that separates people who enjoy CAD from people who fight it. An under-constrained sketch has geometry that can still move, and it will shift unpredictably when you edit something nearby. Most packages show under-defined geometry in a distinct colour — chase that colour until it's gone. It feels pedantic for a week and then saves you constantly.
File naming will be strict
Shared fabrication equipment means a shared submission queue, and labs enforce naming conventions that encode who you are, what the part is, and what material and thickness it needs. Files that don't follow the convention get skipped, and the queue is long near deadlines. Read the convention carefully the day it's given and follow it exactly — this is a pure bureaucratic tax, and the only cost of ignoring it is your own lost time.
Check yourself
Day Six
Reading the world: switches, sensors, and the ADC
Everything so far pushed signals out — light this, spin that. Today the direction reverses. A robot that can't sense is a music box; one that can is an instrument that listens. The ideas here are small, but two of them — pull-ups and debouncing — cause more first-week confusion than anything since integer division.
What a pin sees
Set a pin to input mode and it stops driving voltage and starts measuring it. A digital read gives you exactly one bit: HIGH or LOW.
But the wire itself carries a real, analog voltage — so where's the line? Logic families define bands: near 3.3 V reliably reads HIGH, near 0 V reliably reads LOW, and between them sits a no-man's-land where the reading is undefined. The gap between what an output guarantees and what an input requires is called the noise margin, and it's why digital signals survive messy wiring. The design lesson: keep inputs decisively high or decisively low, never drifting in the middle.
pinMode(4, INPUT); int state = digitalRead(4); // HIGH or LOW
The floating pin — why "nothing" reads as garbage
Here's the trap everyone hits first. Wire a button between a pin and 3.3 V, press it: the pin reads HIGH. Release it — and the pin reads… nothing at all. Not LOW. Nothing. The pin is connected to an open switch, which is connected to nothing, and a disconnected input is a tiny antenna. It drifts with static, hums with the room's electrical noise, even responds to your hand approaching. Your sketch sees random HIGHs and LOWs and appears haunted.
A digital input must be held somewhere at all times. That's the entire job of a pull-up resistor: a weak resistor (typically ~10 kΩ) from the pin to 3.3 V. Now the logic reads:
- Button released — the pull-up gently holds the pin at 3.3 V. Reads
HIGH, firmly. - Button pressed (wired pin-to-ground) — the switch is a direct connection to ground, which easily overpowers the weak pull-up. Reads
LOW, firmly.
Notice the polarity surprise: with a pull-up, pressed = LOW. Half the class writes if (buttonState == HIGH) for "pressed" on the first try and gets exactly inverted behaviour. That's not a broken switch — it's the pull-up doing its job.
The microcontroller has pull-ups built in
You usually don't need a physical resistor: pinMode(4, INPUT_PULLUP) switches on an internal one, and the ESP32 offers INPUT_PULLDOWN too (pin held to ground, pressed = HIGH). One line of code replaces a component — but you still have to know the concept, because sensors and other chips' signals need the same treatment, and the quiz-writers know exactly who skipped this paragraph.
void setup() { Serial.begin(115200); pinMode(4, INPUT_PULLUP); // button: pin 4 to GND } int oldState = HIGH; void loop() { int state = digitalRead(4); if (state != oldState) { // only act on CHANGE if (state == LOW) Serial.println("pressed"); else Serial.println("released"); } oldState = state; }
That oldState pattern — compare this pass to the last pass, act only on the change — is worth internalising. Loop runs thousands of times a second; without it, "print when pressed" prints thousands of lines per press. You'll reuse edge-detection for the rest of the program.
Debouncing — one press, many clicks
Run the sketch above and press once. It may print pressed / released / pressed / released / pressed. The switch isn't broken and neither is your code: inside, two pieces of metal are slamming together, and metal bounces. For a few milliseconds after contact, the connection makes and breaks several times. Your loop is more than fast enough to see every bounce as a separate press.
Three families of fix, in the order the course presents them:
Hardware: RC filter
A capacitor across the switch smooths the spikes — a low-pass filter that's too sluggish to follow millisecond chatter.
Digital circuits
Dedicated debounce chips and latches. Real, but overkill here.
Software — your one
After a change, ignore further changes for ~20 ms. Free, adjustable, and it's a homework assignment.
The software version needs a clock, which brings in the most important function you haven't met yet: millis() returns the number of milliseconds since the board powered on. Record it at a moment of interest and subtraction tells you how long ago that was:
unsigned long lastChange = 0; if (state != oldState && millis() - lastChange > 20) { // a real change, not a bounce lastChange = millis(); // ...act on it... }
This is also how you escape delay()
delay(1000) doesn't wait — it freezes. The board does nothing else for the full second: buttons unread, Wi-Fi commands missed, other servos stuck. Tolerable in a blink sketch; fatal in an orchestra robot that must play notes, watch inputs and listen to the conductor at once. The millis() pattern — check whether enough time has passed, act if so, and never stop looping — is how one loop juggles many jobs. Learn it on a button this week, because the final project runs on it.
The RC filter — what that hardware fix actually is
The "capacitor across the switch" debounce deserves one more paragraph, because the idea behind it — the low-pass filter — is one of the most reused tricks in electronics, and lecture will flash a calculator for it (DigiKey has a well-known one) without much ceremony.
A capacitor takes time to charge and discharge through a resistor. So a resistor-capacitor pair responds eagerly to slow changes and simply can't keep up with fast ones — fast wiggles get averaged into nothing. A circuit that passes slow signals and flattens fast ones is a low-pass filter. (Swap the roles and you get a high-pass filter, which passes the fast stuff instead.)
One number describes the whole thing — the cutoff frequency, where the filter's effect takes hold:
f_c = 1 / (2π × R × C) τ = R × C (the time constant)
Signals much slower than fc pass through; much faster ones are smoothed away. The "−3 dB" label you'll see on plots just marks the agreed-upon line where the rolloff officially starts. And the connection to debouncing is now obvious: bounce is kilohertz-scale chatter, your finger is a few hertz — choose R and C so the cutoff lands between them, and the chatter never reaches the pin.
Cutoff frequency calculator
The same idea returns everywhere once you can see it: smoothing a jittery sensor reading, taming PWM into a steady voltage, keeping motor noise out of a supply line. Averaging a sensor over several reads in software? That's a low-pass filter too — just written in code instead of copper.
analogRead — voltage as a number
Digital reads collapse the world to one bit. The analog-to-digital converter (ADC) instead measures the actual voltage and hands it to you as a number. On the ESP32 it's a 12-bit converter: 0 V reads as 0, 3.3 V reads as 4095, everything between scales linearly.
int raw = analogRead(4); // 0–4095 float volts = raw * 3.3 / 4095.0; // note the .0 !
Volts ↔ counts
That third row is map(), a convenience you'll use constantly — it rescales a number from one range to another: map(reading, 0, 4095, 0, 255) turns a 12-bit sensor reading into an 8-bit brightness. Pair it with a switch/case statement and you get "dark / dim / bright" style banding in a few lines.
Board specifics worth writing on your hand
Only some pins reach the ADC — on this board GPIO 0, 1, 4 and 5 — and the course's own materials warn that readings on GPIO 5 are inconsistent. If your sensor numbers look like nonsense on pin 5, move to another ADC pin before debugging anything else. Also remember the input range ends at 3.3 V: feeding an ADC pin more than that is the same chip-killing mistake as on a digital pin.
Sensors — the voltage divider's payoff
Here's where Day 1 closes the loop. Most simple sensors are just resistors that change with the world: a photocell (CdS cell) changes resistance with light; a thermistor with temperature; a potentiometer with rotation. But the ADC reads voltage, not resistance — so how do you read a resistance?
You already know: put it in a voltage divider. Fixed resistor on one side, sensor on the other, ADC on the midpoint. As the sensor's resistance moves, the ratio moves, the midpoint voltage moves, and analogRead() watches it happen. When the course said dividers were how "nearly every sensor you meet" reports itself — this is what that meant, and it's why the divider got a whole interactive on .
| Light sensor | Speed | Character |
|---|---|---|
| CdS cell | Slow (1–100 ms) | Cheap, robust, sees light like a human eye. The classroom default. |
| Phototransistor | Fast | Sensitive and cheap; the usual step up. Used with a ~10 kΩ divider resistor. |
| Photodiode | Very fast (ns) | High dynamic range; for when timing is the point. |
One practical habit: raw sensor ranges are never the datasheet's full scale. A CdS cell in a real room might swing 200–3400 counts, not 0–4095. Print the raw values first, note the actual min and max you observe, and feed those into map(). Calibrating to reality instead of theory is half of what makes sensor code feel solid.
Check yourself
Day Seven
From spinning motor to striking arm: mechanisms & design
A servo turns. A drum needs to be hit. The gap between those two sentences is mechanism design — the art of converting the motion you have into the motion you need. This is also the day the course stops teaching parts and starts teaching how to invent, so half of it is about linkages and half is about how good engineers actually work.
What a mechanism is
A mechanism is a set of rigid bodies — links — connected by joints so they move in defined, predictable ways relative to each other. The whole field rests on a small vocabulary:
- Kinematics — the motion itself, ignoring forces. "Where does the arm go?"
- Kinetics — the forces and torques behind that motion. "How hard does it push?"
- Statics — bodies at rest, forces balanced. "Will it hold without breaking?"
The joints matter as much as the links. The two you'll use constantly:
Revolute joint (pin / hinge)
Allows rotation about one axis, blocks everything else. A bolt through two holes. This is the joint in every linkage below.
Prismatic joint (slider)
Allows sliding along one line, blocks rotation. A drawer. Turns rotation into straight-line motion.
Degrees of freedom
A free rigid body in a plane has three degrees of freedom (DOF): it can move in x, in y, and rotate. In full 3D it has six. Every joint you add removes some of that freedom — a pin joint in a plane pins down two of the three, leaving one rotation.
DOF is the number that tells you how many motors a mechanism needs. A gadget with one degree of freedom needs exactly one input to fully determine its motion — which is why the four-bar linkage below is so powerful: it does something elaborate from a single spinning input.
Quick intuition check
A pendulum has 1 DOF (swing angle). A point in 3D space has 3 (x, y, z). A submarine has 6 (move three ways, rotate three ways). A pencil tip sliding on paper has 5 — it lost one, pressing against the surface. Counting DOF becomes second nature fast, and it's the first thing to ask about any mechanism: how many inputs does this really need?
Connecting a servo to an arm: pin or rigid?
A subtle but load-bearing decision. If you want the servo to transfer its torque into the arm — to drive it — the connection at the servo shaft must be rigid, not a pin. A pin joint would let the arm spin freely on the shaft and the torque would go nowhere.
Two common ways to get that rigid coupling:
D-shaft
The shaft has a flat, and the hole matches it. Simple and cheap, but can wear or slip under repeated load.
Set screw
A small screw clamps the hub onto the shaft. More secure, a bit more hardware and cost.
The other joints in your mechanism — the ones that are just supposed to pivot freely — should be pins. Knowing which joints must transmit force and which must release it is most of what separates a mechanism that works from one that flops or seizes.
The four-bar linkage — the workhorse
This is the mechanism in the picture, and the one you're most likely to build. Four rigid links joined in a loop by four pins. One link is held fixed (the ground), and the whole thing has just one degree of freedom — drive one link and every other link's motion is completely determined.
The four links have names worth knowing:
- Ground — the fixed link. Really just the fixed distance between your two mounted pivots.
- Crank — a link that can rotate a full 360°. This is where a motor or servo connects.
- Rocker — a link that swings back and forth through an arc rather than spinning. This is usually your output — the striker, the sweeper.
- Coupler — the floating link connecting crank to rocker, transmitting the motion across.
A crank-rocker — spinning input, oscillating output — is exactly what a drumming or strumming robot wants: a motor spins steadily, and the arm sweeps out and back, out and back, striking on each pass. But here's the catch that traps everyone: not every set of four lengths produces a crank that can actually spin. Pick the wrong proportions and the crank jams partway round, and your continuously-spinning servo simply stalls against a mechanism that refuses to turn.
Grashof's condition — the rule that decides
Add the shortest and longest links. If that sum is less than or equal to the sum of the other two, at least one link can fully rotate (the mechanism is "Grashof"). Then which link is shortest decides the type: shortest link is the crank → crank-rocker (what you usually want); shortest is the ground → drag-link, both side links spin; shortest is the coupler → double-rocker, and your driven crank locks. If the sum test fails entirely, nothing rotates fully — every link just rocks. Don't memorise this. Feel it in the playground below.
Four-bar linkage playground
Set the four bar lengths, then press Run. The green disk is the crank (your motor), the blue bar is the rocker (your striker), and the pink trail is the path the striker tip travels — the same arc you'd get a drumstick to sweep.
Things worth trying: start from the lecture preset and press Run — smooth continuous rotation, and watch the pink arc the striker traces. Now drag the crank length up until it's no longer the shortest link, and watch the status flip to a lock: the crank jams and can only rock. That single experiment is the whole reason Grashof's condition exists, and it's a mistake people make in real hardware — a beautiful mechanism that the motor physically cannot turn.
Other useful mechanisms from the same family, worth a search when you're brainstorming: the Geneva mechanism (turns continuous spin into precise step-stop-step motion — think a display case that indexes a few degrees and pauses), the Scotch yoke (rotation into pure back-and-forth sliding), and rack and pinion (rotation into straight-line travel). Many complex robot behaviours are one clever motor plus the right linkage — no extra microcontroller required.
Statics — will it survive?
Kinematics tells you where the arm goes; statics tells you whether it snaps on the way. A structure is in static equilibrium when all forces and all moments balance to zero — nothing accelerates, nothing spins.
The one equation to carry into the lab is the moment (torque) of a force:
M = F × d
Force times the perpendicular distance to the pivot. This is why a long arm is harder to hold at the tip than near the base — same force, bigger d, bigger moment — and it's how you work out whether your servo actually has enough torque to swing the striker you designed. If the moment your load creates exceeds what the servo can supply, the arm simply won't lift, no matter how clean the code is.
If your arm bends or flexes while moving
A common first-prototype problem, with three levers to pull. Change the geometry — a taller or boxed cross-section resists bending dramatically better than a flat strip of the same material (this is "area moment of inertia," and it's why beams are I-shaped). Change the material — stiffer stock for the same shape. Or change the loading — shorten the arm, or add a support so the load path is shorter. Geometry is usually the cheapest and biggest win: turning a flat bar on edge can multiply its stiffness many times over for free.
One structural idea the course stresses: a statically determinate structure — like a well-designed truss of straight members pinned at their ends — has exactly enough constraints and no more, so you can actually solve for every internal force. Over-constrain it with redundant members and you get hidden, unknown stresses from tiny manufacturing errors or temperature changes. Simpler and just-rigid-enough usually beats more parts.
Mechanical advantage
When the force or speed you have isn't the force or speed you need, three classic tools trade one for the other:
Gears
Trade speed for torque (or the reverse). A small gear driving a big one turns slower but pushes harder.
Levers
Trade distance for force. Move the pivot to favour the side you care about.
Pulleys
Trade distance for force with rope. More supporting strands, less pull needed.
Nothing is free — you always pay for more force with more motion, or more speed with less push. But that trade is exactly the tool you reach for when a servo has enough torque but moves too slowly, or vice versa.
How engineers actually work: the design process
The back half of the day is a mindset, and it's the part that most changes how your project goes. Three themes to hold onto:
- Preserve ambiguity. Don't lock into one idea too early. Keep several options alive and kill off the risks first, committing only when you actually know.
- Design is a social process. It's about your teammates and your "customer" (here, the conductor and the piece). Communicating clearly is part of engineering, not separate from it.
- All design is redesign. Looking up how others solved a problem and improving on it isn't cheating — in this class and in real engineering, it's the correct move. Just cite whose idea you built on.
Concretely, you work from coarse to fine: broad strategies → specific concepts → modules that break a concept into pieces → components that implement each piece. And you iterate — build a rough version, test it, learn, refine, repeat. The rules of a good brainstorm are worth stealing: defer judgment, build on others' ideas, stay visual (sketch!), and go for quantity over polish early.
Prototype to answer a question, not to impress
The most useful habit here. Before building any prototype, ask "what will this tell me?" Different prototypes answer different questions: a proof-of-concept (cardboard and tape) asks "will this idea even work?"; a looks-like asks "how will it feel?"; a works-like asks "can it do the job?", ignoring appearance. Prototype early, prototype cheap, and attack your biggest unknown first — the thing most likely to sink the project. Finding out your striker can't hit hard enough is worth learning on day one with a hot-glued stick, not on demo day.
The program formalises this with phase gates — checkpoints your project has to clear, in order:
| Gate | What it means |
|---|---|
| Concept Review | Present the overall idea to a TA — how you'll make sound, your resources, the processes you'll use. |
| Critical Function | Prove the one function without which the whole thing fails. Test the riskiest part in isolation. |
| Minimum Viable Prototype | All the major pieces integrated into a first device that actually works, however roughly. |
| Final Product | Tuned, reliable, in-tune. The version that performs. |
And a checklist to judge any mechanism idea against, straight from the course: is it simple, robust, and repeatable? Can it play all the notes, and fast enough? And is it actually feasible in the time, materials, and machines you have? An idea that fails the last question is not a design — it's a wish.
Check yourself
Day Eight · prototype day
Driving motors — and learning by failing
Two threads today. The technical one: how a tiny pin commands a hungry motor, and how to make that motor spin both directions. The cultural one: this is Prototype Day, where the point is not to build the finished thing but to fail fast and cheap enough to learn what the finished thing needs to be.
Why a motor needs a driver at all
Recall the hard limit from Day 3: a GPIO pin can safely source only about 10 mA (the datasheet quotes 12 mA, 25 mA absolute max). A DC motor pulls hundreds of milliamps running and over an amp when stalled. Wire a motor straight to a pin and you don't get a slow motor — you get a dead pin.
So the pin's job is to command, not to supply. It sends a small control signal to a switch, and the switch lets the motor's real current flow from a proper power supply. You met one such switch on Day 4 — the MOSFET. Today adds the rest of the family, and the circuit that gives you reverse.
Transistors as switches: the BJT
A bipolar junction transistor (BJT) is the other great electronic switch, and it works on a different principle from the MOSFET. Where a MOSFET is controlled by voltage on its gate, a BJT is controlled by current into its base. Push a small current into the base and a much larger current — roughly a hundred times larger — is allowed to flow from collector to emitter. It's a current amplifier used as an on/off valve.
- An NPN transistor turns on when its base sits about 0.7 V above its emitter. Below that, it's off.
- Fully on ("saturated"), the collector-to-emitter voltage drops to roughly 0.2 V — nearly a closed switch.
- The base current needed is about 1/10 of the current you're switching. That ratio is the transistor's gain.
The Darlington — when one transistor isn't enough gain
Stack two transistors so the first one's output feeds the second's base and their gains multiply — now a tiny signal (a milliamp or less, easily within a GPIO's budget) switches a big load. The classic part is the TIP120. The trade-off: it takes a larger turn-on voltage (~1.4 V, since two junctions stack) and drops a bit more voltage when on, so it runs slightly warmer. For driving a single motor or solenoid from a microcontroller, it's a workhorse.
| BJT | MOSFET | |
|---|---|---|
| Controlled by | Base current | Gate voltage |
| Turn-on threshold | V_BE ≈ 0.7 V | V_GS(th) ≈ 1–8 V |
| Limited when on by | V_CE (a voltage drop) | R_DS(on) (a resistance) |
| Best at | Cheap, small currents (< ~0.5 A) | Bigger currents, can parallel up |
Neither is "better" — they're tools for different jobs. A BJT or Darlington is cheap and fine for a small motor; a logic-level MOSFET (Day 4) wins when the current climbs. Both need the same care: a flyback diode across any coil you switch, because motors and solenoids kick back.
The H-bridge — giving a motor reverse
A single transistor can turn a motor on and off, but not backwards — current only flows one way through it, so the motor only spins one way. To reverse a DC motor you must reverse the current through it, and the elegant circuit that does this is the H-bridge: four switches around the motor, arranged like the letter H with the motor as the crossbar.
Two switches sit above the motor (connecting each terminal to +V) and two below (connecting each terminal to ground). Close the top-left and bottom-right, and current runs one way — forward. Close the other diagonal instead, and current runs the other way — reverse. It's exactly a double-pole double-throw switch you flip electrically instead of by hand. Toggle the four switches yourself:
H-bridge playground
Click each switch to open or close it. Watch the motor, the live current path, and the status — including the one combination that destroys the driver.
Shoot-through — the mistake that fries drivers
Close both switches on the same side — top-left and bottom-left together — and you've connected +V straight to ground through two transistors, with no motor in the way to limit it. That's a dead short across your supply. The current spikes, the transistors cook, and it happens in an instant. Real motor-driver chips guard against it, but when you wire transistors yourself, never let both switches on one leg conduct at once. Try it in the sim to see the warning — it's the single most important thing to internalise about H-bridges.
Notice the two "safe stop" states, too. Both bottom switches closed shorts the motor's own terminals together — brake, which stops it fast. All switches open lets the motor spin freely — coast. Same motor, four useful behaviours, from four switches.
You won't build it from scratch — you'll use a chip
Wiring four transistors and four flyback diodes correctly, every time, is tedious and easy to get wrong. So in practice everyone reaches for a motor-driver IC that packs the whole H-bridge (often two of them) into one part. The classic in this course is the L293D (or its cousin the SN754410) — a "quadruple half-H driver," which is two full H-bridges, enough for two motors.
The beauty is how simple the interface becomes. Per motor you get three connections to your microcontroller:
| Pin | Connect to | Does |
|---|---|---|
| Enable | A PWM pin | On/off and speed — feed it PWM (Day 4) and the duty cycle sets motor speed. |
| Input 1 | A GPIO pin | One direction bit. |
| Input 2 | A GPIO pin | The other. Set them opposite for forward, swap for reverse, equal to brake. |
And crucially, the motor's real power comes into a separate supply pin on the chip, never through your board — with a shared common ground between the two, the same rule from Day 4. That's the whole stack the orchestra's moving parts run on: PWM sets speed, two GPIOs set direction, the chip does the muscle.
Choosing the motor in the first place
When you pick a motor for a striker or a spinner, a few datasheet numbers matter more than the headline voltage:
- Stall torque and stall current — the most it can push, and the (large) current it draws doing so. Size your driver and supply for stall, not for the easy running case.
- Gear ratio — a gearbox trades speed for torque. A bare motor spins fast and weak; gear it down and it turns slower but can actually move your mechanism.
- The efficiency sweet spot — a motor is wasteful when barely loaded and wasteful when nearly stalled; it's most efficient somewhere in the middle. Design so your normal operating point sits near that middle, not out at the stall end where it's just making heat.
Prototype Day: the point is to fail well
The afternoon flips the mindset. You are not trying to build the final instrument — you are trying to learn the fastest way possible, and the fastest teacher is a cheap prototype that fails. The method the course gives you is value-based prototyping: every prototype must earn its existence by answering a question you don't yet know the answer to.
- List your unknowns. Run down the design criteria — is it simple, robust, repeatable; can it play all the notes, fast enough, feasibly? Each doubt is an unknown.
- Pick your riskiest three. The things most likely to sink the project if they turn out badly.
- Build the smallest thing that answers each. Cardboard, tape, one servo, a hot-glued stick — whatever tests that one question and nothing more.
Attack the scariest unknown first
The instinct is to build the easy, satisfying parts first. Resist it. If there's a real chance your striker simply can't hit hard enough or fast enough, you want to discover that on day one with fifty cents of materials — not on the night before the show with a beautiful finished machine that doesn't work. A prototype that fails early is not a setback; it is the entire point of today. Every "learn by failing" moment now is a disaster you're not having during the performance.
And remember the phase gate this feeds: Concept Review is due at the end of today — your overall idea, the functions you need, the resources and processes you'll use. It's not a commitment to a final design; it's a checkpoint that you have a credible plan and know where the risks are.
Check yourself
Day Nine · circuit review
When it all has to fit: pins, buses, and a winnable instrument
You've learned to drive one LED, one servo, one motor. Now comes the reckoning: a real instrument needs to drive many — and the little ESP32-C3 doesn't have enough pins to go around. Today is about making everything fit on one board, and about the older, harder lesson of picking an instrument you can actually finish.
The pin-count wall
Every servo, every solenoid, every button needs a connection to the microcontroller — usually one GPIO pin each. That's fine for a blinking LED. But a piano wants ten to fourteen notes, a bass needs a fret actuator per note, a drum kit has multiple strikers. Suddenly you need 10 to 20 pins.
The ESP32-C3 doesn't have them. Of its handful of GPIO, several are already spoken for — one drives the onboard RGB LED, one the onboard button, a couple are reserved for boot behaviour or the I²C bus. Realistically you have about six pins freely available. So the central engineering question of the day is simply: you need twenty pins and you have six. What do you do?
Pin budget planner
Dial in what your instrument needs — one pin per servo, per on/off actuator (solenoid, motor, LED), per button or sensor. The planner tells you whether it fits and what to do if it doesn't.
native C3 needs an expander beyond one expander
Three ways past the wall
There is no single right answer — each option trades pins for cost, size, complexity, or speed. The course lays out three:
| Approach | How | The catch |
|---|---|---|
| Port expander | An external chip (MCP23017) adds 16 GPIO, talking to the C3 over just 2 I²C pins. | Slow — each write takes ~50 µs, too sluggish for smooth servo PWM. |
| Bigger board | Swap to an ESP32-S2, which has many more native pins and Wi-Fi. The course's recommended path. | Bigger, pricier, and a slightly new chip to learn. |
| Two microcontrollers | Split the load across two ESP32-C3s that talk to each other over a serial link. | You now have to coordinate and synchronise two brains. |
Notice these are the same trade-offs you've met all week: simplicity versus capability, cost versus convenience. There's no free lunch — only the option whose downside hurts your project least.
How chips talk: serial buses
The last two options need chips to communicate, which introduces the idea of a serial bus. Serial means sending data one bit at a time down a single wire, in step with a clock — the opposite of parallel, which uses many wires at once. Serial trades speed for far fewer wires, and for talking between chips that's exactly the right trade. The ESP32 speaks three serial dialects: UART, SPI, and I²C.
UART — chip-to-chip, one-to-one
Two wires: each chip's transmit connects to the other's receive — TX→RX and RX→TX, crossed over. Both sides must agree on the speed (the baud rate) in advance. This is how you'd wire two ESP32-C3s together.
I²C — one bus, many devices
Just two shared wires — SDA (data) and SCL (clock) — carry a whole crowd of chips. Each device has a unique address so the controller can call one at a time. This is how a port expander connects.
The wire everyone forgets
Whichever bus you use, the two chips must share a common ground — a wire joining their grounds — or the signal has no shared reference for what a "1" and a "0" even are. It's the same common-ground rule from the motor and power sections, and forgetting it produces communication that mysteriously never works. When a link between two boards refuses to talk, check the ground wire before you touch the code.
The port expander, in practice
The most common fix is the MCP23017 (16 extra pins) or its smaller sibling the MCP23008 (8 pins). You wire its SDA and SCL to the C3's two I²C pins, give it an address with its three address legs, and then — with the Adafruit library — it behaves almost exactly like normal GPIO: mcp.pinMode(...), mcp.digitalWrite(...). You can even hang several expanders on the same two wires by giving each a different address, stacking up to dozens of pins.
Why it's fine for solenoids but bad for servos
An expander write travels over the I²C bus, so it's slow — around 50 microseconds, roughly 500× slower than a native pin. For switching a solenoid or LED on and off, that's invisibly fast. But a servo needs a smoothly-timed PWM pulse, and at 50 µs resolution you'd get only about 20 distinct positions across the servo's range — jerky, ~9° steps. So the rule of thumb: put your on/off actuators on the expander, and drive servos from native pins — or use a dedicated I²C servo driver like the PCA9685, which generates 16 clean PWM channels in hardware.
Lessons from the past: choose a winnable instrument
The other half of the day is hard-won wisdom. Teams before you have failed in instructive ways, and the single biggest predictor of a good final show is picking an instrument whose physics you can actually meet with the actuators available. The recurring theme: force and speed are where dreams meet reality.
| Instrument | The real difficulty | What tends to work |
|---|---|---|
| Piano | Weighted keys need real force (~1N over the full stroke); many notes means many actuators. | Servos playing a few chords, or lots of individual solenoids. Aim for 1.5–2 octaves. |
| Drums | Servos are too slow for a valid strike; solenoids often too weak; a hi-hat pedal needs enormous force. | Medium DC motors with an H-bridge (or a spring return). Hardest part is mounting the stick to the shaft; timing to avoid double-strikes is tricky. |
| Bass / guitar | Holding a fret takes large force; strings and frets are close together; strumming needs just-right compliance. | Use only two strings, get one note working first, then four. Retune to lower string tension. |
| Recorder | Needs both airflow and pressure — fans give flow but no pressure, pumps give pressure but no flow. Sealing is hard. | Closing holes takes almost no force, so weak solenoids work. Needs a soft, flexible end effector to seal. |
| Marble machine | Recirculation and consistent timing are genuinely hard without precision manufacturing. | Beautiful when it works — but treat it as ambitious, not a safe first choice. |
The meta-lesson connects straight back to Prototype Day: before you fall in love with an instrument, do the force-and-speed arithmetic. What force does a note actually require, and can your actuator deliver it across the whole stroke, fast enough? A quick M = F × d estimate and a look at a servo's torque spec will tell you in ten minutes whether an idea is feasible or a heartbreak waiting for demo day.
Critical Function — today's gate
This is the checkpoint due today, and it follows directly from everything above. Your Critical Function is the one vital thing without which your whole robot fails — for a drum bot, striking hard and fast enough; for a piano bot, pressing a key with enough force on time. Identify it, then make a concrete plan to prove it:
- What will you test — the single riskiest function.
- How will you test it — the setup that answers the question.
- What you'll build, manufacture, and program to run that test.
It's the same "attack your scariest unknown first" discipline from Day 8, now made a formal gate. Prove the hard part works in isolation, and the rest of the project becomes assembly rather than gambling.
Check yourself
Days 10–13 · the finale
Making it play — in time, on cue, over Wi-Fi
The last stretch is mostly building your robot, so this is one combined section rather than four. There's little new hardware here — instead it's the software architecture and the wireless glue that turn a pile of working parts into an instrument that plays the right notes, at the right moments, in sync with the whole orchestra.
A song is just data
A melody is nothing more than a list: which note, when it starts, when it stops. So a song lives in your program as arrays — one for the MIDI note numbers, one for start times, one for stop times — usually imported from a CSV or MIDI file and stored in the ESP32's flash (it has plenty). Playing the song becomes a matter of walking those arrays in time.
int note[] = {60, 64, 67, 72}; // MIDI note numbers float start[] = {0.4, 1.2, 2.0, 3.2}; // seconds float stop[] = {0.9, 1.7, 2.9, 3.8};
MIDI note 60 is middle C; each step of 1 is a semitone. Your team splits a song's notes across instruments, and each ESP32 only plays the ones it can reach.
Why you can't just delay() through a song
The obvious first attempt — play a note, delay() until the next, play that — falls apart immediately, and understanding why is the key insight of the whole finale. A robot in the orchestra has to do several things at once: play its notes on time, watch its own position sensors, and keep listening for the conductor's commands. But delay() freezes everything — while you're waiting out one note, you're deaf to the conductor and blind to your sensors.
The fix is non-blocking code, built on the millis() idea from Day 6: never stop the loop. Instead, each pass around loop() you quickly check "is it time yet?" for every job, act on the ones that are ready, and immediately move on. One fast loop juggling many short tasks — never one long delay() blocking them all.
Events and Services — the mental model
The course frames this as events and services. An event is an instantaneous change worth reacting to — a timer expiring, a button going down, a UDP packet arriving. A service is the short routine that responds. The rule: keep every event-detector and service short and non-blocking, and let the loop scan them all, round-robin, thousands of times a second. Design the jobs first, keep each tiny, and concurrency falls out for free.
The finite state machine that plays notes
Here's the architecture the whole project runs on. Model your instrument as a finite state machine (FSM): a small set of named states, with events that trigger transitions between them and services that run on each transition. For playing notes, four states cover it:
- Waiting — armed, doing nothing until the conductor's start signal arrives.
- Preparing — the next note is queued; wait until its start time is reached.
- Playing — its time has come: actuate (strike, press, blow) and hold until the stop time.
- End note — stop time reached: release, then loop back to prepare the next.
Each pass of the loop just asks: given my current state, has my triggering event happened yet? It's the same three if checks every time — clean, debuggable, and never blocking. Press start below and watch the machine walk a short melody; drag the time scrubber to step through it by hand.
Note-playing state machine
Timing and latency — the hard part of sounding good
Music lives or dies on timing. The trouble is that every instrument has a delay between the instant you command a note and the instant sound actually comes out — a servo has to swing, a solenoid has to throw, a striker has to travel. That lag is tens of milliseconds, easily enough to make an orchestra sound sloppy.
You can't eyeball a delay that small, so you measure it — a lovely bit of applied robotics. Point a microphone at your instrument, set a baseline sound level, then start a timer the moment you fire the command and watch the microphone's ADC for the spike when sound arrives. The gap is your latency. Do it many times (say 30) and compute the average and variance — because a delay that jitters is harder to fix than one that's just large.
Then fire early
Once you know your delay, you compensate: send the command that many milliseconds before the beat, so the sound lands on it. That's exactly what the latency slider in the simulator above does — watch the note bars shift earlier as you raise it. One extra wrinkle: a servo's 50 Hz PWM only updates every 20 ms, which adds up to 20 ms of its own timing jitter, so servo-based instruments are inherently a little less precise than solenoids.
Knowing where your mechanism is: position sensing
Some instruments need to know where a moving part actually is — has the striker returned? is the carriage at the right fret? A handful of cheap sensors answer that:
| Sensor | Good for |
|---|---|
| Limit switch | Detecting a specific location — a part reaching the end of a rail. Simple and reliable. |
| Photo-interrupter | A beam broken by a passing flag. Counts transitions — is the door open, did the arm pass? |
| Optical encoder | A slotted wheel spinning past a photo-interrupter makes a pulse train — count pulses for position, time them for velocity. |
| Hall-effect sensor | Senses a magnet via the ADC. Good for speed; on its own it can't tell direction. |
These close the loop the servo can't: a servo assumes it reached the commanded angle, but a sensor confirms the mechanism actually did — which is how you catch a jammed striker before it throws off a whole bar of music.
The conductor: Wi-Fi and UDP
Finally, the orchestra has to move as one, and that's what the ESP32's Wi-Fi is for. Each robot joins the same network (WiFi.begin(ssid, password) in station mode), pulls its assigned track from a laptop server, and then waits for the conductor to start and pace everyone.
The messages travel by UDP, and the choice of UDP over TCP is deliberate:
UDP — fast and fire-and-forget
Sends a small packet to an address with no handshake and no guarantee of delivery. Low latency, dead simple. For a "start now" beat signal, speed matters far more than the rare dropped packet — and there's another beat coming anyway.
TCP — reliable but heavier
Guarantees every byte arrives in order, at the cost of handshakes and acknowledgements. Right for downloading the song file; overkill and too slow for the tight timing of live conducting.
So the conductor's laptop blasts a tiny UDP packet — often just the letter "T" — and every robot, sitting in its Waiting state, takes that as the event to begin. That single packet is the downbeat. From there each instrument runs its own state machine, latency-compensated, and the room fills with music that started, on every board, at the same instant.
Performance day, end to end
It all comes together like this: power-cycle the ESP32 → it connects to the router and loads its track of Song.mid from the server → a light confirms it loaded → it drops into Waiting → the conductor sends the UDP start → every robot begins its FSM at once, each firing early by its own measured latency. Notes are often doubled across teams, so if one robot misses a note, another covers it and the music carries on. That redundancy — many simple, imperfect players covering for each other — is the whole charm of a robot orchestra.
The control web — our conductor's console
The orchestra needed a human at the helm, so one of us built a small web app that ran on a laptop — the control web, the bridge between a sheet of music and forty solenoids. You could hand it a photo of a 简谱 (jianpu) score and a vision model would read it straight into the robot's note notation — or just type a song's name and let it draft the melody. You previewed the tune in the browser first (synthesised beeps) to catch mistakes, then, on the same phone hotspot as the conductor board, beamed the notes out over Wi-Fi; the conductor relayed them to every instrument.
One button ties straight back to this page: Arm for class start. It loaded the notes but held fire, waiting for the teaching staff to broadcast the letter T over Wi-Fi — the exact UDP downbeat from the section above — so the whole room began on the same instant. A live on-screen keyboard lit up as real solenoids struck, a status table showed which instrument boards were awake, and a side panel drove the robot's 16×2 LCD.
Underneath sat a tiny notation the whole system spoke — the same "a song is just data" idea from the top of this section, made typeable by hand:
| You type | It means |
|---|---|
| 1–7 | do re mi fa so la ti · 0 = a rest |
| ' , | an octave up · an octave down |
| - _ | hold one more beat · halve the beat (eighth note) |
| (1 3 5) | notes in parentheses strike together — a chord |
| === | on its own line, the parts above and below play at once (two hands) |
| #1 | a black key (C♯) — the sixth board handled those |
So "Twinkle" became 1 1 5 5 6 6 5 - and so on — a line of text a laptop could turn into a photo of a score, a preview you could hum along to, and, a heartbeat after the class cue, an actual piano playing itself.
Check yourself
That's the whole technical arc — thirteen days of loose parts becoming an instrument that plays. The rest of the story — the songs, the build, the late nights — lives in the .
The record · ESAP 2026
The gallery.
The part of the story that never made it onto a whiteboard — the songs we played, the things we built, and the nights that made it worth it.
What we played
All of it — every resistor, every state machine — pointed at one afternoon: the show. The orchestra prepared a handful of pieces, and which ones actually reached the stage depended, fittingly, on how the last stubborn instrument was behaving that morning:
Thunder
Imagine Dragons — the one everyone was set on.
Viva la Vida
Coldplay — the likely centrepiece.
Moondance
Van Morrison — a maybe, if time allowed.
Each was split across the room's instruments — a few notes to every robot, doubled here and there so a single missed strike wouldn't break the line. A laptop read the score, the control web beamed it out, the staff sent the T, and thirty-odd machines that had each been a loose pile of parts nine days earlier came in on the same beat. It was never clean. That was never the point. It played.
The robot
Everything the team built pointed at this one machine — a keyboard with a solenoid under every key, each on its own driver, all struck on cue. It was never pretty. That was never the point. It played.
What we'll remember
I remember the GM lab still bright at ten at night. I remember the walk back to the dorm afterward, under the warm yellow streetlights. I remember laughing at how frustrated we were — and how much those weekends in the lab came to mean anyway. I remember the laser-cutting room, hot and close and stuffy, and how even then I was full of a hopeful, excited feeling I still can't shake. I remember cutting into a big block of wood to make one tiny wooden robot, bolting on its little iron arms and legs — so cute, so fun. And I remember the moment our piano finally played, right next to the frustration of every single second of debugging it took to get there. I wouldn't trade any of it.
— Maria Cai
费城小记 — open my Philadelphia notes
Today is July 31st, 2026 — the day ESAP ended. Looking back on these days of studying in Philadelphia, I really, truly was happy. You might ask how I define a word like “happiness.” It’s a huge word, and a hollow one, and honestly a sentence or two could never pin it down. But I’ll say this much: it was a pure, brimming kind of joy and contentment — the kind I’ll never forget.
That first Friday evening, our TA messaged out of nowhere to ask if I wanted to see Terence Tao’s public lecture — the International Congress of Mathematicians happened to be in Philadelphia that year. Terence Tao. Someone I’d dreamed of seeing since I was little. I listened harder than I ever have, maybe because I knew how rare it was; he spoke about where mathematics is headed in the age of AI. I don’t think I’ll ever forget getting to sit in that room at sixteen.
The next moment that surfaces is, without a doubt, the night our robot piano played “Summer,” the theme from Kikujiro. When that lilting, slightly clumsy little tune rose through the GM Lab in the heart of summer, my burning heart for robotics bloomed like fireworks across the night sky. It was the sweetest gift for all those reluctant goodbyes as we rushed to beat curfew; the freest accompaniment to sprinting under the dim yellow streetlights and singing out loud on rainy nights; the most wonderful reward for every weekend we spent sneaking back into the lab to fight through coding and debugging. It was the joy of something finally working — pride, and contentment, and happiness at its very peak.
With Viva la Vida looping in my earphones, of course I won’t forget our final performance — the place that made a sports kid fall in love with music. When the conductor sent each instrument its own command, they stirred to life, scattered yet in order, quick then slow, each voicing its own strange and beautiful sound in perfect harmony. I can’t forget the vivid life in Viva la Vida, which woke even someone as tone-deaf as me to the courage to open my mouth and sing. And Thunder’s soaring force, and Moondance’s tender melody, will be branded into my memory forever… Viva la Vida — long live life!
If I had to name the thing ESAP left me that’s most worth mentioning, it has to be those two or three dozen little robots made of wood blocks and screws. It began because I’m exactly the type who can’t sit still — waiting on a 3D print was agony, so I started my woodcutting journey. Sawing a meter-long block, thick as a roof beam, into little cubic-centimeter pieces was the perfect way for someone like me to burn off energy. Then came digging through the mini store for screws and nuts — big and small, tall and short, fat and thin, gold and silver, all of it there. Some became one-eyed Minions, some looked like SpongeBob; some got an LED, a resistor, a button; some I stacked into little mountains. Finally I gave each one a little laser-cut house, and they turned into these strange, art-filled little figures. I gave them to my friends, the TAs, the professors — and each became a precious little keepsake between us.
We couldn’t take our keyboard home, but a fried ESP32 turned out to be a fine souvenir too. We burned through a dozen of those five-dollar boards, and more than fifty of the six-dollar solenoids (we did fleece ESAP a little). Those tiny boards carry the marks of our circuit overloads, one after another — and to me, that’s full of meaning.
Now the Philadelphia story pauses for a while — but these events, these people, these things will keep pulling me back, again and again, to that deep summer. It turns out happiness was never such a far-off word. It’s simply that at sixteen, I once lived here — earnestly, freely, fiercely — in Philadelphia.
The six o’clock sun will rise over this place in the end, just as it did when I arrived at six, three weeks ago.
Softly I am leaving, just as softly I came.
— Maria Cai · translated from the original Chinese, 费城小记
The past 3 weeks were absolutely a blast for me. It was something I had never experienced before: from leaving the lab at 9:55pm to reach our curfew, to arriving early to squeeze in some much-needed adjustments for our piano keys, to making little robots that sprinkled a little extra joy into our days. In the past 3 weeks there were laughter, frustration, and all sorts of emotions in between. By encountering and solving different issues, I was able to gain so much more experience in debugging — understanding what was actually going on, but also constantly questioning and comprehending details along the way. I remember vividly the many iterations of our key extensions and overall mechanism design. As we chose to use solenoids, we initially wanted to 3D-print extensions that would connect directly to them. After printing several versions, I recognized a few main issues. First, the extended portion that connects to the solenoid would often be too fragile. Although this was resolved by making the design more robust, it then became too rigid, making it hard to adjust and tune. It also put a lot of burden on the solenoid, eventually only working with a very high voltage input. In the end, we opted to laser-cut our extensions, allowing for a lot of flexibility and control (resulting in many hours in the laser-cutting room). In addition to the laser-cut pieces, I also used yarn I had brought (for crocheting) to create a flexible part that would be much easier for the solenoids to pull down. At the end of the day, through the roller coaster of emotions and experiences, I learned so much in so many areas while having fun along the way — I'm forever grateful and will treasure this summer full of memories!
— Sophia Xi
That's the whole arc. Nine days of parts — a resistor, an LED, a loop, a servo, a linkage, a driver, a bus — and then four days of turning them into something that makes music with thirty other machines. Whether you were there and you're remembering it, or you're headed in and reading ahead, that's the shape of it. Now go build something that plays.
Reference card
The things that waste whole afternoons
None of these are conceptually hard. All of them produce symptoms that look like something else, which is why they cost hours. Skim this now; come back when something inexplicable is happening.
analogWrite() is unreliable on ESP32ledcAttachChannel() + ledcWrite() — use those. A dimming sketch that compiles but never fades is this.Serial.begin() and the Serial Monitor dropdown. Set both to 115200.5 / 3 is 15.0 / 3.0. No warning, no error — your maths is just quietly wrong.if (x = 5) is always truex has been overwritten.pinMode(pin, INPUT_PULLUP) is one line.if (state == HIGH) for "pressed" gives exactly inverted behaviour — the switch isn't broken.millis().delay() freezes everythingmillis() instead.s + l ≤ p + q and make the crank the shortest link before you cut parts.delay() breaks a song that must also listenmillis() in a non-blocking state machine so the loop never stops.The meta-lesson
Notice how many of these produce no error message. That's the real difference between programming a computer and programming hardware: the computer tells you when you're wrong, and the hardware just behaves strangely. Build the habit of measuring and printing rather than reasoning in your head, and most of this list stops being able to cost you an afternoon.
Bench toolkit
Formulas you'll want at the bench
Every calculation from the course days, collected. Keep this tab open during lab.
Quick reference
| Quantity | Formula | Typical use |
|---|---|---|
| Ohm's law | V = I × R | Everything |
| Power | P = V × I | Will this resistor cook? |
| Series resistance | R = R1 + R2 | Adding obstacles |
| Parallel resistance | 1/R = 1/R1 + 1/R2 | Splitting paths |
| Voltage divider | Vout = Vin × R2/(R1+R2) | Sensors, potentiometers |
| LED resistor | R = (Vs − Vf) / I | Every single LED |
| Duty cycle | D = t_on / t_period | PWM, brightness, speed |
| Servo pulse | 1.0–2.0 ms at 50 Hz | Position command |
| ADC reading | counts = V / 3.3 × 4095 | Reading sensors |
| MOSFET heat | P = I² × R_DS(on) | Will the driver cook? |
| RC filter cutoff | f_c = 1 / (2π × R × C) | Debouncing, smoothing |
| Moment / torque | M = F × d | Does the servo have enough torque? |
| Grashof condition | s + l ≤ p + q | Will the crank spin fully? |
| BJT turn-on | V_BE ≈ 0.7 V, I_base ≈ I_load / 10 | Driving a transistor switch |
| H-bridge direction | Q1+Q4 fwd · Q2+Q3 rev · never one leg | Motor direction control |
Ohm's law solver
Fill in any two. Leave the third blank.
Series & parallel
Duty cycle ↔ pulse width
A closing thought. None of this preparation is about arriving as the person who already knows everything — that's neither possible nor the point. It's about arriving with the mechanical parts already automatic, so that when something inexplicable happens at 9pm in the lab, you have the attention free to actually think about it. That's the whole idea.