How to stop an up/down counter at a specified number

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
If I have this 4 digit segment counter:
http://www.electronickits.com/kit/complete/elec/ck1612.htm

And the counter is fed by the pulse from a water flow sensor
And the water is turned on/off with a 12 volt valve,

Is there a way to stop power to the water valve when the counter gets to a specific number? I would actually have 5 different numbers (don't know what they are yet) The user could choose this with a rotary switch.... It would measure out the specified amout of water for making coffee, 2,4,6,8 or 10 cups.
thanks
 

beenthere

Joined Apr 20, 2004
15,819
The kit is made around a microcontroller. You would need to use external logic to decode the signals to the displays in order to catch the number being displayed. It's possible, but hardly convenient.

If you are at all familiar with logic, a single counter IC like a CD4029 or a CD40160 will count from 0 - 9. A CD4028 can decode the count and give signals to some gates when the desired count has been reached.
 

Wendy

Joined Mar 24, 2008
23,421
Assuming you are counting up, a simple diode AND gate will detect whatever number you are after (ignoring the 0's).

If you are counting down, a simple diode OR gate will also detect whatever number you want (ignoring the 1's).

If you want to detect a specific number that is randomly appearing, then a AND gate with inverters for the 0's will do the trick.
 

MMcLaren

Joined Feb 14, 2010
861
If I have this 4 digit segment counter:
http://www.electronickits.com/kit/complete/elec/ck1612.htm

And the counter is fed by the pulse from a water flow sensor
And the water is turned on/off with a 12 volt valve,

Is there a way to stop power to the water valve when the counter gets to a specific number? I would actually have 5 different numbers (don't know what they are yet) The user could choose this with a rotary switch.... It would measure out the specified amout of water for making coffee, 2,4,6,8 or 10 cups.
thanks
Are you interested in a custom or OEM solution? If so, do you actually want to display counter 'ticks', or something more useful?

Cheerful regards, Mike McLaren, K8LH
 

absf

Joined Dec 29, 2010
1,968
A look at the schematic shows that this circuit is good for diplaying the number of clock pulses from the clock input. And it may operate a relay when the count reaches "9999" using the overflow pin. Since the LED segments are displayed multiplexingly. I'm not sure if you can capture the digits from the segments with ease.

It would be far easier to design another circuit, that does what you want, working side by side with your counter circuit. Or if you are able to modify the program inside the MCU to accomplish what you wanted.

Allen
 

Bernard

Joined Aug 7, 2008
5,784
If you can program the counter to give X pulses per cup so that overflow gives one pulse per cup. Use overflow as clock input to a 4017, divede by 10,IC. Outputs 1-9[ 0 not used] go to diode OR gate which drives logic level FET. A multi position switch can select desired count to reset 4017. Output is ON for 1 to 9 cups, or as selected.
 

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
If you can program the counter to give X pulses per cup so that overflow gives one pulse per cup. Use overflow as clock input to a 4017, divede by 10,IC. Outputs 1-9[ 0 not used] go to diode OR gate which drives logic level FET. A multi position switch can select desired count to reset 4017. Output is ON for 1 to 9 cups, or as selected.
Thanks... This sounds interesting. I'm a newbie, and know nothing of programmable chips/ics, but I kinda follow what your saying here. Do I understand correctly that this method would not require programming?
I'm not sure what a logic level FET is, I'll have to look this up.
 

Bernard

Joined Aug 7, 2008
5,784
A seperate counter [ 4017, 4022, 4027, 4040 etc] could be used to give a one pulse per cup. Would be helpfull to know number pulses per cup. No programming of PIC required. These chips can run from the 12V supply so regular FET or transistor can be used as valve driver.
 

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
I'll have to look into this some more. I'm thinking about something like:
http://www.gemssensors.com/Content.aspx?id=1194
but I don't really know how many pulses per cup it will produce.
Would someone be able to just draw me a rough idea diagram of the IC's they'd use to count the pulses, and set 5 different stops for the numbers of pulses required for the different measures. I could control the 5 settings with a 5 throw rotary switch. I already have a 2nd pole of that switch set up to control a 7 segment display using a 4511 IC.
thanks.
 

Bernard

Joined Aug 7, 2008
5,784
The FT-110 # 173932 sensor gives 26100 pulses per1.3 gal or 941.2 pulses per 6 oz cup, or round to 940. Use 4040 IC, 12 stage counter & decode 940 to reset & advance second IC a 4022 or 4017. Might double count to give each out =2 cups depending on max no of cups required. Decoding needs 8 in NAND & one inverter IC. Or optional use BCD counter & 4028 dec decoder for switch select valve control along with 4511 BCD to 7 seg. display.
 

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
The FT-110 # 173932 sensor gives 26100 pulses per1.3 gal or 941.2 pulses per 6 oz cup, or round to 940. Use 4040 IC, 12 stage counter & decode 940 to reset & advance second IC a 4022 or 4017. Might double count to give each out =2 cups depending on max no of cups required. Decoding needs 8 in NAND & one inverter IC. Or optional use BCD counter & 4028 dec decoder for switch select valve control along with 4511 BCD to 7 seg. display.
I follow this a little bit. First I'll try to find an example diagram of how to decode a 4040 to reset at a specific number. I'll use 1880 (2 cups)
 

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
All I'm finding on the 4040 is how to make a chasing LED display.
If I understand it right, I will connect the sensor pulse to the clock pin (10), then, after 1880 pulses, I'll have these pins with voltage:
Q10, Q9, Q8, Q6, Q4, & Q3
There must be some way to check to see that ALL of these have power, then trigger the reset pin. At this time I'm ready for the ouput signal to go on to the 4017. Where do I get this signal from?
If I could see a good diagram of this I'd understand it better.
thanks!
 

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
How does this look?
These 4000 series logic IC's seem pretty easy to learn about.
So far, this should give me V+ at pulse 1880, which I feed back to the reset on 4040. I use this same signal to go on to the next counting stage in the 4017?

would it be possible/easy to set this up with DIP switches, in case I need to adjust the 1880 pulse number?
 

Bernard

Joined Aug 7, 2008
5,784
I'm a bit rusty on decoding, but believe 1880 would be 1880 -1024,Q11,=856-512,Q10,=344-256,Q9,=88-64,Q7,=24-16,Q5,=8-8,Q4,=0. Not used 128,Q8, & 32,Q6. Input Qs 11,10, 9, 7, 5, &4 into an 8 in NAND, 74C30; invert Q8 & Q6 ,input to last two NAND inputs. Invert NAND output & connect to reset & as count in to next IC. On count 1880, the inverted output goes high, resetting counter & providing a 2 cup count pulse. If using 4017 , input pulse is correct polarity, pos going. A BCD counter-7 seg decoder can be connected in parallel with 4040 to give 2 cup incriments on readout. To have display show actual no of cups, decode 1 cup count & then divide by 2 , giving two outputs , one for each counter, 4017 & 7 seg.
 
Last edited:

Bernard

Joined Aug 7, 2008
5,784
I guess dip SW could be used, one SW for all stages desired & inversion also, for max. for 12 stages then 24 switches. I would use a socket protype strip & wire jumpers. MaY need a bigger AND, or NAND.
 

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
I'm a bit rusty on decoding, but believe 1880 would be 1880 -1024,Q11,=856-512,Q10,=344-256,Q9,=88-64,Q7,=24-16,Q5,=8-8,Q4,=0. Not used 128,Q8, & 32,Q6. Input Qs 11,10, 9, 7, 5, &4 into an 8 in NAND, 74C30; invert Q8 & Q6 ,input to last two NAND inputs. Invert NAND output & connect to reset & as count in to next IC. On count 1880, the inverted output goes high, resetting counter & providing a 2 cup count pulse. If using 4017 , input pulse is correct polarity, pos going. A BCD counter-7 seg decoder can be connected in parallel with 4040 to give 2 cup incriments on readout. To have display show actual no of cups, decode 1 cup count & then divide by 2 , giving two outputs , one for each counter, 4017 & 7 seg.
Sorry, I'd never worked with a logic chip till 2 days ago! I kinda follow this, but not exactly. I did find this which I think is really close to what I need!
http://sm0vpo.com/conv/4040_divider_02_cct1.gif

"... If any output has a logic "0" (low voltage) then this will sink the bottom end of the 22K resistor to ground, through its respective diode."

Is this correct:
I can set those 11 switches to get the number I need (1880) and until 1880 is reached, the bottom of the 22k will be low, but when the count gets to 1880 they will all be high, giving me the pos pulse. I can send it to the reset pin, to the 7 segment dispay, and to the 4017 couter. ???
In this picture, what about IC1c & IC1d. Do I need that? I don't understand whta it does.
Thanks!
 

Thread Starter

SouthernAtHeart

Joined Jan 2, 2011
126
Bernard, does this look like it'll work???
I'm beginning to like this logic stuff!
Thanks for the big help, and let me know if I can improve this...
(or if it won't work!)

ps. Hmmmm, I guess it still doesn't actually cut the solenoid off! I'll have to figure this out some more...
 

Attachments

Bernard

Joined Aug 7, 2008
5,784
IC 1c & IC 1d form a non inverting buffer, probably would work without ??
I think thats why I added a big OR gate to 4017 outputs to make it look like a bar graph Maybe Bill Marsden can tell us if we need to invert unused stages in the decoding; I think it is possible to get an unwanted early count.
 
Top