🤖

How To BuildDUSTY

A little robot that sweeps crumbs off the table and stops itself right at the edge instead of driving off. This guide takes you from a pile of parts to a working robot, one step at a time.

DUE NOV 16 ABOUT 6 WEEKENDS PARTS $78 TO $125 SOLDERING NONE

Read this part first

Before you start

Tools you need

None of these are special. Everything here is probably already in the house.

Craft knifeGrown-up only
RulerMillimeters matter
Hot glue gunLow temp if you have it
Small screwdriverPhillips, for brackets
LaptopTo load the code
StopwatchA phone works

Know your gear

Meet the parts

Open the boxes and lay everything out before you build anything. Find each item below so you know what you are holding.

A B

micro:bit v2

A tiny computer the size of a credit card cut in half. The 25 red squares are little lights called LEDs. The gold stripes at the bottom are how it plugs into other boards.

Its job: it is Dusty's brain. It reads the sensors, decides what to do, and tells the motors to go.

MICRO-USB TO PROGRAM · BUTTONS A AND B

MICRO:BIT SLOTS IN HERE POWER M A M B MOTORS

Motor driver board

A board with a slot the micro:bit slides into, a round hole for the battery plug, and two sockets for motors.

Its job: the middleman. The micro:bit is far too weak to run motors directly, so it whispers instructions to this board, and this board does the heavy lifting.

3 TO 11 VOLTS · DRIVES 2 MOTORS

SHAFT + -

N20 gear motor ×2

A small silver can with a gold gearbox on the front and a flat metal shaft poking out. Two wires, one red and one black.

Its job: one drives the left wheel, one drives the right. Run them opposite directions and Dusty spins on the spot.

6 VOLTS · 3 MM D-SHAPED SHAFT

32 mm ACROSS

Wheels ×2

Black plastic wheels with a soft rubber tire. The hole in the middle is a circle with one flat side, shaped to match the motor shaft.

Its job: the wheel size decides how fast Dusty drives, and speed is the thing this whole experiment measures. Do not swap for bigger ones.

PRESS-FIT · NO GLUE NEEDED

ROLLS ANY DIRECTION

Ball caster

A little plastic cage holding a metal ball, plus a bag of thin plastic washers called spacers.

Its job: the third foot at the back. Two wheels plus one ball is steady and turns cleanly. Four wheels would fight every turn.

USE EVERY SPACER IN THE BAG

OUT BACK TABLE SURFACE

Cliff sensors ×2

Two tiny bumps on a small board. One shines invisible infrared light down, the other watches for it to bounce back.

Its job: the whole point of the robot. Light comes back means table. Nothing comes back means the table ended, stop now.

MOUNT EXACTLY 3 MM ABOVE THE TABLE

C NO NC

Whisker switch

A small black block with a springy metal arm and a little wheel on the end. Push the arm and it clicks.

Its job: the backup. A stiff wire drags on the table holding the arm down. Table ends, the wire drops, the switch clicks, motors stop.

3 LEGS · USE C AND NO

BRUSH

Brush motor

A plain silver motor with two metal tabs. You attach your own brush to the shaft: cut-down paintbrush, toothbrush heads, or pipe cleaners.

Its job: flicks crumbs up and backward over a little lip into the tray, exactly the way a dustpan works.

ONE SPEED · ONE DIRECTION · OWN SWITCH

AA AA AA AA ON 4 x AA = ABOUT 6 VOLTS

Battery holder

A black box that holds four AA batteries, with a little switch on the side and a wire ending in a plug.

Its job: powers everything. It is also the heaviest thing on Dusty, and that weight sits over the wheels where it helps them grip.

SWITCH OFF WHILE YOU BUILD

What even is a microcontroller?

A laptop is a computer that can do millions of different things. A microcontroller is a computer that does one job forever, very reliably, using almost no electricity. There is one in your microwave, one in the car's key fob, and a few dozen in the car itself.

The micro:bit is a microcontroller you can reprogram. When you load code onto it, that code stays there. Unplug it, put in batteries a week later, and it starts running your program again immediately. It has no operating system to boot, so it is ready the instant power arrives.

Why can't the micro:bit just run the motors?

Think of the micro:bit's pins as a person who can point but cannot lift. A pin can supply enough electricity to light a small LED, roughly 1/100th of what a motor wants. Wire a motor straight to it and you do not get a slow robot, you get a dead micro:bit.

