Dear all,
I apologize for a question that shows my incompetence as well as my arrogance - I engage in projects that I deem easy but obviously are not in my grasp.
To make things worse, my English leaves much to desire... ![]()
I'm using Arduino with three 4017 IC to scan sequentially three packages of 4 DIP switches.
My aim is to understand which switches are in the "ON" position and which are in the "OFF" position. To that purpose, I use a common "output" line for all the DIP packages. By powering one switch at a time, I should read a non-zero voltage for every switch closed.
Attached please find the circuit.
Two things puzzle me.
-
As soon as I close switch 4 in the rightmost or in the leftmost 4-switches DIP package, I begin to get random readings in all the values (the reading of every switch - including the open ones! - is different from zero) - but this does not apply when I close switch 4 on bank 2 (see photo of the board and a screenshot of correct serial output, showing the sequential readings from left to right that I get with the configuration shown in the picture).
It's not a matter of a defect in the DIP switch pachage, I substituted them with other similar new items, and the error persists. I'm almost sure that there is something very obvious that escapes me, please accept my apologies for asking you to state the obvious. -
(Very obviously), even though I power each 4017 individually, the more switches I close (ON position), the lower voltage I read. This tension drop is a consequence of the number of "rivulets" that I open by closing each switch. I wonder which is the easiest way to get an higher tension that would make open/close discrimination safer (currently I think that a threshold of "above 10/1024th" may be taken as "switch closed" and any analog reading below 10 as "switch open"). By "the easiest way" I mean the simplest breadboardable circuit, with the fewest components.
Thanks for your help and again, excuse my clumsiness.
Cesare Brizio
briziocesare@gmail.com
dip_switch_scanner.ino (3.35 KB)


