# 4017 count to 20

Discussion in 'General Electronics Discussion' started by pyrohaz, Mar 26, 2013.

1. ### pyrohaz

33
0
Oct 28, 2012
Hi guys,
I need 20 inputs to my arduino simple. I'm using mosfets to switch the inputs (already devised the circuit and tested, that works fine!) All I need to know is:

How can I use two decade counters to count to 20? I know I could do this with 3 shift registers clocking 1 bit in and shifting it up 20 bits but that would require 3 chips and 2 decade counters only require a reset and clock.

Cheers,
Harris

2. ### (*steve*)¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥdModerator

25,496
2,837
Jan 21, 2010
Look at the 4017 datasheet, I'm pretty sure it has a circuit to do just this.

However a number of 74HC165's is probably better if you want digital inputs as you won't have to have all those mosfets.

3. ### CocaCola

3,635
5
Apr 7, 2012
I would just program and slave another micro to do it, that is if I was looking to save parts count on an existing design or platform...

4. ### pyrohaz

33
0
Oct 28, 2012
Thanks for the reply, i'm not actually reading a digital input, i'm using the mosfets to really shoddily multiplex 20 capacitors into a 555 timer (a weird form of DCO I suppose). By seeing the frequency of each capacitor I can get a very rough estimate of capacitance.

Hence why using another micro would be a bit annoying as it would literally only be doing what 2 decade counters would be doing, and i'd have to buy another chip!

5. ### BobK

7,682
1,688
Jan 5, 2010
Please explain exactly what you are trying to accomplish. You posts scream that you are making something more difficult than it is.

Bob

Last edited: Mar 26, 2013
6. ### pyrohaz

33
0
Oct 28, 2012
Happily!

What i'm trying to do is find a method of multiplexing lots of capacitive switches, going off the ESD model, a human can be modelled as a 100pF capacitor in series with a 1.5k resistor. What I have thought is to have a free running oscillator with the output in series with a resistor. Mosfets are used to couple this output to each touch switch/pad where if the pad is touched, it has capacitance, if not, it has a smaller capacitance.

By then doing this, the amplitude of the signal can be detected using a single peak detector circuit and by running through each mosfet and subsequently reading each input, can detect whether the input is being pressed or not.

Is there a better way to multiplex many capacitive inputs? This method only required 3 pins!
(Analog read, clock and reset, reset isn't completely required, just adds the option to start at zero again).

7. ### sheldonstv

68
0
Jul 17, 2007
here you go-easy to alter this circuit to have as many outputs as you want by using the last op as a reset-remember each additional ic gives only 8 usable outputs.....