Process in Practise: Arduino Traffic Lights

“Should designers code?”

This is a debate that I often see on the blogosphere, pondered more by designers than great questions such as “what is the meaning of life” and “do aliens exist?”. And whilst I don’t feel that I can contribute a concise solid argument, or for that matter, want to contribute something to it, it has made me think a lot recently.

For the physical product designer, I’d argue that there is one pretty good motivation to take up Arduino coding. “Make stupid stuff” is one of the main lessons that resonated with me last year in the Design Enterprise module in a talk by Ryan McLeod. The message is pretty simple, make stupid stuff, even if it doesn’t work well. Do it for you and make it however you want — at the end of the day, you’re going to learn something new about your trade.

Not only that, but it will breed a love of design. It doesn’t have to be “work”, or have any pressure attached to it — it just needs to be enjoyable. At the end of the day, coding, by many of my peers (including myself), is seen as a horrible time in the design process where they have to open up Arduino and sob into a breadboard for a week solid. Yet it doesn’t need to be this way, it can be better, can’t it?

Despite not wanting to answer the question “should designers code”, maybe a way to rephrase it should be that “should designers make more stupid stuff.” But why am I asking that now?

After a semester of making the right thing, it’s getting to that time where I need to start making the right thing right. The prototyping process is a long process of making stupid stuff, and because of that, it’s important to play and have fun. That means playing with blue foam, lego, wood, wire, anything — you name it, you can play with it.

I began to wonder, how can I apply learning how to code quite simply in my prototyping practise as well? As my project is currently looking at Smart Cities, I thought it would be fun to mock up a Lego city and code into it some simple traffic lights, just to show how Arduino can be applied.

For anyone who’s interested in learning how to code, then this will really give you an insight into some basic coding. It’s important to remember to experiment, have fun and don’t be afraid to mess up. It’s better to fail fast and learn from it straight away.

The simplest thing I could show you is how to turn a light on using a button, but that’s almost too simple. As an unexperienced coder myself, I wanted to throw myself into somewhere that I wasn’t too certain about.


The equipment needed to complete this walkthrough is an Arduino and cable, a breadboard, insulated cable, wire strippers (teeth can also be used), a potentiometer, a computer running the Arduino IDE (get it here), and 3 LED’s, green, yellow, and red. Unless you live on some distant planet with blue, purple and brown traffic lights.

Soldering wire and a soldering iron are not necessary, but recommended if you want to be able to free yourself from the breadboard.

Coding and setup

As I am an unexperienced coder, this took a few attempts to get right. Learning code is quite literally learning a different language, and if you want to get really good then you have to get involved with Serial, and numbers, and maths. Ew.

Anyhow, I started by checking that the LED’s actually worked — there’s nothing worse than troubleshooting on something you’ve done wrong for absolutely ages just to find out that it’s actually just a dud LED. You can easily check the state of an LED by hitting the “blink” command on the Arduino IDE.

Finally, after playing about for quite a while, I managed to pull together this code. It’s not perfect, but it works! I have annotated certain bits of it so you can all see my (strange) method of thinking.

Note: // denotes a comment in Arduino, removing it from the code

int red = 13; // input pin 13, red
int yellow = 12;
// input pin 12, yellow
int green = 11;
// input pin 11, green
int val = 0;
// allows us to store the value of potentiometer
int potPin = 2;
// potentiometer pin analog 2
void setup(){
//used to initialise as output
void loop(){
//reading value of potentiometer
if (val>0, val<800){
// put that potentiometer value in val
// if between 0 & 800, turn on
} else {
if (val>500, val<800){
} else{
if (val>=800){
} else{

You can then test this code simply by plugging one LED into the Arduino, just like the ‘blink’ function, and moving the potentiometer around. Don’t know how to wire up a potentiometer, or even the rest of it for that matter? Don’t worry, I’ve got your back…

Confusing right? I’ll start with the potentiometer. It has three pins, the two on the other side (or for the case of many, the furthest left and right pins) need to connect into 5V and Ground, or GND for those who are more technically inclined.

We power GND on the breadboard by linking the bottom “-” section of the board to it. This means that anything being powered by the board can finish the circuit of electricity.

Lastly, by bringing wires up from the GND stream of electricity, it can then power an LED, which connects back to their respective wires.

And there you have it — thats the working code. All you need to do now is build a Lego street, but I don’t need to instruct you on that…

Thanks for reading! If you enjoyed this, then follow me on Twitter at @jthomasmitchell or Instagram at @jacktmitchell. Alternatively, catch up with my website at

Like what you read? Give Jack Mitchell a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.