Converting a traffic light into a timer

Thread Starter

Transitory

Joined Jan 2, 2013
64
So, I have an antique traffic light box that I want to convert.

What it is now:

3 traditional 60w incandescent light bulbs hooked up to your run of the mill 120v household plug - in an old traffic light housing.

What I want it to be:

A lighted controlled count-down timer. You would:

1) Set how many minutes (maybe seconds) to count down (via a control board - something with a LED read-out and button control)

2) Press start

3) Green light stays on until last minute (or really neat if it stays on until last 10% of interval)

4) Yellow light illuminates for 30s-60s remaining (or 5-10% remaining)

5) Yellow light flashes for last 30s (or last 5%)

6) Red light illuminates when timer completes (plus an extra ability to add an electric buzzer later)

I am a complete beginner when it comes to circuits and building things like this. I'm sure, however, it can be done and I can do it with the right guidance. So all the help you can give will be great.

This doesn't have to be a ground up project, either. Any parts already made for something like this can can be bought would be fine. Just tell me how to start!

P.S. If the control board could also adjust when the yellow and yellow flashing starts that would be an extra bonus.
 

tracecom

Joined Apr 16, 2010
3,944
How many illuminated sides does the traffic light have? If there is only one side, that simplifies the project immensely.

A picture of the traffic light would help.
 

BillB3857

Joined Feb 28, 2009
2,570
A 4017 decade counter fed from a 555 osc would do it. Use diode OR functions to pick out the percentage points for each light, feed a SSR for each light, done.
 

tracecom

Joined Apr 16, 2010
3,944
I like the light; are you planning it to be a decorator piece?

Anyway, I would probably use a microcontroller for the timing, change the bulbs out with LEDs, and switch the LEDs on/off with MOSFETs; that way, the whole thing could be run on DC. You can get any timing you want, including starting and stopping the flashing.
 

Thread Starter

Transitory

Joined Jan 2, 2013
64
Do you mean as a part? By itself all this would do would make the piece into a traditional stoplight - I don't want that. I want the stoplight to be reflective of a programmable countdown timer. I could set it to be 20 minutes and it would count down Green for a while, then yellow at the end, flashing yellow closer to the end, and red at 0. Pardon me if I am misinterpreting your suggestion, though.
 

tracecom

Joined Apr 16, 2010
3,944
Do you mean as a part? By itself all this would do would make the piece into a traditional stoplight - I don't want that. I want the stoplight to be reflective of a programmable countdown timer. I could set it to be 20 minutes and it would count down Green for a while, then yellow at the end, flashing yellow closer to the end, and red at 0. Pardon me if I am misinterpreting your suggestion, though.
No, I misunderstood your intention.

In that case, you will need a microcontroller based circuit. The easiest and most economical way to get started with microcontrollers is with the PICAXE family. The AXE-021 can be configured to do what you want, but you still have to learn to program it, and you will need some additional components. Your project is interesting and doable, but will require a significant time investment on your part, or you will have to have someone else build and program your circuit board. http://www.phanderson.com/picaxe/
 

Thread Starter

Transitory

Joined Jan 2, 2013
64
No, I misunderstood your intention.

In that case, you will need a microcontroller based circuit. The easiest and most economical way to get started with microcontrollers is with the PICAXE family. The AXE-021 can be configured to do what you want, but you still have to learn to program it, and you will need some additional components. Your project is interesting and doable, but will require a significant time investment on your part, or you will have to have someone else build and program your circuit board. http://www.phanderson.com/picaxe/
So I understand the programming to a certain extent, although I imagine circuit code is a bit different from say javascript or actionscript. Essentially, though, it would be something like:

Get desired time from module 1 ==> value A
Begin counting down value A
While value A > 95%, send power to line G
While value A > 10%, send power to line Y
While value A between 5-10% send alternating power to line Y
While value A == 0 Send power to line R

Sort of?

So I would need:

A programmable microcontroller (the AXE-021 or the MPS430)?
A device that can input/display the time value?
A device that control the time value
What else?
 

tracecom

Joined Apr 16, 2010
3,944
Yes, sort of.

If you would be satisfied to program the lights in the pattern and timing you want and seldom change it, you wouldn't need any displays or controls. You would simply program the microcontroller using your PC and the code would reside in the μC and would run whenever you turned the lights on. When you wanted to change the programming, you would reconnect the μC to the PC.

But if you want to be able to change the patterns and timing without a PC, then the hardware and the software becomes much more complicated. I guess it depends on what you intend to do with the light.

As to the TI product you mentioned, it too could be used, but I haven't had much success with it. The PICAXE is the easiest and least expensive μC family to learn on, and although I have others, the PICAXE is the only one I know how to use (and I am no expert on it.) Of course, PICs are much more versatile, and the favorites of many hobbiests.
 

Thread Starter

Transitory