The driver board contains a circuit called an H-bridge. It is four electronic switches arranged in a shape like the letter H, with the motor in the middle. Close two switches and electricity flows left to right and the motor spins forward. Close the other two and it flows right to left and the motor spins backward. The micro:bit just says which pair to close.

1

Cut the base

Weekend 1 · about 30 minutes

Everything bolts to this one piece of foam board. Cut it square and accurately now, or every single thing after this sits crooked.

CENTERLINE MOTOR MOTOR CASTER 100 mm 100 mm 30 mm FRONT IS AT THE TOP

TOP VIEW. THE FRONT EDGE IS WHERE THE SENSORS WILL GO.

  1. Measure a 100 mm by 100 mm square on the foam board and mark it in pencil.That is just under 4 inches. Use the millimeter side of the ruler, it is easier to be exact.
  2. A grown-up cuts it out with the craft knife, using the ruler as a guide.Several light passes beat one hard pass. Hard passes wander.
  3. Draw the centerline from front to back, right down the middle at 50 mm.
  4. Mark the motor spots 30 mm back from the front edge, one on each side.
  5. Mark the caster spot on the centerline, about 20 mm up from the back edge.
  6. Write FRONT on the front edge.It sounds silly. You will be grateful at 9pm on a Sunday.

You are done when

You have a square of foam board with a centerline, two motor marks, one caster mark, and the word FRONT written on it.

2

Mount the motors and wheels

Weekend 1 · about 45 minutes

Both motors have to point in exactly the same direction. If one is even slightly twisted, Dusty will curve instead of driving straight, and you will spend an hour blaming the code.

FOAM BASE (SEEN FROM THE FRONT) BOTH AXLES ON ONE STRAIGHT LINE TABLE 16 mm

FRONT VIEW. IF ONE AXLE SITS HIGHER THAN THE OTHER, DUSTY LEANS AND STEERS ITSELF.

  1. Put each motor into a bracket and tighten the two tiny screws.Finger tight plus a little. These screws are small and they strip easily.
  2. Push a wheel onto each shaft. The hole has a flat side that lines up with the flat side of the shaft.Press straight on with your thumb against a table. Do not hammer it, and do not glue it.
  3. Glue the brackets to the base at your two motor marks, wires pointing toward the back.
  4. Sight down the front before the glue sets. Both wheels should look perfectly parallel, like train tracks.
  5. Check both axles are the same height with the ruler.

What is a gear ratio?

Inside the gold box on the motor is a stack of gears. The motor itself spins insanely fast, around 30,000 times a minute, with almost no strength. Useless for pushing a robot.

The gears trade that speed for strength. A 1:298 gear ratio means the motor spins 298 times for every 1 turn of the wheel. You lose 298 times the speed and gain roughly 298 times the pushing force. That trade is why a robot this small can shove a pile of cereal around.

You are done when

Set it on the table and push gently. It rolls in a straight line, not a curve, and does not rock side to side.

3

Add the ball caster

Weekend 1 · about 20 minutes

This is where almost everyone gets it wrong, because the caster is shorter than the wheels unless you stack up the spacers it came with.

SPACERS, USE THEM ALL TABLE BASE SITS LEVEL, OR A HAIR NOSE-DOWN SIDE VIEW · CASTER AT THE BACK, WHEEL AT THE FRONT

NOSE-DOWN BY A MILLIMETER IS GOOD. IT AIMS THE SENSORS AT THE TABLE.

  1. Build the caster following its bag, stacking every spacer that came with it.
  2. Hold it under the caster mark and set the robot on the table.
  3. Look at it from the side, eye level with the table. The base should be level or tipped very slightly forward.
  4. Glue it down once the height looks right.
If the back sits too high and you have run out of spacers, put a square of thin cardboard under the caster instead. What you must not do is leave the nose pointing up, because then the sensors look out across the room rather than down at the table.

You are done when

Dusty sits on three points without rocking, and a gentle push sends it rolling straight and smooth.

4

Add the brain and the power

Weekend 1 · about 30 minutes

Now the electronics go on. Keep the battery switch OFF for this entire step.

DRIVER BOARD MICRO:BIT 4 x AA BATTERY PACK SITS OVER THE WHEELS POWER FRONT

