Bozoma Innovation Hub · Arduino Ladder · Band 1
Signal Tower
Your first real circuit. You will learn how a breadboard works, wire up three lights, and build a signal that someone else can understand without you explaining it.
About 6 hours. Take it in pieces. Finish Band 0 first, because this band assumes you can already upload a sketch.
Choose your build
- CoreSignal Towerthe three-light sequence you design. This page. Everybody builds this one.
- SwapThe traffic light moduleThe same sequence you built by hand, on a module with four wires. Then find the resistors somebody fitted for you.
- BenchUsing a multimeterFour measurements on a circuit you already built, the one mistake that blows the fuse, and how to turn the board itself into a voltmeter until your meter arrives.
- BenchOhm's law, and checking this courseOne line of arithmetic that turns four of this course's warnings from rules you believe into results you can check.
- BenchSeries and parallelThe two ways to join anything to anything. One of them is what every build in this course already is, and nobody has said so until now.
Swap means build it instead of the one on this page: it teaches the same things and leaves you just as ready for the next band. Everything else on this page still applies, including the Check yourself questions. Practice is short, comes after the core, and gives you no sketch: the job, the check, and the code is yours. Bench is not a build at all: it is an instrument or an idea, done once, and everything after it is easier for having done it.
Sketches for this band
Click one to save it, or get every sketch at once from the downloads page. Each file opens with a plain-English header telling you what it does and how to wire it.
What this band is for
In Band 0 the light was already built into the board. Here you build the light yourself, out of separate parts, on a breadboard. That is a much bigger step than it sounds, because now things can go wrong in two places instead of one: the code, or the wiring.
Most of the time in this band, it will be the wiring. That is normal. There is a checklist at the end that finds nearly every wiring fault, and you should learn to use it before you start guessing.
What you need
- Your Arduino board and USB cable
- The breadboard from your kit
- Three LEDs: red, yellow and green if you have them. Any three colours will do.
- Three resistors of 220 ohms. The stripes read red, red, brown. Anything from 200 up to about 470 ohms also works, and the light is just slightly dimmer.
- Seven jumper wires, the kind with a stiff pin at both ends. Kits often contain wires with a socket at one end instead. Those are for something else and will not go into a breadboard.
- Card, scissors and tape for the housing at the end
By the end you will be able to
- Explain what a breadboard does and which holes are joined to which
- Build a working light circuit and say why the resistor has to be there
- Tell the two legs of an LED apart and know which way round it goes
- Control three pins in an order you designed
- Use names instead of numbers in your code, and say what that gets you
- Find a fault in code that has no error message at all
The rule that matters most in this band
Unplug the USB cable before you change any wiring. Plug it back in when you are done. Build it, look at it, then give it power. Every single time. It costs you four seconds and it is the difference between a mistake and a dead board.
What electricity is doing, in plain words
15 minYou do not need physics for this course. You need one correct picture in your head. Get this picture right now and half the confusion later never happens.
The rope activity
This takes fifteen minutes and it is worth every one of them. Read the whole activity once before you start, so you know where it is going.
What you need
Something long and bendy that you can tie. Any of these work:
- A skipping rope
- A phone charger cable or any long cable
- A shoelace, or two shoelaces knotted together
- A strip of cloth torn from an old shirt
- String, or thin rope
For the group version you want it about as long as you are tall. For the solo version, about as long as your arm is enough.
You also need a marker: a small piece of tape, a bit of paper tied on, or a knot of a different colour. This is important, so do not skip it. It is the only way to see what the rope is actually doing.
Step one: make the loop
Tie the two ends of the rope together so it becomes a closed ring with no ends. Any knot will do as long as it holds when you pull. Two ordinary knots tied one on top of the other is plenty.
Then tie your marker onto the ring somewhere.
Step two, group version: two or three other people
Stand in a triangle, about an arm's length apart, all facing inwards towards the middle.
Everybody takes hold of the rope with both hands, about a hand's width apart, so the ring is stretched between you into a rough triangle. Do not pull it tight. It should be loose enough to slide through your fingers.
Agree which way round the rope is going to travel. Say it out loud: "the rope goes this way," and point. Everybody must agree before you start.
Now move the rope round. Here is the actual hand motion.
Say you agreed the rope travels to your left. Then:
- Your right hand grips the rope and pulls it towards your left.
- Your left hand stays loose and lets the rope slide through it.
- When your right hand runs out of room, let go with it, reach back to the right, grip again, and pull again.
That is what "hand over hand" means. It is the same motion as pulling a bucket up from a well, except the rope does not pile up at your feet. It carries on round the ring to the next person.
Everybody does this at the same time, in the same direction, at about the same speed.
Step two, solo version: on your own
Hook the loop over something fixed, so one side of the ring is held for you. The back of a chair, a door handle, or your own foot all work.
Hold the hanging part of the loop with both hands, one hand on each side of the ring, so it hangs like the letter O.
Pull it round, hand over hand. Right hand grips and pulls down. Left hand stays loose and feeds up. Let go with the right, reach up, grip again, pull down again.
Step three: the three things to try
Now that the rope is moving, do these one at a time and watch the marker each time.
Just keep it moving normally.
That movement is what electricity does in a circuit. We call it current.
Now squeeze. One person closes their loose hand a little tighter, so the rope drags as it slides through. Not enough to stop it. Just enough to make it hard work. Everybody else keeps pulling exactly as before.
That squeeze is resistance: something making it harder for the current to move.
Now untie the knot, so the ring becomes an ordinary piece of rope with two loose ends again. Then try to keep pulling it round.
That is a broken circuit. If the ring is not complete, nothing moves anywhere in it.
Answer this before you go on. It is the whole point of the activity.
When the rope was squeezed and slowed down, what did the marker do?
Did it travel at normal speed until it reached the squeezing hand, and only slow down after that? Or did it slow down straight away, wherever it happened to be?
The answer, and why it matters so much
It slowed down straight away, wherever it was. The whole ring slowed down at the same moment.
That has to be true, because the rope is one connected ring. If one part of it slows, every part of it slows, because it is all the same rope.
Now here is why this matters. Nearly everybody starts out believing that electricity gets used up as it travels, so there is less of it after a light than before it. That belief leads straight to a wrong conclusion: that the resistor must come before the light in order to protect it.
It does not. The current is the same everywhere in a simple loop, exactly like the rope. You will prove this to yourself later in this band by moving the resistor to the other side of the LED and watching absolutely nothing change.
The second activity: read your own badge
Your band colour is brown. Brown is the code for the number 1, and Band 1 is where you are. That is not a coincidence. Resistors carry their value written on them in coloured stripes, and the nine bands of this course are named after the first nine colours of that code.
Find the 220 ohm resistors in your kit. Look at the stripes. On most 220 ohm resistors you will see red, red, brown, then a gap, then a gold stripe. Some kits use a five-stripe version which reads red, red, black, black, brown.
Write down the stripe colours you actually see on yours. From now on, find resistors by reading them rather than by guessing from the size, because all resistors look almost the same.
If your kit came with a paper listing the parts, it will usually say which packet is which. Use it to check that you picked the right ones.
Words to know
- circuit
- A complete loop that electricity can travel round. If the loop is broken anywhere, nothing works.
- current
- Electricity moving round the loop. It is not used up. The same amount passes every point.
- resistance
- How much something slows the current down.
- ohm
- The unit resistance is measured in. Written Ω. A 220 ohm resistor is written 220 Ω.
- ground
- The end of the loop, where current returns to the board. The pins marked GND.
- short circuit
- When current finds a way back to ground without passing through anything that slows it down. This is the dangerous one. It is what happens if you join 5V straight to GND.
How a breadboard works
20 minFirst, put it down the right way round
Everything in this band names holes by row and column, and that only works if your board is the same way round as the picture.
Put the breadboard flat on the table with its long edges towards you, so it is wider than it is tall.
Check the long coloured lines run left to right, along the top edge and along the bottom edge. Those are the rails.
Put the Arduino to the left of it, or above it. Anywhere your jumper wires can reach.
So when this band says "the − rail", it means one particular one, and everything in a build has to use the same one. In Band 1 that is the − rail along the top edge: of the two strips up there, it is the inner one, the one closest to the main block of holes. (Further down this page the rows get letters, and that inner strip is the one nearest row j. Come back and check this box once you have read that bit.) If you put one wire on the top − rail and another on the bottom one, nothing will work and nothing will look wrong.
A breadboard is a plastic block full of small holes. Inside it, some of those holes are already joined together by metal strips you cannot see.
That is the entire idea. You push component legs and wires into holes, and any two things in the same joined group are now connected to each other. No soldering, no glue, and you can pull it apart and start again.
The only thing you have to learn is which holes are joined to which. Get that wrong and nothing works, and nothing looks wrong either.
The three rules
- Five holes in a column are joined. Look at the middle of the board. The holes are arranged in columns. In each column, the group of five holes on one side of the middle channel is joined together. If you put a wire in one of those five and a leg in another, they are connected.
- The long lines at the edges are joined all the way along. These are called the rails. There is usually a red line with a
+beside one and a blue or black line with a−beside the other. Every hole along one rail is joined to every other hole in the same rail. Rails are for things that many parts need to share, like ground. - Nothing crosses the middle channel. The gap down the centre is a wall. The group of five above it and the group of five below it are separate, even though they look like they are in a line.
How we will describe holes
The columns are numbered along the long edge: column 1 is at the left-hand end when the board is in front of you the long way round, then 2, 3 and so on to the right. The rows are lettered down the short side: j i h g f above the channel, and e d c b a below it, so row j is the top row and row a is the bottom row.
So hole f5 means row f, column 5. And because f, g, h, i and j in column 5 are all one joined group, putting something in f5 is the same as putting it in j5. They are the same connection.
Not every breadboard prints the letters and numbers, and some print them the other way up. What matters is the pattern, not the labels.
Put the board down the right way round as above. Now count the columns from the left: that is 1, 2, 3 and so on. And name the rows from the top down: j, i, h, g, f, then the channel, then e, d, c, b, a.
Write those on a strip of paper and lay it beside the board. It takes two minutes and it saves you the whole band.
Check you have understood, before you build anything
Answer these three on paper.
- Are holes
f5andh5joined? - Are holes
f5andf6joined? - Are holes
e5andf5joined?
Answers
1. Yes. Same column, same side of the channel, so they are in the same group of five.
2. No. Different columns. Column 5 and column 6 are separate groups.
3. No. This is the one that catches people. They are in the same column and they look like they are in a line, but the channel runs between them. Row e is below the channel and row f is above it.
If you got any of these wrong, read the three rules again now. Almost every wiring problem in this course comes back to them.
The parts, and how to handle them
25 minTwo parts, and three physical skills you will use in every band from here to the end of the course. The skills take five minutes to learn and save you hours.
The LED
LED stands for light emitting diode. It is a small light. The important thing about it is that it only works one way round. Put it in backwards and nothing happens at all. It does not break, it just does not light.
You can tell which way round it goes in two ways.
- The legs are different lengths. The long leg is the side electricity goes in. It faces the pin. The short leg is where electricity comes out. It faces ground.
- The rim is flat on one side. Look at the bottom edge of the plastic dome. One side is flat rather than round. The flat side is next to the short leg. This is useful when somebody has already trimmed the legs to the same length.
A way to remember it: long leg goes to the pin, short leg goes to ground. Say it once or twice now. It is the most common mistake in this band, so if a light does not come on, turn the LED round before you do anything else.
The resistor
A resistor slows the current down. It has no direction, so it goes in either way round.
Why an LED needs one: an LED will take as much current as it can get. Connect it straight to a pin with nothing to slow it down and it takes far more than it can handle, gets hot, and burns out in seconds. The resistor limits how much gets through, and the LED lives.
Never connect an LED without a resistor. Not even for a quick test.
Reading the stripes
All resistors look almost identical. The only way to tell them apart is the coloured stripes, so learn to read them now rather than guessing.
Turn the resistor so the gold or silver stripe is on the RIGHT. That stripe sits slightly apart from the others, with a wider gap before it. If yours has no gold or silver stripe, put the widest gap on the right.
Now read the other stripes from left to right.
If your kit came with a paper listing the parts, it usually says which packet is which. Use it to check.
Why 220 ohms
A rough answer is enough for now. The board supplies 5 volts. An LED is comfortable with about 15 thousandths of an amp, which is the unit we measure current in. Working out what resistance gives roughly that lands you somewhere between 200 and 330 ohms, and 220 is a common value in that range.
You do not have to do that arithmetic to finish this course. For now, anything from 200 to about 470 ohms works fine and the light is just a little dimmer at the top end. If you ever want to work it out yourself, the sum is Ohm’s law, and it is worth looking up once you are comfortable with everything in Band 4.
The three skills
Skill one: bending the legs
This is the step nobody tells you about, and it stops more beginners than anything else.
A resistor arrives with two long straight legs pointing out sideways, like a tiny dumbbell. It will not go into a breadboard in that shape. You have to bend both legs down first.
Hold the body of the resistor between one thumb and finger.
With your other hand, bend one leg straight down, right where it leaves the body, so it makes a right angle. Use your fingers. You do not need pliers.
Do the same to the other leg, bending it down the same way.
LEDs usually do not need bending, because their legs already point down. If an LED's legs are too close together for the two holes you need, spread them apart gently, holding the plastic body, not the legs.
Skill two: pushing a part in, and knowing it went in
Line the legs up over the holes first, before you push anything. Look from directly above.
Push straight down, not at an angle. Push on the plastic body or the resistor body, never on the middle of a bare leg.
Push until it stops. It takes a firmer press than you expect. You will feel a little resistance and then a grip.
Skill three: taking a part out again
You will move things constantly. Doing it wrong slowly destroys your parts.
- Pull by the body, never by one leg. Pulling one leg bends it and eventually breaks it off.
- Pull straight up, rocking very slightly side to side if it is tight.
- For an LED, hold the plastic dome, not the legs.
- For a jumper wire, hold the stiff plastic end, not the soft wire. Pulling the soft part will eventually tear the wire out of its plug.
Words to know
- LED
- A small light that only works one way round.
- long leg
- The leg of an LED that faces the pin. Electricity goes in here.
- short leg
- The leg of an LED that faces ground. The rim is flat on this side.
- resistor
- A part that slows current down, so the LED is not destroyed. Works either way round.
- amp
- The unit we measure current in. An LED wants about 15 thousandths of one.
- volt
- The unit we measure the push of electricity in. Your board supplies 5 of them.
- jumper wire
- A short wire with a stiff pin at each end, for joining holes on the breadboard to pins on the board.
- seated
- Pushed fully into a hole and gripped by it. A part that is not seated is not connected.
Read the code before you build
8 minHere is the sketch for the first circuit. Read it and answer the questions before you touch anything.
b1_01_one_led_given.inoint lampPin = 8;
void setup() {
pinMode(lampPin, OUTPUT);
}
void loop() {
digitalWrite(lampPin, HIGH);
delay(400);
digitalWrite(lampPin, LOW);
delay(1600);
}
Everything here you met in Band 0, except the first line, which you saw in the worked example. int lampPin = 8; makes a name called lampPin and puts the number 8 in it. Everywhere below, lampPin means 8.
Write your answers down first
- How long is the light on for? How long is it off for?
- Out of every full round, what fraction of the time is it lit? A quarter? A half? Something else?
- The circuit will be: pin 8, then the resistor, then the LED, then ground. If you moved the resistor so it sat between the LED and ground instead, what would change?
- The sketch would work exactly the same if you deleted
lampPinand just wrote 8 everywhere. So why is it there?
Build one light
30 minHere is what you are building. Follow the picture first, then the steps.
Put the LED in. Long leg into hole f5. Short leg into hole f6.
The two legs must be in different columns. If both legs end up in the same column they are joined to each other, the current skips the LED entirely, and it will never light.
Bend the resistor's legs first, as in Part 3, skill one. Then put one leg into hole j5 and the other into hole j3.
Hole j5 is in the same column as f5, so the resistor is now joined to the LED's long leg. That is the connection you want. Either way round is fine for a resistor.
Wire from the board to the resistor. One end of a jumper wire into hole h3, the other end into digital pin 8 on the Arduino.
h3 reaches the resistor leg in j3 just as surely as if they shared a hole. When a hole you want is already taken, use another hole in the same column.Wire from the LED to the rail. One end of a jumper wire into hole j6, the other end into any hole on the − rail, the long strip running left to right along the top edge.
Hole j6 is in the same column as f6, so this connects the LED's short leg to the rail.
Wire from the rail to the board. One end into any other hole on the same − rail, the other end into a GND pin on the Arduino.
There is more than one GND pin. Any of them works. This wire is what closes the loop.
Check it before you plug in. Look at the whole thing and say each connection out loud: pin 8, to resistor, to LED long leg, out of short leg, to rail, to GND.
Plug in the USB cable. Open b1_01_one_led_given.ino. Upload it.
Check your four answers from Part 4. Mark each right or wrong.
Now test the thing you were asked to predict
Question 3 asked what would change if the resistor were on the other side of the LED. Find out.
Here are the exact holes, so you are changing the circuit and not guessing at it. Unplug the USB first.
Take out the resistor and the wire that runs from j6 to the − rail.
Move the pin wire. Take the wire out of h3 and put it into h5 instead. Pin 8 is now joined straight to the LED's long leg, with nothing in between.
Put the resistor on the other side. One leg into j6, the other into j8.
Wire from h8 to the − rail. (Same column as j8, different hole, because j8 now has the resistor leg in it.) Now the order round the loop is: pin 8, LED, resistor, rail, GND.
Plug back in and watch.
What you should have found
Nothing changes. The light behaves exactly the same.
This is the rope activity again. The current is the same all the way round the loop, so it does not matter where in the loop you put the thing that slows it down. Anywhere in the loop protects the LED equally.
Now put it back the way it was before you carry on, so the rest of the instructions match your board: resistor from j5 to j3, wire from h3 to pin 8, wire from j6 to the − rail.
Build all three
45 minSame idea, three times over. The one new idea is that all three lights share a single return path back to the board.
Two rules that will save you an hour
- Every LED needs its own resistor. Not one resistor shared between them. Three LEDs, three resistors.
- They all share one ground. Every short leg goes to the same − rail, and one single wire takes that rail to one GND pin. You do not need three ground wires.
Start from what you already built. Your Part 5 light is already in the right holes to become the red one. Leave the LED at f5 and f6, and its resistor at j5 to j3. Move the wire from pin 8 to pin 9, and leave the other two wires alone: the one from j6 to the − rail, and the one from the − rail to GND.
If you have already taken it apart, no problem. Just build the red light from scratch with the next step.
Red light. LED long leg into f5, short leg into f6. Resistor from j5 to j3. Wire from h3 to pin 9. Wire from j6 to the − rail.
Yellow light. LED long leg into f10, short leg into f11. Resistor from j10 to j8. Wire from h8 to pin 8. Wire from j11 to the − rail.
Green light. LED long leg into f15, short leg into f16. Resistor from j15 to j13. Wire from h13 to pin 7. Wire from j16 to the − rail.
One ground wire. From any hole on the − rail to a GND pin on the Arduino.
Check every connection out loud, then plug in the USB cable.
Open b1_02_signal_hardcoded.ino and upload it.
Now read the sketch you just ran
b1_02_signal_hardcoded.inovoid setup() {
pinMode(9, OUTPUT);
pinMode(8, OUTPUT);
pinMode(7, OUTPUT);
}
void loop() {
digitalWrite(9, HIGH);
digitalWrite(8, LOW);
digitalWrite(7, LOW);
delay(5000);
digitalWrite(9, HIGH);
digitalWrite(8, HIGH);
digitalWrite(7, LOW);
delay(1500);
digitalWrite(9, LOW);
digitalWrite(8, LOW);
digitalWrite(7, HIGH);
delay(5000);
digitalWrite(9, LOW);
digitalWrite(8, HIGH);
digitalWrite(7, LOW);
delay(1500);
}
Look at the shape of it. There are four blocks, and every block has exactly the same form: three digitalWrite lines, then one delay.
Each block is one state. A state is one complete situation: what all three lights are doing, and for how long.
Notice that every block says something about all three lights, including the ones that should be off. That looks like extra typing. It is deliberate, and there is a question about it in the next part.
Words to know
- state
- One complete situation the whole circuit can be in. This signal has four states.
- shared ground
- One return path back to GND that several parts all use.
- rail
- One of the long lines along the edge of the breadboard, joined all the way along.
Look closer
25 mina. Follow the code by hand
Copy this table onto paper and fill it in for one full round of b1_02. Then add up the four times and say how long a complete round takes.
| State | Red | Yellow | Green | How long | What it means |
|---|---|---|---|---|---|
| 1 | on | off | off | 5000 ms | stop |
| 2 | |||||
| 3 | |||||
| 4 |
Check your table
State 2: red on, yellow on, green off, 1500 ms, get ready. State 3: red off, yellow off, green on, 5000 ms, go. State 4: red off, yellow on, green off, 1500 ms, about to stop.
A full round takes 5000 + 1500 + 5000 + 1500 = 13000 milliseconds, which is 13 seconds.
b. Find a fault with no error message
Open b1_04_buggy_silent.ino and upload it. It will compile with no error. It will upload with no error. The wiring is correct. And the green light never comes on.
Here is the third block of its loop:
digitalWrite(6, HIGH);
delay(1000);
digitalWrite(6, LOW);
Find the fault by reading. Do not touch the breadboard. Look at the top of the sketch where the names are made, and compare.
Answer
At the top the sketch says int greenPin = 7; and setup sets up pin 7 properly. But this block writes to pin 6, which has nothing connected to it.
Nothing is against the rules about that. Pin 6 is a real pin. The computer has no way of knowing you did not mean it. So it says nothing and does exactly what you asked.
The lesson: a program that compiles is a program with no spelling mistakes. It is not the same as a program that is right. This is your first fault the computer cannot help you find, and there will be many more. From here on, when something behaves wrongly but shows no error, suspect a number.
c. Put the states in order
Imagine the four state blocks of b1_02 have been cut out and shuffled. Put them back into an order that would be safe at a real road crossing, and write one sentence saying why you chose that order.
There is more than one reasonable answer. The sentence is the part that counts.
d. Explain one line
In state 1, there is a line that says digitalWrite(8, LOW);. It switches off the yellow light. But in state 1 the yellow light is already off. So why is that line there at all?
Answer
On the very first round it does nothing, exactly as you noticed.
On every round after that, it is the line that turns the yellow light off after state 4 left it on.
Here is the idea underneath, and it is important: a pin stays however you last set it. It holds that setting for as long as the board has power. Nothing resets when loop comes round again. If you never tell a pin to go off, it stays on forever.
Writing out all three lights in every state, even the ones that are already correct, is a habit that prevents a whole family of bugs. People who only write the changes meet those bugs at Band 3 and lose an evening to them.
Change it, and measure the difference
30 minThis part contains the most useful thing in the whole band, and it is disguised as a boring task. Do it properly.
- Bronze
- Move the yellow light from pin 8 to pin 12. Do it in
b1_02first. Count every line you had to edit, and write the number down. Then do exactly the same job inb1_03_signal_variables.inoand write that number down too. Move the wire on your board from pin 8 to pin 12 as well, so the tower still works. (Pin 6 is deliberately left empty. Part 7b needs it that way.) - Silver
- Add a warning state at the very start: all three lights on together for one second, then carry on into the normal sequence.
- Gold
- Make the yellow light blink three times during state 2 instead of staying on solidly, without changing how long state 2 lasts in total.
Here is the top of the second sketch. Everything below it is the same as b1_02, except that it uses these names instead of the numbers.
int redPin = 9;
int yellowPin = 8;
int greenPin = 7;
int stopTime = 5000;
int changeTime = 1500;
int goTime = 5000;
Your two numbers from Bronze are the lesson
In b1_02 the number 8 appears five times: once in setup, and once in every one of the four states. Miss a single one and the sequence breaks in a way that is very hard to spot, because three of the four states still look right.
In b1_03 it appears once, at the top, next to a name that says what it is for.
Five edits against one. Nobody has to tell you why giving your numbers names is worth the typing, because you counted it yourself.
Write both numbers in your build log, along with one sentence saying which version you would rather be handed in six months' time when you have forgotten how it works.
A hint for Gold, if you are stuck
State 2 lasts 1500 milliseconds in total. If the yellow light needs to blink three times inside that, work out how long each on and each off can be so that they add up to 1500.
Three blinks means three on periods and three off periods, so six pieces in total. 1500 divided by 6 is 250. So: yellow on for 250, off for 250, and repeat that three times. Remember the red light must stay on the whole way through.
Make: a signal somebody actually needs
120 minWhat to build
A three-light signal for a real situation you can point at. Choose one of these, or bring your own idea:
- A crossing outside a school
- A borehole pump light: off, starting, running
- An exam hall timer: plenty of time, five minutes left, stop writing
- A clinic queue light: wait, next patient, closed
- A phone charging kiosk: free, busy, full
It is finished when all of these are true
- It has three states that a stranger can work out without you explaining them
- You can say in one sentence why each timing is the length it is. Why five seconds and not two?
- Every timing and every pin number is held in a name at the top of the sketch, not written into the middle of the code
- It is housed in a card tower that stands up on its own
- It still works after you carry it across the room. Unplug it from the laptop, plug it into a phone charger or a power bank, and carry it. Your program stays on the board, exactly as you proved in Band 0.
Building the housing
You do not need anything fancy. A cereal box, the side of any cardboard box, or a piece of stiff card is enough.
Cut a rectangle of card about the size of your hand with fingers spread, roughly 20 cm tall and 10 cm wide. It only has to be big enough for three lights in a row and stiff enough to stand.
Mark three dots down the middle, about 4 cm apart, with a good gap above the top one and below the bottom one.
Make the holes. Scissors will not start a small hole in the middle of card. Push the point of a pen, a nail or a skewer through each dot first, then twist it round to widen the hole until an LED head just fits. About 5 mm across.
Push each LED through from the back, so the coloured head pokes out of the front and the legs stay behind the card. You will need to pull the LEDs out of the breadboard to do this, then push their legs back into the same holes afterwards.
Make it stand up. Two easy ways. Either fold the card into a triangular tube, by folding it into three along its height and taping the last edge to the first. Or cut a second piece of card, fold a flap at the bottom of each, and tape them together at right angles like a photo frame stand.
Tape the breadboard to the back, and tape the wires down too so nothing is hanging and pulling.
A wire pulled half out is the most annoying fault there is. It works when you press it and fails when you let go, so it looks like a code problem when it is not.
Test it on somebody
Find one person who was not there while you built it. Do not tell them what it is. Show it to them and ask: what do you think this is telling you?
Write down what they actually said, in their words, not what you were hoping they would say.
If they got it wrong, that is not a failure. That is a finding, and it is worth more than a working build. Write down what you would change, and if you have time, change it and test again.
Show your work
Post a photo of the tower, a video of the full sequence, and the sentence your tester said. Then look at one other person's sketch and leave them one useful comment: something you would have done differently, and why.
b1_02_signal_hardcoded.ino instead. It is somebody else's code and it has a real weakness. Find one thing you would change about it and write down why. That is the same exercise.Check yourself
15 minCode you have not seen. Answer from reading only.
int a = 10;
int b = 11;
int wait = 300;
void setup() {
pinMode(a, OUTPUT);
pinMode(b, OUTPUT);
}
void loop() {
digitalWrite(a, HIGH);
digitalWrite(b, LOW);
delay(wait);
digitalWrite(a, LOW);
digitalWrite(b, HIGH);
delay(wait);
}
- Two LEDs are wired to pins 10 and 11. Describe in one sentence what someone watching them would see.
- Is there ever a moment when both are lit? How can you tell from the code alone?
- Change one line so that LED
astays on twice as long as LEDb. Which line, and what does it become? waitis used in two places. Name one good thing about that and one bad thing about it.- Somebody deletes the line
pinMode(b, OUTPUT);. What are you likely to see, and why is this harder to work out than an error message? - Both LEDs have been put in with their long legs towards GND. What will you see, and why is this not a problem with the code?
Answers
1. The two lights take it in turns, changing about three times a second, and one of them is always on.
2. To someone watching, no. Each block switches one on and the other off with nothing in between. Strictly, there is a moment: on every round after the first, a is switched on while b is still on from last time, until the next line switches b off a few millionths of a second later. That is the same pin-holds-its-setting idea from Part 7d. Either answer is fine. The better answer reasons from what the pins are holding rather than from what the eye can see.
3. Change the first delay(wait); to delay(wait * 2);. Or make a second name with a different value. Both are good. The strongest answer notices that using wait for both delays is exactly what makes this awkward, which is question 4.
4. Good: one edit changes the whole rhythm at once. Bad: the two timings are now stuck together and you cannot change one without changing the other. Deciding what to give a name to is really a decision about what should move together.
5. The LED on pin 11 will be off, or glowing very faintly. Without pinMode the pin is still an input, and switching on an input pin does something different: it turns on a small resistor inside the chip that lets through only a tiny trickle. It is harder than an error message because nothing tells you anything at all. It looks exactly like a dead LED or a loose wire, so people rewire a perfectly good circuit for twenty minutes.
6. Neither light comes on. An LED only works one way round and both are now backwards. It is not a code problem because the code is doing exactly what it says. This is the question that matters most in this band. If your first instinct was to go and look at the sketch, that instinct is what this question is testing. In this band, most faults are physical.
When a light will not come on
Work down this list in order. Do not skip and do not guess. Six of the seven faults below can be seen in a photograph, which is why the first thing to do when you are stuck is photograph your board.
| Check | What is wrong | How to tell |
|---|---|---|
| 1. Which way round is the LED? | Long leg must be on the pin side, short leg towards GND | By far the most common fault. Turn it round before you do anything else. It costs nothing to try. |
| 2. Are both LED legs in the same column? | They are joined to each other, so the current skips the LED | The light will never come on and nothing looks wrong. The legs must be in two different columns. |
| 3. Are any bare legs touching? | Two metal legs in contact behave as one connection | Look for crossed legs lying against each other, especially where they bend over near the board edge. |
| 4. Is anything across the middle channel? | Two holes that look next to each other but sit on opposite sides of the channel | Look along the channel from the side. Row e and row f are not connected. |
| 5. Does the − rail reach a GND pin? | Everything returns to the rail, but the rail goes nowhere | One missing wire stops all the lights at once. If nothing at all works, check this before anything else. |
| 6. Is every leg pushed fully in? | A bent leg resting in a hole instead of gripped by it | It works when you press it and stops when you let go. Push every leg all the way home. |
| 7. Only now, look at the code | Wrong pin number, a missing pinMode, or a state you forgot to write | Look at the sketch last. In this band, most faults are in the wiring. |
Still stuck after 30 minutes?
Stop. Take a photo of the breadboard from directly above, in good light, with the whole board in the picture. Post the photo, your sketch, and one sentence saying what you expected and what happened instead.
Do not rebuild it before you ask. A rebuilt board has thrown away the evidence, and now nobody can help you.
What you know now
You can read a breadboard. You can build a circuit that works and explain why each part is in it. You have met a bug that the computer could not find for you, and you found it by reading. And you have measured for yourself why naming your numbers is worth the effort.
Before you move on, make sure you have
- Your signal tower, working and housed, with a video of the full sequence
- The sentence your tester said, in their words
- Your two numbers from Bronze
- Your completed state table from Part 7a
- Your build log for this band
- Five or six correct answers in Part 10, including question 6
Next is Band 2: Mood Lamp. So far your lights have only been fully on or fully off. Next you get everything in between, and colour.
Ship it
One video under sixty seconds, and one post of five lines. The video is the same one this band already asks you for as evidence, so this is not extra work. It is the same work, done once, somewhere a person can see it.
The four shots: three seconds of the thing sitting still, fifteen of you doing something to it, fifteen of it responding all the way to the end, and ten of the honest bit, which is your measurement or the wire that was wrong the first time.
The line worth writing in the post: why you write all three lights every time, including the ones staying off.
Show your work has the five-line template, a
worked example, and the three checks to make before anything goes public. Tag it
#BozomaBuilds so all nine of yours sit together.