Joined Jan 2, 2013
64
Yes, sort of.

If you would be satisfied to program the lights in the pattern and timing you want and seldom change it, you wouldn't need any displays or controls. You would simply program the microcontroller using your PC and the code would reside in the μC and would run whenever you turned the lights on. When you wanted to change the programming, you would reconnect the μC to the PC.

But if you want to be able to change the patterns and timing without a PC, then the hardware and the software becomes much more complicated. I guess it depends on what you intend to do with the light.

As to the TI product you mentioned, it too could be used, but I haven't had much success with it. The PICAXE is the easiest and least expensive μC family to learn on, and although I have others, the PICAXE is the only one I know how to use (and I am no expert on it.) Of course, PICs are much more versatile, and the favorites of many hobbiests.
I am willing to have greater complexity if it means greater function. My planned use for the light means that I will need to change the intervals fairly often, and even pause the timer from time to time.
 

tracecom

Joined Apr 16, 2010
3,944
I am willing to have greater complexity if it means greater function. My planned use for the light means that I will need to change the intervals fairly often, and even pause the timer from time to time.
Then, the first thing you need to do is list what functions and timing that you want and attempt to differentiate between those that you must have versus those that would be nice to have. That will also enable you to decide how much, and what kind of help you will need to complete the project.

Those parameters will lead to a general design, probably in the form of a block diagram, which will lead to a specific design in the form of schematics and code. Often the hardest part of a project is deciding exactly what you want the outcome to be.
 

Thread Starter

Transitory

Joined Jan 2, 2013
64
Then, the first thing you need to do is list what functions and timing that you want and attempt to differentiate between those that you must have versus those that would be nice to have. That will also enable you to decide how much, and what kind of help you will need to complete the project.

Those parameters will lead to a general design, probably in the form of a block diagram, which will lead to a specific design in the form of schematics and code. Often the hardest part of a project is deciding exactly what you want the outcome to be.
Well, if I am doing this, I want to do it right. My necessary functions:

Input comes via two buttons to add minutes and seconds.
Input time is shown on a small digital display.
A start/stop button for pausing and stopping the count.
A reset button to bring the counter back to 0.
As the timer counts down, the digital display shows time remaining.
At 1 minute left, the light goes yellow.
At 30 seconds the light blinks yellow.
At 0 light is red.
At 0 an electric buzzer is activated.
Above 1 minute light is green.
 

elec_mech

Joined Nov 12, 2008
1,500
It's been awhile since I've programmed, but this looked like a fun project to brush up on my flowcharting skills. Attached is a flowchart of one way you might program a microcontroller to do this. It could probably be fine-tuned, but this should give you an idea of the programming logic you'll need.

I didn't go into a ton of detail. You'll need to add things like switch debounce, tell the display to go from 1:00 to 0:59 and not 0:99, etc.

If you haven't programmed before, I'd suggest using a PICAXE with BASIC programming. Personally I've used PICs, but the software is pricey and the free versions are limited. PICAXE gives you an inexpensive IC and free full featured (as far as I know) software.

Another option is the Basic Stamp II from Parallax which you can pick up from RadioShack if in the U.S. as long as you're okay with the large board. These are great, just a little pricey for the IC. Software is free like the PICAXE.

Tracecom has experience with PICAXE, I have experience with the other two. All three use BASIC programming which I feel is the easiest to learn. Between the two of us, I think we can check your code and offer advice if you stick with BASIC. There are other languages such as C and assembly, but they have a longer/steeper learning curve IMHO and I couldn't be much help to you with either. But the choice is yours of course.

If you want to go hardcore, I think I can come up with a schematic to do this all with discrete logic (no programming involved). Unfortunately, this will require several ICs, a large board, a lot of time to assemble, and cost some dough by the time you get everything. Still, a lot of fun to us gluttons for punishment. :D

Let us know what path you'd like to take (microcontroller vs. discrete logic), how many digits you want (MM:SS, M:SS, H:MM:SS, etc.), how tall you want the digits (0.56", 1", etc.), and how you'd like to power this (I assume this will be powered from an outlet, not batteries, and would need to know what you plan to use for your power supply).
 

Attachments

Thread Starter

Transitory

Joined Jan 2, 2013
64
You guys are awesome! ^

To your questions:

Micocontroller sounds easier, and software programming I can understand much more readily

Power: Standard outlet

Power supply: No clue

MM:SS will suffice (minutes going to 99)

1" in digits will be fine

I imagine the next step is to order parts. Besides the controller, what else do I need to pick up?
 

tracecom

Joined Apr 16, 2010
3,944
I looked back through the thread and didn't find the answer, but you may have already said. Are you going to keep the 120 V 60 W bulbs or are you going to LEDs? It's not a crucial item at the moment, but at some point a decision will have to made based on whether we are switching AC or DC.
 
Top