The Stone Grinder: a heavy round stone that turns slowly on an axle. A Large Motor turns it. People have ground grain with machines like this for thousands of years.
It is the heaviest thing a motor of yours has turned. That is on purpose. A grinding stone should be heavy, because the weight does the grinding.
A grinder asks a new question. Not what should it do, or how far. It asks how long. Grind for too short a time, and the grain is still lumpy. Grind too long, and you waste the day. Today the robot gets a clock.
In the real world 5 min
Where you have seen it
Two flat stones, one turning on top of the other. The grain goes in between. It is one of the oldest machines in the world. We still use it. Many kitchens still grind spices on a stone. Big factories use the same idea to make flour today.
Grinding grain on an old-style grinding stone. Photo: Rogerirakoze / Wikimedia Commons (CC BY-SA 4.0).
Why it is built that way
The stone is heavy on purpose. Grinding needs pressure, or pushing down hard. The stone must also keep going when it meets a hard grain. Once a heavy wheel is turning, it is very hard to stop. That is called momentum.
So the hard part is the start. Getting a heavy stone moving takes much more effort than keeping it going. Watch someone turn one by hand. The first push is big. After that, it is easy and steady.
What would go wrong without it
Now think about running it. “Grind for two minutes” is a real instruction. A miller counts time, not turns. What matters is how long the grain stays under the stone.
There is a second reason a machine needs a clock. What if a machine waits for something that never happens? It waits for ever. No error, no message, no clue. A clock lets it give up.
A robot with no clock can only do what it is told. A robot with a clock can tell you how long things took. It can also give up.
The main concept — the timer 6 min
The Brick has a clock that runs all the time. Two blocks let your program use it.
Block
What it does
reset timer
Sets the clock back to zero. It starts counting again from here.
(timer)
Gives the seconds since the last reset. It is a number, so it fits anywhere a number fits. You can compare it, or write it on the screen.
How is this different from a wait?
You have used wait (10) seconds before, on the Ferris Wheel in Lesson 12. It is simpler than the timer. Most of the time it is the right block. But they can do different things:
wait (10) seconds
the timer
Pauses the program
Yes, that is all it does
No. It just keeps counting
Can you read the number?
No
Yes, any time you like
Can the program do other things meanwhile?
No. A motor you started keeps going, but no new blocks run
Yes. Blocks keep running while it counts
The middle row is why the grinder needs a timer. A wait cannot tell you how long the job took. The timer can put the time on the screen.
no way out
repeat until distance < 15
start moving straight: 0
with a timeout
reset timer
repeat until distance < 15 or timer> 5
start moving straight: 0
write GAVE UP at line 1
1.2stimer212cm · distance
Both robots are told to drive until something is within 15 cm. The room ahead is empty.Three seconds. No wall. Both are still driving — and the right-hand program is also watching its timer.The timer passes 5. The right-hand robot gives up, stops, and says so.The left robot is still going. Its condition can never become true, so that block will hold the program for ever.The right-hand program finished. The left one has not, and there is nothing to say why.
timer 1.2 s
The sensor is not faulty and the program is not wrong. There is simply no wall, and only one of these two programs has a way of noticing that.
The demo shows the timer’s other job. It is even more useful: getting out of a wait that never ends. The robot on the left is not broken. It is doing just what it was told. It will still be doing it tomorrow!
A wait tells the robot to do nothing for a while. The timer tells the robot how long it has been doing something.
▶The timer, and the Large MotorHow both work. Open it if you are not sure about the clock or the motor.Show meHide
ComponentControl4 min
The Timer
A wait pauses for a length of time. The timer is different: it runs in the background and can be read at any moment, so the robot can know how long something has taken while it is still happening.
Blocks reference
Block
What it does
(timer)
Reports the seconds since the timer was last reset.
reset timer
Sets it back to zero, so the next reading counts from here.
The timeout — a safety net
The most valuable use of a timer is escaping a wait that might never end. A robot told to drive until it sees a wall will drive for ever if the wall is not there. Combined with a timer, it can give up:
Repeat until the wall is close or five seconds have passed. That one change turns a program that can hang into one that always finishes. Both robots below are looking for a wall that is not there.
no way out
repeat until distance < 15
start moving straight: 0
with a timeout
reset timer
repeat until distance < 15 or timer> 5
start moving straight: 0
write GAVE UP at line 1
1.2stimer212cm · distance
Both robots are told to drive until something is within 15 cm. The room ahead is empty.Three seconds. No wall. Both are still driving — and the right-hand program is also watching its timer.The timer passes 5. The right-hand robot gives up, stops, and says so.The left robot is still going. Its condition can never become true, so that block will hold the program for ever.The right-hand program finished. The left one has not, and there is nothing to say why.
timer 1.2 s
The sensor is not faulty and the program is not wrong. There is simply no wall, and only one of these two programs has a way of noticing that.
The left-hand robot is not broken, and neither is its sensor. Its condition is simply one that will never come true, so the program sits on that block for ever — with nothing on the Brick to say so. The right-hand program asks the same question with an escape route bolted on, and finishes every time.
Why it matters
Real systems time themselves out constantly — a lift that cannot close its doors eventually gives up and beeps rather than trying for ever. A robot with no timeout simply stops responding, and there is nothing on screen to say why.
ComponentMotion4 min
The Large Motor
The Large Motor is the bigger of the two EV3 motors. It turns more slowly than the Medium Motor but pushes far harder, which is why it drives wheels and lifts loads. If a mechanism struggles or stalls with a Medium Motor, this is usually the answer.
Large Motor
Medium Motor
The two motors at the same scale. The Large Motor is visibly bigger and heavier — that extra size is what gives it more turning force and less speed.
Blocks reference
Block
What it does
[B v] run [clockwise v] for (3) [rotations v] :: motors
Turns the motor a measured amount, then stops.
[B v] run [clockwise v] for (2) [seconds v] :: motors
Turns it for a length of time rather than a distance, then stops — however far the shaft actually got.
[B v] set speed to (40) % :: motors
Sets how fast the next movement will be.
[B v] start motor [clockwise v] :: motors
Starts it turning and carries straight on.
Watch them race, then watch them lift
Give both motors the same program and the same arm. With nothing on the arm the Medium Motor wins easily — which is why it is tempting to treat it as simply the better motor. Then the demo hangs a weight on both arms and runs it again.
when program starts
A run clockwise for 1rotations
and on the Large Motor, only the port changes
B run clockwise for 1rotations
0%medium lifted0%large liftednoneload
Medium: not enough forceLarge: slower, but it lifts
) : clock.step === 1 ? (
With nothing to lift, the Medium Motor is quicker
The same program, the same arm, one on each motor. Nothing to lift yet.No load: the Medium Motor is clearly the quicker of the two.Now hang a heavy weight on both arms and run exactly the same program.The Medium Motor stalls a third of the way up. The Large Motor keeps lifting.Same program, same weight — the motor was the difference.Finished — it will run again in a moment.
at rest
Turning the speed up would not rescue the Medium Motor here — a stalled motor needs more force, which means gearing it down or using the Large Motor.
That is the whole difference. The Medium Motor is quicker; the Large Motor is stronger. A motor that cannot produce enough force does not move slowly — it stops altogether and strains, which is the buzzing, going-nowhere failure almost every LEGO builder meets sooner or later.
A stalled Large Motor hangs the program too
Being stronger buys the Large Motor a bigger load, not an infinite one. Every winch runs out of cable and every lift reaches the top of its rails, and when a motor arrives at a limit it stalls: the shaft stops turning and the motor sits there straining.
That is a problem for the program, not just the mechanism. run for (3) rotations does not finish when three rotations’ worth of time has gone by — it finishes when the shaft has actually turned three times. A winch that reaches the top after two and a half will never report three, so the block waits, and every block after it is unreachable. Nothing crashes. The motor keeps pushing and the rest of the program simply never happens.
The third setting in that dropdown is the way out. for () seconds drives the motor for a duration and then stops regardless, so it always finishes and the program always moves on. Drive into a limit slowly, for a comfortably long time, and then call that position zero:
when program starts :: events hat
[B v] set speed to (30) % :: motors
[B v] run [counterclockwise v] for (3) [seconds v] :: motors
[B v] reset degrees counted :: motors
The lift ends up against its own stop, the encoder is zeroed there, and every measured move afterwards starts from a place you know. The rule is the same for both motors: if the movement ends against something solid, run for seconds; if it ends somewhere in the middle, measure it. The Medium Motor module has the animation for it — see The Medium Motor, which is where this bites hardest, because a Medium Motor is usually the one doing the lifting.
Which motor for which job
Large Motor — wheels, winches, anything lifting weight. Strong, slower. Normally ports B and C.
Medium Motor — arms, gates, jaws, pointers. Quick, lighter. Normally ports A and D.
The blocks are identical apart from the port letter, so swapping one motor for the other is a build change, not a programming change.
Why it matters
Real machines match the motor to the load. A lift uses a powerful, slow motor; the button panel beside it uses tiny ones. Choosing the wrong size is the most common reason a LEGO mechanism whines but does not move.
Say this back before moving on: “Reset the timer to start counting. Read the timer to find out how long it has been.”
What’s in this build 4 min
Two electronic parts. And this time, the heaviest part has no cable at all.
Part
What it is doing here
EV3 Intelligent Brick
Runs the program and keeps the clock. Shows the time on its screen.
Large Motor
Turns the stone. It is the strong motor, and this model really needs it. Check yours has the big red drum.
The stone (no cable)
The heavy wheel. Its weight is what makes the machine work. It also makes starting hard.
Feel the weight before you power it
Spin the stone by hand, as fast as you can. Then let go. Count how long it keeps turning. That is momentum, and you just measured it!
Now try to start it moving gently with one finger. Starting is much harder than keeping it going.
Turn the motor drum by hand. Does it turn the stone through gears, or on its own axle? Either way, the motor must get all that weight moving from still.
Check the stone turns smoothly. It should not wobble or rub on the frame as it turns.
Ports — and the rule 4 min
Sensors go in ports 1, 2, 3, 4. Motors go in ports A, B, C, D. You cannot swap them. If you do, nothing warns you. The robot just will not work.
Part
Port
Why this one
Large Motor (turns the stone)
A
A motor working on its own goes in A, as always.
The clock
none
The timer is not a part. It is inside the Brick and already running. There is nothing to plug in.
Check your own build now:
Motor cable in port A: a letter, not a number.
Keep the cable away from the turning stone. A heavy wheel can grab a cable. It can pull the plug out, or worse.
Is the model held down? The wheel may not be quite centred. Then it can shake a light frame across the table.
Is the screen facing you? Soon you will put a number on it. You need to read it.
Connect the Brick 4 min
Two routes, and either is fine. USB is the reliable one and the one to fall back on when a room’s Bluetooth is busy; Bluetooth leaves the robot free to move, which some models need.
▶How to connect the BrickUSB and Bluetooth, step by step, with a photograph of every screen. Open it if you have not done this before — or if pairing is not working.Show meHide
USB — the reliable one
Switch the Brick on with the dark grey centre button.
Cable into the Brick’s PC port — the small square socket beside the numbered ports, not one of the numbered ones.
Other end into the computer.
Bluetooth — name it first
Do these in order. Naming the Brick after you go looking for it in the list is how groups end up driving each other’s robots.
Name your Brick. On the Brick: Settings (the spanner) → Brick Name. Type something nobody else will pick, then press the tick. Every Brick is called EV3 until somebody changes it.
Turn Bluetooth on. Settings → Bluetooth. Tick Bluetooth and Visibility. Leave iPhone/iPad/iPod unticked.
Connect from EV3 Classroom. Click the Brick icon at the top of the programming area, find your Brick by name, and click Connect.
Say yes on the Brick. It asks “Connect?” with the computer’s name — choose the tick, then accept the passkey, which is already 1234.
Where to read it. The name sits in the bar across the very top of the screen, on every screen — so you can check which Brick you are holding at any moment without going into a menu. This one is EV3VE. A Brick nobody has renamed says EV3.Step 3, and the reason step 1 exists. Three Bricks in range — read the name before you click Connect. Pairing with the wrong one is not an error: it works perfectly, on somebody else’s robot.
Step 2.Bluetooth switches the radio on; Visibility is what lets the computer find you. With Visibility off your Brick works perfectly and simply never appears in the list.Step 4. Look at the Brick. It asks whether to accept and names the computer. Choose the tick.Then the passkey, already 1234. Press the tick again and you are connected.
The two failures, every class, every time. The Brick has gone to sleep while you were building — press the centre button to wake it. Or you have paired with the group at the next table, which is why the name matters.
The long version, including Port View and how to read the port tiles, is in the Brick & Bluetooth guide.
Bluetooth is best for this one. The stone throws things about a bit. A cable across the table is one more thing it can catch.
Confirm the connection 2 min
Check the Brick icon: connected, or not.
Check the port tiles. A Large Motor on A. If it reads Medium, swap it. The Medium Motor will struggle to start this stone. Then you might blame the program by mistake!
Turn the stone by hand and watch degrees counted move.
There is no tile for the timer. It does not need one. It is already running. It started when the Brick switched on. Your program does not start it. It only resets it.
Change it and test 8 min
Make one change at a time. Guess what will happen before each run. Today, guess the number on the screen too. Not just what the stone does.
Change the 15 to 5. Guess the number on the screen. Then run it. See how the stone keeps rolling long after the program has finished.
Delete the reset timer block. Run it twice in a row without switching the Brick off. Guess the second number. The clock never went back to zero. So the wait ends at once, and the stone hardly turns.
Put it back. Then add a second write (timer) at line (3) right after reset timer. Guess what that line says. It is zero. A zero on the screen proves the reset really happened.
Change 60 % to 20 %. Same fifteen seconds. Guess if the number on the screen changes. It should not. The timer measures time. Time does not care how fast the stone turns.
Now hold the stone gently with a finger, so it cannot start. Run it. The program still ends at fifteen seconds and still shows the time. The clock ran even though nothing happened.
Step 5 shows what a timer cannot do. It tells you how long you waited. It does not tell you if anything worked. A machine can show a perfect fifteen seconds of doing nothing at all!
Measuring time is not the same as checking the job got done. The clock only tells you about time.
This is what you are building: the Stone Grinder.
Build it 15 min
Build the model before you read any further. Everything after this is about making it do something, and none of it will make much sense with nothing on the table in front of you.
One page at a time — use Next and Previous, or the ← → keys. Fullscreen makes it big enough to build from.
Check the finished build against the picture before you switch anything on. A motor mounted the wrong way round is far easier to spot now than it is to debug later, when it looks like a program fault.
Make it move 10 min
Seven blocks. Start the clock and start the stone. Let it run for fifteen seconds, then stop. Then show how long it really took.
when program starts :: events hat
reset timer
[A v] set speed to (60) % :: motors
[A v] start motor [clockwise v] :: motors
wait until <(timer) > (15)>
[A v] stop motor :: motors
write (timer) at line (1) :: display
The motor runs while the clock counts. At the end, the timer shows how long it really took.
Walk it in the order the Brick runs it:
reset timer — the clock goes to zero. Do this first. If not, you will count from when the Brick was switched on.
set speed to 60 % — nothing moves yet. A grinder should be steady, not too fast.
start motor clockwise — the stone starts turning, and the program carries on. See, this is start motor: it has no end built in. So the next block runs while the stone is still going.
wait until timer > 15 — the program waits here. It keeps checking the clock. The stone turns the whole time.
stop motor — the stone starts to slow down. Watch how long it keeps going after this block. That is the momentum from section 5.
write (timer) at line 1 — the time goes on the screen. It will not be exactly 15. It will be a little more. The program only noticed after the number went past 15.
What success looks like: the stone takes a moment to get going. It turns steadily for about fifteen seconds. Then the motor stops, and the stone slowly rolls to a stop. The screen shows a number just above 15.
Does the stone not start at all? Do not raise the speed. That does not help a stuck motor. First check the stone spins freely by hand. Then check the tile really says Large Motor.
Challenges 27 min
Work through them in order — each is harder than the last. The extra challenge comes after all three, and it is meant to make you plan before you build.
Challenge 1
Grind for a set time and tell the truth about it. Run the stone for exactly thirty seconds. At the end, show the measured time on the screen. Then say why your number is not exactly 30. Is it over or under? Say why it could never be under.
Challenge 2
Time the coast. The coast is how long the stone keeps turning after the motor stops. Measure it with the timer, not a phone. Do it three times at three different speeds. Write down all three. Then say what that tells you about the stone's momentum. Momentum is how much a moving thing keeps on moving.
Challenge 3
Build a timeout. A timeout is when a program stops waiting and gives up. Make a program that waits for something that will not happen. For example, it waits for the centre button to be pressed. But it gives up after ten seconds. Then it shows that it gave up. It must not wait for ever. Show both endings. In one, you press the button in time. In the other, you do not.
Extra challenge
Make a grinder that reports on its own work.
Your machine must run a grinding cycle that you planned. After that, it must tell someone what happened. How long did it run? Did it finish properly, or was it cut short? No one may touch it during the run. No one may use a stopwatch. The machine measures itself.
Plan on paper before you build. What can your machine really know about its own run? Be careful here. The timer tells you how long you waited. It does not tell you if anything really turned.
You will be asked two questions when you show it. Could your machine report a perfect run while the stone was stuck and not moving? If so, what would you need to fix that? And why is reset timer the first block, not the second?