Controlling Street lights with Synchronous Counter

Status
Not open for further replies.

Thread Starter

dasPhillipBrau

Joined Oct 30, 2019
24
Hello.

For an University project, I need to design a circuit that uses a Synchronous counter to control a streetlight with 4 sides. The sides are South to North, North to south, West to East and East to West. All sides have 3 lights, with the exception of south to north, which has an extra green light (for a total of 4 lights).

I got the counter working, but I don't really understand how can I connect it to the lights for them to stay on for the time needed. The first condition is for the Green light of S-N and N-S and the Red light of W-E and E-W to stay on for the first 5 seconds.

How can I pass a 1 to the lights only in specific instances? Let's assume that the counter is in seconds.

street light.PNG

(If you're wondering about the NOR at the bottom, it's because the total time of the cycle is 14 seconds, so I set the counter to go from 1 to 14 only)

I'm using Digital Works for the simulation, in case you want to look at the file. It's in the attachments.
 

Attachments

dl324

Joined Mar 30, 2015
16,839
How long is the yellow light supposed to stay on? What are you supposed to do with the lights that have an extra green?

Are you supposed to design a mod 14 synchronous counter?

Can you post the entire text of the problem?

Can you post your .dwm file with the extension changed to .txt? I can't open .rar files on my Windows computer.
 

Thread Starter

dasPhillipBrau

Joined Oct 30, 2019
24
How long is the yellow light supposed to stay on? What are you supposed to do with the lights that have an extra green?

Are you supposed to design a mod 14 synchronous counter?

Can you post the entire text of the problem?

Can you post your .dwm file with the extension changed to .txt? I can't open .rar files on my Windows computer.
I didn't want to post the whole problem because I didn't want to make it look as if I was looking for someone to solve my homework.

The instructions are as follow:

"The first green light of S-N and the one from N-S must light up for 5 seconds, meanwhile, the red lights from E-W and W-E must be on as well. After these 5 seconds, the yellow lights for both S-N and N-S turn on for 2 seconds. After this, the red lights for S-N and N-S turn on and the 2nd green light of S-N will turn on for 2 seconds to allow traffic coming from the south to steer to the west. This is the only instance where 2 lights of the same side are lit up simultaneously. While the 2nd green light from S-N is on, every other Red light must be on as well. After the 2nd green light from S-N turns down, the red light of S-N and N-S will stay on, and the green lights of W-E and E-W will turn on for 3 seconds. After these 3 seconds, the yellow lights will turn on (while the green ones will turn off) for 2 seconds and then the red ones will turn on, starting the cycle anew. Total duration is 14 seconds".

The 2nd green light of S-N is to allow steering to the side.

The problem says that the cycle is 14 seconds, so I figured that my counter had to go from 1 to 14.

Thank you!
 

Attachments

djsfantasi

Joined Apr 11, 2010
9,156
So,
  1. You need a counter which counts from 0 to 14, and then starts over again.
  2. Then, you need to have one output for each stage of the count.
  3. You need to translate each count to unique patterns of 13 lights.

Now, given that summary (more than I usually give in a reply to a Homework Help post), can you answer how you’ll satisfy each of the requirements, 1-3, listed above?
 

Thread Starter

dasPhillipBrau

Joined Oct 30, 2019
24
So,
  1. You need a counter which counts from 0 to 14, and then starts over again.
  2. Then, you need to have one output for each stage of the count.
  3. You need to translate each count to unique patterns of 13 lights.

Now, given that summary (more than I usually give in a reply to a Homework Help post), can you answer how you’ll satisfy each of the requirements, 1-3, listed above?
That's one of the things that's bugging me out and I asked my professor for clarification. because the instructions say the cycle takes 14 seconds, so I assume this means the counter needs to go from 1 to 14 rather than from 0 to 14, in any case, I can already implement this in the counter (which is already counting from 1 to 14). My main issue is about figuring out how to connect those "counts" to the lights. I tried setting up some gates that would output 1 when the inputs corresponded to 0101 (to test the first stage of the lights) but then it doesn't work because it simply means that the light will turn on when the counter is at 5, not that the thing will light from 1 to 5.
 

dl324

Joined Mar 30, 2015
16,839
because the instructions say the cycle takes 14 seconds, so I assume this means the counter needs to go from 1 to 14 rather than from 0 to 14, in any case, I can already implement this in the counter (which is already counting from 1 to 14).
Is it customary for your professor to expect that a modulo 14 counter would count from 1-14 instead of the more typical 0-13?
My main issue is about figuring out how to connect those "counts" to the lights. I tried setting up some gates that would output 1 when the inputs corresponded to 0101 (to test the first stage of the lights) but then it doesn't work because it simply means that the light will turn on when the counter is at 5, not that the thing will light from 1 to 5.
Isn't there a more methodical way to set this up? Slinging gates around isn't typically the way teachers expect these problems to be solved. The way you get to a solution is often more important than getting the right answer.