TOP VIEW. HEAVY THINGS GO OVER THE WHEELS, NOT OUT AT THE ENDS.

  1. Check the battery switch is OFF.
  2. Stick the driver board near the front with double-sided foam tape.Tape, not glue. You will want to take this off again one day.
  3. Slide the micro:bit into the slot with the LED side and the buttons facing up.It only goes in one way. If it feels wrong, turn it over rather than pushing harder.
  4. Tape the battery pack on roughly over the wheels, switch facing out where you can reach it.
  5. Plug the battery into the driver board, still switched off.
  6. Now flip the switch on. The micro:bit should light up.Nothing? Switch off immediately and check the plug and the batteries.
Why weight placement matters. The battery pack weighs about 92 grams, which is most of the robot. Directly over the wheels it presses them into the table and they grip. Hung off the back it lifts the front, the sensors point at the ceiling, and nothing works.

You are done when

Flipping the switch lights up the micro:bit, and the robot still sits level with all the weight on board.

5

Wire the motors and make it drive

Weekend 1 · about 1 hour

First code of the project. The goal is small on purpose: forward, backward, and spin. No sensors yet.

DRIVER BOARD A B LEFT RIGHT RED AND BLACK · IF A WHEEL SPINS BACKWARD, FIX IT IN THE CODE

LEFT MOTOR TO A, RIGHT MOTOR TO B. WRITE IT DOWN SOMEWHERE.

  1. Switch the battery off.
  2. Plug the left motor into socket A and the right motor into socket B.
  3. Open MakeCode on the laptop and start a new project.
  4. Build the test program from the blocks below.
  5. Plug in the micro-USB cable and download the program onto the micro:bit.
  6. Unplug the cable, hold Dusty in the air, switch on, and press A.In the air, not on the table. It has no idea about edges yet.
on button A pressedRuns once each time you press the A button
motor A run at 40 % speed
motor B run at 40 % speed
pause 2000 msTwo seconds
motor A stop
motor B stop

What does 40% speed actually mean?

You cannot give a motor "a bit less electricity" easily. What the board does instead is switch the power fully on and fully off, hundreds of times every second. Leave it on 40% of the time and the motor behaves as if it is getting 40% of the power. This trick is called PWM, short for pulse width modulation.

It is exactly how a dimmer switch works, and how a phone screen changes brightness. The flicker is far too fast for eyes to catch.

40% is not random. It gives Dusty about 7 centimeters per second, slow enough to stop safely at an edge. Turning that number up is literally the experiment.

If a wheel spins the wrong way, do not rewire it. Change run at 40 % to run at -40 % for that motor. Fixing it in code takes three seconds and cannot come loose later.

You are done when

Pressed on the floor, Dusty drives forward in a straight line for two seconds and stops. That is Weekend 1 finished.

6

Build the sensor boom

Weekend 2 · about 45 minutes

This little stick is the most important part of the whole robot. It carries the sensors out in front of the wheels, and that head start is the only reason Dusty can stop in time.

TABLE EDGE 20 mm HEAD START 3 mm SIDE VIEW

TWENTY MILLIMETERS AHEAD, THREE MILLIMETERS UP. MEASURE BOTH.

  1. Cut a popsicle stick or strip of foam board about 40 mm long.
  2. Glue it to the underside of the front edge so it sticks out 20 mm past where the wheels touch.
  3. Glue one sensor near each end of the boom, facing straight down, roughly at the front corners.
  4. Set the robot on the table and measure the gap under each sensor. You want 3 mm.Two stacked business cards is very close to 3 mm if you have no feeler gauge.
  5. Shim with cardboard until both sensors sit at the same height.
  6. Press down gently on the boom. It should barely flex.A floppy boom changes the reading every time the robot bumps something. Brace it with a triangle of foam board if it moves.

What is infrared?

Light comes in lots of colors, and your eyes only pick up some of them. Just past red, there is more light your eyes simply cannot see. That is infrared.

TV remotes use it. So does the sensor that stops an automatic door closing on you. Dusty's sensor shines infrared straight down and measures how much bounces back, so it works in a dark room just as well as a bright one.

Here is the catch worth remembering: dark surfaces swallow infrared. A black placemat bounces almost nothing back, so Dusty thinks the table ended. That is not a bug in your robot, it is how light works, and Step 7 is where you deal with it.

You are done when

Both sensors sit 3 mm above the table, 20 mm ahead of the wheels, and the boom does not wobble when you nudge it.

