Converting a traffic light into a timer

thatoneguy

Joined Feb 19, 2009
6,359
There is an I²C version of that same segment driver, Hardware I²C is supported and tested functional with a MAX6956 by my son.
 

thatoneguy

Joined Feb 19, 2009
6,359
Or maybe we switch to a 20X2.
If you already have the SPI driver, then switching the controller would be more straightforward, if the driver hasn't been ordered yet, the commands are the same over I²C or SPI.

If you have both, then replace the cheaper part. It's a tossup.
 

Thread Starter

Transitory

Joined Jan 2, 2013
64
Okay, here is a first cut at the schematic.

OP, please take a look and let us know if this is roughly how you envision the unit to operate.


Currently,
  1. Minute and second buttons are used to increment display by one minute and one second, respectively, each time they are pressed.
  2. Reset button clears the display and turns off all lights.
  3. Start/pause button is used to begin countdown as long as the displayed value is greater than 00:00. It will also stop the count and resume.
  4. When each light comes on, blinks and for how long will be programmed in and can only be changed by modifying the code. We will follow the sequence the OP originally mentioned and which is shown in the flowchart unless told otherwise.
The schematic is a first draft and is subject to change. Some notes:
  • R7 determines current to the display and will depend on the display selected.
  • Buttons are used with pull-down resistors. This may change to pull-ups if it makes programming for one reason or another easier.
  • Fuse values selected somewhat arbitrarily. 60W bulbs consume ~0.5A, so 1A was selected for some cushion. Let me know if you feel another value should be chosen.
  • For the sake of reducing parts variety, an opto-isolator is used to control the buzzer in the event it requires more current than the PICAXE can provide. Actual voltage used to power buzzer will be subject to buzzer selected.
  • Pins used on PICAXE were selected arbitrarily. Please let me know if the ones selected will not work for their intended purpose.
OP,


We can make selections for the parts if you're not too concerned about picking them out yourself. A few questions regarding parts:
  1. Would you prefer 1" tall digits with a MM.SS format or 0.39" tall digits with a MM:SS format? Both are about $2-3 from the source I have in mind and include all four digits.
  2. What color would you like the digits to be, e.g., red, green, yellow, blue, or white?
  3. What kind of buzzer do you have in mind? Little one to get attention or big one to make you flee for your life?
You'll also want to think about how you're going to build this, what to enclose it in, etc.
-Yes, you have the general plan right.

-If the price is the same, 1" is better. Would it be hard to move to larger digits in the future? If so, maybe we might want to consider something bigger to start, i.e. 6"?

-I've always liked bluuuuuuue.

-Little buzzer, something low pitched. I've always preferred mechanical bells. Something with 3 dings with 1/2 intervals.

-Everything except for the display and buttons can be easily housed in the traffic light itself. I'll just need a long cable to run from the traffic light. The display/buttons can be simply attached to some sort of wood or plastic piece. I can work on the elegance of the housing later.
 

elec_mech

Joined Nov 12, 2008
1,500
-If the price is the same, 1" is better. Would it be hard to move to larger digits in the future? If so, maybe we might want to consider something bigger to start, i.e. 6"?
Larger digits, anything above 1" really, will require a separate driver circuit to provide enough voltage and current to the displays. While certainly not difficult, it will add quite a bit of complexity and cost to the final circuit. Unless you opt to make the displays out of LEDs yourself, the least expensive 6" display I can find right off the bat is a 6.5" from Sparkfun which runs $15 USD per digit. That takes your $3 one-inch display to $60. Unfortunately, I don't think you'll have much luck with finding a multiplexed display this big, so wiring this will be a bigger effort too. You might find some slightly cheaper displays, but I doubt it'll be by much.

As a larger display only requires a hardware change (no software changes), I would suggest sticking with the 1" display, seeing what you think once it's built, then we can help you modify the circuit to work with a larger display. You'll have to decide if you want to buy or build the digits and we'll need more details on where this will be used, e.g., indoors, outdoors, day, night, distance digits need to be seen from, etc.

