Controlling 6 light bulbs with one switch

BobTPH

Joined Jun 5, 2013
11,528
It only affects the numbering of the bulbs. If the 4017 clocks on the leading edge, the bulb connected to the 1 output lights first. If it clocks on the trailing edge, the bulb connected to output 0 lights first.
 

MrAl

Joined Jun 17, 2014
13,709
I suppose. My thinking is that if you clock on the falling edge (was thinking of a positive pulse) the light wouldn't light until you actually clocked the 17. But then it wouldn't light because the button isn't pressed. But you point out that it can still be on the negative going edge, which would mean the clock would be held high by a pull-up resistor and only go low when the button pulls the clock low.

But now I'm thinking you have to use the button to pull all the lamps low at the same time.
I'm so confused.
Hello again,

Yes it is a little tricky. You have to consider all possibilities for the button switch as well as the clocking and the bulbs being turned on, and the relationship between all of them.

There are two possibilities for clocking the counter and two possibilities for the push button and two possibilities for the lighting of the bulb being selected.
For any given possibility for the push button you have to choose the right clock edge for the counter, and the right bulb being selected for turn on. If you change the possibility for the push button then you have to follow suite with the clock edge and bulb being turned on.

The most straightforward is when you press the button the bulb turns on, which is really the desired mode of operation. When you press the button one bulb must turn on. That fixes the function of the push button in relation to the bulb being turned on. When you release the button, the bulb must turn off, but that's easy all you have to do is drive the bulb to turn on when the button is pushed. So we've established that much so far.

Now we come to the clock edge. I'll assume the count starts at 0 to begin with during power on, and the driver 1 is connected to bulb 1, etc.
The first choice is to clock the counter when the button is pushed...
We have to use the rising edge of the clock, that means the count would go from 0 to 1 and bulb 1 driver must be wired to output 1 to turn on bulb 1. When we release the button the bulb 1 goes off and that's all that happens so far. When we press again, the count goes from 1 to 2 and bulb 2 lights up.
The second choice is to clock the counter when the button is released...
We use the falling edge of the clock, that means that when we press the button the count does not increment so we have to wire bulb 1 driver to output 0. When we press the button bulb 1 lights up. When we release the button, the bulb goes out and the count advances to the next count which would be 1. Next time we press the button bulb 2 lights up because we have to wire bulb 2 driver to output 2.

Now we invert the clock so when the button is pushed it generates a falling clock edge and that clocks the counter from 0 to 1, so we have to wire driver 1 to output 1. The bulb 1 lights up.
When the button is released nothing else happens except the bulb goes out, yet the count does not increment. Next time the button is pressed we get another count increment so the next bulb in turn lights up, then goes out when we release the button.
When we have the clock inverted and the button is pushed and it generates a rising edge, then the count does not increment so output 0 has to be wired to driver 1 which turns on bulb 1. When we release the button, the bulb goes out and the counter advances to a count of 1 but no bulb comes on yet. Next time we push the button bulb 2 comes on.

So we can use either clock edge to increment the counter, but the bulb driver wiring will be slightly different for each choice. The main thing is that bulb driver 1 either connects to output 0 or it connects to output 1.

This highlights the fact that it does not matter when the bulb driver is switched, either on the rising edge or on the falling edge, as long as we wire the drivers up to the proper output pins for each choice.
The falling edge clock method is interesting because it appears to be the only way to get the count to stay at 0 when the button is pressed for the first time, but we can also do that with the rising edge if we just invert the clock itself. This means we wire the bulbs in the same order as the outputs 0 to 5. Output 0 then comes about again via wraparound back to state 0. If we do it the other way, we have to wire the bulb drivers starting with output 1 to 5, then let 0 drive the 6th bulb, which would also work although it seems less intuitive from the wiring and thus circuit board trace routing and understanding of the schematic.

We could draw up a table to illustrate this and that would make the operation much clearer.
 

MrAl

Joined Jun 17, 2014
13,709
It only affects the numbering of the bulbs. If the 4017 clocks on the leading edge, the bulb connected to the 1 output lights first. If it clocks on the trailing edge, the bulb connected to output 0 lights first.
If you invert the clock externally to the counter, that gets reversed.
I tried to outline the various combinations but maybe we should draw up a table to show the operation better it's a bit confusing for me too at this late time of day (ha ha).
 

MrAl