7

Teach Dusty about edges

Weekend 2 · about 1.5 hours

The big one. By the end of this step Dusty stops itself at the edge of a real table, and you have the numbers written down to prove it.

  1. Wire each sensor to power, ground, and a pin. Left sensor to P0, right sensor to P1.
  2. Load the reading program below and watch the numbers scroll across the LEDs.
  3. Write down two numbers: what it reads on the table, and what it reads held over the edge.They should be far apart. On white paper, maybe 200 on the table and 900 over the edge.
  4. Add the calibration routine so Dusty works out its own threshold on whatever table it is sitting on.
  5. Add the stop-and-turn behavior.
  6. Test on a low table. Twenty approaches: ten straight on, five at an angle, five into a corner.
  7. Write down every single run in a notebook. Twenty out of twenty, or keep fixing.
on button A pressedCalibration. Hold Dusty still on the table, then press A.
set onTable to analog read pin P0
set threshold to onTable + 200Anything much brighter than the table means no table
show icon: yes
foreverThe main loop, running over and over
if analog read P0 > threshold or analog read P1 > threshold then
motor A stop, motor B stop
drive backward 400 ms
spin for pick random 300 to 900 ms
else
motor A and B run at 40 %

What does "analog" mean?

Some questions have two answers: is the button pressed, yes or no. That is digital, and computers love it.

Other questions have a whole range of answers: how much light came back? That is analog. The micro:bit turns it into a number from 0 to 1023, where 0 is none at all and 1023 is loads.

Analog is better here than a simple yes/no, because you get to pick where the line falls. And picking that line on the actual table you are using, instead of guessing once and hoping, is what calibration means.

Why calibrate at all?

A white paper tablecloth might read 200. Dark wood might read 650. If you hard-coded "over 500 means cliff" then Dusty would refuse to move on the dark table, convinced it was already falling.

So instead, Dusty looks at whatever surface it is sitting on, right now, and decides for itself what "normal" looks like. Everything much brighter than normal is a cliff. Same code, any table. That one idea is worth explaining to a judge.

Test on a low table first, and put a cushion on the floor. Your first few runs will have bugs, and a bug here means the robot drives off the edge.

You are done when

Twenty approaches out of twenty end with Dusty stopping and turning away, written down in the notebook. That is Weekend 2 finished.

8

Add the whisker

Weekend 2 · about 30 minutes

A second way of noticing the edge that works on a completely different principle, so the two cannot fail for the same reason.

TABLE IS THERE ARM PUSHED UP = CLICKED KEEP DRIVING TABLE IS GONE ARM DROPS = STOP EVERYTHING

IT IS NOT LOOKING AT ANYTHING. IT IS TOUCHING. COLOR CANNOT FOOL IT.

  1. Glue the switch under the front of the base, lever pointing forward and down.
  2. Bend a stiff wire so it rests on the table and holds the lever pressed up.
  3. Wire the C and NO legs to a pin and to ground.
  4. Add one line to the forever loop: if the whisker is not pressed, stop the motors.
  5. Test it with the sensors covered up with tape, so only the whisker is working.

Why two of everything?

The infrared sensor can be fooled by a black placemat. The whisker cannot, because it touches instead of looking. The whisker could be fooled by a placemat edge it slides over. The infrared would catch that instantly.

Engineers call this redundancy: two systems that fail for different reasons, so a problem that defeats one gets caught by the other. Planes have several of everything important for exactly this reason.

When a judge asks "what if the sensor is wrong?", this is the answer, and it is a really good one.

You are done when

With the infrared sensors taped over, Dusty still stops at the edge using nothing but the whisker.

9

Build the sweeper and the tray

Weekend 3 · about 2 hours

Up to now you have built a robot that avoids falling. Now it earns its name.

TABLE SPINS LIP TRAY CRUMBS GO UP AND BACK SIDE VIEW · EXACTLY HOW A DUSTPAN WORKS

