Maker Pro
Maker Pro

Changing strobe pattern?

peter.s

Dec 18, 2014
37
Joined
Dec 18, 2014
Messages
37
I made an LED strobe based on this design which was posted some time ago on another thread (https://www.electronicspoint.com/threads/12v-led-strobe-controller.254837/).

It works great - exactly as designed - however now I want to change the strobe pattern to incorporate a short pause between flash bursts and I'm having trouble figuring it out.

Currently the strobe flashes three times LED1, immediately followed by three times LED2, and then repeats. What I want is flash three times LED1, short pause, three times LED2, short pause, etc.

I figure this could be done by making 4017 skip a cycle between flashing LED1 and LED2, but I can't see how to make 4017 skip a cycle.

Or maybe I'm on the wrong track and it can't be achieved with these components and I have to add something, or change 4017 for something else?

Any advice welcome...

Police Lights.png
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
You can't easily do that. The 4017 can be configured to divide by any number from 2 to 10 inclusive, but not more. For what you want, you need a new gap between Q4 and Q5, and another new gap between Q9 and Q0. That means you need to divide by 12.

There are ways to hack delays into the clock circuit but they're messy and it's probably best to rethink the approach.

The way I would do it is to use one 4017 to generate the three flashes (using one gate from the 4075) with a trailing gap, i.e. as a divide-by-six circuit, and use a second IC (a 4017, or various other options) to alternate between two states each time the first 4017's sequence ends, and direct those three flashes to one or the other set of LEDs according to its state.

There are many ways to implement this, depending on your priorities. Assuming you want minimum changes:
  • Delete U3B (tie its inputs to fixed levels so they don't float)
  • Connect U2's RESET input (pin 15) to its Q6 output
  • Add a second 4017 as a divide-by-two circuit (link Q2 to RESET), and clock it from Q0 on U2
  • Add a CD4053B, using only one of its three switches, controlled by the second 4017's Q0 output, to direct U3A's output to either Q1 or Q2.
The CD4053B contains three changeover switches, each of which is controlled by a logic signal. You can use one of these switches to direct the three pulses from U3A's output to either one of the transistors. There are many other ways to achieve what you want, but I suggest the 4053 because it's an interesting chip to know about.

See if you can work out how to do it :)
 

peter.s

Dec 18, 2014
37
Joined
Dec 18, 2014
Messages
37
Hi Kris - thanks for your response. I've been reading up on the 4053 and I can see what your suggesting, but I'm a bit confused about the second 4017.

I've also bee reading up on the 4017 and don't really get the Reset function. Is it simply shortening the cycle (Q2 to RESET skips Q3, Q4, Q5, etc.), or does it provide a down signal for a full cycle until it gets back to Q0?
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
This is why almost every project should be done with a microcontroller. If you had done that, it would be a programming change that would take you about 1 minute.

Edit: and it would have taken 1 chip instead of 3.

Bob
 

peter.s

Dec 18, 2014
37
Joined
Dec 18, 2014
Messages
37
I hear you Bob, but I know nothing about coding microcontrollers... mind you it seems I also know nothing about ICs - lol.
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
Yep. There is bit to learn if you have not used microcontrollers, and particularly if you have not done any programming, but the benefits are huge.

Bob
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
This is why almost every project should be done with a microcontroller.
Bob, you're getting a bit predictable with your "everything should be done with a microcontroller" mantra.

I agree this project would be an ideal application for a microcontroller, but I certainly don't agree that almost every project (your words) should use one.

I've explained to you before why I don't jump straight into recommending microcontrollers when a few logic ICs will do the job. If you recall, it's because of the investment in time and money needed before you can do anything useful with them.

Naturally they are your first thought, but there was a day when you knew nothing about them, and they were a big and complicated mystery. You've obviously come a very long way since then, as many of us have. But I think you should try to remember that others are still back at day one.

Edit: Another point for you to consider is that (I presume) you were already familiar with standard logic ICs when you started learning about microcontrollers, and that understanding of logic principles and standard logic functions would have been a big help when it came to undestanding the functions inside a microcontroller. In other words, standard logic ICs can be considered a stepping stone to more complicated logic devices such as microcontrollers.
 
Last edited:

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
I've also bee reading up on the 4017 and don't really get the Reset function. Is it simply shortening the cycle (Q2 to RESET skips Q3, Q4, Q5, etc.), or does it provide a down signal for a full cycle until it gets back to Q0?
The first one. As soon as the 4017 advances to count 2 and Q2 goes high, the 4017 resets and returns to count 0, so the time it actually spends at count 2 is almost zero (just long enough for the internal propagation delays inside the IC). So for all practical purposes, it alternates between count 0 and count 1.
 

peter.s

Dec 18, 2014
37
Joined
Dec 18, 2014
Messages
37
Is this what you had in mind? I am assuming the signal from 4017-2 triggers 4053 to switch between outputs... but if so I don't understand how a pause is included in the cycle as 4017-1 is on a short cycle (reset by pin 9) and 4017-2 is on an even shorter cycle. Hmmm?

Strobe.png
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Yes, that's the idea. It's a bit hard to follow with just pin numbers; better to mark the pin functions on the inside of the IC rectangle, and the numbers on the outside.

You'll need to connect pin 13 of the second 4017 to 0V. You can't leave it floating just because you're not using it. Also, pins 11, 12 and 13 of the 4075 must also be connected to fixed logic levels (e.g. grounded). All unused inputs on logic ICs must be tied to known logic levels.

You also need to connect pin 7 of the 4053 to 0V. Those three analogue switch ICs have three power supply pins: VDD, VSS, and VEE. For single-supply applications like this one, you connect VEE and VSS to the 0V rail.

And you've changed the outputs on the first 4017 that you feed into the OR gate. You should keep them as pins 3, 4 and 10, as before, so there will be gaps between the blinks. If you use pins 4, 2 and 7 (Q1, Q2 and Q3), the LEDs will not blink ON and OFF three times.

You have the other connections right for the second 4017 and the 4053. The second 4017 will change state (from count 0 to count 1, and from count 1 to count 0) once each time the first 4017 goes through its complete six-count sequence. This will generate three flashes on the first LED, then three flashes on the second, and repeat.

Edit: And you need a decoupling capacitor on each IC. Normally 0.1 µF ceramic, connected as directly as possible between VDD and VSS on the logic ICs, and between pins 1 and 8 on the 555.
 

peter.s

Dec 18, 2014
37
Joined
Dec 18, 2014
Messages
37
Yep - that all makes sense. So the 4053 stays switched to one LED until 4017-1 completes the cycle and trigers 4017-2 to switch it to the second LED.

In my head (I haven't yet made this) this all happens in quick succession, and this design effectively strobes as the previous design. But I'm trying to get a delay between LED1 flashing and LED2 flashing. At the moment 4017-1 is reset from Q6, I guess if that is changed to Q9 there will be a short delay before the second LED flashes. But if I want that delay to be a bit longer, say about a complete cycle of 4017-1, how can that be done? Or am I missing something?

Also, pins 11, 12 and 13 of the 4075 must also be connected to fixed logic levels (e.g. grounded). All unused inputs on logic ICs must be tied to known logic levels.

Oops - In my first strobe I have left these hanging... It is working fine, but I guess I should ground them. What would happen if they are left open?

And you've changed the outputs on the first 4017 that you feed into the OR gate. You should keep them as pins 3, 4 and 10, as before, so there will be gaps between the blinks. If you use pins 4, 2 and 7 (Q1, Q2 and Q3), the LEDs will not blink ON and OFF three times.

Ooops again - I didn't realise I had done that. I understand the difference and will fix it.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Yep - that all makes sense. So the 4053 stays switched to one LED until 4017-1 completes the cycle and trigers 4017-2 to switch it to the second LED.
Right.
In my head (I haven't yet made this) this all happens in quick succession, and this design effectively strobes as the previous design. But I'm trying to get a delay between LED1 flashing and LED2 flashing. At the moment 4017-1 is reset from Q6, I guess if that is changed to Q9 there will be a short delay before the second LED flashes. But if I want that delay to be a bit longer, say about a complete cycle of 4017-1, how can that be done? Or am I missing something?
You're right. All you're missing is that you didn't say how long you wanted the delay to be. I assumed you wanted a delay of one oscillator cycle, rather than zero cycles as in the design in post #1. If you want a longer delay, with the circuit we're running with now you have limited options. (I can imagine BobK saying to himself again how you should be using a microcontroller because all of these changes would be so easy to implement...)

The longest delay will occur if the first 4017 operates as a divide-by-10. In terms of oscillator cycles, the first LED will get one cycle ON, one cycle OFF, one cycle ON, one cycle OFF, one cycle ON, then five cycles OFF and the pattern will swap to the other LED.

If five oscillator cycles' gap is not enough, you could put a "T" ("toggle") flip-flop in between the oscillator and the first 4017 to divide the frequency by two, so the first 4017 only advances by one count for each ON+OFF period, and use the logical OR of Q0, Q1 and Q2, ANDed with the oscillator signal to produce your three blinks. This would require another IC for that gating (though you could easily eliminate the 4075 using a "diode OR gate").

You could use a 4013 or 4027 for the T flip-flop; these both have two flip-flops and the second one could replace the second 4017, since it is only being used as a divide-by-two anyway.

That would give you a gap of 1, 3, 5, 7, 9, 11, 13 or 15 oscillator cycles (depending on the division you use with the first 4017) between the end of the flash on one LED and the start of the flash on the other.

Oops - In my first strobe I have left these hanging... It is working fine, but I guess I should ground them. What would happen if they are left open?
CMOS inputs will float to undefined states and can pick up noise, which can disturb the operation of other gates in the same package, especially if you don't have a decoupling capacitor on each IC. The gate can also stay in its "linear region" where it draws more current than it should. Floating inputs are also more susceptible to ESD (electrostatic discharge) which can destroy the IC.
Ooops again - I didn't realise I had done that. I understand the difference and will fix it.
You're doing fine :)
 

peter.s

Dec 18, 2014
37
Joined
Dec 18, 2014
Messages
37
Thanks for the reply Kris - it seems I may have been unclear with my initial description... I've noticed that my interpretation of the word Cycle is probably inaccurate as I took it to mean a full round of signals (Q0-Q9) on the IC, not a single On or OFF signal as you are suggesting.

Before I read your response I was thinking through a possible solution of my own. Would this work?


Strobe -2.png
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Is the idea to switch the oscillator between the two 4017s?

It won't work as you've drawn it. You would need a latch to remember which 4017 the oscillator is to be directed to, and the Q9 outputs of the two 4017s would need to set and reset (respectively) that latch. You would also need a T flip-flop to control which set of LEDs receives the group of pulses. And you would need to change how the 4017s are reset. I wouldn't use that as a starting point.

I see what you mean about "cycle". But the reason I assumed you wanted a short pause was that you said "short pause". I would have described a whole sequence of ten oscillator cycles as a "long pause"!
 

peter.s

Dec 18, 2014
37
Joined
Dec 18, 2014
Messages
37
I see what you mean about "cycle". But the reason I assumed you wanted a short pause was that you said "short pause". I would have described a whole sequence of ten oscillator cycles as a "long pause"!

Indeed - sorry for the misunderstanding!

I will spend some time going through what your suggesting as my options and will get beck if (more likely when) I run into trouble.

Thanks again for all your help :)
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
Bob, you're getting a bit predictable with your "everything should be done with a microcontroller" mantra.
Yeah, I guess I do sound like a broken record. I just thought this example was a good one for one of the main benefits, the ability to make changes easily in software.

Bob
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
It's an excellent example, I agree. If you or I were asked to produce a device to meet this requirement, we wouldn't consider doing it any other way. And we would "leverage" (yes, it's a verb now) that approach to add other advantages, and produce a wonderful product.

But Peter is just starting out, learning about logic functions, getting ideas to form in his head. He has plenty of opportunity to get into microcontrollers after he has absorbed the more basic ideas, and gained confidence through hands-on experimentation. Producing a highly compact, easily upgradeable, low-cost design right off the bat is probably as close to the bottom of his priorities as it is to the top of yours!
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Re my paragraph in post #12:
If five oscillator cycles' gap is not enough, you could put a "T" ("toggle") flip-flop in between the oscillator and the first 4017 to divide the frequency by two, so the first 4017 only advances by one count for each ON+OFF period, and use the logical OR of Q0, Q1 and Q2, ANDed with the oscillator signal to produce your three blinks. This would require another IC for that gating (though you could easily eliminate the 4075 using a "diode OR gate").
That's not actually true - you don't need a T flip-flop between the oscillator and the first 4017's clock input, unless you want to guarantee that the gaps between the flashes are exactly the same duration as the flashes, i.e. a mark-to-space ratio of 1:1 or a duty cycle of 50%.

If you just feed the oscillator into the first 4017's clock input, and also AND that signal with the output of the OR gate, you will get the three pulses to blink the LED three times, but the duty cycle (the ratio between the ON time and the total oscillator cycle time) will not necessarily be 50%. It will be equal to the duty cycle of the oscillator's output signal.

The 555-based oscillator used in the schematic in post #1 is not the normal design and I can't be bothered calculating its duty cycle. You will get fairly close to 50% duty cycle using the standard 555 astable circuit, with a lowish resistor (e.g. 3k3) between VCC and pin 7, a much higher resistor (e.g. 100k) from pin 7 to pins 6 and 2, and the timing capacitor from pins 6 and 2 to 0V.
 

peter.s

Dec 18, 2014
37
Joined
Dec 18, 2014
Messages
37
Producing a highly compact, easily upgradeable, low-cost design right off the bat is probably as close to the bottom of his priorities...

Yes and No. I would like to produce a compact, reliable and low-cost design, but I'm not sure if a microcontroller is right for this anyway.

All this mucking around is to get the flash rate and flash pattern I like, once I've done that there would be no reason to change it in the future. So I assume that a couple of extra ICs is probably an even match (or a better deal) than stuffing around with programming microcontrollers for a single (and simple) operation.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
All this mucking around is to get the flash rate and flash pattern I like, once I've done that there would be no reason to change it in the future.
Oh boy! And no additional features? That sounds like "famous last words"...
So I assume that a couple of extra ICs is probably an even match (or a better deal) than stuffing around with programming microcontrollers for a single (and simple) operation.
There are a lot of factors. Assuming you're only building one, cost isn't a factor, and a discrete logic solution will be cheaper than buying a device programmer anyway. Of course you want it compact, but how compact? A microcontroller is far more compact than 2~4 logic ICs, but if the logic IC solution is small enough, then so what. A microcontroller's built-in oscillator will be somewhat more accurate than a 555-based clock source, so a microcontroller would give a more accurate and consistent flash rate, and the precise timing can be adjusted easily and accurately. Ease of future changes and expansion are another factor. And this would be a good starter project if you want to get involved with microcontrollers to use for other future projects. I think those are the major factors you should take into account.
 
Top