Joined Jun 17, 2014
13,709
I haven't been following this. When you say you want to clock the 4017 on the falling edge, are you talking about clocking it when the switch is released? If so, the TS was pretty clear about not wanting that.

OR - are you talking about clocking the 4017 on the switch release, then enabling lamp power on the next switch press - ? That would work, but I'm not sure it has any advantage over any of the schematics presented so far. Still, if this were a class exercise, that would be a good bonus credit problem.

ak
Hi,

Yeah there are a number ways to do it. I think a table is in order and that should stand regardless what the final specs come out to be.
If not anything else, I think it's kind of interesting to consider all the possibilities and there aren't that many really.
 

MisterBill2

Joined Jan 23, 2018
27,584
Consider that with the counter changing state when the button is pressed, the bulb is not yet connected and so the switch has time to stop bouncing before the bulb starts drawing current. With a bit more effort that time can be stretched a bit more.
The reason for wanting a bit of delay is to avoid the inrush as the button contacts are closing, as not all buttons are good for inrush currents. And if an improvement is a no-cost method, then why not use it.
 

MrAl

Joined Jun 17, 2014
13,709
Consider that with the counter changing state when the button is pressed, the bulb is not yet connected and so the switch has time to stop bouncing before the bulb starts drawing current. With a bit more effort that time can be stretched a bit more.
The reason for wanting a bit of delay is to avoid the inrush as the button contacts are closing, as not all buttons are good for inrush currents. And if an improvement is a no-cost method, then why not use it.
Hi,

I would think we would not want to have the button pass any significant current as that means we'd need a higher current switch. The button should only drive the transistor(s) that drive the bulb(s), not the bulb(s) themselves.
 

AnalogKid

Joined Aug 1, 2013
12,143
The reason for wanting a bit of delay is to avoid the inrush as the button contacts are closing, as not all buttons are good for inrush currents.
In #36 and #41, 0% of the bulb current goes through the switch.

Also, activating a function on the release of a switch, instead of on the press, is disconcerting to some people. I used to hang with I/O (Industrial / Organizational) Psychologists. They have data on this.

Note that while the Enable input can be used as a negative-edge clock input, it is not a Schmitt Trigger input. This makes switch debouncing more difficult.

ak
 
Last edited:

MrAl

Joined Jun 17, 2014
13,709
In #36 and #41, 0% of the bulb current goes through the switch.

Also, activating a function on the release of a switch, instead of on the press, is disconcerting to some people. I used to hang with I/O (Industrial / Organizational) Psychologists. They have data on this.

Note that while the Enable input can be used as a negative-edge clock input, it is not a Schmitt Trigger input. This makes switch debouncing more difficult.

ak
Hi,

I agree, but only if you receive some sort of sensory feedback. If you don't see any difference either way we do it, it won't matter. The operator would never be able to tell if it changed on the push or on the release. That's because if it changes when you push it the bulb lights up after that, and if if changes when you release the button it's after the bulb had already gone dim. So no matter which way we do it, the bulb is always off when the transition occurs.

I know what you mean though some Windows buttons are like that. They don't do anything until you stop pressing the mouse button. It seems a little less user friendly that way.
 

AnalogKid

Joined Aug 1, 2013
12,143
The start button on my toaster oven is like that. And it has a relatively long activation time - you have to hold down the button for almost one second, or nothing will happen when you release it. This totally eliminates the chance of bumping the button and starting something accidentally, but it is a bit heavy-handed in its protection.

And, true to the science, in a house where everything else operates on press rather than on release, it took a surprisingly long time for me to get to where I have two different expectations of action, one for the oven and one for everything else.

ak
 
Last edited:

MrAl

Joined Jun 17, 2014
13,709
The start button on my toaster oven is like that. And it has a relatively long activation time - you have to hold down the button for almost one second, or nothing will happen when you release it. The totally eliminates the chance of bumping the button and starting something accidentally, but it is a bit heavy-handed in its protection.

And, true to the science, in a house where everything else operates on press rather than on release, it took a surprisingly long time for me to get to where I have two different expectations for action, one for the oven and one for everything else.

ak
Hi,

Yes, I have experienced that all too many times now. The cell phone has some unique ways of handling this too. Sometimes it gives visual feedback that you've 'pressed' a button on the screen, other times not. It should be made a standard for all virtual buttons I think because half the time you don't know if you pressed it or not until something decides to change on the screen to let you know. This is even after pressing and also releasing as sometimes there is a significant delay before anything changes at all.
 
Top