# percision timing ratio of multiple lights blinking with different durations and intervals

I'm learning a lot of this as I go, my background is mostly in programming. I'm trying to setup a timing circuit for two sets of lights going into a model, and am trying to determine the best way to go about it. The setup is this: The first light set starts on, then goes off at 0.5s then stays off for 1s. The second set of lights come on for 0.025s in the middle of the on and off periods of the first lights so on at 0.25 sec for 0.025s and then again at 1s.

I've done some rough prototyping using a 555 oscillator, a digital counter, and logic gates to hard code the timing for the shorter strobe lights. I know I can hard-code a sequential logic for the longer lights, but that seems as it would take up a bit of real estate using just straight logic gates.

I've considered possibly using a programmable logic array or FPGA to handle the logic for the counter output, but don't know enough about either to know which would work best.

Ideally I want to avoid using an Arduino unless I can put a small processor on the board instead. I need to keep the design as compact as I can since it will be installed inside some very tight spaces inside a model.

The overall timing period of the lights can change a little, the key is the ratio between the two.

I've looked around and found questions here about 1 set of lights with verying timing, but not a situation like I have here. Any help or suggestions is much appreciated.

• You have just two outputs so start looking for e.g. a 6 pin processor. They don't come much smaller. Feb 25, 2019 at 20:02
• A simple MCU will be far smaller and cheaper than any FPGA you can work with. Even a CPLD would be non-trivial to find in a comparable package, and is going to be an order of magnitude more work. Dedicated logic is really only used for things that need to be blindingly fast and a few other edge cases. Feb 25, 2019 at 20:54
• Start with a timing diagram before coding.. i.e. a functional spec. It appears as 2 phase clocks that alternate in frequency. Feb 25, 2019 at 21:00
• When you become an expert after 20yrs in programming it should take a day to complete This task. Write a design spec, Then design it, including a prototype. Then someone can layout the board in a day. It's about the same time for an expert in logic H/W design .. Let me try the latter. in Simulation Feb 25, 2019 at 23:05
• Thanks for the input. Any suggestions on MCU lines to take a look at. Got a couple starting places below to look at. I figure it will a little more work learning the programming side unless it’s done in a language I’m already familiar with but I’m not holding my breath on that one.
– CyF
Feb 25, 2019 at 23:10

The most basic microcontroller will have all you need to generate the timing with no additional components - an internal oscillator, a timer which can be run from a scaled clock source, and enough memory for the simple logic to produce the signals. An ATtiny has an internal 8MHz clock, can run the timer at a 1/256 divider to give an 32us timebase that would allow the 16 bit timer to run a cycle up to 2 seconds, you'd then just need to pick on and off times for two outputs. Available in SOT23 package, as are PIC10s.

• Thanks I was thinking that would be the way to go probably. I also now have a place to start looking to part wise,
– CyF
Feb 25, 2019 at 23:08

Although I don't suggest this is better than a simple uC design. This is how I might have done it in 1975 when I graduated just after CMOS was new.

The key is to design the timing chart then realize how to implement it in the tools you know how. If not good enough, learn a new tool like PIC machine language.

Note that fastest clock here is 4 Hz.

• Ignore the fact that the Reset on Johnson counter in SIM is inverse logic. But you can replace all the OR & INV with 1 Quad NAND Schmitt IC Feb 26, 2019 at 1:19
• Thanks always nice to have another method to put into the tool box for anything. That is definitely a lot simpler then the solutions I was coming up with on my own sans a uC. I’ll probably end up prototyping this up on a board either way to really get into my head how the design works, though I think I’ve gotten to a point I can tell now just looking at the schematic. Like I said my background as mostly been in high level programming and one assembly class back in collage. Been nice getting into the electrical side of things.
– CyF
Feb 26, 2019 at 3:19
• For coding you need the following clocks. 40 Hz (25ms), 4Hz then either shift left or right 0000001 and pattern match as I did or binary count and decode 2 or 6 states ( or 60 states at 40Hz ). for the 25ms pulse and of 6 states at 4Hz for the 100100100.... 1.5 second pattern.. Got it? :Learn/Play with the SIM is faster than breadboarding. Feb 26, 2019 at 3:34
• Yeah I need to get a simulator up and running. I’ve been working on paper off a 40Hz 60 state setup, but I hadn’t even considered setting up a delay quite the way you did there. I only just started looking at Johnson counters this morning for another application.
– CyF
Feb 26, 2019 at 3:49
• Yes I only used 4Hz & 1 shot instead of 40Hz but If you search/learn how to code counter matching states in machine code then you can create arbitrary patterns. With a Tiny4 at 10MHz and 500 bytes, it should be possible if you are efficient. Learn how to detect rising edge states with XOR previous and current state. I just used a differentiator with a diode to make a rising edge 1 shot, but this can be done in code too Feb 26, 2019 at 3:52