The Lucky Draw Machine: a paper wheel cut into segments, a pointer at the top, and a motor that spins the wheel. It slows down, coasts, and stops — and whichever segment is under the pointer is your prize.
Here is the question worth asking before you build it. How does the machine decide where to stop?
It does not. Nothing in the program picks a segment, and there is no block anywhere in this lesson that produces a random number. The wheel just spins and runs out of speed — and that turns out to be enough.
In the real world 5 min
Where you have seen it
The roundabout in a playground. You push it as hard as you can, jump on, and it goes round and round and gradually slows and stops — and you have no idea in advance which way you will be facing when it does.
A playground roundabout — pushed once, then left to coast. Photo: Jorge Royan / Wikimedia Commons (CC BY-SA 3.0).
Why it is built that way
Once it is turning, a heavy wheel keeps turning. That stored motion is momentum, which you met on the Stone Grinder in Lesson 20 — and here it is the feature rather than the nuisance.
What stops it is friction: a little at the bearing, a little from the air. Friction is small and steady, so a fast wheel takes a long time to stop, and it makes hundreds of turns getting there.
And that is where the unpredictability comes from. To know where it will stop you would have to know exactly how hard the push was, exactly how much friction there is today, exactly how the paper is sitting. A difference far too small to notice at the start becomes half a turn by the end.
What would go wrong without it
Imagine a prize wheel that always stopped in the same place. It would be worthless — everybody would get the same prize, and after one go nobody would want another.
A draw has to be one nobody can predict, including the person who built it. That is not decoration; it is the entire reason the machine exists.
A long coast turns a tiny difference at the start into a completely different answer at the end.
The main concept — you do not need a random block 6 min
Two blocks you already know, used in a way you have not needed before: start the motor, stop the motor, and let the wheel carry on by itself.
Block
What happens to the wheel
[B v] run [clockwise v] for (3) [rotations v] :: motors
Exactly three turns, then it holds. Predictable — the same three turns every single time.
[B v] start motor [clockwise v] :: motors
Spins up and keeps going, with no ending built in. This is the Lesson 4 block.
[B v] stop motor :: motors
Stops driving it. The wheel keeps turning on its own and coasts to a halt — and where it lands is nobody’s decision.
That third row is the whole lesson. You noticed it on the Stone Grinder, where the stone kept turning after the program had finished and it was slightly annoying. Here it is the machine.
The program controls the blue part. The brown part is physics, and it is far longer — which is why the finishing point is out of your hands.
EV3 does have a random block, and you are not using it. It belongs to a later level, and for this machine it would be the wrong tool anyway: a random number would tell the wheel where to stop, and then you would have to make it stop there — which is far more work than simply letting go.
The physical world is already unpredictable. Sometimes the cheapest way to get a surprise is to stop controlling something.
▶The Large Motor, and the Brick buttonsThe full reference for this motor and for the buttons on the Brick, which start today's draw. Open either if it is not clear yet.Show meHide
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.
ComponentSensing4 min
The Brick buttons
The Brick has five buttons of its own — up, down, left, right and centre. They need no sensor, no cable and no port, which makes them the easiest way to let a person tell the robot to do something.
Five buttons — up, down, left, right and centre — built into the Brick. No cable, no port, no sensor to plug in.
Blocks reference
Block
What it does
when [center v] button [pressed v] :: events hat
Starts a whole stack when that button is pressed.
wait until <is [center v] button pressed? :: sensors>
Holds an existing program until the button is pressed.
Press to begin
A program sitting on a wait block looks exactly like a program that has crashed. Watch one wait — including through two presses of the wrong button.
when program starts
wait until is center button pressed?
A run clockwise for 1rotations
the other way to do it
when center button pressed
A run clockwise for 1rotations
The program has reached the wait block. It is not stuck — it is waiting, and nothing below it will run until the centre button goes down.Up is pressed. The button reporter changes to 4, but this wait is watching the centre button, so the program stays where it is.Right: 3. Still not the one.Centre: 2. The condition is true and the wait lets go.The motor runs. One press, at the moment a person chose.Finished. The robot did nothing at all until a person said so.
waiting for centre
A program parked on a wait block looks identical to a crashed one. This is why the status light or a line on the screen is worth setting before you wait.
The wait is watching one button. Up and right change the (button) reading, and the program does not care. That reading is a number rather than a name: 0 for nothing, then 1 left, 2 centre, 3 right, 4 up, 5 down.
A hat, or a wait?
A hat gives the button its own separate stack, which can run at any time. Good for a control the user may press whenever they like.
A wait puts the button in the middle of a sequence. Good for “press to begin”, where nothing should happen before it.
Why it matters
Nearly every machine has a start button that is deliberately separate from switching the power on. A robot that begins moving the instant it is powered up is hard to set down and hard to test — one that waits for a press can be positioned first.
Say this back before moving on: “Stop motor stops driving it. It does not stop the wheel.”
What’s in this build 4 min
Part
What it is doing here
EV3 Intelligent Brick
Runs the program, and its centre button is the start switch for the draw.
Large Motor, port B
Spins the wheel. Strong, because a paper wheel on an arm has real swing to it.
Large Motor, port C
The lever the player pulls down. See the note below — your program does not read this one.
The paper wheel (no cable)
You cut this yourself: a disc divided into 8 to 12 segments.
About the lever, honestly. Making the program react to somebody pulling that second motor means reading a motor backwards — asking it how far it has been turned by hand. That is a real EV3 skill and it is a Level 3 one, so it is not in this lesson. For now the lever is a satisfying thing to pull and the Brick’s centre button is what actually starts the draw. When you meet degrees counted properly, come back and wire it up.
Make the wheel, and make it readable
Cut a paper disc that fits your holder and divide it into 8 to 12 equal segments — fewer than 8 and the draw feels rigged; more than 12 and the pointer sits ambiguously between two.
Colour and label each segment differently. From a metre away, can you tell instantly which one the pointer is on?
Check the pointer at the top actually points at one segment rather than hovering over a line. If it is ambiguous, make the pointer narrower.
Spin the wheel hard by hand and count how long it coasts. Under two seconds and the bearing is too tight — find the rub and free it, because a short coast is a predictable coast.
Ports — and the rule 4 min
Sensors go in ports 1, 2, 3, 4. Motors go in ports A, B, C, D. They are not interchangeable, and nothing will tell you politely if you swap them.
Part
Port
Why this one
Large Motor (spins the wheel)
B
The motor the program actually drives. Every block below says B.
Large Motor (the player’s lever)
C
Plugged in and doing nothing, on purpose. Leaving it connected means it is ready the day somebody adds the Level 3 code.
The centre button
none
Part of the Brick, like the screen and the speaker.
Check your own build now:
Wheel motor in B, lever motor in C.
Spin the wheel by hand. Free, smooth, and coasting for a good few seconds?
Is the pointer firmly fixed? A pointer that wobbles as the wheel stops makes the result arguable, and an arguable draw is a bad draw.
Is the machine on a steady surface? A wheel this size will walk a light frame about.
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.
The Brick has to be reachable today. The centre button starts the draw, so mount the Brick where a player can press it without leaning across the spinning wheel.
Confirm the connection 2 min
Check the Brick icon: connected, or not.
A Large Motor on B and one on C.
Turn the wheel by hand and check it is tile B that counts. If it is C, swap the cables — you would be spinning the lever and pulling the wheel.
Now something worth seeing. Spin the wheel hard by hand and watch tile B’s degrees counted race up on its own. The Brick can see the wheel coasting — it just is not using that information yet.
That number climbing with no program running is proof the motor is a sensor as well as a motor. Level 3 is where you get to use it.
Make it move 10 min
Six blocks: wait for a player, spin up, drive for two seconds, and let go. Notice there is nothing in here that decides an answer.
when program starts :: events hat
wait until <is [center v] button pressed? :: sensors>
[B v] set speed to (100) % :: motors
[B v] start motor [clockwise v] :: motors
wait (2) seconds
[B v] stop motor :: motors
The program ends at the last block. The interesting part of the draw happens afterwards, with nothing running at all.
Walk it in the order the Brick runs it:
wait until centre button pressed — the machine sits ready. This is the player’s go.
set speed to 100 % — a setting, and it must be here rather than after the start, as you learned on the Gyro Launcher. Full speed, because a long coast needs a fast start.
start motor clockwise — no ending built in, so the wheel spins up and the program moves on.
wait 2 seconds — the spin-up. The wheel is getting faster the whole time.
stop motor — and the program is finished. The wheel is not: it now coasts, for far longer than the two seconds you drove it, and stops wherever it stops.
What success looks like: press the button, the wheel winds up for two seconds, then spins freely for several more before settling — and the pointer lands on a clearly readable segment. Run it five times and get five different answers.
If it keeps landing on the same segment, the coast is too short. Free up the bearing, take weight off the wheel, or drive it for longer. A wheel that stops after half a turn is a wheel you could predict.
Change it and test 8 min
This section is a measurement, not a fiddle. Run each version ten times and write down which segment came up each time. Ten is not many, but it is enough to see the difference.
Run the program as written, ten times. Tally the results. How many different segments came up?
Change the spin-up to 0.3 seconds. Ten more runs. Now the wheel barely gets going, the coast is short, and you should see the same few segments over and over — because a short coast is predictable.
Back to 2 seconds, and change the speed to 30 %. Ten runs. Same problem, different cause.
Now replace start motor and stop motor with a single [B v] run [clockwise v] for (5) [rotations v]. Predict what happens, then run it ten times. The motor now holds at the end of five rotations instead of letting go, so the wheel barely coasts at all — and the draw becomes almost fixed.
Put it back. Then, from your tallies, answer one question: which version would you actually use for a real prize draw, and what is your evidence?
Step 4 is the surprise, and it is the reverse of everything the course has taught so far. Measured movement has been the reliable, grown-up choice since Lesson 5 — and here it is the wrong one, because reliability is exactly what this machine must not have.
Precision is not always the goal. Ask what the machine is for before you decide which block is better.
This is what you are building: the Lucky Draw Machine.
Challenges & mission 27 min
Work through the challenges in order — each is harder than the last. The mission comes after all three, and it is meant to make you plan before you build.
Challenge 1
Prove your draw is fair enough to use. Run twenty draws and tally which segment comes up each time. Report the tally. Every segment does not have to appear — twenty is a small number — but if half of them never come up at all, your wheel is not spinning freely enough and you should say so.
Challenge 2
Make it a proper show. The machine must announce that it is starting, build suspense while the wheel spins, and signal clearly when the wheel has stopped and the result can be read. Use sound, screen and status light, and time it so the announcement does not arrive before the wheel has actually settled.
Challenge 3
Break your own machine, then fix it. Deliberately make the draw predictable — a short spin, a tight bearing, a slow speed — and show it landing on the same few segments over twenty runs. Then undo it and show the difference. Report both tallies side by side.
Mission
Build a draw somebody would accept losing on.
Your machine must be one another group is willing to use for a real prize, which means they have to be convinced they cannot influence or predict it. Run it in front of them and let them try to work out how to make it land where they want.
Plan on paper before you build. Decide what would make this draw unfair — a wheel that always stops in the same arc, a pointer that can be nudged, a spin the player controls — and design each one out.
Two questions when you demonstrate it. Nothing in your program chooses a segment, so what does? And how long does your wheel coast for after the program has finished, and why does that number matter more than anything you wrote?
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.
Use the viewer's own controls to zoom and turn pages. 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.