When is this problem due?
 

djsfantasi

Joined Apr 11, 2010
9,156
I agree with dl324. When someone says the cycle takes 14 seconds, the first question I ask myself is how many states in a cycle? And what is the initial state? Modulo-14 counts from 0 to 13 for a total of 14 states. It’s more difficult to count from 1 to 14 rather than 0 to 13.

If you have trouble figuring this out, make a chart with one column per light. And manually go through each step in your problem and indicate which lights are in and which lights are off. Add a couple more columns with the time each state is maintained and another column with the total time from the beginning of the cycle. This chart will show you how to wire your circuit.

There is a easy way to drive n number of outputs in unique patterns from inputs, either binary or decimal. How do you decode multiple 4017 outputs to drive a single LED? Without additional logic chips?

The other way uses additional logic chips. Do you know what a multiplexor chip does? Look it up.
 
Last edited:

Thread Starter

dasPhillipBrau

Joined Oct 30, 2019
24
Is it customary for your professor to expect that a modulo 14 counter would count from 1-14 instead of the more typical 0-13?
Isn't there a more methodical way to set this up? Slinging gates around isn't typically the way teachers expect these problems to be solved. The way you get to a solution is often more important than getting the right answer.

When is this problem due?
Well, the term modulo 14 is actually never used in the project. The exact words are just "The cycle takes 14 seconds to complete". And since they're asking for a counter, I assume they mean "Each number in this count = 1 second."
So basically that they expect for the lights to respond to the count. So for example, when the counter goes from 0 to 5, the green lights of the S-N and N-S should be on.

But you're right by saying that I'm not using the right counter, it should just go from 0 to 14, otherwise 1 to 14 is actually just counting 13 seconds, not 14.

Its due on Sunday 0000 hour.
 

Thread Starter

dasPhillipBrau

Joined Oct 30, 2019
24
I agree with dl324. When someone says the cycle takes 14 seconds, the first question I ask myself is how many states in a cycle? And what is the initial state? Modulo-14 counts from 0 to 13 for a total of 14 states. It’s more difficult to count from 1 to 14 rather than 0 to 13.

If you have trouble figuring this out, make a chart with one column per light. And manually go through each step in your problem and indicate which lights are in and which lights are off. Add a couple more columns with the time each state is maintained and another column with the total time from the beginning of the cycle. This chart will show you how to wire your circuit.

There is a easy way to drive n number of outputs in unique patterns from inputs, either binary or decimal. How do you decode multiple 4017 outputs to drive a single LED? Without additional logic chips?

The other way uses additional logic chips. Do you know what a multiplexor chip does? Look it up.
My problem isn't so much about figuring out the states, I just don't know, at all, how to take the output of that counter and "plug it" to the lights. I honestly have no idea how can I translate "this counter is currently at 0, turn on the lights until its at 5" into the design of the circuit.

I don't think a multiplexor is the desired solution, since we didn't cover that in the course.
 

dl324

Joined Mar 30, 2015
16,839
But you're right by saying that I'm not using the right counter, it should just go from 0 to 14, otherwise 1 to 14 is actually just counting 13 seconds, not 14.
1-14 and 0-13 both have 14 states. But it makes a difference in the decode logic.

I have the circuit working for a 0-13 counter.

What are your ideas for generating the decode logic in a methodical manner?
 

djsfantasi

Joined Apr 11, 2010
9,156
My problem isn't so much about figuring out the states, I just don't know, at all, how to take the output of that counter and "plug it" to the lights. I honestly have no idea how can I translate "this counter is currently at 0, turn on the lights until its at 5into the design of the circuit.
You’re overthinking this.

If a light/LED turns on at 0 seconds and turns off at 5 seconds, what happens at 1,2,3,4 seconds? A hint: the light is on.

So, for any given light, you know which seconds it is on and which seconds it is off. If you made that chart exactly as I suggested, you’d see this.

Another way to describe this is for any given second in the cycle, you know which lights are on and which lights are off.

For analysis, let’s simplify the problem. Imagine that you were using a decade counter (goes from 0 to 9). Your problem was controlling a single traffic light. It shows 3 seconds green, 2 seconds yellow and 5 seconds red. How would you do this with only discrete components?

I would put a diode on the 0,1&3 outputs and tie them together to create 1 output to the green light. What would you do now to get yellow and red outputs.

So, that’s three lights. Extend what you’ve learned to 13 lights. Can you do it?

