Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

My 1st project - To cycle through 7 LEDs with push button

Status
Not open for further replies.
Aight fellas, while you all have provided some incredible insight, and I have followed some of it, I need to put something together using my limited capabilities. While I learn from the things you all have posted, I'd like to produce something as a "working temp model". To help you all help me, this is a schematic that shows you were I am so far. The numbers may be wrong, and this probably isn't the best model with the cleanest edges (and I have no idea about the circuitry inside the strobe unit)

But will this do as I need it to?

Strobe-Counter_zpspgh6ldoj.jpg
 
Last edited:
1st problem:

The LED's can't drive the LEDs at all, because you only have 0.5 to about 3 mA sourcing and sinking current (depends on supply V and temperature). That's why you need the ULN part. The LED supply comes from a +V IGN source and the driver SINKS the LED when a positive voltage appears at the input.

What's the coin battery there for?

Please measure the open circuit voltage at the switch. i.e. measure the voltage to ground with the PB (pattern) switch open and the PB switch pushed.

Discussion about other junk required like transient suppression, unused gate inputs HAVE to be tied to ground or +V for CMOS logic, 0.1 uf ceramic caps connect to power and ground near each IC.
 
Aight fellas, while you all have provided some incredible insight, and I have followed some of it, I need to put something together using my limited capabilities. To help you all help me, this is a schematic that shows you were I am so far. The numbers may be wrong, and this probably isn't the best model with the cleanest edges (and I have no idea about the circuitry inside the strobe unit)

But will this do as I need it to?

How will you sync them?

MR = Q7 or Sync

Remember I suggested Sync could be sustained depress of switch?

Coin Cell wont work and would not connect to CLK. Use dash or accessory V+ is on always. Also need diode and large cap.

However there are rules that you cannot apply signal control to CMOS when power is off, becuase of latchup risk when power is turned on. zzzt.
 
Last edited:
Your counter is /8 move tap to get /7
No, it's divide-by-seven (in practical terms) as shown. The eighth pulse is vanishingly brief (it persists only for <1uS while the counter is resetting). Don't 'move tap'.
 
Last edited:
I agree alec.. Do you agree with my other suggestions?
 
Certainly some means of syncing the display to the light sequence is needed. Depends on how the strobe sequencer itself resets. My posted circuit assumed a power-on reset, but a hold-button-pressed method would also work. As for buffering the 4017 outputs, yes, but the details would depend on the form of display to be used (i.e. 7-segment common anode/cathode, or discrete LEDs).
 
I made a lot more suggestions

1) remember , it must remember the same LED.
the unit will need to light the same LED that was on prior to switching off the unit.

2) It must use an inverter like ULN2002 to invert the output to give Common Anode LED to V+ or switched 12V
3) Both the ULN2002 and CD4017 work down at 3V ( suitable for LiPo )
4) The ULN2002 is a darlington with ~22K input impedance ( inc. 3 diode drops)
5) The only way the coin cell will work is if the LED's to run the switch and CD4017 off 3V and common Anode (+) (ULN2002/4) as I said before.
 
In Post #10, I suggested the ULN2004 which is 12 V logic. The datasheet is here: https://www.ti.com/lit/ds/symlink/uln2003a.pdf It's noting more than Darlington transistor arrangement to ground with the COM terminal to reduce the parts count when driving relays.

So, Tony we are on the same page.

==

Depending on the units smarts, it could remember where it was when powered up or always powers up in some known mode.

==

One way is to read the existing switch and count and another is to make that switch work some circuit and the circuit plays switch.
A.
Existing switch [circuit] count
B
A switch (could be the same one)[circuit that counts reliably] AND actuates (pulses) [switch]

So, we still need to know a little bit about the switch. Technically, you don't with option B.
 
Last edited by a moderator:
Hi

Here's something you could do.
I didn't spend a lot of time on this, but I think you'll get the idea. A switch is used to control power to the PB and LEDs.
Otherwise, power is maintained to the D- flip flop and counter.
You'll have to choose an appropriate mosfet and adjust the LED resistors.

eT
 

Attachments

  • sequencer-ckt.png
    sequencer-ckt.png
    36.6 KB · Views: 342
  • sequencer-sim.png
    sequencer-sim.png
    16.3 KB · Views: 240
I missed your post #10.. agreed

Thanks eTech for the schematic.

I cut N pasted it with an ECN to reflect my prior suggestions. Hope you approve. :)

7162723800_1426829904.jpg


hysteresis on CLK input, Time constant will switch with ~45% hysteresis compared to T=1/e or 62%
1305784900_1426830210.jpg


the 100nF if ceramic may have self leakage < 10MOhm so plastic is recommended.
 
Last edited:
The Clk input is shown connected permanently to 12V :confused:.
 
No, rather it is connected to a momentary push-button , incorrectly shown as Normally Closed connected to ignition switch +12V

Tiny push buttons are ~1ms bounce and larger momentary push buttons are ~10-20ms while flakey old contacts depend on pressure and can oxide and bounce forever, so the cap also helps burn off oxide ... ( microscopic oxide detonation) , although scaling the C up and R down would do better in the latter.

The result is CLK is Schmitt input from 1/3 to 2/3 V+ so it generates a clean clock with slow falling edge and from switch and fast rising edge from diode and slow rising edge to RESET needs no Schmitt as the Reset prevents clocking and this occurs when released after 1s.

