The robot’s body
A robot is a bit like you. Every part has a job.
Point to each part and say its job: “brain”, “eyes”, “muscles”, “food”.
Which part is the robot’s brain?
Learn how it works, code it with blocks, wire it up and make it move.
Four games about code, numbers, gears and robots. They get harder as you get better!
You learned: code is a list of steps. The robot does them in order, one by one.
You learned: a computer counts with lights that are only on (1) or off (0). This is called binary.
You learned: gears that touch turn opposite ways. A small gear turns faster than a big one.
You learned: things fall faster and faster. That is gravity! The air stops them getting too fast, and the wind pushes them sideways.
See how every part works.
Snap blocks and test them.
Join the wires, pin to pin.
Send the code. It moves!
Type your team name and start with project 1.
All seven projects are ready.
Pick parts, place them, connect the wires, then make them work with blocks. You are the boss here.
Electrons are tiny and carry a negative charge. The − end has lots of them, the + end has few, so they move from − to +. Long ago, scientists decided that current goes the other way, from + to −: from high voltage to low voltage, just like water going downhill.
An Arduino pin set to HIGH is like a high tank: 5 volts. LOW is like a low tank: 0 volts. The LED only glows when its + leg is higher than its − leg.
Drag parts in, connect the wires, add blocks, then press Start Simulation.
Drag a part here from Components, or tap it.
Special sessions for Aroha 2026 are on their way. Check back soon.
A robot that “sees” with sound, like a bat, and drives around things.
A four-legged robot that walks, turns, waves and shakes hands.
A robot cat that walks, looks around, and meows when something is in its way.
Hold the button, ask a question, and hear the answer in about 2 seconds.
A robot arm with 4 joints and just 3 buttons. Use it to pick up a chess piece!
Show your hand to the camera, and the robot hand copies you.
Drive this robot car with a phone. Push the ball into the goal and score!
A tiny screen for your keys. Draw on your phone and it shows up!
Five short stops: the parts, the eyes, the motor, the driver and the speed.
A robot is a bit like you. Every part has a job.
Point to each part and say its job: “brain”, “eyes”, “muscles”, “food”.
Which part is the robot’s brain?
Our robot sees with sound, just like a bat.
A quick echo means the wall is near. A slow echo means it is far.
So: distance = speed × time
About 340 metres every second, in air.
The sound goes to the wall and comes back: two trips.
Wall 34 cm away → sound travels 68 cm → takes 2 ms.
340 m/s × 0.002 s ÷ 2 = 0.34 m = 34 cm ✓
Clap near a wall, then far away. The echo comes back later when you are further away.
The echo takes longer to come back. What does that mean?
Magnets and electricity push the wheel round.
Press Swap the battery wires while it spins. Watch the pushes flip and the coil slow down, stop, and spin the other way.
What makes the coil spin?
A wire carrying a current makes its own magnetic field (Ørsted, 1820), so the coil becomes an electromagnet. Put that current-carrying conductor in the field of the permanent magnets and each side of the coil feels a force F = B × I × L (Fleming’s left-hand rule). The two forces make a turning force (torque) of 2·F·r·|cos θ|: biggest when the coil lies flat, zero when it stands upright. Just there, the current reverses (a split ring on the shaft does this), so the torque keeps the same direction. As the motor speeds up it also works as a generator (back-EMF), which lowers the current; that is why the push arrows shrink and the motor settles at a steady speed set by the battery voltage.
A real robot motor has many turns of wire, 3 or more coils and curved magnets, and it spins about 100 times a second. The yellow robot motors also have a gearbox that trades that speed for strength.
How the brain makes the wheels go forward and backward.
A motor joined straight to a battery spins only one way. To go the other way, you must swap the wires by hand.
The brain sends a tiny signal. The driver swaps + and − for us, electronically, as fast as we like.
Touch a motor’s wires to a battery. Swap them: it turns the other way! The L298N swaps them for you.
The brain says “backward”. What does the L298N do?
How to go slower without a smaller battery.
Flick a light switch on and off very fast. The room looks dimmer. That’s PWM!
The pin is on half the time. How fast does the wheel go?
With the ENA/ENB jumpers fitted, each enable pin is tied to 5 V, so the motors always get the full battery voltage. To control speed, remove a jumper and wire ENA (or ENB) to a PWM pin marked ~ on the Uno that is still free here, such as ~3 or ~11, then use analogWrite(ENA_PIN, 0–255). Uno PWM on those pins runs at about 490 Hz. The code made from the blocks keeps the jumpers and drives at full speed.
Five short stops. Each one has a picture, something to try, and a quick question.
Every part has a job, just like your body.
Count the servos on your spider, leg by leg. Three on every leg, four legs. Does your count match?
How many servo motors does the spider have?
Our spider sees with sound, just like a bat.
A quick echo means you are near. A slow echo means you are far.
So: distance = speed × time
About 340 metres every second, in air.
The sound goes to your hand and comes back: two trips.
Hand 34 cm away → sound travels 68 cm → takes 2 ms.
340 m/s × 0.002 s ÷ 2 = 0.34 m = 34 cm ✓
Hold your hand in front of the spider and step back slowly. It follows you!
Your hand is 30 cm away. What does the spider do?
Distance: cm = echo time in µs ÷ 58 (for example 1160 µs = 20 cm).
Wiring: Trig → D2, Echo → D3, VCC → Uno 5V (shared with the PCA9685 VCC via a mini breadboard or 2-way jumper), GND → Uno GND.
Logic: median of 3 readings, taken only between steps. < 10 cm step_back(1); 10 to 20 cm hold; 20 to 50 cm step_forward(1); nothing within 50 cm for 15 s → sit().
A motor that stops exactly where you tell it.
Same trick as the car’s speed (PWM)! The pin flicks on and off. For a car, how long it is on sets the speed. For a servo, it sets the angle.
Hold your arm out. A friend says “left”, “up” or “right”. Point there and freeze. When your friend gently pushes your hand, push back to the same spot. That’s what a servo does!
The brain sends a long pulse. Where does the arm point?
Pulse rule: pulse (µs) = 500 + angle × 1900 ÷ 180 (about 10.6 per degree). So 0° = 500 µs, 90° = 1450 µs, 180° = 2400 µs. 1450 µs = 1.45 ms for the angle picked above.
From the code: SERVO_MIN_US = 500, SERVO_MAX_US = 2400, SERVO_FREQ = 50 (one pulse every 20 ms).
Wires: brown = GND, red = V+ (6.0 V), orange = signal.
Hip, upper leg and lower leg.
Put your hand flat on the table. Lift it using only your shoulder. Now bend only your elbow. Then use both. A spider leg works the same way!
How many servos does the whole spider have?
Leg sizes in the code: upper leg (femur) 55 mm, lower leg (tibia) 77.5 mm, hip arm (coxa) 27.5 mm.
Channels: leg 0 → 0, 1, 2 · leg 1 → 3, 4, 5 · leg 2 → 6, 7, 8 · leg 3 → 9, 10, 11 (order: upper leg, lower leg, hip).
The code takes a foot position (x, y, z) and works out all 3 angles with inverse kinematics.
The secret is the triangle.
Stand with your feet close together and lean a little. Wobbly! Now spread your feet wide and lean again. Much steadier!
Why does the spider lift only one leg at a time?
Lift, swing, down. Then the next leg!
Crawl like the spider! On hands and knees, move only one hand or knee at a time. Say it out loud: lift, swing, down, next leg!
How many legs does the spider lift at one time?
From the code (creep gait): a foot lifts from z = −50 mm to −30 mm, swings 80 mm (2 × y_step of 40 mm), and lands. The body then shifts while all four feet are down.
Order in step_forward: legs 2 and 1 on one step, then legs 0 and 3 on the next.
Speeds: a moving foot travels 8 mm every 20 ms; the body shifts 3 mm every 20 ms.
Four short stops: the parts, the eyes, the muscles and the legs.
Nine muscles, one brain, and a pair of eyes that work with sound.
Find the one servo that is not in a leg. What does it move? (Hint: the cat can look left and right.)
How many servo motors does the Robo Cat have?
Just like the Obstacle Bot and the Spider, Robo Cat sees with sound.
A quick echo means something is near. A slow echo means it is far, or nothing is there at all.
So: distance = speed × time
About 340 metres every second, in air.
The sound goes out to the object and comes back: two trips.
Object 34 cm away → sound travels 68 cm → takes 2 ms.
340 m/s × 0.002 s ÷ 2 = 0.34 m = 34 cm ✓
Move your hand slowly towards the sensor. Closer than 20 cm, and the cat should meow!
Something is 15 cm from the cat. What does it do?
Distance: cm = echo time in µs × 0.034 ÷ 2.
Wiring: Trig → Uno pin 9, Echo → Uno pin 10, VCC → Uno 5V (shared with the PCA9685 and JQ6500 via a mini breadboard or jumpers), GND → Uno GND.
Logic: while distance < 20 cm, the legs hold at their neutral 90° pose, the head servo sweeps between about 60° and 120°, and the JQ6500 plays its sound at full volume. Once distance is 20 cm or more again, the head returns to centre and the walking cycle resumes.
A motor that stops exactly where you tell it.
Hold your arm out. A friend says “left”, “up” or “right”. Point there and freeze. When your friend gently pushes your hand, push back to the same spot. That’s what a servo does!
The brain sends a long pulse. Where does the arm point?
From the code: SERVOMIN = 150, SERVOMAX = 600. These are PCA9685 “ticks”, not microseconds: at 50 Hz the driver divides each 20 ms cycle into 4096 ticks, so pulse = map(angle, 0, 180, 150, 600) and pwm.setPWM(channel, 0, pulse).
In real time that’s about 150 ticks ≈ 0.73 ms at 0°, up to 600 ticks ≈ 2.93 ms at 180°.
Wires: brown = GND, red = V+ (6.0 V), orange = PWM signal.
Both servos stay on the body and pull the leg with crossed bars.
Cross two pencils into an X. Wiggle the tops and watch the bottom tips move. That’s how the cat’s legs work!
Where are a leg’s two servos?
Mechanism: each leg is a five-bar linkage. The body is the fixed bar, the two body-mounted servos drive the two cranks, and the two long bars cross and join at the foot. Two inputs give the foot a two-dimensional workspace, so neither servo maps to a single joint on its own — the pair work together.
Channels (from the code): head = 7 · front-left 15 and 14 · front-right 13 and 12 · back-left 11 and 10 · back-right 9 and 8. The sketch names the pair HIP and KNEE for each leg; those are the names of the two servos, not two joints down the leg.
One gait, three poses: a step is HIP → 120° on all four legs, then KNEE → 120°, then everything back to 90°. No inverse kinematics and no balancing act: unlike the Spider, Robo Cat does not lift three feet to stand on a triangle, so it is a simple synchronized shuffle forward.
Mirrored hips: the code sends the same angle to the front-right hip (channel 13) as the front-left hip (channel 15), so they always move together.
Five short stops: the parts, the ears, the voice, the AI helpers and the wait.
Ears, a voice, a brain — and three helpers that are not even in the room.
Could you answer a question you never learned? Neither can the robot. It asks the AI on the internet.
Where does the robot do its thinking?
A skin, a gap, and a number.
That’s why it needs 3 wires: one for the numbers, two for the clock.
The same controls move the speaker below. Watch both at once — they are the same machine facing opposite ways.
Stretch cling film over a bowl and put rice on it. Shout at it: the rice jumps! You made a diaphragm.
The diaphragm gets pushed closer to the back plate. What happens?
What it is: a MEMS capacitive microphone. The diaphragm and the fixed back plate form a capacitor; acoustic pressure changes the plate separation, which changes the capacitance, which the on-chip circuit converts to a digital value. There is no coil and no magnet in this one — see the speaker topic for where those live.
Protocol: I2S. SCK is the bit clock, WS the word-select (left/right) line, SD the serial data. The ESP32 is the I2S master, so SCK and WS are outputs from the board and SD is an input to it.
Wiring: SD → GPIO 4, SCK → GPIO 5, WS → GPIO 6, VDD → 3V3 (a 3.3 V part — 5 V can destroy it), GND → GND, and L/R → GND so it claims the left channel, which is the one the sketch reads.
Rate: 16 kHz mono, which is what Whisper expects. Ten seconds of that is 320 KB — far more than the board’s free heap — so the sketch streams the recording out while you are still speaking rather than storing it.
The same machine, running backwards.
Music makes the electricity change direction again and again. Each flip turns the coil’s magnet around.
Out, in, out, in… hundreds of times a second. That shakes the air, and you hear the sound!
Press Pause and move the slider in the topic above to make the speaker move by hand.
Gently touch a speaker while music plays. Feel the buzz? That’s the cone moving. Be gentle: it tears like paper.
What makes the cone move back instead of forward?
The motor: a voice coil in the field of a permanent magnet. Current through the coil produces a force along the axis (F = BIL), so the cone follows the waveform of the current.
The amplifier: a MAX98357A, a class-D I2S amplifier. It receives the same kind of digital numbers the microphone sends, and switches its output very fast to reproduce them as power. Its output is bridged — it drives both speaker terminals in opposite directions — which is exactly why SPK− must never be joined to GND.
Wiring: DIN → GPIO 15, BCLK → GPIO 16, LRC → GPIO 17, VIN → 5V (unlike the microphone, this one really is a 5 V part), GND → GND. GAIN and SD are left floating for the default 9 dB.
Loudness: a 4 Ω speaker is noticeably louder than an 8 Ω one here. The GAIN pin changes it in hardware without the distortion that comes from pushing the software volume past 100.
Nobody in the room is doing the thinking.
Play it with 3 friends: one writes down your question, one writes an answer, one reads it out loud.
Where does the thinking actually happen?
Models: whisper-large-v3-turbo for speech-to-text, openai/gpt-oss-120b for the reply, canopylabs/orpheus-v1-english for the voice — all three served by Groq on one free API key.
Cost per turn: three API requests, one to each model. Each model has its own quota, and every reply carries live x-ratelimit-* headers.
Privacy, worth saying out loud to the class: the recording really does leave the room. It travels to a company’s servers to be transcribed. That is the trade for an answer this good from a board this small, and it is a fair thing for children to know about every voice assistant, not just this one.
Two seconds, and most of it is one stage.
Count “one elephant, two elephant”. That’s about the wait. Are your friends faster?
Which stage takes the longest?
These are the real measured figures the sketch prints to the Serial Monitor at the end of every turn, on a free Groq key:
STT : 297 ms whisper-large-v3-turbo LLM : 1119 ms 312 ms connect + 807 ms think TTS : 805 ms orpheus-v1-english ---------------------------- TOTAL : 2221 ms button release -> ready
They move around with network conditions, so the class will not see exactly these. That is the point: the robot measures rather than assumes, and so should the children.
Five short stops: the parts, the muscles, the joints, the buttons and the 3-button trick.
Four muscles, three buttons and four little lights to remember by.
Pick up a pen using only your shoulder, then only your elbow, then only your fingers. Every joint does one job. The arm has four of them.
What do the four LEDs tell you?
A motor that stops exactly where you tell it.
Hold your arm out and let a friend press down gently. You push back to stay level. That’s what a servo does!
What happens if you nudge a powered servo away from its angle?
From the sketch: all four servos start at 85°, and are limited to minDeg = 7 and maxDeg = 173 so a button cannot drive a joint into its own frame. Each press moves the selected joint by movement = 2 degrees.
Servos: MG90D. The original build wires them to Uno pins 5, 6, 7 and 8 with the standard Servo.h library; ours plug into the PCA9685 driver on channels 0 to 3 instead (the lines marked [BB] in the sketch).
Important: run the sketch with the servos connected but before bolting the arm together. It parks everything at 85°, and the arms are then fitted around that pose — otherwise a joint will run out of travel halfway through a move.
Shoulder, elbow, wrist… and a hand.
Pick up an eraser moving one joint at a time. Slow, isn’t it? That’s what the buttons do.
Which joint decides which direction the arm is pointing?
Plugs: servo 1 (base) → PCA9685 channel 0, servo 2 (shoulder) → channel 1, servo 3 (elbow) → channel 2, servo 4 (gripper) → channel 3. The published build wires them to Uno pins D5 to D8; ours goes through the driver, like the Spider Bot.
Worth knowing: in the published sketch, servos 1 and 2 move in the opposite direction to servos 3 and 4 for the same button, because the two halves of the code were written slightly differently. On a real build you simply learn which way each one goes — or swap the two lines for that joint.
Two legs, and a springy strip that joins them.
Joined or not joined. The Uno checks thousands of times a second.
Hold your two fingertips apart: that’s the gap. Touch them: joined! That’s a button.
What is actually happening inside the button when you press it?
The tactile switches in the kit have four pins, not two, but there are still only two connections: the pins are paired, and each pair is permanently joined inside. Pressing bridges one pair to the other.
The practical consequence on a breadboard: pick two pins on opposite sides of the switch, not two on the same side. Two pins on the same side are already joined to each other, so the circuit is permanently on and the button appears to do nothing. If a button seems stuck on, this is almost always why — turn it ninety degrees.
Straddling the centre channel of the breadboard with the switch makes this automatic, which is why that is the standard way to seat one.
And the resistor that stops a button telling fibs.
Hold a key on a string gently (the spring). A friend pulls it down (the button). They win! Let go and it comes back up.
What happens if you leave out a button’s resistor?
Wiring, from the original: 10 kΩ from 5 V to one side of each button, the same node to the Uno pin, and the other side of the button to GND. S1 → D2, S2 → D3, S3 → D4. That is a pull-up, so the pin idles HIGH and is pulled LOW when pressed.
Worth checking on the day: the published sketch counts a press with if (digitalRead(switchPin) == HIGH), which is the opposite sense to the pull-up wiring described above. On the bench, press S1 and watch the Serial Monitor: if the count climbs while you are not pressing, either invert that test to LOW or wire the buttons as pull-downs. We have left the code exactly as published, so decide which you prefer and change one or the other, not both.
LEDs: 330 Ω on each, to D9, D10, D11, D12.
Five short stops: the parts, the camera, the muscles, the strings and the power.
Six muscles, a brain in the forearm, and a second brain on the laptop.
Hold your hand up and copy a friend’s hand, finger by finger. You are the laptop and the robot hand at the same time.
Which part watches YOUR hand?
The robot hand has no eyes of its own. The laptop’s webcam does the seeing.
…means the finger is bent → send a 1.
1 on the wrist + 4 on each of 5 fingers.
wrist, index, middle, ring, thumb, pinky.
Peace sign → index and middle up, the rest bent.
Message: 0 0 0 1 1 1
Slowly curl your finger. When the tip drops below the knuckle, the camera calls it “bent”.
Where does the “seeing” happen?
Fingers: landmark tips are 8, 12, 16, 20; the program compares each tip’s y with the joint two below it (6, 10, 14, 18). Larger y means lower on screen, so “tip y > joint y” = bent.
Thumb: compares the x of landmark 4 with landmark 3. This assumes one hand facing one way; show the other hand, or turn it round, and the thumb reads backwards. Good debugging lesson.
Wrist: the first digit is always 0 — the Python never sets it, so the wrist servo stays still. That is how the published code works.
A motor that stops exactly where you tell it.
Hold your arm out. A friend says “left”, “up” or “right”. Point there and freeze. When your friend gently pushes your hand, push back to the same spot. That is what a servo does!
How many servos does the bionic hand use?
Servos: JX PDI-6225MG-300, a 25 kg·cm metal-gear servo that turns through about 300°, not 180°. That is why the sketch maps degToPwm(degree) over 0–320.
From the code: SERVOMIN 70, SERVOMAX 510 (PCA9685 ticks at 50 Hz), the author’s values for his servos. Test yours before fitting the fishing line.
Directions: the ring (channel 3) and pinky (channel 5) servos turn the opposite way to the others; the code handles that.
The servos live in the forearm, not in the fingers.
Make a paper-straw finger: cut two small V-notches in a straw, thread a string through and tape it at the end. Pull the string and the straw curls at the notches. You built a tendon!
What straightens the finger again?
The hand is the InMoov i2 design by Gaël Langevin. It needs about 1 kg of PLA/PETG/ABS at ~30% infill, ~3 m of fishing line rated near 20 kg, and five 3/16″ × 1¾″ extension springs. Routing the line without tangles is the fiddly part; follow the InMoov hand i2 and forearm tutorials.
Printing takes days, so print and assemble the hand before the session. Children do the wiring, code and testing.
Big muscles need a big, gentle supply.
All six servos squeezing at once.
≈ 108 watts. That is why the author used a ~100 W supply.
The small 5 A one from the Spider is not enough here.
USB gives about 0.5 A. The servos could need 36 times more. The ESP32 stays on USB; the servos never touch it.
Watch an adult set the buck converter: turn the tiny screw while a multimeter reads the output, until it shows 6.0 V. Only then do the servos get plugged in.
What does the buck converter do?
Supply: 12 V, 10 A (120 W) switch-mode supply → a 20 A / 300 W step-down module set to 6.0 V with a multimeter before anything is connected. Fuse the 12 V side.
The PCA9685 trap the author warns about: the green terminal goes through a reverse-polarity MOSFET. On some clone boards that part only handles about 0.5 A, far less than six big servos. Check your board: if it has the small part, either bridge it (per the author’s linked video) or take the 6 V to the servo V+ rail by another route. Feeding six of these servos through a 0.5 A part will make it burn out.
Grounds: buck OUT− goes to the PCA9685 GND terminal, which is joined on the board to its logic GND and so to the ESP32 GND. That shared ground is what lets the servos understand the signals.
Six short stops: the parts, Bluetooth, the motors, the motor drivers, speed and steering.
A brain, two very strong muscle boards, four wheels — and a phone as the remote.
Open a Bluetooth controller app on a phone and look at the buttons. Every one of them sends just one letter to the car.
How does the phone talk to the striker?
An invisible cable made of radio waves.
Robot Ready Bluetooth: ESP32 Robot
case 'F': forward(); break;
8 moves, stop, lights on and off, horn and 10 speeds.
Walls and bodies shorten it.
Tap F, then S. The Serial Monitor shows exactly the two lines the real ESP32 prints.
Play “robot” with a friend. They may only do what one letter says: F = step forward, L = turn left, S = freeze. Give them letters to steer them round a chair.
You let go of the Forward button. What does the phone send?
Classic Bluetooth only. The sketch uses BluetoothSerial (Bluetooth Classic, SPP). That exists on the original ESP32 only — not ESP32-S3, C3 or C6, which have only Bluetooth Low Energy. Use an ESP32 DevKit like the one in the picture.
Android only. iPhones do not offer the Classic serial profile to apps, so an iPhone cannot drive this car. Have Android phones or tablets ready for the session.
Apps: any “Bluetooth RC controller” app that lets you choose the letter each button sends. Set the horn button to Y and the light button to X/x — some apps send other letters (for example V for the horn) by default.
Magnets and electricity push the wheel round.
Press Swap the battery wires while it spins. Watch the pushes flip and the coil slow down, stop, and spin the other way.
What makes the coil spin?
A wire carrying a current makes its own magnetic field (Ørsted, 1820), so the coil becomes an electromagnet. Put that current-carrying conductor in the field of the permanent magnets and each side of the coil feels a force F = B × I × L (Fleming’s left-hand rule). The two forces make a turning force (torque) of 2·F·r·|cos θ|: biggest when the coil lies flat, zero when it stands upright. Just there, the current reverses (a split ring on the shaft does this), so the torque keeps the same direction. As the motor speeds up it also works as a generator (back-EMF), which lowers the current; that is why the push arrows shrink and the motor settles at a steady speed set by the battery voltage.
A real robot motor has many turns of wire, 3 or more coils and curved magnets, and it spins about 100 times a second. The yellow robot motors also have a gearbox that trades that speed for strength.
Two BTS7960 boards, one for each side of the car.
A motor on a battery spins one way. To reverse it, you swap the wires.
The ESP32 sends RPWM or LPWM, and the driver swaps + and − for us.
Touch a motor’s wires to a battery. Swap them: it spins the other way!
RPWM = 0 and LPWM = 255. Which way does that side turn?
Header: RPWM, LPWM, R_EN, L_EN, R_IS, L_IS, VCC, GND. The sketch holds both EN pins HIGH and drives the two PWM pins. R_IS and L_IS are current-sense outputs and are not used.
Logic: VCC must be 5 V. The board buffers its inputs with a 74HC244 at 5 V, whose guaranteed HIGH is 3.5 V; the ESP32 gives 3.3 V. It works on almost every board in practice, but if one side refuses to move with correct wiring, this is why.
Size: these drivers are rated around 40 A — far more than four BO motors need. They will run cold, which is fine; an L298N would also do the job.
How a digital pin makes “a bit faster” and “a bit slower”.
…is how much of every flick the pin is on.
On 100% of the time: full speed.
125 ÷ 255 ≈ 49%: about half.
Button 3 → 75. 75 ÷ 255 = 29% on. Slow enough to dribble carefully!
Flick a light switch on and off as fast as you can. It flickers. Now imagine 1000 flicks a second: your eyes would just see a dimmer light. That is PWM.
You are driving forward at speed 9 and press speed 3. What happens?
Turn by making one side faster than the other.
Push a toy car with two fingers, one on each side. Push both evenly: straight. Push one harder: it curves. Push them opposite ways: it spins.
To curve left (letter G), which side goes slower?
Four short stops: the parts, the screen, Wi-Fi and animation.
A brain, a screen and 4 wires.
Find the brain and the screen in your kit.
Which part is the brain?
Pictures made of dots.
Pixels ON: 0
pixels on the screen
Like a tiny light switch.
Smaller than a stamp!
Your grid is 16 × 16 = 256 pixels.
Look at a phone screen with a magnifying glass. You’ll see tiny dots!
What can one pixel do?
The keychain makes its own Wi-Fi.
Draw something, then press Send.
Through the air, with Wi-Fi.
No internet needed.
All small letters.
192.168.4.1 in the phone’s browser.
Two friends, one keychain: take turns sending drawings!
How does your drawing get to the keychain?
Every keychain calls its Wi-Fi OLED-Studio. With several in one room, change AP_SSID in the code for each one (OLED-Studio-1, -2…) so children join their own. Phones may say “no internet”: choose to stay connected.
Lots of pictures, very fast.
Fast enough to move!
pictures a second
4 pictures and 7 robot faces
Count the pictures in one second. About 7!
Draw a heart in the corner of every page of a notebook, a bit bigger each time. Flick the pages!
How do pictures start to move?
Drag blocks under when robot switches on, or tap a block to add it. Press Run to watch your robot drive. Like a real robot, it never drives exactly the same path twice.
This is the real code your blocks make. You upload exactly this in step 4.
Drag the rock or the flower to make the puzzle harder or easier.
The green triangle shows the three feet holding the spider up while one leg is in the air.
Drag the toy left or right to choose where the cat will meet it.
Your blocks become the real Robo Cat code on the Upload page.
The stage times are the real measured ones from the robot. A different question is picked each time you press Run.
Drag the chess piece along the bench to make the puzzle harder or easier.
On the real arm you nudge one joint at a time with the three buttons. Here you can type the angle straight in, so you can plan the whole move first.
Finger numbers: 1 thumb · 2 index · 3 middle · 4 ring · 5 pinky. On the real hand you don’t write blocks: your own hand in front of the camera is the program.
Hold an arrow to drive; let go and it sends S. Keyboard: arrow keys, space to stop.
Point at the screen: x is across, y is down. Use those numbers in your heart blocks.
First learn what pins are. Then build the circuit like in Tinkercad: drag a wire from pin to pin. Do the same wires on your real robot.
A digital pin is like a tiny light switch that the brain flips on and off. It only has two states:
HIGH = ON = 5 volts · LOW = OFF = 0 volts
OUTPUT pins talk. The brain sends a signal out. TRIG (“shout now!”) and IN1 to IN4 (“which way, wheels?”) are outputs.
INPUT pins listen. ECHO is an input: the sensor uses it to tell the brain when the echo came back.
Pins with a ~ (like ~9 and ~10) can also do “half power”. We don’t need that today.
Pins are like house numbers. Our code says the TRIG wire lives at pin 10. If you plug it into pin 11, the brain knocks on the wrong door and nobody answers!
| Pin 10 | TRIG | brain says “shout now” |
| Pin 9 | ECHO | sensor says “echo is back” |
| Pins 7, 6 | IN1, IN2 | left wheel direction |
| Pins 5, 4 | IN3, IN4 | right wheel direction |
The HC-SR04 sensor has 4 pins: VCC → 5V, GND → GND, Trig → pin 10, Echo → pin 9.
On the board we see it from the front, so the pins read VCC, Trig, Echo, GND.
The 9 V battery plugs into the Uno’s round DC jack. It powers the brain.
The 7.4 V pack goes to the L298N’s 12V and GND screws. It powers the motors. Adult only.
For this project, always connect VCC to 5V and GND to GND. Never join 5V straight to GND: that’s a short circuit!
The brain talks to the servo driver using I2C (say “eye-squared-see”). It needs only two wires:
SDA carries the message. SCL is the clock: tick, tick, tick, so both boards read each bit at the same moment.
On the Uno, I2C lives on A4 (SDA) and A5 (SCL). (The SDA and SCL pins near AREF are the same two pins.)
Lots of boards can share the same two I2C wires. Each one has an address, like a house number. Our driver lives at 0x40.
The driver then makes the pulses for up to 16 servos, one per channel (0 to 15). We use channels 0 to 11.
Every servo has a plug with three wires:
| Brown | GND | outside edge of the board |
| Red | V+ | 6 V power, middle |
| Orange | PWM | the pulse signal |
Each leg uses 3 channels in a row: upper leg, lower leg, hip. Leg 0 uses 0, 1, 2. Leg 1 uses 3, 4, 5, and so on.
The HC-SR04 sensor has 4 pins: VCC → 5V, GND → GND, Trig → pin 2, Echo → pin 3.
On the board we see it from the back, so the pins read GND, Echo, Trig, VCC.
The 9 V battery plugs into the Uno’s round DC jack. It powers the brain.
The 7.2 V pack goes through the buck converter (6.0 V) to the servos. Adult only.
Servos get 6.0 V from the buck converter, never the 7.2 V pack directly. Join every GND together. Adult only: batteries, the buck converter, the multimeter and soldering.
The brain talks to the servo driver using I2C (say “eye-squared-see”). It needs only two wires:
SDA carries the message. SCL is the clock: tick, tick, tick, so both boards read each bit at the same moment.
On the Uno, I2C lives on A4 (SDA) and A5 (SCL).
The driver makes the pulses for up to 16 servos, one per channel (0 to 15). Robo Cat uses channels 7 to 15: the head is on channel 7, and the 8 leg servos are on channels 8 to 15.
The code calls each leg’s pair hip and knee, but both of them bolt to the body and pull the leg through its crossed bars — there is no servo down in the leg.
| Brown | GND | outside edge of the board |
| Red | V+ | 6 V power, middle |
| Orange | PWM | the pulse signal |
The HC-SR04 sensor has 4 pins: VCC → 5V, GND → GND, Trig → Uno pin 9, Echo → Uno pin 10.
On the board we see it from the back, so the pins read GND, Echo, Trig, VCC.
The JQ6500 sound module plays the meow through a small speaker. It needs VCC → 5V, GND → GND, its TX → Uno pin 11, its RX → Uno pin 12, and two more wires straight to the speaker: SPK+ and SPK−.
SPK− is not a ground. Don’t join it to the GND rail: it carries half of the sound signal.
The 9 V battery plugs into the Uno’s round DC jack. It powers the brain.
The 7.2 V pack goes through the buck converter (6.0 V) to the servos. Adult only.
Servos get 6.0 V from the buck converter, never the 7.2 V pack directly. Join every GND together, except the sound module’s SPK−. Adult only: batteries, the buck converter, the multimeter and soldering.
This board gives out both 3V3 and 5V, and the two parts want different ones.
| Microphone VDD | → 3V3 only |
| Amplifier VIN | → 5V |
Swap them and the microphone can be damaged for good. Read the label on the part, not the colour of the wire.
Sound travels as numbers, so each side needs a data wire plus two clock wires that keep both ends counting together. This is called I2S.
| SD → pin 4 | mic data in |
| SCK → pin 5 | mic bit clock |
| WS → pin 6 | mic word select |
| DIN → pin 15 | amp data out |
| BCLK → pin 16 | amp bit clock |
| LRC → pin 17 | amp word select |
The microphone has a pin that decides whether it is the left or the right ear. Our code listens to the left one, so L/R goes to GND.
Leave it unconnected and the mic answers on the channel nobody is listening to — you get silence, and the AI politely invents “Thank you.”
The two speaker wires come out of SPK+ and SPK− on the amplifier and go nowhere else.
SPK− is not a ground. This amplifier pushes and pulls both wires at once. Joining SPK− to GND can damage it.
The USB cable carries both the code and the power. Nothing here needs a battery pack, a buck converter or soldering.
Adult only: the mains USB charger, if you use one instead of a laptop.
The microphone runs on 3.3 V and the amplifier on 5 V — swapping them can destroy the microphone. Join every GND together, except the amplifier’s two speaker wires. Adult only: the mains USB charger.
The pins run in neat groups, which makes this one of the easier boards to check. The servos do not use Uno pins at all: they plug into the servo driver, on channels 0 to 3.
| D2, D3, D4 | the three buttons |
| A4, A5 | to the servo driver (SDA, SCL) |
| D9, D10, D11, D12 | the four LEDs |
The buttons and LEDs sip a tiny amount, so they run from the Uno’s 5V, through the breadboard’s + rail.
The four servos are hungry. Their 4 × AA battery pack goes into the servo driver’s green terminal. Never run them from the Uno — it can damage the board.
Adult only: batteries.
The PCA9685 is the same blue board as on the Spider Bot. The Uno sends it short messages over just two wires, SDA and SCL, and the driver makes the pulses for all four servos.
It also joins the battery’s ground to the Uno’s ground for you, through its GND wire. Two supplies have to agree on what “zero” means, or the arm jitters.
A 9 V block looks powerful, but it can only give a trickle of current. Four servos pulling together will flatten it in moments and the arm will stutter.
Four AA cells give about the same voltage a servo wants and enough current to actually move.
3 × 10 kΩ — one per button, the gentle spring that holds the pin at ON so it does not float and fire by itself.
4 × 330 Ω — one per LED, so it does not burn out. An LED with no resistor is a very short-lived LED.
Servos get the 4 × AA pack through the driver’s green terminal, never the Uno’s 5V. Adult only: batteries.
The ESP32 talks to the servo driver using I2C: just two wires.
SDA carries the message. SCL is the clock: tick, tick, tick, so both boards read each bit together.
| GPIO 21 | → SDA |
| GPIO 22 | → SCL |
| 3V3 | → VCC (the driver’s brain) |
The driver board has little resistors that pull SDA and SCL up to whatever VCC is. The ESP32 is a 3.3 V board, so VCC must be 3V3, or 5 V lands on its pins.
The Uno projects used 5V here. The ESP32 is different.
| 0 | wrist | 3 | ring |
| 1 | index | 4 | thumb |
| 2 | middle | 5 | pinky |
Brown wire to the outside edge, every plug.
The ESP32 gets its power from the laptop’s USB cable.
The servos get 12 V → buck converter → 6 V → the green V+ terminal. Adult only.
Servos get 6.0 V from the buck converter, never 12 V and never the ESP32. Set the buck with a multimeter before connecting anything. Adult only: the mains supply, the buck converter and soldering.
Each motor driver needs four signal wires from the ESP32:
| Left | Right | |
| RPWM | 25 | 32 |
| LPWM | 26 | 33 |
| R_EN | 27 | 12 |
| L_EN | 14 | 13 |
PWM pins set speed and direction; EN pins switch each half of the driver on.
R_IS and L_IS tell you how much current the motor is using. This car doesn’t need them, so they stay empty.
Every driver also needs VCC → 5V and GND → GND for its little logic chip.
| Buzzer + | → GPIO 2 |
| LED + | → GPIO 4 (through its resistor) |
| both − | → GND |
Each driver has two big output screws, M+ and M−. Both motors on one side share them, so they always turn together.
If one side drives backwards, swap that side’s two motor wires. No code change.
The 7.4 V pack goes to both drivers’ B+ and B− screws. It feeds only the motors.
The ESP32 runs from a USB power bank, and its 5V pin feeds the drivers’ logic. Adult only: the battery pack.
The motor battery goes only to the drivers’ B+ and B− screws, never to the ESP32. Every GND is joined: the drivers’ GND pins go to the ESP32 GND. Adult only: the battery pack and screw terminals.
| VDD | → 3.3 |
| GND | → G |
| SCK | → 8 |
| SDA | → 9 |
VDD and GND give the screen power.
SDA and SCK carry the picture to the screen.
Careful: SDA goes to 9, SCK goes to 8.
Leave the 5V pin empty. Never join 3.3 straight to G.
Check your wires, then upload the code your blocks made. Change your blocks, and this code changes too.
Before you upload, check your real robot against this circuit, wire by wire.
| Wire | From | To | What it does |
|---|
Based on the classic Arduino obstacle robot shared by makers on Instructables and Hackster, with fixed pins for BrainyBotz.
File name: spider_pca9685_calibrate.ino. Arduino needs each sketch inside a folder with the same name.
Some servos ran at 7.2 V before (a full pack is really 8.4 V, and MG90S are rated 4.8 to 6 V). Test those first. A weak servo makes a wobbly leg.
A servo is weak if it buzzes while still, stops short of the angle, moves slowly or jerkily, or gets warm. Put weak ones aside and use good ones for the legs.
servo_trim table it prints.servo_trim lines near the top of the spider code.This is the spider code with a small follow part added. Every original line is still there. USE_FOLLOW is set to 1.
| HC-SR04 Trig | → Uno pin 2 |
| HC-SR04 Echo | → Uno pin 3 |
| HC-SR04 VCC | → Uno 5V (shared, see below) |
| HC-SR04 GND | → Uno GND |
The Uno has only one 5V pin, and the PCA9685 uses it too. Share it with a mini breadboard or a 2-way jumper, or use the 5V on the driver’s other side.
distance what the spider does < 10 cm → step_back(1) 10–20 cm → hold still 20–50 cm → step_forward(1) nothing 15 s → sit()
Robo Cat walks on its own, looks around with its ultrasonic eyes, and meows through a JQ6500 sound module, with fixed pins for BrainyBotz.
File name: my_robo_cat.ino. Needs the Adafruit PWM Servo Driver and JQ6500_Serial libraries. Arduino needs each sketch inside a folder with the same name.
This is the Robo Cat code with a small follow part added, the same way the Spider Bot’s follow add-on works. Every original function is still there, unchanged — only the rule for when to walk is different. No new wiring needed: it uses the same eyes already wired for obstacles.
distance what the cat does < 20 cm → stop and meow (unchanged) 20–40 cm → walk forward (follow it) more, or none → stand still, head centred
Code and wiring from the open-source ESP32-S3 Groq Voice Assistant by techiesms, used as published apart from the two lines marked [BB] (a safer volume, and a timeout that can no longer hang).
File name: Code.ino. Both files live in the same folder, or the sketch cannot find your key.
https://espressif.github.io/arduino-esp32/package_esp32_index.json, then Tools → Board → Boards Manager → install esp32 by Espressif Systems. It must be version 3.x — version 2 will not compile this.This little file holds your WiFi details and your AI key. It is kept separate so you can share the sketch with anybody without handing over your password.
gsk_. An adult or mentor should do this part, because the key belongs to a real account.secrets.h.Circuit and code from “Servo Controller for a 4 Axis Robot Using a 3 Button Control System” by break_it_fix_it on Instructables, with your blocks in place of the button control.
The top of the sketch is the published 3-button controller with the PCA9685 changes marked [BB]. Its button logic in loop() is replaced by the blocks: they run once after a 2-second pause, and again on every press of S1 (read as LOW, to match the 10 kΩ pull-up wiring). Joints move one degree every 15 ms and stay between 7° and 173°. The gripper uses 20° for closed and 90° for open: adjust those two numbers to suit your claw.
Code and build from “Bionic Hand Controlled by OpenCV” by bloudakm on Instructables (CC BY-NC-SA). Hand design: InMoov i2 by Gaël Langevin. BrainyBotz powers the servos from an external 6 V buck converter.
File name: bionic_hand_esp32.ino. Lines marked [BB] are the only places BrainyBotz changed the published code: filling in what the page left out, and switching off the fingertip sensors our hand does not have. Your blocks are added at the end.
https://espressif.github.io/arduino-esp32/package_esp32_index.json. Then Boards Manager → install esp32 by Espressif Systems.COM3, COM5… on Windows, /dev/ttyUSB0 on Linux, /dev/cu.usbserial… on a Mac. Change "COM3" in the code to match.hand_tracker.py and run it: python hand_tracker.pycv2.CAP_DSHOW is a Windows-only camera setting. If the camera will not open on a Mac or Linux laptop, ask your mentor to remove , cv2.CAP_DSHOW from that line.Published as written; the [BB] lines are fills for text cut off on the page or placeholders that cannot compile, plus the fingertip-sensor lines switched off because our hand has no sensors. Know these before the day:
0. No feeling. The original stops each finger when its fingertip sensor feels pressure. Ours cannot, so a closed hand keeps pushing on whatever it holds and the servo stalls. Stalled 25 kg servos draw a lot of current and heat up, along with the driver and the buck. Let it hold only soft, light things, and only for a moment; if a finger buzzes, open the hand.
1. int index. Some ESP32 core versions already define a function called index, and the global int index = 1; then fails with “redeclared as different kind of entity”. If you see that error, rename the variable (it is only used inside the sketch) — a good real-world lesson in name clashes.
2. Wrist. The Python always sends 0 for the wrist, so channel 0 never moves.
3. change is never reset to false, so the loop keeps running every 100 ms. Harmless: nothing moves when the states already match.
4. MediaPipe. The code uses the older mp.solutions.hands interface. If a newer MediaPipe says it has no attribute solutions, install an older one, e.g. pip install "mediapipe<0.10.15", on Python 3.12 or below.
5. One Serial user at a time. If Python says “Access is denied” or “could not open port”, the Arduino Serial Monitor is still holding it.
Code: the BrainyBotz Bluetooth car sketch, used exactly as written. ESP32 + two BTS7960 (IBT-2) drivers + four BO motors.
File name: soccer_striker.ino
https://espressif.github.io/arduino-esp32/package_esp32_index.json. Then Boards Manager → install esp32 by Espressif Systems, version 3.x (version 2 cannot compile ledcAttach).Robot Ready.1. No failsafe. If the Bluetooth link drops while a move button is held, the ESP32 never receives the S, so the car keeps driving at the last command until it hits something or the battery is switched off. Keep a hand near the switch, and run on a fenced pitch. A safety timeout (stop if no letter arrives for ~0.5 s) would fix it; we have left the code exactly as written.
2. Classic Bluetooth. Original ESP32 only (not S3/C3/C6), and Android phones only — iPhones cannot use the serial profile this sketch needs.
3. Strapping pins. GPIO 12 (right driver R_EN) and GPIO 2 (buzzer) are boot strapping pins. The driver and buzzer inputs normally don’t disturb them, but if the board won’t boot or upload while wired, unplug those two wires and try again.
4. Check what your app really sends. This sketch expects G = forward-left, H = forward-right, I = back-left, J = back-right, X / x = light, Y = horn. Some popular Android RC-car apps use I for forward-right and H for back-left, and V for the horn, so a diagonal button would drive the wrong way. Before the first drive, press every button with the wheels in the air and read the letters in the Serial Monitor. If they differ, pick an app that lets you set the letters; the code here is unchanged.
The Pixel Studio code is the BrainyBotz keychain project, used exactly as written. File 3 is made from your blocks.
File name:
Boards URL: https://espressif.github.io/arduino-esp32/package_esp32_index.json. Set USB CDC On Boot: Enabled for the Serial Monitor. No port? Hold BOOT, tap RST, release BOOT.
One Wi-Fi name per keychain: change AP_SSID on each one if several are in the room.
Pins: the code uses Wire.begin(9, 8): SDA on 9, SCK/SCL on 8.
Not compiled here: file 3 is generated from the blocks and was checked by eye. Verify it once before the session.
Every real engineer fixes problems. Find what your robot is doing below and try the fix.