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

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
A note on the flow sensor:
The one I mentioned earlier about using--they wanted over $100 for the little thing!
So I found anther one by SeedStudio for less than $10.
I won't know for sure without testing it, but I'm pretty sure the pulses for 1/10 of a 6 oz cup will be 80-120. That being the case I could get by with the 4024 ripple counter, a divide by 128 chip. That would mean a lot less "stuff", especially if I have to use the inverters. (I reckon I do, I just don't understand why yet...)
 

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
@ 120 counts per 1/10 cup, looks like you need to count to 1200, keep the 4040 to count to 1024?
Not if the output pulse to the next stage is set for 1/10 cup increments to get the tenth decimal place on my 3 digit display...
But I will have to divide by 10 to feed the cup counter part of my circuit. I hope it makes sense on the drawing I posted.
 

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
All my chips are of the 4000 series, but I don't see a hex NOT with Schmitt.
Do I have to have one with the Schmitt?
The MC74HC14A is Schmitt, but the datasheet says 2-6 volts and I'm working with 12 volts.
 

SgtWookie

Joined Jul 17, 2007
22,230
A CD40106 is a hex Schmitt trigger inverter.
You could also use a CD4093 quad NAND Schmitt trigger as inverters by wiring both inputs to a gate together.

4093's are very useful ICs.

You show your solenoid valve as rated for 6.9v, but you're supplying it with 12v. It'll have a short life.
The BC548 is rated for only 100mA collector current; that means its' useful maximum is around 50mA. You haven't stated what the resistance or current requirement of the solenoid valve is; or if 6.9v is really the correct voltage rating for it.

At any rate, 4000 series CMOS ICs are not able to source or sink very much current without having a good deal of voltage drop/rise at their outputs. A total load of about 3.9k is as much as you can safely put on one output and still maintain logic-level voltages; otherwise you wind up with indeterminate signal levels (neither considered 1 nor 0; the "forbidden zone").
 

Audioguru

Joined Dec 20, 2007
11,248
CD40106, MC14584 and 74C14 are all ordinary Cmos Schmitt-trigger hex inverters with an 15V max supply voltage.
The glitch remover has a fairly slow rise and fall time. Some CD4017 ICs need a fast clock rise and fall time. But a Texas Instruments CD4017 IC has a Schmitt-trigger clock input.
 

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
A CD40106 is a hex Schmitt trigger inverter.
You could also use a CD4093 quad NAND Schmitt trigger as inverters by wiring both inputs to a gate together.

4093's are very useful ICs.

You show your solenoid valve as rated for 6.9v, but you're supplying it with 12v. It'll have a short life.
The BC548 is rated for only 100mA collector current; that means its' useful maximum is around 50mA. You haven't stated what the resistance or current requirement of the solenoid valve is; or if 6.9v is really the correct voltage rating for it.

At any rate, 4000 series CMOS ICs are not able to source or sink very much current without having a good deal of voltage drop/rise at their outputs. A total load of about 3.9k is as much as you can safely put on one output and still maintain logic-level voltages; otherwise you wind up with indeterminate signal levels (neither considered 1 nor 0; the "forbidden zone").
It's 6.9 watts, not volts. At P=I*E it'd be about 500-600ma of current for the solenoid. What transistor would you recommend?

I'll look into these schmitt triggers you mentioned...
 

Wendy

Joined Mar 24, 2008
23,429
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.

As long as the counter is counting up (which is the only thing a 4040 can do) then you DO NOT need inverters. The OP is right, open inputs are assumed high. The first number hit by the counter is the selected number, just reset the counter afterwards. Or are you thinking of making a clock?
 

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
"As long as the counter is counting up (which is the only thing a 4040 can do) then you DO NOT need inverters. "

....THANK YOU, THANK YOU!
That simplifies things.
 

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
It's not that I'm trying to get out of doing it myself, but I've spent 45 minutes trying to figure out what kind of transistor to use to turn on the solenoid. Could someone please recommend something. I "think" I need an NPN, but I'm not even sure about that. It's getting late.

EDIT:
How about this: It's NPN,
TIP29A
Maximum DC Collector Current: 1 A
Power Dissipation: 30watt
 
Last edited:

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
If anyone's interested, here's what I've come up with. I'm going to have to wait for a shipment from Mouser, now.
It has 2 displays, a 2 digit and a 3 digit.
The 2 digit display is set to 2,4,6,8, or 10 by the 2P5T switch
The 3 digit display counts up to the desired setting, showing the 10th's count as well.
Feel free to tell me anything about it that you see might not work... :rolleyes:
 

Attachments

thatoneguy

Joined Feb 19, 2009
6,359
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.
Could work, but I don't know what the clock source is for the other circuit.

The division choices are rather high valued powers of two, with not much for in-between selections:
Rich (BB code):
A     B     Counter Stages     2n      
        n          
0     0     13     8192      
0     1     10     1024      
1     0     8     256      
1     1     16     65536

--ETA: The latest schematic shown above makes me want to blurt out "This would be easy with a PIC or Arduino!", but I'm holding my tounge. ;) Imagine a nice Blue LCD display with a keypad for input...
 

Bernard

Joined Aug 7, 2008
5,784
On trying to prove the need for inverting unselected bits in decoding a number, I can find no examples to prove it. Chalk it up to bad memory of a need for it from early 1960's. Maybe it's because I turn 84 next monday. Another maybe: maybe Bill Marsden can lend a hand. Already settled- the secret counting up. Why not use a FET or darlington?
 
Last edited:

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
Could work, but I don't know what the clock source is for the other circuit.

The division choices are rather high valued powers of two, with not much for in-between selections:
Rich (BB code):
A     B     Counter Stages     2n      
        n          
0     0     13     8192      
0     1     10     1024      
1     0     8     256      
1     1     16     65536

--ETA: The latest schematic shown above makes me want to blurt out "This would be easy with a PIC or Arduino!", but I'm holding my tounge. ;) Imagine a nice Blue LCD display with a keypad for input...



HMMMMMM, after reading what you posted, I think this 4040 is not working the way I'm thinking it is. So it doesn't let me stop the count anywhere I want?

Tell me more about an Arduino! I know nothing about them, or next to nothing. If I get a programming kit, like what Radio Shack sells for $99, then is that all I need to do something like this?
Let me ask you this: I don't mind sinking the funds into a nice little arduino kit, but then how much would you estamate it would cost to do something like what I'm trying to do? Would I find ample help on coding it?
Right now, I think I could be talked into Arduino pretty easy. I would consider investing $100 in a kit (any good recommendations) if I knew I could do what I'm trying to do with it...
 

Audioguru

Joined Dec 20, 2007
11,248
You want the solenoid-driving power transistor to saturate. Its datasheet (and the datasheet for every transistor) shows that it saturates good with a base current of 1/10 its collector current. So it needs a base current of 60mA which is impossible with the 1k resistor driving it from the low-current output of a Cmos gate.
Replace the power transistor with an N-channel Mosfet.
 

Bernard

Joined Aug 7, 2008
5,784
I see no reason that 4040 does not do as you wish. Need to connect manual reset, SW2, to display reset. U 19, 4017, triggers on pos going input; inverted AND out is a skinney neg pulse so count is on trailing edge- should be OK. The F-F as shown has problems, should use NORs I think.
 

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
You want the solenoid-driving power transistor to saturate. Its datasheet (and the datasheet for every transistor) shows that it saturates good with a base current of 1/10 its collector current. So it needs a base current of 60mA which is impossible with the 1k resistor driving it from the low-current output of a Cmos gate.
Replace the power transistor with an N-channel Mosfet.
Okay, that narrows it down to just a few thousand transistors at Mouser, so I ordered the MOSFET Power 200V N-Ch MOSFET, 512-FQP10N20C



I see no reason that 4040 does not do as you wish. Need to connect manual reset, SW2, to display reset. U 19, 4017, triggers on pos going input; inverted AND out is a skinney neg pulse so count is on trailing edge- should be OK. The F-F as shown has problems, should use NORs I think.
Yes, now with a bit more sleep I see the 4040 will count the way I need it to. I'm pretty sure I can replace it with the /128 counter, 4024.
I don't think I'll need a manual stop, so I can do away with SW2? I just need to start it, if it needs stopped, the master power button will work.
I don't understand enough yet about the F-F to troubleshoot it. I may have to wait for my shipment of parts to come. I'll order some NORs.
 

SgtWookie

Joined Jul 17, 2007
22,230
I'm just going to focus on your 3-digit display for this reply.

It looks like you're using a common cathode display, but I think you're going to run into problems as the logic will be inverted. Swap the display for a common anode type, replace the 4511 with a 4543, and have the transistors source from Vcc rather than sink to GND.

See ONSemi's datasheet for the MC14553B.

A typical 7-segment display might have a Vf of 2v/segment with a 10mA current. You're showing 330 Ohm resistors, which would result in (12v-2v)/330 = 10v/330 = 30.3mA; far too much for the display and the driver IC. The resistors should be >=1k Ohms to get the current below 10mA.

Also, the transistors will have to source up to 7 segments simultaneously; so whatever you choose for the resistors, keep this in mind.

For example, if you used 1.3k resistors, you would have ~7.7mA current per segment, which would be a total of ~54mA for all segments on (8); so you'd need to source the base current of the transistor with 54mA/10 = 5.4mA, which is do-able with 2k base resistors and the 2N3906 transistors you've specified. If you want more segment current, you're going to have to swap out the 2N3906 transistors for something better.
 
Top