You Are Here: Home » AVR ATmega Projects » Micro controller programming: Making a set of traffic lights using Microcontroller ATTiny2313

Micro controller programming: Making a set of traffic lights using Microcontroller ATTiny2313




So you wana learn how to programme a micro controller?

This tutorial has been designed as a next step, following the fantastic tutorial ‘Ghetto Programming: Getting started with AVR microprocessor on the cheap.’ by The Real Elliot link you should read this before progressing onto this next step.

Today my friends we are going to make a pelican crossing using an Ateml ATTiny2313. This is probably more common in the UK but a pelican crossing allows pedestrians to stop road traffic and cross in a safe manner.

At the end of this project you might like to mess about with the code and get the lights to sequence for your countries equivalent system, or for a junction like a cross roads (intersection).

Step 1 Parts

Ok if you are continuing this project after completing the Ghetto Programming instructable you will need to order a few extra parts. I have a list below which will detail every thing you need for this project. However if you already have the parts (Micro controller, LEDs etc..) then just leave these out. For clarity I have given the part numbers which you can use to order them directly from Rapid Online the company from which I ordered mine.

These are minimum requirements you could order more for backup or expansion of this project.

1x ATTiny2313-20PU (73-4316)
1x 20 pin socket (22-0170)
1x Parallel port plug (15-0510)
1x Breadboard (34-0655)
1x Jumper Links (34-0495)
2x Red Led’s (55-0155)
1x Orange (not amber) Led (55-0124)
2x Green Led’s (55-0120)
1x White Led *(55-1640)
1x Electronic Buzzer (35-0072)
1x Push to make button (78-0350)
3x 1K Resistors (62-0370)
6x 150ohm Resistors (62-0350)
5x Head Plug (22-0515)
2x Head Socket (22-5114)
1x Battery Box (18-3685)

Rapid Online

In total this came to £17.18 ex vat (approx $35.42) however you might find it cheaper else where but I doubt it.

Rapid Online offers free shipping when you spend over £5 it might be worth looking about for a few goodies and upping the led’s and chips for backup if you intend to explore microchip programming further.

As well as the above parts you will need some basic stuff which you may already have…

Wire (probably about 0.5mm stranded wire)
Solder (around 22swg lead free stuff)

You will also need these tools…

Soldering Iron + Stand + Sponge
Solder Sucker/Pump
Side Cutters
Wire Strippers

Once you have all the parts you are ready to assemble your project.

Step 2 Getting started

I am going to assume you already have the programming cable and software setup from the Ghetto project and jump straight into building the project.

Ok first we are going to lay a few things out connect the pins of the battery the the +ve and -ve lines, plug in the micro controller and the head pins.

To start with you will notice that there are 2 sets of holes running down both sides of the board each row down is interconnected up to the break in the middle of the board, effectively there are 8 strips running down the board. We are only going to use the inner 4 strips on the board. To make the top strips link with the bottom ones we need to connect them using a jumper wire. You can see the orange wires on the image below they are joining the top and bottom.

Now place the battery on the board at the bottom as close to the edge as possible and work out where its pins will rest, ensure the +ve and -ve pins are on different sides of the central divide. Using the a longer jump wire connect the pins to the +ve and -ve strips. (Notice the yellow jump wires in the image below). They are connected because the rows are connected across up to the central divide (this is different to the way the power strips work which are columns not rows).

Ok Now at the very top right of the board push the header pins into the board it should use rows 1-5 then two rows down (8) insert the microchip so it bridges the gap over the centre.

Ensure the micro controller is inserted correctly (the dip/cut semi circle should be nearest pin 8 on the breadboard).

Step 3 Wiring up the micro controller

I used my own wiring for the header pin so make sure you connect your parallel port pins to the right place on the micro controller. (Just follow the instructions on the Ghetto project).

Once its wired up you should have some thing like this… If you do not already have 1k resistors on your programming cable ensure they are installed on your board to protect the parallel port on your computer from being fried.

Step 4 Installing the LEDs

Installing the LEDs

Before we begin ensure all LEDs are connected the right way around. The short lead goes into the -ve supply the long one goes into the micro controller (+ve).

Also ensure you use the 150ohm resistors on the LEDs lay them out as below.

I have jumped the centre divide with resistors and put the -ve pin directly into the -ve rail so that I create a circuit, you could alternatively solder the resistor onto the long wire coming out of the LED.

For more Detail: Micro controller programming: Making a set of traffic lights using Microcontroller ATTiny2313

Leave a Comment

You must be logged in to post a comment.

Read previous post:
USBasp drivers
Instalacion del controlador USBasp (USBasp drivers setup) – Dark Side Electronics using AVR microcontroller

English version available at the bottom Se enseñara paso a paso como instalar los controladores (drivers) necesarios para el correcto...

Close
Scroll to top