THE BRUSH SPINS BACKWARD, NOT FORWARD. FORWARD THROWS CRUMBS OFF THE TABLE.

  1. Attach your brush to the motor shaft. Try three materials and keep notes on which grabs most.
  2. Mount the motor at the front so the bristles just barely touch the table.Barely. Pressed down hard, the brush stops the whole robot.
  3. Glue a lip about 8 mm tall just behind the brush, with a small gap underneath.
  4. Make the tray from a shallow container lid and tape it behind the lip so it slides out.
  5. Wire the brush motor straight to the battery through its own small switch.
  6. Check the spin direction. Crumbs must be flicked backward over the lip. Swap the two wires if it throws them forward.
  7. Test it properly: weigh out 5 grams of crushed cereal, run Dusty, then weigh the tray.
Keep the sensors ahead of the brush. A spinning brush sprays crumbs everywhere, and a single crumb sitting on a sensor blinds it completely. Sensors in front, brush behind. Always.

You are done when

You can say a real number out loud: "Dusty picked up 3.8 grams out of 5." That is Weekend 3 finished.

10

Two brains, then run the experiment

Weekend 4 · the whole day

The robot is finished. This weekend turns it into a science project, and this is the part the display board is actually about.

BUTTON A: RANDOM BOUNCE GOOD AT CORNERS, SLOW ON A PILE BUTTON B: SPIRAL GREAT ON A PILE, MISSES THE CORNERS

SAME ROBOT, TWO DIFFERENT IDEAS. RACE THEM AND SEE WHICH WINS.

  1. Put random bounce on button A and the expanding spiral on button B.
  2. Run the speed experiment. Four speeds: 25%, 50%, 75%, 100%. Twenty runs at each.
  3. For every run write down how far past the sensor it traveled before stopping, and whether it fell.Put a cushion on the floor. At 100% it is supposed to fall. That result is the answer, not a failure.
  4. Make the first chart: speed along the bottom, stopping distance up the side.
  5. Race the two patterns. Scatter the same measured pile of cereal, time each one until the table is clean, three tries each.
  6. Make the second chart comparing the two patterns.
  7. Try three surfaces if there is time: white paper, bare wood, black placemat.

Why the falling is the good part

Your prediction was that somewhere past half speed, Dusty needs more room to stop than the 20 mm head start it has, and goes over the edge.

If that happens, you did not fail. You predicted a thing using arithmetic, then tested it, and the world agreed with you. That is the entire job of science, and it is much more interesting than a robot that just works.

The one number a judge will remember is the crossing point: the fastest speed where Dusty still stopped every single time. Put that number in big type on the board.

You are done when

You have a filled-in data table and two charts drawn from your own numbers. That is Weekend 4, and the project is basically won.

When it misbehaves

Fixing it

Everything here has happened to somebody. Find the symptom, try the fix.

What you seeMost likely causeWhat to do
Nothing happens at allPowerSwitch on? Batteries the right way round? Plug pushed fully in? Try fresh batteries.
Drives in a curveMotors not parallelSight down the front. If they look fine, one motor may be slower; trim its speed by a few percent in code.
One wheel goes backwardWires swappedDo not rewire. Make that motor's speed negative in the code.
Refuses to move at all, sensors litDark surfaceIt thinks it is already at a cliff. Recalibrate on that table with button A.
Falls off despite the sensorsToo fast, or boom movedLower the speed. Re-measure the 3 mm gap and the 20 mm overhang.
Stops randomly in the middleLoose wire or a crumbWiggle each wire with the power off. Wipe the sensor faces.
Brush spins, catches nothingHeight or directionBristles should just kiss the table. Check it flicks backward, not forward.
Gets slower as you testBatteries drainingNormal. Use fresh batteries for every measured run so the experiment is fair.
micro:bit will not take the codeCableMany micro-USB cables are charge-only. Borrow one you know moves data.

Words to know

Say these like you mean them

Judges ask what words mean. Here they are in one place.

MicrocontrollerA tiny computer that does one job forever, using barely any power.
H-bridgeFour switches that let a motor spin either direction. Inside the driver board.
InfraredLight just past red that eyes cannot see. TV remotes use it.
Gear ratioTrading spinning speed for pushing strength. 1:298 means 298 motor turns per wheel turn.
PWMFlicking power on and off very fast to make a motor run slower.
AnalogA measurement with a whole range of answers, not just yes or no.
CalibrationLetting the robot measure its own surroundings instead of guessing in advance.
Differential driveSteering by running two wheels at different speeds, with no steering wheel at all.
RedundancyTwo systems that fail for different reasons, so one catches what the other misses.
ThresholdThe line you draw in a measurement: above this means cliff, below means table.

Everything else

The other pages