Instructables
 I made this project on the same night that my Arduino Duemilanove arrived from Cool Components.  After being an Instructables member for about a year I though it was time I should contribute. There is another Arduino traffic light project similar to this, but it is much more complex; mine is aimed at beginners and children (who already know the basics).

As a beginner to the Arduino I had spent a fair amount of time researching them and how they work prior to investment, I had already learnt a little about www.processing.org so I was familiar with the programming environment.

This project takes very little skill to make, and I think it is ideal as a 'first' project (it gives a 'real world' application to the traditional 'LED Blink' tutorial.

This instructable aims to give beginner Arduino users a project to do, rather than teach them about electronics, so I have left out things such as the polarity of LEDs, because information like this can be found in a myriad of locations.  Because of this I have made the presumption that you own (or are getting) an Arduino, can connect it to your computer, know how to strip wires and the such.

"Hear me ye foreigners, there be Angles on this here site!" - The code and hardware is designed for the English lighting system, feel free to adapt it to your preferred pattern/colours etc.


Step 1: Bits and bobs.

workspace.JPG
wire.JPG
 For this project you will need:

  1 x Arduino (Duemilanove 328)
  1x Breadboard, fairly large one (I don't know the size)
  3 x LEDs (Red, amber and green)
  *some wire*
  USB cable for programming
  Computer / laptop preferably with a desk
  1 x paper clip

The paper clips shown in the picture have already been shaped. (sorry)

Step 2: Mount the Arduino

 I needed to come up with a way of fastening my Arduino to my breadboard, so I put a cut, bent paper clip through the PCB and into two of the boards holes.

The close-up photo was taken using a home made macro lense - search instructables to find out how! :-D
 
Remove these adsRemove these ads by Signing Up
What resistors should I use? I have 10 K and 220 Ohm resistors.
zoltzerino (author)  Thebuilderdd2 years ago
220's should be fine. I'd use 330's (it should really be done with a calculation, but as this isn't a long-term installation project and just a quick playaround/learning experiment, you'll get away with 220's.

Because I didn't use ANY resistors (bad form), anything you use will be an improvement. You know what, try the 10k's as well, just so you can see the outcome.
where is your resistors!!! if you dont add in any resistors then your arduino sockets will be burned to where you cant use them anymore!
zoltzerino (author)  TheParacorder2 years ago
I know I know. This was a while ago, very irresponsible of me...I only ran it for a few seconds to get the image though - I hope nobody fries their I/Os, it'll be a quick learning experience for them anyway...
lol we all do trial and error
gapak3 years ago
You can also use an elastic in stead of paper clips to attach the arduino to the breadboard.

I haven't downloaded the code and I only see taylors version downhere so I don't know if it's different in the original code but I don't understand the delay(0) lines. Aren't they totally useless?
Lenny244 years ago
Uh! Shame on you! You forgot the resistors! :DD No, srsly, this COULD damage your Arduino or the LEDs. The pins on your Duemilanove may only draw 50 mA of Current. If LEDs are directly connected to +5v , they often draw much more than 50 mA. So... In case youre' connecting an LED to your arduino, simply add an 150 Ohm Resistor ( everything around 150 Ohms will work ( 220 Ohm etc.) but at 150 your LED will be very bright)
taylor1794 years ago

hey, excellent instructable, but in your programming it has the red and amber overlap. heres my version of the programming.:

int red = 12;              //defines pin number for each colour
int amber = 4;
int green = 5;

void setup(){              //this section of code only runs once
  pinMode(red, OUTPUT);    //defines what each pin will be doing
  pinMode(amber, OUTPUT);
  pinMode(green, OUTPUT);
}


void loop() {
  digitalWrite(red, HIGH);
  delay(4000);
  digitalWrite(red, LOW);
  delay(0);
  digitalWrite(green, HIGH);
  delay(5000);
  digitalWrite(green, LOW);
  delay(0);
  digitalWrite(amber, HIGH);
  delay(1000);
  digitalWrite(amber, LOW);
}

zoltzerino (author)  taylor1794 years ago
British patriotism...Feel free to adapt for your own country's system :-)
zoltzerino (author)  taylor1794 years ago
 The red and amber overlap is incorrect, as I said at the beginning of the 'ible, I am using the English light system. Thanks for the comment though :-)