How to set a 4040 ripple counter with a 12 position DIP switch

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
Working on my coffee water timer, but I didn't want to clutter that thread anymore. And since this question is singularly specific I'll just ask it here:

I need to be able to use a CD4040 ripple counter to get a count that is end user customizable by dip switches. Is there a way to have just 1 set of DIP switches, 1 on each Q1-Q12 to select the desired number? I've tried putting inverters on each Q1-12, and jumpers in front of and after the inverter, but this is making a huge nightmare on my pc board. I'm just wondering if there's a simpler way to do this???
 

Wendy

Joined Mar 24, 2008
23,421
Yes. The DIP switch will connect the 4040 to a really large AND gate. You can easily make good AND gates with one diode per input and one resistor. Need an illustration?
 

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
Yes. The DIP switch will connect the 4040 to a really large AND gate. You can easily make good AND gates with one diode per input and one resistor. Need an illustration?
Yes, a diagram would be great. All I can visualize is that the dip switches will cut the Q's from the 4040 off the AND gate... So does that leave it high or low or ? ...if it is just disconnected.
thanks,
 

thatoneguy

Joined Feb 19, 2009
6,359
Would you need all 12, or could you use a combination of 8, leaving out the 2-3 least significant and the most significant bit to get enough of a span for times? It would be a simpler interface as well, not to mention DIP Switches typically come in banks of 2, 4, or 8.
 

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
Would you need all 12, or could you use a combination of 8, leaving out the 2-3 least significant and the most significant bit to get enough of a span for times? It would be a simpler interface as well, not to mention DIP Switches typically come in banks of 2, 4, or 8.
I thought about that. Q1-8 would be enough.
thanks.
 

Wendy

Joined Mar 24, 2008
23,421
If you haven't seen diode gates before this may not be obvious. An open input is assumed high. It is a real 12 input AND gate though.



Since the 4040 counts up the gate will go high with all the selected digits go high. If the counter stops then it is done, if the counter keeps going it will go high several more times as the selected outputs go high. It doesn't respond to the open switches, since they are open.
 

Attachments

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
If you haven't seen diode gates before this may not be obvious. An open input is assumed high. It is a real 12 input AND gate though.



Since the 4040 counts up the gate will go high with all the selected digits go high. If the counter stops then it is done, if the counter keeps going it will go high several more times as the selected outputs go high. It doesn't respond to the open switches, since they are open.
Thanks! Yes, I see how this works. The R1 would be connected to Vcc, correct. Giving the output a high valve, except if any of the the selected Q's are low, that will sink the high pulse and keep it low.
Could I use 14448 diodes for the gate? Or what would you recommend?
This is much simpler than I thought I'd be, which is usually how things work!
 

Wendy

Joined Mar 24, 2008
23,421
Almost any diode will work. Something like the 1N914 or 1N4454 are signal diodes, which means they are fairly fast. Whatever junk box parts is good though.
 

Bernard

Joined Aug 7, 2008
5,784
Welcome back. I' drawn up amy interpitation of your requirement- at least something to throw knives at. As shown big AND gate uses jumper wires, but could easily use dip sws & still provide for necessary inversions by directly connecting U2 outputs 8- 512 to invertor inputs, outputs going to
dip sw's. That is just one more 74C14 [ or other invertor ] for 2- 8 position dip sw's. Assuming not using 1,2.4,&2048. I would preffer moving diodes to U15 side of AND.
Rather than inhibiting U2 input, U2 reset is held hi when ckt is off. The F-F is composed of U9 & U10. Pushbutton sw , SW1,starts water flow by setting F-F , U9-Q hi & removing reset from U2. When programed count is reached, U2 is reset & & U8 receives a count. U8 counts up, illuminating LED's in sucession, untill SW3 selection is reached, U8 clock enable goes hi stopping further counting; selected LED stays on, F-F is reset, valve closes, U2 held at reset. A manual reset is provided by SW2.
 

Attachments

Audioguru

Joined Dec 20, 2007
11,248
The CD4040 is a ripple counter, not a syncronous counter. Its ripple causes many extra glitch outputs that will probably clock the CD4017 wrongly.

Maybe the timer circuit should be a simple CD4541 oscillator/timer IC instead of those hundreds of parts.
 

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
The CD4040 is a ripple counter, not a syncronous counter. Its ripple causes many extra glitch outputs that will probably clock the CD4017 wrongly.

Maybe the timer circuit should be a simple CD4541 oscillator/timer IC instead of those hundreds of parts.
Doesn't the 4541 create it's own pulse/freq. rather than monitor the incoming pulses?
 

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
Welcome back. I' drawn up amy interpitation of your requirement- at least something to throw knives at. As shown big AND gate uses jumper wires, but could easily use dip sws & still provide for necessary inversions by directly connecting U2 outputs 8- 512 to invertor inputs, outputs going to
dip sw's. That is just one more 74C14 [ or other invertor ] for 2- 8 position dip sw's. Assuming not using 1,2.4,&2048. I would preffer moving diodes to U15 side of AND.
Rather than inhibiting U2 input, U2 reset is held hi when ckt is off. The F-F is composed of U9 & U10. Pushbutton sw , SW1,starts water flow by setting F-F , U9-Q hi & removing reset from U2. When programed count is reached, U2 is reset & & U8 receives a count. U8 counts up, illuminating LED's in sucession, untill SW3 selection is reached, U8 clock enable goes hi stopping further counting; selected LED stays on, F-F is reset, valve closes, U2 held at reset. A manual reset is provided by SW2.
I'm following most of this,
I'll be drawing this up in PCB Artist! I'm not quite sure about the inverters, if/why I need them if I use DIP switches, but I'll post my drawing thus far when I get it done.
 

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
The CD4541 has its own built-in oscillator but can also use an external oscillator. It is a timer that is programmable with DIP switches or other things.
I am drawing up something now, with the ripple counter, and will post what I got tonight. If it seems better to use the 4541, I don't mind that. I tried finding some schematics with the 4541 in it so I'd better understand it, but anything I found, it was being used as an oscillator/timer like thing... If it's not hard to sketch a diagram or if you could point me to an example online somewhere, I'd like to see it.
 

Bernard

Joined Aug 7, 2008
5,784
I do not think ripple counter glitches are a problem, but threw in a glitch filter just in case. I do not see a way around using invertors to decode random number selection.
 

Attachments

Audioguru

Joined Dec 20, 2007
11,248
The CD 4541 does not look verry promising if I read it right- selects only 4 divisions??
Then use a CD4536 oscillator/timer IC. It has 24 binary counter stages. Its first 8 stages can be bypassed with one-bit and its last 16 stages can be decoded with 4-bits.
 

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
I do not think ripple counter glitches are a problem, but threw in a glitch filter just in case. I do not see a way around using invertors to decode random number selection.
Here's a .pdf of what I've got so far. I didn't put in the inverters, but I will if you say I need them. I thought that if any of the dip switches were open, then that leg would just read high? I must not be following the logic quite right here.

Note that I've added a 3 digit display to give a readout of the cups as the water fills up. If I decode the pulses into 10th's of a cup (1/10 of 6 oz to be exact) then the display will count to the 10th's decimal place! That should be pretty nice.

Oh, I see a mistake already. The output going on the the cup counter is counting 10th's of a cup, not cups. I guess I need to put another devide by 10 (4017) in there, unless I find some kind of smaller chip with fewer pins.

Can someone also confirm that the BC548 transitor is a good choice to gate the water solenoid-I don't quite follow the PNP/NPN thing.


I'll now work on adding the glitz remover components you just mentioned...
 

Attachments

Top