So 1 switch is all that is needed with direct unswitched power to circuit and switched power to pushbutton and LED Anodes.(+) to perform dual task of click advance or HOLD Reset after advanced the Alarm to last position so on the RESET ... Alarm advances to 1st positona nd Johnson Counter Resets to 1st position. Now both are in sync until battery is glitched or disconnected. ( switch bypass cap also couples glitches....so another LPF may be needed on CLK in. )

I think I got every right now.
 
Last edited:
got it... I see the skinny rat.. corrected

4405137600_1426881618.jpg
 
Last edited:
BFoulk
Is this the strobe your using?

Also...how about using a 7-segment display instead of LED's?
It will provide a numerical readout.

eT
 

Attachments

  • 41rWKrWHCWL.jpg
    41rWKrWHCWL.jpg
    27.7 KB · Views: 245
Last edited:
Hi

I guess I prefer a digital signal output diving the clock input of the counter. So I kept the flip-flops.
The circuit can be reset by operating the on/off switch.

eT
 

Attachments

  • sequencer3-ckt.png
    sequencer3-ckt.png
    173.9 KB · Views: 243
  • sequencer3-sim.png
    sequencer3-sim.png
    127.5 KB · Views: 234
Sorry but all Digital devices are still analog and Flip Flop relying on two RC delays works but is no better in performance. ... ( because the CD4017 CLK Schmitt trigger is designed to square up slow rising inputs. at 2/3Vcc high then 1/3Vcc low.)

Unless you choose a gold plated pushbutton switch like all Telecom Relays <2A, I would add 1uF across Clk input to ground for additional contact cleaning and glitch reduction.

What you choose depends on your experience.
 
Last edited:
Sorry but all Digital devices are still analog and Flip Flop relying on two RC delays works but is no better in performance. ... ( because the CD4017 CLK Schmitt trigger is designed to square up slow rising inputs. at 2/3Vcc high then 1/3Vcc low.)

*sigh*

Unless you choose a gold plated pushbutton switch like all Telecom Relays <2A, I would add 1uF across Clk input to ground for additional contact cleaning and glitch reduction.

The circuit I posted works with crummy old radio shack buttons...

What you choose depends on your experience.

No disrespect intended...I'm sure you have plenty.

There is a difference in performance however. The circuit you posted is sensitive to the duration of the button press.
The circuit I posted is not as sensitive. Doesn't matter if the PB is pressed for 1 sec or 10 seconds.

If you press the button like a human being, the duration may or may not be longer than a second.

Here are three simulations of your circuit, holding the button down for 250ms, 1sec, 1.5sec.

In addition, since this will be in an automotive environment, there could be a significant variation of supply voltage...a range of maybe 11-14v.

eT
 

Attachments

  • sequencer4-cktsim1r5sec.png
    sequencer4-cktsim1r5sec.png
    186.5 KB · Views: 222
  • sequencer4-cktsim1sec.png
    sequencer4-cktsim1sec.png
    183 KB · Views: 206
  • sequencer4-cktsim250msec.png
    sequencer4-cktsim250msec.png
    177.3 KB · Views: 216
Last edited:
** longer sigh **

Perhaps I should explain the schematic I edited. that the reason no Flip Flop is needed the momentary switch with cap across or to ground acts as a Sample & Hold, so any crappy switch it will be effectively debounced.

To eliminate the Darlington and R's simply use 1 R and a switch to ground to save battery and only needed when LED strobe is needed.

Try it out here

Result below
1700659700_1427050890.jpg

Falstad Sim uses 5V and wrong polarity of R and probably no Schmitt trigger on CLK input, so added for accuracy.
Moving the switch debounce cap to ground improves feedthru filtering or LPF of load dumps on Auto Vbat when 100 Ohm added in series.

Trace signals are ;
Top: internal CLK Schmitt trigger out ( non inv. shown for clarity)
Mid: Reset integrator voltage which triggers at Vcc/2 ( 2.5V in this case)
Bot: Reset! (active low in SIM) inverted to show buffered analog signal (Middle).

I hope you understand now. The 100R added increases the zero edge trigger in my design to 100*100nF= 10 microseconds which may be too fast as load dumps are 1~10us.
 
Last edited:
1st problem:The LED's can't drive the LEDs at all, because you only have 0.5 to about 3 mA sourcing and sinking current (depends on supply V and temperature). That's why you need the ULN part. The LED supply comes from a +V IGN source and the driver SINKS the LED when a positive voltage appears at the input.

I didn't understand what a driver was. After seeing the schematic with the ULN, it makes more sense. The problem with using the +V ING source, I often disconnect the truck's batter when working on the truck... if that causes the counter to lose count and return to Q0 it would defeat the purpose.

What's the coin battery there for?
it's a secondary battery supply (as opposed to the IGN source) to keep the counter on and "remember" the last count. An idea found here 4013 and 4017 output behavior

Please measure the open circuit voltage at the switch. i.e. measure the voltage to ground with the PB (pattern) switch open and the PB switch pushed.
It varies 11v to 13v depending on how long the engine has been turned off (as someone has mentioned). Once pushed it varies based on length held... at 100 BPM (beats per minute) it averages 9v (8v to 10v)

[QUOTE"]Discussion about other junk required like transient suppression, unused gate inputs HAVE to be tied to ground or +V for CMOS logic, 0.1 uf ceramic caps connect to power and ground near each IC.[/QUOTE]
Is this shown in the schematics listed so far? or is it one of those things that you all (whom actually know what your doing) understand without having to draw it out?

BFoulk
Is this the strobe your using?

**broken link removed**

Also...how about using a 7-segment display instead of LED's?
It will provide a numerical readout.

For display purposes, either would be fine. I didn't realize that was option and was familiar with LEDs
 
Last edited by a moderator:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top