Hello Im using two chained 74hc165 shift register to take in inputs from 12 led push buttons and reading the inputs with arduino. The buttons are wired such that the led lights up when pressed. I have a 470 ohm resistor connecting the positive on the led of the button to the NO of the switch, C connected to 5V and NO connected to the input of the shift register. I am using 10k ohm pulldown resistors on the inputs which are connected to ground.
The problem I am having is that the shift register will work for a while but after using it a few times it will start to return all HIGH on the inputs. Is my wiring somehow shorting the shift register? If anyone has any input as to why this is happening that would be a big help. Thanks!
From my reading it's usually a good idea to put bypass capacitors on anything with IC's. I use a 4.7uF electrolytic and a 0.1uF ceramic between 5V and GND as close to the chip as possible. Given that you are having intermittent problems it might be noise and capacitors are cheap . Not sure which board you are using but I've found that the Mega has a noisier power supply than the Uno and definitely needs the capacitors for some IC's to work.
Thanks for the info grumpy! Ah I might have to re-solder everything lol. I have the schematic but how do you post pictures on here? Im using an UNO so maybe I should use a capacitor. But unfortunately now the dang shift register is always reading high no matter what I do lol.
I see. But the thing is it was working fine before. And now its reading all high with the switches closed ie there is no power to the inputs. Maybe I am misunderstanding though.
davidrh:
From my reading it's usually a good idea to put bypass capacitors on anything with IC's. I use a 4.7uF electrolytic and a 0.1uF ceramic between 5V and GND as close to the chip as possible. Given that you are having intermittent problems it might be noise and capacitors are cheap . Not sure which board you are using but I've found that the Mega has a noisier power supply than the Uno and definitely needs the capacitors for some IC's to work.
I think your switches are probably not designed for low level (low energy) switching. 5VDC is quite low for a switch designed to handle 125VAC (for example) and 0.5mA is too low for a switch designed to handle 5A (for example). The low current could be the main problem ... I would definitely replace the 10K with 1K to get 5mA whetting current when the switch is closed. May need to change the LED resistor to 330Ω to re-gain the original brightness. Do you have a link to your switches?
dlloyd:
I think your switches are probably not designed for low level (low energy) switching. 5VDC is quite low for a switch designed to handle 125VAC (for example) and 0.5mA is too low for a switch designed to handle 5A (for example). The low current could be the main problem ... I would definitely replace the 10K with 1K to get 5mA whetting current when the switch is closed. May need to change the LED resistor to 330Ω to re-gain the original brightness. Do you have a link to your switches?
EDIT: Replace "Arduino" with 74HC165 below:
These are the switches I used.
Thanks so much for the schematic!
So what could could be the effects of using too large of a pull down resistor? My shift registers always seem to work for a while and then just stop working completely showing all high at the inuts. Even if I pull the power from the system and reconnect it still shows high and I just assume the chip is somehow damaged
TomGeorge:
Hi,Hmm, aren't you doing first prototype in protoboard, or IC in IC sockets?
Tom....
Ahh I was just soldering the chip directly to the board... Ill definitely use ic sockets next time. I'm just starting with making circuits at a part time job but I'm a mechanimal engineer so I'm pretty ignorant to a lot of electoral stuff...
Your switch is pushbutton style, but works like a toggle switch.
"This button is an on/off switch button, when you press it the 'normally-open' contact shorts to the common contact and the button stays 'pressed'. When you press it a second time, the button springs open, and the contacts open up again."
Regarding the 74HC165, I assume your following something similar to "Typical Application Diagram" page 14
Here's a better way to connect the ON/OFF switch (updated) ...
Yes I'm trying to do like the typical application. Thank you so much for the detailed diagram. I just have a few questions. So the 220 ohm is the resistor for the led? Are you not using a pull down resistor? Thanks!
On input pins? No. The outside source will just have trouble pulling them low.
I am interpreting "too high" as meaning needing a lot of current to change level, i.e. a low value resistor - 220 for example, vs 10K. 10K does not take much current to change from high to low level, just 5V/10000 = 0.5mA