In Lesson 15 we met a brain without a body: an AI that is great at talking but can’t pick up a glass of water. In Lesson 16 we built a body that follows the rules we write. This lesson joins the two together, with AI as the brain and the robot as the body. Once they are joined, they become a loop that never stops: sense, think, send the command, move, check the result, then go round again. Our nervous system works in a loop like this too, so this lesson uses our own body as a map to help us understand. Remember, this is only a comparison. It does not mean that robots have brains like people.
By the end of this lesson, you’ll be able to explain how an AI brain and a robot body pass the work along to each other in a loop, and why a good robot double-checks, stops by itself and asks a person. You’ll also be able to connect an AI you taught yourself to the car from Lesson 16 with your own hands.
A helper robot at home hears the command Put the apple in the basket which is very easy for us. But for a robot, this job needs many parts working together: one part listens, one looks, one plans the route, one picks up, and another checks whether the job is really done. In this level we will look at the whole loop first and do 5 short missions, then try to break it in the free lab.
A helper robot at home doesn’t have one single AI that does everything. Instead, it has many parts that pass the work along in a loop: listen to the command, look for the object, plan the route, pick it up, then check the result. When the world changes, for example once the apple has moved into the basket, the eyes come back to look again, round and round.
It’s like passing the ball in a football team. Each player is good at a different position, and each one has to trust the pass a teammate sends. If the first player makes a bad pass, the next player picks up that bad pass and carries on with it too.
The listening part and the looking part are AIs that learn from examples, like the ones we met in Lesson 15 while the route-planning part and the checking part are programs that calculate by rules. The picking part is a feedback loop like the one in Lesson 16 and a safety layer keeps watch underneath them all.
Start with Mission 1. Press ▶ Start mission, then watch the strip of five boxes. Each box is one member of the team, and the symbol in the box shows what it is doing. The room picture is the room seen from the ceiling, and the dark picture is what the robot’s own camera sees. Finish all 5 missions and the free lab opens by itself, but you can skip ahead to it if you like.
Choose 1 protection layer to switch on
Choose a command, then flip the switches in the panel below. Try to break the robot, then switch on the protection layers one at a time to see what helps. Press ×10 to try ten rounds in one go, then count how many times it was wrong without knowing (✗) and how many times it asked a person (?).
Command
🔁 Loop-back arrow: the world changes, so the eyes come back to check the result
✗ Dashed arrow: the wrong target is passed along
Plan from the language AI No command received yet
○ Waiting · ◐ Working · ✓ Passed · ↻ Trying again · ? Asking a person · ✗ Mistake · ⊘ Can’t do it · 🧠 AI that learns from examples · 🧮 Program that calculates by rules · ⚙ Feedback loop
The camera hasn’t looked yet
Right now, you are the person in the robot’s loop. See the term human-in-the-loop in Lesson 15. Look carefully at the camera picture before you answer.
👀 marks things we can see from the outside but the robot doesn’t know
| Step | Result | Why |
|---|
Break it
Protection layers all on by default
Keyboard: Tab moves from button to button · Space or Enter presses a button or flips a switch · Left and right arrows choose the command, protection layer and speed · Press . (full stop) to go one step at a time · When the robot asks, press 1, 2 or 3 to answer
The legs have no way of knowing that the eyes got it wrong. If the eyes say the apple is on the right, the route-planning part will plan a route to the right very precisely, and the hand will carefully pick up the thing on the right. In short: if the eyes get it wrong, the legs can walk to the wrong place very precisely.
In Mission 4, the arrows in the strip turn into dashed lines with ✗ from the Look step onwards. That is a mistake being passed from hand to hand, without anyone in the team noticing.
When the AI says “apple 74%”, it doesn’t mean it is definitely an apple. It means the AI quite strongly believes it is one. That is why a good system sets a threshold it has to reach. In this simulation, it must be at least 80% confident and at least 15 points ahead of the second-best guess. That is why the box in the camera picture is a thick solid line when it is confident enough, and a dashed line when it isn’t sure yet.
If it doesn’t reach the threshold, the robot takes a second, closer look, and if it still isn’t sure, it stops and asks a person. You’ll get to slide the threshold yourself in Level 2
A robot that makes a mistake and knows it can still put it right. But a robot that makes a mistake and reports success is far more dangerous, because nobody knows there is something to fix.
Checking with a different kind of sensor (such as a scale) can catch the mistake, because the ball and the apple look alike but don’t weigh the same. But double-checking with the same camera usually makes the same mistake again, because eyes that got confused the first time get confused in the same way. It’s like checking your own homework straight after you finish it: you tend to miss the same mistakes.
The safety layer works separately from the AI and outranks it. In Mission 2, the AI brain is still saying “keep going”, but the safety layer can order a stop straight away, because it doesn’t have to wait for the AI to agree.
In a real robot, this layer must never be switched off, so it is locked on our switch panel. You can read more about why in Level 7
Some newer robots aren’t split into boxes the way this simulation is. The vision-language-action brains you saw on the Lesson 16 card combine seeing, understanding instructions and moving in a single model. But underneath, they still need a fast control layer that keeps adjusting the motors very quickly, and a safety layer too, because the big brain thinks too slowly to control the motors in time on its own.
This simulation is split into boxes to show how information is passed along and which way mistakes travel. It doesn’t mean every real robot has to be split up like this.
Our loopThe brain and body pass the work around in a loop. Each step trusts the step before it, and 🛡 keeps watch underneath every step.
In Level 0 we saw the whole loop: Sense, Think, Send the command, Move, Check the result. Now let’s look inside. We’ll find that neither our body nor a modern AI robot has just one controller. Instead, each has several layers stacked on top of each other. The lower layers are very fast but can only think about simple things. The upper layers are slower but understand what things mean. Tap one layer at a time to match our body with the robot, then press the button to see where a real brain is different from the diagram.
The AI in Lesson 15 answers questions, writes stories and explains how to pour a glass of water step by step, all very smoothly. But if you asked it to pick up even one real glass, it couldn’t do it at all, because it has no hands, no body that is really there next to that glass, and no idea how heavy that glass is.
The car in Lesson 16 drives, turns and stops for real, but everything it does comes from rules we wrote in advance, such as “if the left sensor sees the black line, turn left”. If it meets something that isn’t in the rules, it doesn’t know what to do, and it doesn’t understand what any of it is for.
In a simple diagram, the nervous system has four layers that work at different speeds. Here they are from the bottom layer up to the top.
Modern AI robots are split into layers in a similar way: a safety layer, a very fast motor controller, skills learned in training, and a big AI that makes plans.
Tap a layer button, or tap a part of the body or the robot in the picture. The matching parts get a thick outline and diagonal stripes, with a line linking the human side to the robot side. Layer 1 is at the bottom and layer 4 is at the top. Then try switching the view to Real brain.
This is easy to read, like the diagram in Lesson 16
No layer chosen yet. Tap a layer button or a part of the picture to see its match.
The speed numbers are rough ranges taken from research and from many different robots. They vary depending on the robot and the year it was built, and they aren’t the numbers for any one particular robot.
| Layer | (a) Human side | (b) Robot side | (c) Speed | (d) Good at | (e) If the robot didn’t have this layer | (f) Find out more |
|---|
Keyboard: Tab moves through the buttons and the parts of the picture one at a time · Enter or Space selects · press 1 to 4 to choose a layer · 0 or Esc clears the selection · M switches between Diagram and Real brain · the left and right arrow keys change the view when you are on the view buttons · if your device is set to reduce motion, the real brain picture shows still arrows with no moving dots
The lower layers are fast but only think about simple things. The upper layers are slow but understand difficult things. Our body and robots need both kinds working at the same time. Imagine you are carrying a glass of water over to your mum and you trip. Your legs and arms rush to help you keep your balance before you’ve even had time to think about what happened. Your hand adjusts its grip on the glass so the water doesn’t spill, while your frontal lobe still remembers who you were taking the water to. If you only had the upper layers, you would fall over before you finished thinking. If you only had the lower layers, you would be great at balancing but wouldn’t know where you were going.
Robots face the same problem. A big AI may only be able to think a few times a second. If every movement had to wait for it, the arm would jerk and the car would crash before the AI finished thinking. So engineers put faster controllers underneath it, and put the safety layer at the very bottom, so it can stop the robot by itself without asking the AI. Want to see how this difference in speed turns into extra distance the car travels while it waits? Try it in Level 4
Some robot designers have been copying this idea since 1986 (Rodney Brooks), with a bottom layer called Don’t crash that is always running, and a smarter layer placed on top of it. The upper layer chooses which way to go, while the bottom layer keeps dodging things every single moment. Even if the upper layer gets stuck, the robot still won’t charge into a wall.
The obstacle-avoiding car in Project 3 of Lesson 16 can also do the job of the Don’t crash layer in the same way: if something is very close, stop first and think afterwards.
The names System 1 and System 2, which some companies use for their fast and slow layers, are borrowed from psychology. They are not the names of parts of the brain. A psychologist called Daniel Kahneman made these names well known. He used them to describe two kinds of human thinking: a fast kind that happens by itself without you trying, and a slow kind where you have to think things through step by step.
Robot companies borrowed these names as nicknames for their fast and slow layers, so they don’t mean any particular part of the human brain. You can find the real speed numbers for some robots in Level 4
Our loopThe same loop has several layers stacked together: the lower layers are fast, the upper layers are smart, and the safety layer beats all the others.
In this lesson’s project, the car’s eyes are the computer’s camera, and its brain is an image-sorting AI that you teach yourself with arrow cards or hand signs. But the AI never answers “yes, definitely”. It answers “probably this sign, and I’m this many percent sure”. In this level you’ll design the set of pictures used for teaching, test it on 12 scenes, then set a threshold for how sure the AI has to be before the car will move.
Remember how in Lesson 15 we saw that, to a computer, a picture is a grid of numbers? In our project, the camera picture is shrunk down to 224 × 224 dots, and each dot has 3 numbers for red, green and blue. So one picture becomes a row of 150,528 numbers, and the camera sends pictures like this to the AI many times every second.
The AI doesn’t see arrows or hands the way we do. It only sees this set of numbers, then works out which class that pattern of numbers belonged to when you taught it.
The AI doesn’t answer with just one word. It answers with a list: every class we taught gets its own confidence percentage, and all the percentages always add up to 100%. For example, when you hold up the up-arrow card in a bright room:
Adding them up: 91 + 4 + 3 + 2 = 100. The car looks at the class with the highest percentage, then turns it into a single letter, F L R or S, and sends it down the cable. But before it is sent, it has to pass one more checkpoint, which you’ll set yourself in the second half of this level.
Made-up numbers for this simulationAn image-sorting AI has to choose one of the classes it has, every single time. It has no “I don’t know” answer. If we have never taught it what nothing looks like, it might look at an empty scene, with nobody holding up a card, and confidently answer “Forward”. Then the car shoots off by itself even though nobody told it to. The fix is to add a fifth class called Nothing and put pictures of empty scenes in it.
Take pictures in both bright and dim light, hold the card both close up and far away, ask several people at home to hold up their hands, and take pictures in the room where you will really drive the car. The AI can only learn from pictures it has seen. If during training it only ever saw your hand in a bright room, it will hesitate when it meets your younger brother’s or sister’s hand in the evening. A hundred pictures that all look the same may help less than fifty pictures that are all different.
When you train in Teachable Machine, the camera picture is flipped left to right like a mirror by default. So when you really drive, you have to flip it the same way, because the AI learns exactly what it sees. It doesn’t know what an arrow means. If the picture isn’t flipped when you drive, the way it was in training, a left arrow will look just like the right arrow it saw before.
In this project, we teach the AI only with hand signs or arrow cards, and we never take pictures of people’s faces. The reason is that when you press Upload my model in Teachable Machine, anyone who has the link can use that model.
The arrow cards have one more advantage: anyone at home can hold them, so the AI gets to see many people’s hands without collecting a picture of anyone’s face.
Choose one class at a time, set the number of pictures, then tap the kinds of picture you’ll collect. After that, press Test 12 scenes and the car will meet 12 different scenes. Some match what it was trained on and some don’t. See which letter the car gets in each scene. The car sends a class’s letter when the AI is 80% confident or more. If not, it sends S.
The Nothing class uses pictures of an empty scene with no hand or card, plus pictures of other things you don’t mean to teach. Take them from lots of angles in the room where you’ll really drive. In this simulation, just setting the number of pictures is enough.
The starter set is 4 classes with 50 pictures each, taken in bright light, held close, using only your own hand, and with no Nothing class yet. Try pressing Test first to see how many scenes it passes.
Keyboard Tab moves from button to button · Left and right arrows choose the class and number of pictures · Space or Enter presses buttons and picture kinds · Press Enter on the Nothing tick box or on the Test button to test 12 scenes
Not tested yet
| Test scene | AI’s answer | Car | Result |
|---|
Tap the AI’s answer in the table to see its confidence for every class in that scene.
Confidence is the AI telling us how similar this picture is to the pictures it has seen in each class. It doesn’t tell us whether it’s right. So before our car sends a command, it has a checkpoint called a threshold line. If the AI’s confidence reaches the line, the car sends that class’s letter. If it doesn’t, the car sends S so it stops and waits for now.
If the threshold is too low, the car trusts wrong guesses. If it’s too high, the car stops so often it never gets anywhere. And sometimes the AI is very confident but wrong, so the threshold can’t help at all.
In one test done in a simulated world, researchers only moved the camera a little, or slightly changed the robot arm’s starting position. A robot that used to succeed almost every time started failing much more often, because what it saw was different from its training.
Our car can run into this too. If you move it to another room, change a light bulb, or sunlight shines in, what the camera sees is no longer like it was in training. So always test in the room where you’ll really drive, and test with the wheels off the ground before putting the car on the floor.
You hold up cards to make the car follow tape on the floor. The camera sees 30 frames in order. Some frames are from while you’re changing cards, some have glare, and in one frame a person walks past in the background. Try sliding the threshold and see how many times the car is correct, pauses, or goes wrong. While you’re changing cards, if the car stops and waits it counts as Paused, and if it moves it counts as Correct.
↻ means changing cards · ▲ F forward · ◀ L turn left · ▶ R turn right · ■ S stop
Path the car takes when it’s correct · ■ Where the car stopped and waited · Dashed line means a wrong turn · ▲ Cone
Frame 0 of 30 · Press Drive or Next frame
Correct 22 · Paused 7 · Wrong 1
Reached the finish, but nearly hit a cone
Keyboard Left and right arrows move the line by 1 · PageUp PageDown by 5 · Home End jump to either end · Tab moves to the Drive, Next frame and Start again buttons
Our loopThe AI eye doesn’t pass on a simple “yes”. It passes its confidence on to the decider. If it doesn’t reach the line, the loop sends S instead.
If we say I’ve spilt water on the table, please help to a robot, it has to break the big job into small steps by itself: go to the kitchen, pick up a sponge, come back, and then wipe. Language AI, like the kind in Lesson 15, is good at thinking up steps that sound good, but it has never had a body, so it doesn’t know where the robot is standing, what it’s holding, or which moves it knows how to do. At this level we’ll look at how researchers get the brain and the body to choose the next step together, and then see why the brain has to think fast enough to keep up with the rhythm of the arm.
Language AI is good at guessing what the next step should be. It’s a bit like guessing the next word, which you saw in Lesson 15. If you ask what to do about water spilt on a table, it can answer straight away: wipe the table, because it has read sentences like this many times.
But it doesn’t know where the robot is standing right now, what it’s holding, or which moves it knows how to do. It can’t see that the sponge is still in the kitchen, and it doesn’t know whether this robot’s arm has ever been trained to wipe a table.
A research project called SayCan (2022) had a language AI give each step a Say score for how useful it would be, and had the robot’s part of the system give it a Can score for whether it could really be done from where the robot was. Then it multiplied the two scores and chose the step with the highest result.
When one step is finished, it thinks up the next step again from wherever the robot is standing at that moment. So the plan isn’t all written out at the start. It grows one step at a time as the real world changes.
If either score is zero, multiplying them gives zero straight away. So a step that is no use at all, or that can’t be done at all, can never win. Here’s an example from the demo below. When the robot is standing at the table with empty hands, Wipe the table gets the highest Say, 0.45, but if the robot has never been trained to wipe, its Can is 0, and multiplying gives 0. Meanwhile, Go to the kitchen gets a Say of only 0.15, but its Can is 0.9, so multiplying gives 0.135, and it wins. If we added the scores instead, a step that can’t be done at all could still keep the points it gets for sounding good. If the language AI were confident enough, a step that can’t be done might beat one that really can. So multiplying means a step has to pass both checks.
Made-up numbers for this simulationChoose a command, then press the button to choose the next step, one at a time. The robot scores every move from wherever it is standing at that moment. Try switching the mode to Say only or Can only, and see where the robot gets stuck.
No steps chosen yet
Striped Say = how usefulDotted Can = can it really be done from hereSolid = multiplied together. The longest bar is the biggest result that round
The numbers in this demo are made up to help you learn. They are not numbers from the research. Made-up numbers for this simulation
Keyboard: Tab moves from part to part · Arrows change the command or mode · Space turns table-wiping training on or off · Enter chooses the next step
If it listens only to the language AI, the robot tries to do the best-sounding step straight away, even though its body isn’t ready, and then gets stuck there, because the language AI’s answer doesn’t change as long as the world doesn’t change. When the AI made things up in Lesson 15, it was only saying something wrong. But once an AI has a body, that mistake becomes an action that can’t be done, or is done in the wrong place.
If it listens only to its body, the robot does whichever move is easiest from where it is: walk to the kitchen, walk back to the table, round and round. Every step can really be done, but none of them brings it any closer to the goal. The body knows what it can do, but not what it should do. That’s why the two parts have to work together.
RT-2 was one of the first research projects to take an AI that had learnt from pictures and text on the internet and train it further until it could answer with commands to move an arm. Instead of answering with a sentence, it answers with a set of numbers saying which way the arm should move (see the “Vision-language-action models” card in Lesson 16)
The biggest version thinks about 1 to 3 times a second and runs on computers in a data centre, not inside the robot. So the robot has to send pictures to a faraway computer to do the thinking, then wait for the answer to come back.
It splits the work into two parts: one part plans the steps, and the other turns each step into arm movements. It is similar to layer 4 🗺 Plan and layer 3 🎓 Trained skills on the layer map in Level 1 and it can partly carry skills practised on one robot over to robots with different bodies.
The part called thinking before acting is text the AI produces along the way, not human-style thinking. It writes out the smaller steps as words before it acts. People can read it and roughly guess what it is about to do, but that doesn’t mean it feels or understands the way we do.
The robot speed numbers in this lesson are approximate. They vary with the robot and the computer used, and this field changes very quickly.
π0 (2024) works out its movements ahead of time in chunks of about 1 second, each split into 50 small steps, and then the arm follows them one step at a time. One round of thinking gives one second of movement, so the brain doesn’t have to think again for every step, and the arm still gets commands often enough to move smoothly.
If the brain thinks more slowly than the arm needs, the robot pauses or moves jerkily. Research from 2025 fixed this by having it think about the next chunk while it is still doing the current one. It’s like reading aloud: your eyes usually look ahead to the next word before your mouth has finished saying the current one, so your reading doesn’t stumble.
Make the robot arm draw one circle. The circle is split into 4 chunks of 1 second each, and each chunk has 50 steps of 0.02 seconds. The brain has to finish thinking about the first chunk before the arm can start. Choose how fast the brain thinks, then press Draw circle.
Press Draw circle to count how long the arm stops and waits
Each dot is one step. Chunks 1 and 3 are gold dots, chunks 2 and 4 are blue dots, and each is labelled with its chunk number. If the arm stops to wait, the dots pile up in the same spot as a ring with the word “Wait”. The bottom row is a timeline: striped bars show when the brain is thinking, and solid bars show when the arm is moving. The AI predicts a slightly different path for each chunk. With overlapped thinking, the robot gradually blends the old chunk into the new one over 5 steps, so the joins are smooth.
Nothing drawn yet. Press Draw circle first.
Keyboard: Tab moves between parts · arrow keys choose the thinking speed · Space turns overlapped thinking on or off · Enter or Space presses Draw circle
Our loopThe brain in our loop doesn’t give random orders. It has to ask the body whether something can be done, and it has to think fast enough to keep up with the arm.
This level is about time. When the doctor taps your knee, your leg kicks by itself without the brain having to give the order. Robots with a big AI brain run into a problem similar to ours: clever brains tend to think slowly, and while the robot waits for the brain to think, the car keeps moving. So a good body and a good robot both need a very fast layer close to the sensors, ready to stop first and let the brain think afterwards. Let’s see how many centimetres a delay of just a fraction of a second turns into.
When the doctor taps just below the kneecap, the thigh muscle is stretched a tiny bit. Stretch sensors in the thigh muscle send a message to the spinal cord, and the spinal cord sends the command Kick! straight back. The brain doesn’t have to decide. The brain still knows someone tapped, but the kick command doesn’t wait for the brain, so its path is short and very fast.
You can already find a picture of this pathway in Lesson 8 and Lesson 13 Have a look back if you like. This level invites you to look at something else instead: time.
When we compare times, we must compare things measured in the same way. The thigh muscle receives the kick signal about 0.02 seconds after the tap. The leg starts to move visibly at about 0.1 seconds, because the muscle needs time to contract and pull the leg. An adult in a lab who sees something and presses a button on purpose takes about 0.2 to 0.25 seconds.
So the knee’s first signal is about ten times faster than acting on purpose, and even the visible kick is still about twice as fast. Remember this carefully: 0.02 is the time for the electrical signal to reach the muscle, not the time the leg moves. The leg has to wait a moment longer before it visibly starts to kick.
If you step on something sharp, the spinal cord starts lifting that foot and stiffening the other leg to stop you falling, often before the brain feels the full pain. This reflex does two jobs at once: one leg escapes from the danger, while the other holds up your body weight. Otherwise you might lose your balance and fall over too.
⚠ Never experiment with hot things, sharp things or electricity This part is for reading only. Your body already does it by itself, so there’s no need to prove it.
Reflexes don’t work alone. The brain keeps turning a knob to make them more or less sensitive. If you hook the fingers of both hands together and pull while someone gently taps your knee, the leg tends to kick harder. The brain can also hold a reflex back, for example when you try hard to keep your arm still during an injection. As for why hooking your fingers together makes the leg kick harder, scientists are still debating it.
Robots adjust their sensitivity in a similar way. For example, the safety layer slows the arm down by itself when someone walks close, and stops it when they get too close. But the AI can’t tell the safety layer to relax. Find out more in Level 7
Sit with your legs dangling. If your knee hurts or has been injured before, skip this. Ask an adult to tap gently just below your kneecap with the side of their hand. Never use a hammer or swing hard. Then try hooking the fingers of both hands together and pulling while they tap again.
If you don’t see the leg kick after a tap, don’t tap harder. Just stop there.
At home, whether the leg kicks hard or gently doesn’t tell you anything about health. Only a doctor can judge reflexes.
Hertz is the number of times per second. 200 hertz means thinking again every 0.005 seconds. In real robots, each layer runs on a clock ticking at a different speed.
The numbers vary from robot to robot. Examples: Helix’s slow layer runs about 7 to 9 times a second and its fast layer 200 times (reported by the company Figure itself, 2025) · GR00T N1’s thinking layer runs 10 times a second and its movement layer 120 times (NVIDIA, 2025)
Understanding pictures and language takes a lot of computing, so it can’t be done very often. Controlling motors is much simpler, so it can be repeated very often. This is like the layers in the body we saw in Level 1
The fastest nerve messages travel about 100 metres per second, or 360 kilometres per hour, roughly as fast as a racing car. Slow messages about a dull ache travel about as fast as a person walking.
Signals in a robot’s wires are millions of times faster, but the brain still keeps up because billions of cells work at the same time. So wires win on signal speed, while the brain is good at doing many things at once.
This axis goes up in steps, and each step is ten times bigger than the one before, so very fast things and things a thousand times slower fit in the same picture. Solid bar = body · diagonal-striped bar = robot · dashed-outline bar = our car. Tap any row to read the details.
Tap any row to read the details
| Class | What | Time |
|---|---|---|
| Body | Signal reaches the thigh muscle | 0.02 seconds |
| Body | Hand grips tighter when a glass slips | about 0.07 seconds |
| Body | Leg visibly starts to kick | 0.10 to 0.13 seconds |
| Body | Adult sees, then presses on purpose (in a lab) | 0.2 to 0.25 seconds |
| Robot | One round of the motor control loop | No more than 0.001 seconds |
| Robot | One round of the arm control layer | 0.005 to 0.02 seconds |
| Robot | One thought by a big AI brain | 0.1 to 1 second |
| Our car | Sending one character at 9600 | about 0.001 seconds |
| Our car | Watchdog (set by us) | 1 second |
The body numbers come from adults in research studies. The robot numbers are estimates and vary from model to model. This is only a comparison.
A big AI can only think a few times a second. While we wait for it to think, the car keeps on moving. So the safety layer must be separate from the AI and must have the final say. It doesn’t need to be clever. It just needs to be fast and never fall asleep.
In our car, the Arduino’s watchdog works like a reflex (see Level 8), and the HC-SR04 sensor from Project 3 in Lesson 16 could be a reflex too: if something is closer than 20 centimetres, stop first and think afterwards.
The HC-SR04 part is an idea to build on. It hasn’t been built or tested on the real car yet.
Look at the car from above. It drives straight ahead, and after half a second a ball pops out in its way. The car’s AI brain thinks in beats. On every beat it checks whether the ball is closer than 30 cm yet. If it is, the AI orders a stop, but the command only reaches the wheels on the next thinking beat. After that, the car needs another 3 cm to brake to a standstill. Choose a speed, choose how many times a second the AI thinks, then press “Release the car”.
While waiting for the AI to think (worst case 2 beats), the car can travel up to 70 cm.
The car is parked at the start line. There’s no ball yet. Press “Release the car” to begin.
Release 10 times (not tried yet)
Bar under the car = distance from the front of the car to the ball · Dashed line = once the front of the car passes this line, the AI sees the ball as close · Solid 🛡 line = the reflex layer’s line (20 cm) · Dashed bracket = distance the car keeps rolling while waiting · Solid bracket = braking distance · ✓ stopped in time · ✗ crash · 🛡 reflex helped
Keyboard Tab moves from button to button · Left and right arrows pick a speed or how often the AI thinks · Enter or Space presses a button · While the car is moving, press Space or Esc = emergency stop
Made-up numbers for this simulationA latency (delay) of a split second sounds tiny, but the car doesn’t stop and wait for us. Try being the car’s brain yourself. When the Stop sign appears, press as fast as you can. The time you take turns into the distance the car keeps rolling before it starts to brake. Then switch so the AI is the brain, and try changing how long the camera and AI take.
Rolling distance = speed × waiting time
Total distance = rolling distance + braking distance
When the sign appears, the front of the car is on the 0 line and the box is 40 cm away.
Let’s say the car needs 2 cm to brake at slow speed and 4 cm at medium speed, and the command cable has a latency of 0.001 seconds. In “AI is the brain” mode, the sign always appears 1.5 seconds after you press start.
Read before you play This number also includes the delay of your screen, mouse or touchscreen, which is different on every device. Some devices have a long delay, so you can’t compare numbers between devices. This game is just for fun. It is not a medical test. And don’t compare your number with grown-ups’ or friends’ numbers, because sleep, tiredness and the device you use can all change it.
Keyboard Inside this box, press Space to start and to stop · Tab moves to the options · Left and right arrows choose the mode and speed, or move the distance slider · This page never saves your times. Every time you play again, you start from zero.
Made-up numbers for this simulationOur loopIn the loop, the fast layers have to sit close to the body, because while the brain is thinking, the world doesn’t wait.
When you reach out to pick up a glass of water, your brain doesn’t wait for your hand to bump into the glass before it starts thinking. Scientists think the brain predicts in advance where your hand will arrive and how heavy the glass will be, then keeps comparing that guess with the real feelings that come back. If the guess misses, the part it missed by is the lesson for next time. In this level we’ll try throwing a beanbag while wearing prism glasses and have a robot hand grip a paper cup to see how guessing first and then correcting helps both people and robots.
The cerebellum sits at the back of your head, below the big brain. It is only about 1/10 the size of the brain, but it has about 4/5 of all the nerve cells. Its job is to help coordinate movements and fine-tune them, so your hand reaches its target smoothly, without overshooting or falling short. You can read about the shaking that can happen when the cerebellum is injured in Lesson 16 and about the doctor’s touch-your-nose, touch-my-finger test in Lesson 13
Scientists think the cerebellum predicts in advance how a movement will feel, then compares that with the real feeling that follows. If they match, it carries on. If they don’t, the difference is the error it uses to correct next time. This is a leading theory with lots of evidence, but it isn’t a settled conclusion yet. Robots also use a model that predicts what will happen if they move in a certain way, for example which way the car will turn if the left wheel spins faster than the right. Then they compare that guess with what the sensors really measure.
Try tickling the palm of your own hand, then let a friend tickle it. Your own tickle feels weaker, because your brain has already predicted how it will feel, so a touch it predicted isn’t surprising. With your friend’s finger, your brain can’t predict where or when it will touch. Brain scans hint that the cerebellum helps make this prediction.
Scientists have asked people to wear prism glasses that shift everything they see to one side, and then throw things at a target. At first people miss, then get a little closer to the target with each throw. When they take the glasses off, they miss the other way for a short while, because the brain is still using the correction it learned while wearing them. People with some kinds of cerebellum injury don’t adapt as well. The formula used in both the person and the robot simulations is:
It’s the same idea as training the artificial neurons in Lesson 15 where the weights were nudged a little at a time based on the error. With a small learning rate, the corrections are tiny and slow. With a large one, they are quick but may swing back and forth.
This picture is a view from above. It shows what the thrower’s eyes see. With the glasses on, the target your eyes see shifts 12 centimetres to the right. The dashed line is the direction your hand is aiming. Your hand knows its own direction from feelings in your muscles and joints, so the glasses don’t move your hand. They move the target your eyes see. Put the glasses on, throw several times, then take them off and see what happens.
Not thrown yet. The target is straight ahead.
● With glasses on · ▲ After taking them off · ○ Before ever wearing them · Striped band = while the glasses are on · Middle line = on target
Made-up numbers for this simulation| Throw | Glasses | Missed by (cm) | Learned correction (cm) |
|---|---|---|---|
| Not thrown yet | |||
The simulated cerebellum aims at the target it sees, then subtracts the correction it has learned. Current correction: 0.0 cm
Start by throwing a few times without the glasses, then press “Wear prism glasses”.
Keyboard: Tab to the aiming slider, press the left and right arrows to aim, then press Enter to throw · In option groups, use the arrows to choose · For other buttons, press Enter or Space
Think of a robot arm that uses a camera to find things. If the camera gets knocked and tilts just a little, an object 60 centimetres away seems to shift by about 5 centimetres, so the arm misses when it grabs, just like a person wearing prism glasses. If it uses the formula correction = error × learning rate, it will gradually get accurate again by itself, without waiting for a person to retune it. This robot arm uses the same learning rate you chose in the beanbag game, which right now is 0.3
Press the button to bump the camera, then watch the robot arm grab 10 times.
Made-up numbers for this simulationWhen a glass starts to slip, touch receptors in your fingertips sense tiny vibrations, and your hand squeezes tighter within about 0.07 seconds (roughly twice as fast as squeezing on purpose). Then the brain adds a little extra grip, just in case, so it does not slip again. If the fingertips are numb, for example after numbing medicine from the dentist, people squeeze with the wrong strength and things slip out of their hands more easily, because the signals coming back from the fingertips are weaker. So the loop loses part of its Check the result step.
When you shake a water bottle up and down, your fingers grip tighter at exactly the moment the bottle is about to slip. In short: Squeeze before it slips (the brain predicts the pull ahead of time, so it does not wait for a slip and then fix it). So human hands use two things together: predict first, and feel then fix. In the game below, you can switch each of these on and off in the robot’s hand yourself.
A two-finger robot hand is holding a paper cup. The cup will not slip as long as the grip is strong enough. The grip needed to stop it slipping depends on how hard the cup is pulling and how slippery the surface is. A wet surface is more slippery, so it needs a firmer grip. But if the grip goes over 100 units, the paper cup gets crushed. Try turning the switches on and off, then press “Pour water” or “Shake up and down”. A switch you change takes effect from the next round.
Not started yet
Made-up numbers for this simulation. The force units are not real unitsTurn the switches on or off, then press “Pour water” or “Shake up and down”
Keyboard: Enter or Space for the switches and buttons · arrow keys for the grip slider · arrow keys to choose the playback speed · arrow keys for the time slider, 0.01 seconds per press
Human fingertips have touch receptors that keep telling the brain whether something is about to slip. But many robots still have no touch like this. They grip things by looking through a camera, then squeeze with a force that was set in advance. Robot skin that can tell when something is slipping is still research in progress. In Lesson 16 a person squeezed the prosthetic hand using muscle signals. In this lesson the robot squeezes by itself, using sensors and prediction, just like you tried in the game above.
Our loopThe Move and Check the result steps of the loop do not just wait to see what happens. They predict first, then use each mistake to correct the next try.
In Level 1 we saw that a robot’s layer 3 is its skills, such as picking up, putting down and walking around things in the way. These skills are not created while the loop is running. Most of them were practised long before, like a footballer who practises dribbling thousands of times before a real match. In this level we will look at three ways robots get their skills: watching a person and copying, trying it themselves while a person helps correct them, and learning from surprise. Then you will see that a child’s body needs just as much practice.
Imitation learning means a person drives the robot to show how a job is done, while pairs of data are saved at every moment: what the robot saw at that moment, and how the person told it to move. Then the AI practises answering like the person: when it sees a picture like this, it moves like that.
Sound familiar? This is just like the cat and dog board in Lesson 15. The only difference is that the answer labels are not the words “cat” or “dog” but movements, such as “move forward”, “turn left” or “pinch”. Newer robots that use vision-language-action models (from the card in Lesson 16) also get most of their skills from examples like these.
Mission: drive the robot to pick up the ball, then take it to the box on the right. While you drive, every step is written down as one pair: what the robot sees, and the move you told it to make. Teach it for three or four rounds, then let the robot try on its own.
Start by driving it yourself. Press the arrows to take the robot to the ball, then put it in the box. Every step is written down as one pair.
◎ The centre of the map is the goal. Each square is a place where the robot might be standing compared with the goal. An arrow is the move we taught most often at that spot. ? means there are no examples yet. The thick frame is what the robot sees right now. The robot can see at most 3 squares away. Anything further away looks just the same as 3. When it drives itself, the robot finds the 3 examples most similar to what it sees, then follows the majority vote. If even the most similar example is more than 1.5 squares away on the map, it shows the sign “Never seen this before ❓”
Keyboard: tap the room picture or the arrow buttons, or reach them with Tab, then use the arrow keys on the keyboard to drive the robot · choose the driver with the left and right arrows · for other buttons, Tab to them and press Enter or Space · while the robot is driving itself, pressing an arrow at any time counts as helping to correct it
Made-up numbers for this simulation A simulated room of 9 × 7 squares, not a real robot. The examples you teach stay on this page only. Close the page and they are all gone. Nothing is saved anywhere.
In the ALOHA research (2023), a person controlled robot arms by moving another set of arms, and the robot arms copied every move. After being shown for only about 10 minutes, the robot could do 6 fiddly tasks, such as putting in a battery, and succeeded about 8 to 9 times out of ten overall.
Later, Mobile ALOHA (2024), a robot on wheels, learned each household job by watching a person drive it about 50 times, and it got better when it also saw examples from other jobs.
RT-1 (2022) learned from about 130,000 recorded practice runs that 13 robots collected over 17 months, until it could do about 700 different tasks in kitchens and offices.
OpenVLA (2024) is free for researchers to use. It was trained on nearly one million real robot examples collected by many institutions working together. Varied examples help a robot cope better with rooms it has never seen, but that does not mean it will never make mistakes.
Copying alone has the weakness you just saw in the simulation: when the robot meets a new situation, it guesses from examples that are not very similar. So research from late 2025 made robots better by letting them really try the job, with a person helping to correct them when they got it wrong, mixing the trial and error from Lesson 16 with copying, a bit like when you pressed the arrows to help correct the simulated robot while it was driving itself.
In a 2025 study, robots using a robot brain called π0.5 could tidy away dishes and clothes in homes they had never seen before, but the researchers themselves said they still often made mistakes. Training in a simulated world also helps a lot, but a simulated world cannot guess weight and slipperiness exactly right, so researchers change these values at random during training, to get robots used to not knowing for sure. See the “Practise in a simulated world first” card in Lesson 16.
Lesson 15 told us that children can recognise a new animal from just a few examples. That is true for remembering names and things, but movement skills are different. In one study, toddlers about one to one and a half years old took about 2,400 steps and fell about 17 times in one hour of play. Both people and robots need lots of practice and lots of mistakes.
Language is a different story. A chatbot reads about ten thousand to a hundred thousand times more words than a child hears while learning to talk, yet children still learn language very well. Scientists think part of the reason is that children learn through their bodies, their eyes and the people around them, not from written words alone.
The unit is the time a person spent demonstrating · 2023 · 6 fiddly tasks, successful about 8 to 9 times out of ten overall
The unit is recorded practice runs · 2022 · 13 robots, collected over 17 months, about 700 tasks
The unit is falls per hour · children about one to one and a half years old · in the same hour they take about 2,400 steps
The unit is how many times more words are read · children hear far fewer words. Scientists think part of the reason is that children learn through their bodies, their eyes and the people around them
The four cards use different units (minutes, runs, falls and times more). They cannot be compared directly, so they are not drawn on one shared graph. What they have in common is that body skills, in both people and robots, need lots of practice.
There was a robot that learned to walk to the battery in Lesson 16 (do you remember it?). At every step it worked out its surprise (prediction error): the points it actually got, plus the points it expected to get from then on, minus the points it had expected before. If it was very surprised, it changed its score table a lot. If it was not surprised at all, it did not need to change anything.
In an experiment with monkeys (1997), some dopamine cells fired a signal when a monkey got juice it did not expect. Once the monkey learned that a light meant juice was coming, the signal moved to the moment it saw the light. And if it expected juice but did not get any, the cells went quiet for a moment. This is similar to the surprise value of the Q-learning robot in Lesson 16. Try letting both of them learn side by side below.
Learned 0 rounds
Press “Learn 1 round” and see where the surprise shows up
The top row is how much juice it expects. The bottom row is the surprise: positive above the line, negative below it. The numbers along the very bottom are time, from 0 to 9. The moment the light comes on cannot be guessed, so there is no expectation before the light.
✗ No juice this round. The light comes on as usual, but the juice never comes
The robot walks right from square c0 to the battery, using the same numbers as Lesson 16: each step costs 0.1 points, finding the battery gives 10 points, points further ahead count only 0.9 as much, and it corrects halfway each time (0.5).
✗ This round the battery in this square has run out. The robot gets there but does not get the 10 points
Formula: surprise = reward + 0.9 × next square’s score − this square’s score, then new score = old score + 0.5 × surprise
Press “Learn 1 round” and the calculator will show how the score of the chosen square changes
A square’s score = the score for moving right in the Lesson 16 table
Amazingly similar, but it is a comparison, not a copy. Scientists are still debating it. The brain does not run this program.
Made-up numbers for this simulation The learning speed, rewards and timing in this picture were chosen for teaching. They are not values measured from real monkeys.
Keyboard: Tab to a button, then press Enter or Space · use the left and right arrow keys on the α slider · choose a step in the calculator with the left and right arrow keys · the table under the graph shows every number
Dopamine is not a “happiness chemical”, as people like to call it, and the brain does not run a robot program either. It helps with learning from surprise, getting ready to move, and wanting to take action. Scientists are still debating what exactly its signals mean.
A technique invented to help AI get better at video games led scientists to find that different dopamine cells in mice predict rewards in different ways, some in a more optimistic way and some in a more cautious way (in 2020). Knowing about the brain helps people build AI, and AI also helps people ask new questions about the brain.
Our loopBefore the loop can run, the body has to practise its moves. Most of a robot’s skills are learned during training, and only then used in the loop.
However clever a robot is, it can still make mistakes. Its eyes may see something wrongly, the AI may give a wrong command, or someone may suddenly walk up close while the robot arm is working. So every robot loop has a Safety layer underneath it. This layer does not need to be clever, but it must be fast and reliable, and it has the right to stop everything, even if the AI wants to carry on. Another skill a good robot needs is knowing when to stop and ask a person. Try being the person walking towards the robot arm in the simulation below, and see who decides how fast the arm moves.
This robot arm is picking things up from a table. The AI that acts as its brain wants the job done quickly, while the safety layer keeps watch on how close people are. Move the slider or press the button to walk closer. Try switching the AI’s command on and off, try making the arm hold something sharp, then press emergency stop and see what it takes before work can start again.
Keyboard in this box · ← walk closer · → step back · S or Space for emergency stop (Space works when you are not on another button)
Person is 2.5 metres away · ✓ Normal zone
AI asks for: 150% · Safety layer allows: 100%
AI asks for 150%, but this arm is limited to 100% at most
The distances in the picture are made-up numbers. Real ones are calculated from each robot’s speed, task and stopping time.
Made-up numbers for this simulationDid you notice that this simulation has no button to switch off the safety layer? We left it out on purpose, because real robots should not have a button like that either, one that would let the AI or anyone else skip it easily. The safety layer must be working the whole time the machine is switched on.
The safety layer works separately from the AI and outranks it. If the emergency stop button is pressed, or a sensor detects a bump, the robot must stop, whatever the AI is telling it to do, and a person must check and reset it before it can start again.
Why keep them separate? Because if the AI freezes or gets something wrong, the part whose job is to stop it must not freeze or go wrong along with it. And why a two-step restart? If the robot went back to work by itself the moment the button was released, someone might still be standing in a dangerous spot. So the emergency stop stays locked on until a person has checked and started the robot again themselves.
Our bodies have something similar. When you step on something sharp, your spinal cord can start lifting your foot away, often before your brain fully feels the pain (Level 4). But this is only a comparison, and it is just for reading about. Never try it out for real.
Robots that work near people must slow down when someone comes near and stop when they get too close. If there is a bump, the force must not go over a set limit, and that limit is different for different parts of the body, because each part of the body can take a different amount of force.
In real robots, the distance at which slowing down starts is not just picked at random. Engineers calculate it from the arm’s speed, the task it is doing, and how long the robot takes to come to a complete stop. The faster the arm moves, or the more slowly it stops, the wider the zone has to be, rather like a car going fast needs to leave more space behind the car in front.
The industrial robot standard ISO 10218, updated in 2025, treats safety as something that depends on the whole job. A robot arm holding something sharp does not count as safe enough to work near people, even if the arm itself is a model designed to work near people.
Think about the same robot arm. Holding a sponge, it might be able to work beside people, but holding something sharp or hot, the whole job becomes more dangerous straight away. In the simulation above, when you switch on “Arm holding something sharp”, the stop ring and the slow ring become twice as wide.
Some robot brains in 2026 are designed to notice when a person comes near and bring the robot to a safe stop, but the basic safety layer must still always be kept separate.
The reason is that big AI models can still make mistakes, and they think more slowly than the lower layers (Level 4). So the basic safety layer should be simple, easy to check, and still work even if the AI freezes, just like the watchdog in our car’s Arduino, which stops the wheels by itself when the web page goes quiet (Level 8)
Asking is not a weakness, it is a skill. A robot that confidently picks up the wrong thing is more dangerous than a robot that stops and asks. A robot should ask a person when: the command is unclear · its confidence is below the threshold · it has tried and keeps failing · it is a task it has never trained for · it is a task that could put people at risk
When a robot asks, someone has to answer, so people are part of the loop too. In our car, you are the one who checks the result and changes the hand sign, and you can press STOP at any time (Level 9)
The AI mistakes from Lesson 15 can become real-world mistakes once AI has a body. When AI lives only on a screen, a mistake means a wrong answer. But when AI is connected to wheels or an arm, the same kind of mistake becomes a wrong movement in the real world. Tap each card to flip it and see what the mistake turns into, and which layers help to guard against it.
Tap a card to flip it and see what an on-screen mistake turns into when AI has a body
Keyboard · Tab moves from card to card · Enter or Space flips a card or flips it back · the link under each card takes you back to review Lesson 15
There are loads of videos of amazing robots on the internet. In some, the robot really does it by itself, but many have things the video does not tell you. Before you believe one or share it, try asking these three questions. Tap a card to see what to look out for.
Many robots are controlled by people from a distance, using a joystick or a leader arm, which is a good way to collect examples to teach AI (Level 6). But if the video does not say so, viewers will wrongly think the robot did everything by itself. Look for a caption that says whether it acted by itself or was controlled by a person.
Many real robots still move more slowly than people, so videos are often sped up to make them look quick and exciting. Check the corner of the screen for numbers like 2x or 10x, and watch whether people or other things in the scene move unnaturally fast.
The video you see might be the one success picked out of dozens of tries. Ask how many times out of ten it succeeds. Good research reports this number and lets you see the failed videos too.
Good research clearly labels which videos show the robot acting by itself, which show it controlled by a person, and which show failures. If a video tells you nothing at all, that does not mean it is fake, but it does mean we do not know yet. Keep your questions in mind before you believe it.
In 2024, a two-legged robot called Digit started working in a warehouse, lifting plastic boxes onto a conveyor belt, a repetitive job with clear limits. In 2025 and 2026, most two-legged robots in factories and warehouses are still in pilot trials, and nearly all the newest robot brains are still in research labs, or open only for developers and partner companies to try out. They are not yet something you find in ordinary homes. This lesson does not predict when robots will arrive in our homes.
Notice that the first real jobs robots get are usually repetitive jobs in clearly marked-out areas, where it is easier to set up safety layers than in a home, where both things and people keep moving around.
Our loopEvery command in the loop must pass through 🛡 before it reaches the body, and people are part of the safety layer too.
For the brain and the body to work as one team, there has to be a way for commands to get from one to the other. In our bodies, that is the nerves. In our car, it is a single USB cable. In this level we follow one command, from a camera picture made of more than a hundred thousand numbers, all the way down to a single letter running down the cable and turning into spinning wheels. Then you will meet the small signal the web page sends over and over to say “I’m still here” and the watchdog in the Arduino, which stops the wheels by itself when the cable goes quiet for more than 1 second
The car in the Level 9 project is connected like this. Each box passes its work on to the next. This level zooms in on the USB cable box, which sits in the middle, between the brain and the body.
The bottom row in italics shows the parts of our body that do a similar job. It is a comparison to help you remember, and does not mean the car really has a brain or nerves.
The web page sends just one letter down the USB cable: F go forward L Turn left R Turn right S Stop. Both sides must agree on the same set of rules, which is called a Protocol in computer talk. Arduino only pays attention to these four capital letters and skips any others.
It’s like a secret code you agree on with a friend before a game. If your friend doesn’t know that F means forward, the letter means nothing at all. A small f, or any odd letter that strays onto the wire, is simply ignored by Arduino, and it doesn’t count as hearing a signal either. This will matter a lot when we meet the watchdog below.
Why use a single letter? Because it’s the shortest, quick to send and easy to check. The hard work, like looking at pictures, is left to the AI on the computer.
The sending speed must be set the same on both sides. This project uses 9600 for both. If they don’t match, the letters come out garbled. At 9600, sending one letter takes about one millisecond, so the wire isn’t the slow part. The slow parts are the camera and the AI.
9600 means 9600 beats can be sent in one second. The Arduino code says Serial.begin(9600) and the web page says baudRate: 9600 to match. If one side counts the beats fast and the other counts them slowly, it’s like one person talking very fast while the other listens at a slow pace: they hear every sound but understand it all wrong.
One millisecond is one thousandth of a second. Even a single blink lasts a hundred times longer or more. The camera, though, has to take a picture, and then the AI has to work with more than a hundred thousand numbers every round, so they take much longer than the wire.
The web page can’t secretly connect to a device by itself. A person has to click a button and choose the port from a list every time. A port can only be used by one program at a time, so close Serial Monitor first. After connecting, the web page waits 2 seconds, because Arduino usually restarts when the port opens, and then it always sends S first.
A port is the channel the USB cable opens so a program can talk to the board. Browsers are made so that only a person can give permission. That way, no website can secretly control things plugged into our computer. And a web page can only use ports if it is opened from localhost or https.
We always send S first so the loop starts from stop, not from some leftover command that came from who knows where.
Choose which hand sign to hold up to the camera, then press “Next” one step at a time, or press “Send the whole route”, to see how one picture turns into spinning wheels. Then try pressing “Cut this step” on some of the steps and see where the loop breaks. Try the 🤏 Unclear hand sign too.
Hand sign shown to the camera
Step 1 of 7 · Camera
Keys in this box · ← previous step · → next step · P send the whole route · X cut this step or put it back · in the hand sign row, use the arrow keys to choose a sign
No steps cut yet
The AI percentages in this picture are a simulated example, not a real AI. But the wheel speeds of 150 and 160 and the letter codes are real values from the project’s code.
Made-up numbers for this simulationA letter doesn’t travel down the wire all in one lump. It is sent one beat at a time, as power on (1) or power off (0). While the wire is idle, it stays at 1. When it’s time to send, the sender sends a 0 for one beat as a start bit to say “I’m starting!”, like knocking on a door. Then come 8 bits of data, sent with the smallest-value digit first and, at the very end, a stop bit, which is a 1. That makes 10 beats for each letter. This way of sending is called 8N1 because it has 8 data bits, no check bit (N) and 1 stop bit.
In a real USB cable, the letter is first wrapped up in a USB packet. Then a converter chip on the Arduino board passes it on to the main chip as beats like these, at a speed of 9600.
The receiver doesn’t share a clock with the sender. It spots the start bit, then counts the time by itself to work out where the next bit is. If the speeds are set differently, it reads out of step and the letter comes out garbled. Change the hand sign above to see other letters.
The web page sends a letter as soon as its decision changes, and resends the same letter every 0.4 seconds as the “I’m still here” signal. If Arduino doesn’t receive a valid letter for more than 1 second, it stops the wheels by itself.
the watchdog (the word literally means a dog that guards a house) is a small timer in the Arduino code. Every time it gets a valid letter, it starts counting again from zero. If it counts past 1 second without hearing anything at all, it stops the wheels by itself, without waiting for anyone’s permission.
lastCommand = millis(); // got a good letter, note the time if (millis() - lastCommand > WATCHDOG_MS) drive(0, 0); // quiet for over 1 second, stop the wheels
Why resend? If the page only sent when the hand sign changed, then while we kept holding up the forward sign, the web page would go quiet. The watchdog would think the brain had disappeared and stop the car even though nothing was wrong. Resending every 0.4 seconds means Arduino hears it about twice in each second, so missing one still won’t make it stop.
The “I’m still here” signal is sent on purpose from inside the loop where the AI guesses each picture. If the AI freezes or the tab is hidden, the loop stops, the signal stops, and the car stops by itself. If we moved it to a separate timer, that timer would keep sending the old command even though the AI was no longer looking at the picture.
So this signal doesn’t just say the cable is still connected. It says the brain really is still watching. Every time the AI finishes guessing one picture, the web page asks itself: has the answer changed, or has it been quiet for more than 0.4 seconds? If so, it sends. If this loop isn’t running, nobody sends anything.
// inside the AI’s loop, after finishing one guess
if (letter !== lastSent ||
performance.now() - lastSentAt > HEARTBEAT_MS) await send(letter);
Browsers usually pause loops like this when the tab is hidden, but the details depend on the browser. So you must test it for real with the wheels off the ground: switch to another tab and check that the wheels stop within about 1 second. This is item 8 on the test list in Level 9
This simulation draws the last 5 seconds as three rows. The top row is the letters the web page sends, the middle row is the watchdog counting how long it has been quiet, and the bottom row is the wheels. Start with mode (a), keep holding up the forward sign, and see what happens after 1 second. Then switch to mode (b), which is how the real project works. Try making the AI freeze, hiding the tab or unplugging the cable, then compare with mode (c).
Hand sign (keys 1 to 4)
Sending method
Make something go wrong
After pressing STOP, choose a hand sign again to turn the camera back on
Pause / step by step
In this simulation the AI’s loop guesses about 15 times per second (made up). The real number depends on the computer and the model. The 0.4 second and 1 second values, though, are the same as in the project’s code.
Made-up numbers for this simulationKeys in this box · 1 to 4 choose a hand sign · J AI frozen · H hide the tab · K unplug the cable · Esc STOP · P pause · N one step · in the sending method row, use the arrow keys to choose
If the USB cable comes out, Arduino has no power and the watchdog can’t work. With the motor batteries still connected, we don’t know for sure yet what the motor driver board will do. So the rule is: press STOP, turn off the battery switch, and only then unplug the cable.
In our car, Arduino gets its power from the USB cable, while the motors get theirs separately from the battery holder. The watchdog lives in Arduino’s code, so if the board loses power, the guard falls asleep too and nobody is left to call stop. That’s why we always cut the motors’ power first.
If the cable comes out by itself while the car is moving, an adult should turn off the battery switch straight away. That’s why an adult needs to stay near the battery switch the whole time the car is on.
The camera is on the computer, not on the car, so when the car moves, the camera doesn’t get a new view of the road. The person who watches the car and changes the hand sign is the eyes that check the result. So our car’s loop runs through us (human-in-the-loop, see Lesson 15). One day, if we put a camera and a single-board computer on the car, the loop could close without a person.
TodayCamera sees hand → AI → cable → car moves → you watch the car → change the hand sign → loop again
One dayCamera on the car sees the road → computer on the car → wheels → camera sees the new road by itself → loop again
Even if the loop can close by itself, the safety layers and a person who can press stop must always still be there (Level 7). Look back at the first simulation once more: its last step, the arrow that loops back, is you.
Our loopThe cable is the loop’s nerve. If the nerve goes quiet, the body must stop by itself.
ai_driver_car and close Serial Monitor. Open the web page through localhost, following steps 6 to 8 of the Level 9 project (keep the battery switch off while uploading)Time to build the real loop with our own hands. The AI you trained yourself in Teachable Machine will be the Brain living in the browser, the car from Lesson 16 will be the Body on the floor, and the USB cable will be the Nerves, carrying the letters one at a time. You hold up arrow cards to the camera, the AI guesses which sign it is, and the car moves to match. Everything we’ve learned from Levels 0 to 8 comes together here: the 80% threshold, the “I’m still here” signal, the watchdog, the safety layers and the person in the loop.
The project page is separate from the lesson page because it has to load two AI libraries from cdn.jsdelivr.net and load the model from Google’s servers. The lesson page doesn’t load any AI, doesn’t use the camera and doesn’t send pictures anywhere. Camera images are processed in the browser, and the project page doesn’t upload them anywhere.
But the link to the model you uploaded is a public link, so anyone who has it can use the model. That’s why we train the AI only with arrow cards or hand signs, and never film anyone’s face.
Use Chrome or Microsoft Edge on a Windows, Mac, Linux or ChromeOS computer. Safari, iPhone and iPad won’t work. Newer versions of Firefox and of Chrome on Android support it now, but they haven’t been tested with this project yet, so we recommend using a computer.
Every step says which level its knowledge comes from. Under each step there is a compass tag showing that step’s key idea. Tap the level name to jump straight back and read it. For example, if you forget where the 80% threshold comes from, go back to Level 2.
All the project files are on the project kit page, which is a separate page from this lesson. The kit has three files.
ai-driver.html The AI brain web page, with the buttons 1. Connect robot · 2. Start camera · STOP (Esc). The text on this page is in English.ai_driver_car/ai_driver_car.ino The body code for the Arduino board on the Lesson 16 carREADME_TH.txt How to open the web page, the quick steps and the safety rules, in ThaiThe project kit page is on a website whose address starts with https. You can open the AI Driver page from there straight away, with no commands to type. Before you open it, ask a grown-up to read the part about the internet and privacy on that page together with you.
| Part | Notes |
|---|---|
| The car from Project 2 of Lesson 16 with an Arduino Uno, an L298N (ENA/ENB jumpers left on), 2 gear motors with wheels, a caster wheel, a holder for 4 AA batteries, the chassis and jumper wires | Pins D5, D6, D9, D10 and the drive() function all stay exactly as before. The IR sensors on D2 and D3 can stay where they are. This code just doesn’t use them. |
| Battery holder with an on/off switch | You must have this. If your holder has no switch, ask a grown-up to swap it for one that does. |
| Long USB cable for the Uno | Long enough to hang loose |
| A computer with a webcam + Chrome or Edge + Arduino IDE | Not a phone or tablet |
| 4 paper cards: an up arrow, a left arrow, a right arrow and an open palm | Never use people’s faces |
| A box or books to lift the wheels, and clear space on the floor | You can mark the edges of the driving area with sticky tape |
Why a battery switch? Because the switch is the final way to stop the car, and it sits completely outside the AI brain. If the web page freezes, a cable comes loose or anything else goes wrong, a grown-up flips the switch off and the motors lose power straight away.
Each button opens a Lazada search in a new tab and is not tied to any one shop. An adult should choose the shop and place the order.
Easiest: buy a complete kit. A line-follower car kit costs about 550 to 750 baht. Read the list of what is in the box before buying. Most kits have no HC-SR04 sensor and no long USB cable, and the battery holder may have no switch, so add those from the table below.
Or buy the parts one by one. About 400 to 700 baht in total, not counting batteries.
| Part | Approximate price | Check before you buy | Search |
|---|---|---|---|
| Arduino Uno R3 board with USB cable | 140 to 220 baht | Some shops sell the board without the cable, so check that a USB cable is included | Lazada |
| L298N motor driver board | 40 to 75 baht | A red board with a black heatsink | Lazada |
| Two-wheel car chassis with motors | 90 to 150 baht | It must come with 2 yellow gear motors, 2 wheels and a free-spinning caster, not just a bare acrylic plate | Lazada |
| 2 TCRT5000 sensor modules | 20 to 35 baht each | Choose the module with a small circuit board and 3 pins, not the bare sensor that costs a few baht, and not the 5-channel version | Lazada |
| 4 x AA battery holder with a switch | 20 to 45 baht | It must have an on/off switch so you can cut the power at once | Lazada |
| Jumper wires | 15 to 30 baht | Get both male-to-female and male-to-male | Lazada |
| HC-SR04 ultrasonic sensor, for project 3 in Lesson 16 | 30 to 60 baht | You only need it for the obstacle-avoider project | Lazada |
| 3-metre USB cable, for the AI Driver project in Lesson 17 | 20 to 45 baht | Check the socket on your board first: most use Type B, but some use Type-C | Lazada |
Approximate prices from Lazada search pages in September 2026. Shops and prices change all the time. Choose shops with good reviews that ship from within Thailand. This website receives no payment from any shop or from Lazada.
Follow these steps in order, one at a time. Under each step there is a tag that tells you which idea the step uses and which level it comes from. If a step doesn’t pass, don’t skip ahead to the next one. Always go back and fix it first.
drive() turns both wheels forwards. If a wheel turns backwards, swap that motor’s wires (the same way as in Lesson 16). Do this step before you upload the new code, because once you upload the new code, the old code is gone.
The body must be ready before the brain can drive · Level 0
The classes are the answers the AI can choose from · Level 2
Forward Left Right Stop (it doesn’t matter if you use capital or small letters, or leave a space at the end of a name, but they must be these English words), then add a fifth class Nothing for an empty scene and any other objects, which the web page turns into S for you. Collect at least 50 pictures for each class: in bright and dim light, close up and far away, with several different people’s hands, in the room where you will really drive. Only photograph the cards or hands, never faces. Don’t press the flip button (it mirrors the picture). If you press it by accident, change the third argument of new tmImage.Webcam(224, 224, true) to false in the code. To edit the code, you need the files on your computer: download the kit zip, then edit ai-driver.html in a text editor, then open it using the second way in Step 7 (localhost). You can’t edit the page on the website.
The Nothing class · Varied pictures · Keep the flip setting the same for training and driving · Level 2 · You are the teacher · Level 6
Confidence and the threshold · Level 2
Privacy: the link is public, so we use cards, not people’s faces
ai_driver_car.ino in the Arduino IDE and press Verify first. If there are no errors, press Upload. Close the Serial Monitor window because only one program can use the port at a time. This code always starts by stopping the wheels with drive(0, 0) and it has a watchdog that stops the wheels by itself if it doesn’t hear one of the right letters for more than 1 second.
Protocol · Start from stop · Watchdog · Level 8
This file is very short, so you can read all of it. The pins, the motors and drive() are the same as in Lesson 16. What’s new is reading letters from the USB cable, plus the watchdog.
// AI Driver car: the web page's AI sends ONE letter over USB serial, the Arduino drives. // F = forward, L = left, R = right, S = stop. Pins and drive() are the same as lesson 16. const int L1 = 5, L2 = 6, R1 = 9, R2 = 10; // L298N IN1, IN2, IN3, IN4 (ENA/ENB jumpers stay on) const unsigned long WATCHDOG_MS = 1000; // no good letter for 1 second = stop unsigned long lastCommand = 0; // time (ms) of the last good letter void drive(int left, int right) { // speeds from -255 to 255 analogWrite(L1, left > 0 ? left : 0); analogWrite(L2, left < 0 ? -left : 0); analogWrite(R1, right > 0 ? right : 0); analogWrite(R2, right < 0 ? -right : 0); } void setup() { pinMode(L1, OUTPUT); pinMode(L2, OUTPUT); pinMode(R1, OUTPUT); pinMode(R2, OUTPUT); drive(0, 0); // always start with the wheels stopped Serial.begin(9600); // must match baudRate: 9600 in the web page } void loop() { while (Serial.available() > 0) { // read every letter that has arrived char c = Serial.read(); if (c == 'F') drive(150, 150); // forward else if (c == 'L') drive(0, 160); // right wheel only = turn left else if (c == 'R') drive(160, 0); // left wheel only = turn right else if (c == 'S') drive(0, 0); // stop else continue; // ignore any other byte (it does not feed the watchdog) lastCommand = millis(); // a good letter feeds the watchdog } if (millis() - lastCommand > WATCHDOG_MS) drive(0, 0); // lost contact with the AI: stop }
python3 -m http.server and then opens http://localhost:8000/ai-driver.html in Chrome or Edge. (Double-clicking the file directly might work in Chrome, but this hasn’t been confirmed yet.)
The browser only lets safe pages use the port and the camera · Level 8
AI: Forward 93% -> F
The full loop: sense, think, send, move · Level 0 · Level 8
Here are some parts of ai-driver.html copied exactly as they appear in the real file. The full file is on the project kit page.
const THRESHOLD = 0.8; // below 80% sure = not trusted = Stop const HEARTBEAT_MS = 400; // re-send the current letter so the Arduino's 1000 ms watchdog stays fed const LETTER = { forward: 'F', left: 'L', right: 'R', stop: 'S' }; const key = (name) => name.trim().toLowerCase(); // "Forward " and "forward" both count
// Button 1: the browser shows a list of serial ports (only works from a click) $('btnSerial').onclick = async () => { if (!('serial' in navigator)) return say('No Web Serial here. Use Chrome or Edge on a computer.'); try { const port = await navigator.serial.requestPort(); await port.open({ baudRate: 9600 }); // must match Serial.begin(9600) on the Arduino const w = port.writable.getWriter(); say('Connected. Waiting 2 seconds while the Arduino restarts...'); await sleep(2000); // an Uno usually resets when the port opens writer = w; await send('S'); // always begin stopped say('Robot connected. Now start the camera.'); } catch (e) { say('Could not connect: ' + (e.message || e)); } };
// One turn of the loop: SENSE (camera) -> THINK (AI) -> ACT (send a letter) async function loop(id) { if (id !== runId) return; // STOP was pressed webcam.update(); // SENSE: grab a new frame const preds = await model.predict(webcam.canvas); // THINK: [{className, probability}, ...] if (id !== runId) return; // STOP was pressed while the AI was thinking const top = preds.reduce((a, b) => (b.probability > a.probability ? b : a)); const sure = top.probability >= THRESHOLD; const letter = sure ? (LETTER[key(top.className)] || 'S') : 'S'; // unsure or unknown class = Stop // ACT: send only when the decision changes, plus a heartbeat repeat. // This loop pauses when the tab is hidden, so heartbeats stop and the Arduino stops itself. if (letter !== lastSent || performance.now() - lastSentAt > HEARTBEAT_MS) await send(letter); $('ai').textContent = `AI: ${top.className} ${Math.round(top.probability * 100)}%` + (sure ? '' : ' (not sure)') + ` -> ${letter}`; requestAnimationFrame(() => loop(id)); }
// Emergency stop: the button or the Esc key async function emergencyStop() { runId++; // ends the loop await send('S'); // stop the wheels first if (webcam) { webcam.stop(); webcam = null; } // then switch the camera off $('btnCam').disabled = false; say('Stopped. Press Start camera to try again.'); } $('btnStop').onclick = emergencyStop; document.addEventListener('keydown', (e) => { if (e.key === 'Escape') emergencyStop(); });
Watchdog · The “I’m still here” heartbeat · Distribution shift · Level 7 · Level 8
THRESHOLD to 0.6 or 0.95 and see whether the car stops more often or moves the wrong way more often. To edit the code, you need the files on your computer: download the kit zip, then edit ai-driver.html in a text editor, then open it using the second way in Step 7 (localhost). You can’t edit the page on the website. Threshold · Level 2When the Arduino has no power, the watchdog can’t help · Level 8
| Line in the code | What it means |
|---|---|
THRESHOLD = 0.8 | The decider: the AI must be at least 80% confident, otherwise it sends S (Level 2) |
LETTER[key(top.className)] || 'S' | Any class name that isn’t one of these four words, such as Nothing, becomes S |
HEARTBEAT_MS = 400 | Sends the same letter again every 0.4 seconds as an “I’m still here” heartbeat, only from inside the AI’s loop (Level 8) |
await sleep(2000) then send('S') | Waits for the Arduino to restart, then always starts with Stop |
WATCHDOG_MS = 1000 | The watchdog in the Arduino: if it doesn’t hear a valid letter for more than 1 second, it stops the wheels by itself |
else continue; | Any letter other than F L R S is skipped and doesn’t count as an “I’m still here” signal |
emergencyStop() | The STOP button and the Esc key send S first, and only then turn off the camera (Level 7) |
| Problem | Try this |
|---|---|
You see the message No Web Serial here | Use Chrome or Edge on a computer |
| Can’t connect | Close the Serial Monitor or any other program that is using the port |
You see the message the model needs 4 classes | Spell the class names exactly: Forward Left Right Stop |
| The car turns the wrong way | Swap the wires of the motor on that side |
| The car keeps stopping by itself | Keep the tab open and in front, and the AI’s confidence must be above the threshold. If the light or background is different from when you trained it, take more pictures |
| The AI line shows F but the car doesn’t move | Check the battery switch, and check that the GNDs are connected together as in Lesson 16 |
| The camera is blocked | Open the page from localhost or https |
Before you do it for real, try putting the 12 step cards below in the right order. There isn’t just one right answer. Some steps can swap places: for example, pressing Connect robot and turning on the camera can happen in either order. But in some pairs, one step must always come first, because if they are swapped the car might not be safe. Press Check to find out why a pair is wrong. Once your order passes, the cards turn into a tick list that you can print out and stick beside the car.
Tick one item at a time, once you have really done it with an adult. You can’t tick out of order, and the safety test step must pass all 8 checks before you go on. This page doesn’t remember your ticks: close it and they disappear, so you can print the list to keep.
Ticked 0 of 12 steps
Put the cards in order with the ▲ ▼ buttons, then press Check
Keyboard · Tab to a card’s ▲ or ▼ button · Alt and Up arrow moves the card up · Alt and Down arrow moves the card down · Enter or Space presses a button · Space ticks a box in the list
on ML wave start in MakeCode. The model runs on the micro:bit itselfon ML … start runs only when the recognised movement changes, similar to sending only on change, and unknown means it is below the point where it can recognise a movement, similar to the 0.8 thresholdOur loopThis is our very own real loop: the camera senses, the AI thinks, the cable sends the command, the car moves, and then you check the result and change your hand sign.
All through this lesson, we have borrowed our own bodies as a map to help us understand robots: eyes are like a camera, nerves are like a USB cable, and spinal cord reflexes are like the watchdog in the Arduino. A good map helps you not get lost, but a map is not a photo. It leaves out an enormous amount of detail. So this last level invites you to look at how far the comparison works, and where it stops. The people who know what their own map is missing are the ones who use maps best.
Each row is something we have already met in this lesson. For each one, guess whether our body and a robot are alike, partly alike, or not alike at all. You get one guess per row. Once you have guessed, the answer and a short reason will open by themselves. Don’t worry about being wrong, because some rows have kept scientists arguing for years.
● Alike · ◐ Partly alike · ○ Not alike · ✓ Right guess · ✗ Not quite
Guess first, then the answer will open by itself
Keyboard in this table · Tab goes to the show-answer button, then on to the next row · ← → moves between answers in the same row · Enter, Space or the numbers 1 2 3 choose an answer · After you guess, the show-answer button opens and closes the answer
Robot diagrams usually draw boxes in a row: sense, then think, then act, one box at a time, like people queuing to buy sweets. This is easy to read, and it really did help us build the car in Level 9. But the real brain is messier and cleverer than that.
In the brain, many loops work at the same time: the cerebral cortex, the basal ganglia, the cerebellum and the spinal cord, and they all keep talking to each other. When you reach for a glass of water, your eyes are still looking for the glass, your hand has already started reaching, and your brain is still choosing how to hold it. Even the spinal cord can make quick decisions by itself, such as starting to lift your foot away when you step on something sharp, before the brain is fully aware of it (you can read about this in Level 4 but never try it for real)
Both of these pictures are still simplified maps. You can see the four-layer diagram compared with the real brain in more detail, with a switch button, in Level 1
Some robots have sensors that measure pressure or heat. When the value goes above a set limit, the program might tell the arm to pull back, or make a speaker say “Ouch!” It sounds as if it really hurts, but inside there is only a number going up and a rule that a person wrote.
There is no evidence yet that today’s robots or AI really feel pain, happiness or fear, even when they are set up to say “Ouch”. Our pain, on the other hand, is a real feeling that warns us to take care of our body quickly. You can see the table comparing the brain with AI in Lesson 15
The whole brain uses about 20 watts of power, about the same as a small light bulb (Lesson 15 and Lesson 16). But one powerful AI chip can use up to about 700 watts, as much as about 35 brains.
700 ÷ 20 = 35 · One chip at full power equals about 35 brains
The 700-watt figure is the most the chip can handle. It doesn’t use that much all the time, and this is only a rough comparison. But don’t forget that big AIs are trained on thousands of chips like this at the same time.
In 1988, a robot scientist called Hans Moravec pointed out that getting a computer to win at draughts is easier than getting it to see and move as well as a one-year-old child. This is an observation from people who work with robots every day, not a law of nature. AI has got much better since then, but walking on rough ground, picking up soft things and folding clothes are still hard for robots.
Part of the reason may be that our bodies have practised these things every day since we were little, so we have forgotten how hard they are (Level 6), and the real world is never exactly the same twice. One piece of cloth can crumple in thousands of ways, while a draughts board has rules that never change.
This lesson doesn’t predict what future robots will be like, because things change very fast. But we can carry good questions with us that work for every robot, whenever it comes out.
Read one card at a time, then choose which box that job belongs in. Cards labelled 🧍 Body are about what happens inside us. Cards labelled 🤖 Robot are about robots and our car. There are 20 cards in total. Normal mode has no timer, so you can answer and read the explanation for every card at your own pace. If you want a challenge, try the 60-second timed mode, where correct answers in a row earn extra points.
Keyboard in this game box · 1 2 3 4 choose a box · ← → change mode when you are on the mode buttons · in no-timer mode, after answering, press Enter on the Next card button · the timer pauses by itself when you scroll the game off screen
The body and the robot each have a thinking layer, an adjusting layer, a stopping layer and message wires, all working at the same time, not one step at a time.
Timed mode keeps your best score in this browser on this device only. It isn’t sent anywhere, and there is no leaderboard.
Our loopAI is the brain and the robot is the body. Joined together, they make a loop that senses, thinks, sends the command, moves and checks the result, with a fast layer guarding against danger and a person in the loop when it is unsure.
This lesson has 24 new words, and not one of them repeats a word from the Lesson 15 or Lesson 16 glossaries. Level 1 covers the words you need from the very first day you connect AI to the car. Level 2 covers the words that make the loop really work and stay safe, and Level 3 covers the words robot researchers and brain scientists really use when they talk to each other. Every word has a link back to the part of the lesson that explains it (Levels 0 to 10 in the contents).
You can type in English or Thai. It searches the word names, the explanations and the examples. Press Esc to clear the search box. On the keyboard, the level buttons work with the left and right arrows, Home and End.
Turn on self-test mode and the explanations will be hidden, leaving only the words. Try saying what each one means in your own words first, then tap to see how close you were. This is the same loop as in Level 5 (guess first, look at the real answer, then fix it).
Getting it wrong is completely fine. Seeing where your answer is different from the real one is what shows you what to fix. The robots in this lesson get better in the same way.
You can find basic words such as training data, classification, hallucination and human-in-the-loop in the Lesson 15 glossary and sensor, actuator, feedback control, reinforcement learning and embodied AI in the Lesson 16 glossary
If these words confuse you in this lesson, go back and look them up. This lesson deliberately doesn’t explain them again, to leave room for the new words.
Our loopAll 24 words help explain the same loop: eyes that must be sure enough, a brain that plans ahead in chunks, a wire that keeps saying it is still there, a body with reflexes, and surprise that helps the loop adapt when something unexpected happens, all with a safety layer always watching underneath.
12 questions from the whole lesson, with 3 choices each. You can only choose once. Then read the explanation under the question every time, even when you get it right. If you miss a question, press the review link under it to go back and read that level, then come back and press Start again.
Every question from this lesson is in the Body 101 arena. Race the clock, duel someone at home, play as a team, beat the bosses, or practise with no timer at all.