[QUOTE{I don't think a multiplexor is the desired solution, since we didn't cover that in the course.[/QUOTE]

Ok, a multiplexor isn’t needed at all, because as I’ve mentioned several times, there is an easier method. Which I’ve almost given you above.
 

Thread Starter

dasPhillipBrau

Joined Oct 30, 2019
24
You’re overthinking this.

If a light/LED turns on at 0 seconds and turns off at 5 seconds, what happens at 1,2,3,4 seconds? A hint: the light is on.

So, for any given light, you know which seconds it is on and which seconds it is off. If you made that chart exactly as I suggested, you’d see this.

Another way to describe this is for any given second in the cycle, you know which lights are on and which lights are off.

For analysis, let’s simplify the problem. Imagine that you were using a decade counter (goes from 0 to 9). Your problem was controlling a single traffic light. It shows 3 seconds green, 2 seconds yellow and 5 seconds red. How would you do this with only discrete components?

I would put a diode on the 0,1&3 outputs and tie them together to create 1 output to the green light. What would you do now to get yellow and red outputs.

So, that’s three lights. Extend what you’ve learned to 13 lights. Can you do it?

[QUOTE{I don't think a multiplexor is the desired solution, since we didn't cover that in the course.
Ok, a multiplexor isn’t needed at all, because as I’ve mentioned several times, there is an easier method. Which I’ve almost given you above.
[/QUOTE]

I'm really sorry, but I have never in my life taken any electronics course or anything like that, asides from this one. This is a digital circuits course and I honestly don't think they have ever told us what a diode is or that it's even an available component in the simulation software that we use, maybe it is and I'm not aware of it. I am not an electronics student, I study computer science but in order for the curriculum to be "more complete" they decide to give us this electronics class (only one in the curriculum) so my bases here are probably terrible.

I have not had a problem about the idea of the states. I am 100% aware that if the light turns on at 0 and turns off at 5, then it means that it's also on at 1, 2, 3 and 4, I think that this much is logical.

My problem is that I literally do not know how to take the output of that counter and connect it to the lights, so that it stays on at 0, 1, 2, 3, 4 and turns off at 5. I do not know how to "group" the "timings" to have a group that's 0 to 5, 5 to 7, 7 to 10 and 10 to 14.
 

dl324

Joined Mar 30, 2015
16,839
This is a digital circuits course and I honestly don't think they have ever told us what a diode is or that it's even an available component in the simulation software that we use, maybe it is and I'm not aware of it.
There are no diodes in Digital Works and I don't think that's what your instructor intended.
I am not an electronics student, I study computer science but in order for the curriculum to be "more complete" they decide to give us this electronics class (only one in the curriculum) so my bases here are probably terrible.
The logic used for this problem can also be applied by programmers, so pay attention in class.
My problem is that I literally do not know how to take the output of that counter and connect it to the lights, so that it stays on at 0, 1, 2, 3, 4 and turns off at 5. I do not know how to "group" the "timings" to have a group that's 0 to 5, 5 to 7, 7 to 10 and 10 to 14.
What have you been studying in the class so far? Teachers rarely assign problems that they don't think you can solve. This is a trivial problem. You just need apply what you should have learned.

Have you studied truth tables and Karnaugh maps?

Regarding the counter you designed. We don't use set and reset on the flip flops. The logic takes care of that using only the inputs.
 

djsfantasi

Joined Apr 11, 2010
9,156
I'm really sorry, but I have never in my life taken any electronics course or anything like that, asides from this one. This is a digital circuits course and I honestly don't think they have ever told us what a diode is or that it's even an available component in the simulation software that we use, maybe it is and I'm not aware of it. I am not an electronics student, I study computer science but in order for the curriculum to be "more complete" they decide to give us this electronics class (only one in the curriculum) so my bases here are probably terrible.

I have not had a problem about the idea of the states. I am 100% aware that if the light turns on at 0 and turns off at 5, then it means that it's also on at 1, 2, 3 and 4, I think that this much is logical.

My problem is that I literally do not know how to take the output of that counter and connect it to the lights, so that it stays on at 0, 1, 2, 3, 4 and turns off at 5. I do not know how to "group" the "timings" to have a group that's 0 to 5, 5 to 7, 7 to 10 and 10 to 14.
Sorry you don’t know what a diode is. Some basic logic circuits were made with diodes. Search for “diode OR circuits”.

Basically,to turn on a light from 0 to 5nseconds, you would OR the signals representing 0 seconds to 5 seconds. The output of the OR gate represents when an LED should be lit. An OR gate is a basic logic gate. They also come in 8 input form, which I estimated is what you’ll need.

That’s one light. You have 13. It should be easy to extrapolate to all of your lights.

You do know what an diode
Logic diode gate is?? If not, don’t tell me you can’t apply my hints. As I see it you have two choices. You can whine about your situation. Or you can google OR gates, dieodes. and diode logic. And ask us about diode or diode steering logic. Ok
 
Last edited:

DickCappels

Joined Aug 21, 2008
10,153

dl324

Joined Mar 30, 2015
16,839
@dasPhillipBrau I see that you're still checking the thread. Don't be discouraged. I remember having some difficulty when I was first learning electronics. Everyone was learning at some point.

Tell us what you've been taught and we can guide you through the steps in the way your instructor intended. Ideally you should go to your instructor for individualized instruction, but the concepts aren't difficult to master and some member should be able to describe it in a way that works for you.

I study computer science but in order for the curriculum to be "more complete" they decide to give us this electronics class (only one in the curriculum) so my bases here are probably terrible.
I was required to take a programming class for my major and ended up spending most of my career doing software development to facilitate IC design.
 

Thread Starter

dasPhillipBrau

Joined Oct 30, 2019
24
@dasPhillipBrau I see that you're still checking the thread. Don't be discouraged. I remember having some difficulty when I was first learning electronics. Everyone was learning at some point.

Tell us what you've been taught and we can guide you through the steps in the way your instructor intended. Ideally you should go to your instructor for individualized instruction, but the concepts aren't difficult to master and some member should be able to describe it in a way that works for you.

I was required to take a programming class for my major and ended up spending most of my career doing software development to facilitate IC design.
First of all: Thank you for the help so far. I haven't given up, I can't give up because it's the final project and I need max score to pass the course. I just couldn't reply because I was at work.

I have seen logic gates, karnaugh maps, flip flops, async and sync counters and there's a chapter on memory in the book, but we didn't see much about it.

I study in a remote university btw, which means I don't actually see my professor or even attend classes, I'm expected to just read the book and show up to do exams and deliver projects. My professor rarely connects to the questions forum in our virtual campus, and when he does he barely replies so I can't really ask him much (I asked him about the mod 14 thing like over a week ago, and he just replied today, with a completely unrelated response that didn't address the question).

I made a state list to see if I could visualize it better.

states.PNG

And I think I'm getting close...so, I should take the output of each flip flop (which are the LSB, 2nd bit, 3rd bit and 4bit) and pass it to a sort of NOR gate?

But I'm confused as to if its really a XOR gate or not. For the first "group" (0 to 5) a XOR gate would ouput 1 to the light, but now, how does it turn off when its turn for the next group?


EDIT: I made a Kmap for 1-5, am I on the right track?

kmap.PNG

Another edit:

So apparently the Kmap didn't work or something. But let's see if I can further illustrate my question.

So, for 1 to 5, SN/NS Green and EW/WE Red must be ON. The green block has the binary code for 1 to 5 (with A being the LSB and D being the MSB).

Meaning the result of combining those outputs must be 1. I understand this could be done with a NAND gate.
However, this is where I start having issues.
OK, so we turned on the green and red light from SN/NS and EW/WE ON.
But after that, the conditions for a NAND gate to output 1 are still being met! There is never a state in that table, where a NAND gate would output 0. So how can I turn off the lights that have already been turned on?
 
Last edited:

WBahn

Joined Mar 31, 2012
29,976
As has been pointed out, most counters start in state 0 as that is usually the easiest state to reset them to. Since you are claiming to want a synchronous design, you want fourteen states. The sequence 0-13 is the usual one, but you can make 1-14 work. Or, ANY set of fourteen unique states.

Forget about the lights for a moment. Can you take the outputs of a four-bit counter and implement some logic so that each unique state lights up a different LED? If you want, you can just choose the 14 states you want to use.

Now, if you have those fourteen outputs (each of which is HI for one clock cycle) and you wanted another LED to be lit whenever the first, seventh, eighth, or tenth output us HI, what could you do to accomplish that?

There are many ways to skin this cat. As near as I can tell from looking at your table, there are five unique output conditions. You could use a set of states to represent those conditions and then some additional states to count the time within each output condition.
 

dl324

Joined Mar 30, 2015
16,839
So apparently the Kmap didn't work or something.
The order of the variables in your map makes it incredibly difficult for me to read because that's not the way I'm used to doing them. Normally the variables would be DC on the left side and BA on the top. You have it as CD and AB which makes reading the numbers tedious and prone (for me) to errors.

But, it will work. I added the don't cares and was able to simplify the equation I expected.

You have two incorrect entries in the Kmap and you aren't taking advantage of using the invalid counts as don't cares.

EDIT: Can you double check this result?
1574912907057.png
I don't get that when I don't use don't cares. It's more typical to keep the variables in MSB to LSB order, so I'd write it as D'CB'+D'CA+D'B'A. It's easier to convert to numbers, unless your native language writes binary numbers backwards.

You're on the right track.
 
Last edited:
Status
Not open for further replies.
Top