What is your ultimate goal with this project? First you mentioned 1" displays, then said a smaller size would be useable, now you state you'd like a 6" display? The more we know up front, the easier it is to incorporate.

-I've always liked bluuuuuuue.
Then this would be ideal: https://www.sparkfun.com/products/11408.

I wouldn't suggest buying anything until we have tested the code and circuit, then you can buy everything at once from as few sources as possible to save money on shipping.

-Little buzzer, something low pitched. I've always preferred mechanical bells. Something with 3 dings with 1/2 intervals.
Hmm, could you post a link to an example? A product that makes said sound or a video with the sound demonstrated? A simple buzzer will just sound continuously. Some sirens will change the pitch on their own, but many will probably require an additional circuit. Alternately, you could add a module that plays an MP3 file if that would work.

-Everything except for the display and buttons can be easily housed in the traffic light itself. I'll just need a long cable to run from the traffic light. The display/buttons can be simply attached to some sort of wood or plastic piece. I can work on the elegance of the housing later.
The bulk of the circuit should probably go into the button/display housing to reduce your total wire run count. We can address this in more detail down the road.

Tracecom and I are working offline on code. We'll post it once complete. I imagine it will be several days, possibly a week or so before we have something ready to show.
 

Thread Starter

Transitory

Joined Jan 2, 2013
64
What is your ultimate goal with this project? First you mentioned 1" displays, then said a smaller size would be useable, now you state you'd like a 6" display? The more we know up front, the easier it is to incorporate.
This is going to hang in a classroom as an indicator for students as to how much time is left. (You are thinking: why not just buy a timer? I have one, and it works, but it's become boring to me. A traffic light is fun, visible, and easy to interpret - plus I happen to have a traffic light and I want to make it productive).

So since the traffic light is going to be the main visual, let's stick with 1" numbers, ignore what I said earlier. If I find I need a time display with it, we'll cross that bridge later.

Sorry for the vacillations - was just thinking aloud (in text...)

I'll see if I can find an electronically firing bell. Then it's just a matter of sending the right amount of electricity in the right amount of time, right?

You guys are great, and I appreciate the work.
 

Thread Starter

Transitory

Joined Jan 2, 2013
64
Hmm, could you post a link to an example? A product that makes said sound or a video with the sound demonstrated? A simple buzzer will just sound continuously. Some sirens will change the pitch on their own, but many will probably require an additional circuit. Alternately, you could add a module that plays an MP3 file if that would work.
I was thinking a 6" fire bell, but I think it wouldn't fit in the light and it would be a bit too loud and expensive.

How about an MP3 playing module. Then the sound can be changed easily. I was thinking a noise like this: http://www.youtube.com/watch?v=EsRXzNGuovQ
 

elec_mech

Joined Nov 12, 2008
1,500
This is going to hang in a classroom as an indicator for students as to how much time is left.
Ah, how cool. This just got more fun. :D

And you may be thinking, why are there people designing electrical circuits, writing code, offering advice and how to spend as little dough for completing such projects? For the same reasons you provided - it's fun and different.

How about an MP3 playing module.
Then there is this which allows you to load an MP3 (technically a WAV, but a soft copy of your choice anyway):
http://store.bigdawgspromo.com/prod...12955&osCsid=7d0a81f82cd186e4730bd8aafdd1d550

If you want to spice it up later, with a single jumper setting you can have this play up to 20 different sounds - a different sound every time it is triggered. You can have a lot of fun with this. I used this on a control console I made my toddler and it plays a different Looney Tunes clip ("I taw I taw a puty cat", "You're deesspicable", etc.) everytime he hits a big red button.

If pennies count, you could use a recordable greeting card or go with one of these: http://store.bigdawgspromo.com/prod...12947&osCsid=7d0a81f82cd186e4730bd8aafdd1d550.
 

Thread Starter

Transitory

Joined Jan 2, 2013
64
And you may be thinking, why are there people designing electrical circuits, writing code, offering advice and how to spend as little dough for completing such projects? For the same reasons you provided - it's fun and different.
This is why I love the internet. It's taught me so many awesome things.
 

tracecom

Joined Apr 16, 2010
3,944
I am in a hurry, but I wanted to post a couple of pics of my breadboard setup. Operation is still erratic; I thought maybe you could spot some problem areas. I will post more details in a couple of hours.
 
Last edited:

elec_mech

Joined Nov 12, 2008
1,500
Only thing catching my eye at the moment is the connection between pin 9 of the PICAXE and pin 12 of the MAX7221. It looks like the white wire coming from pin 9 should be moved to the right of the blue wire (currently it is to the left and doesn't appear to be connected).

This is the chip select line and tells the MAX7221 when to look at and ignore data. If it is not connected, it could explain the erratic behavior you've mentioned.
 

tracecom

Joined Apr 16, 2010
3,944
Only thing catching my eye at the moment is the connection between pin 9 of the PICAXE and pin 12 of the MAX7221. It looks like the white wire coming from pin 9 should be moved to the right of the blue wire (currently it is to the left and doesn't appear to be connected).

This is the chip select line and tells the MAX7221 when to look at and ignore data. If it is not connected, it could explain the erratic behavior you've mentioned.
You are correct; it was off by two rows. That error crept in during my rebuild, and unfortunately, even after I corrected it, the operation is still erratic as before.

The red and green LEDs function just as the code says they should every time I attach the power, but the operation of the 7 segment display is unpredictable. Sometimes they light just as I attach the power, sometimes they don't light at all.

I am being called for lunch. More later.
 

Attachments

Last edited:

tracecom

Joined Apr 16, 2010
3,944
Report to Transitory.

Elec_mech's code is now running on my breadboard. Of course, this is just test code to control the display and light the LED's, but it's a big step. It proves that the PICAXE can communicate with the MAX7221 and control the 4 digit display.

:D
 

Thread Starter

Transitory

Joined Jan 2, 2013
64
Report to Transitory.

Elec_mech's code is now running on my breadboard. Of course, this is just test code to control the display and light the LED's, but it's a big step. It proves that the PICAXE can communicate with the MAX7221 and control the 4 digit display.

:D
Yay! Wonderful news.
 

thatoneguy

Joined Feb 19, 2009
6,359
Top to bottom:

LED Display
LED Display Driver (Maxim IC, think of it as a port expander to drive all the LEDs in Display)
Breadboard Programmer for PICAXE (to left of LED Display Driver)
Interconnects for power/programming/display communication
PICAXE 20M2 in center of board
Power connections Gnd/+5V on right edge, red and black alligator clips on headers to power each rail on breadboard
Traffic Light LEDs on right
jumper wires to connect switches to PICAXE
Select buttons on board at bottom for setting time.
 

Thread Starter

Transitory

Joined Jan 2, 2013
64
Top to bottom:

LED Display
LED Display Driver (Maxim IC, think of it as a port expander to drive all the LEDs in Display)
Breadboard Programmer for PICAXE (to left of LED Display Driver)
Interconnects for power/programming/display communication
PICAXE 20M2 in center of board
Power connections Gnd/+5V on right edge, red and black alligator clips on headers to power each rail on breadboard
Traffic Light LEDs on right
jumper wires to connect switches to PICAXE
Select buttons on board at bottom for setting time.
Thanks! So in this setup, the Maxim IC is translating the time to the individual LEDs (to form numbers) on the display or does the PICAXE also do that?
 

thatoneguy

Joined Feb 19, 2009
6,359
The PICAXE does everything, the Maxim IC simply drives the 7 segment displays, since there aren't enough pins on the PICAXE to drive them. The Maxim does more than that, but essentially, the PICAXE tells it what to display, and it displays it, the "brain" is all in BASIC code on the PICAXE.
 
Top