Shift register problems

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!

If you look at this project http://www.thebox.myzen.co.uk/Hardware/Pendulum.htmlthen you will see the proper way of wiring a switch to be an input to a logic gate and light an LED at the same time.

If you want someone to check your connections, don't you think a schematic would be in order?

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 :slight_smile: . 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.

74HC05 datasheet

When powered with 5V, the logic high level needed is about

VIH = 1/((4.5/3.15)/5) = 3.5
Vinput = 5 - VLED = 3.0
Vinput < VIH = problem!

ok here is the schematic for the switch

dlloyd:
74HC05 datasheet

When powered with 5V, the logic high level needed is about

VIH = 1/((4.5/3.15)/5) = 3.5
Vinput = 5 - VLED = 3.0
Vinput < VIH = problem!

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.

so I found this. I probably fried the chip because I didnt use a capacitor.

http://forum.arduino.cc/index.php?topic=187385.0

Thanks for all the input.

Gotta solder a new chip now haha.

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 :slight_smile: . 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.

You were correct. Thanks for the help!

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:

probably fried the chip because I didnt use a capacitor.

Lack of a decoupling capacitor is not going to fry a chip, it will just not work reliably.

A pull down resistor of 10K is too high for that chip.

Hi,

Gotta solder a new chip now haha.

Hmm, aren't you doing first prototype in protoboard, or IC in IC sockets?

Tom.... :slight_smile:

or IC in IC sockets?

That is what I always use.

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.... :slight_smile:

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...

So what could could be the effects of using too large of a pull down resistor?

The pins will always read high.

RUGGED METAL ON/OFF SWITCH WITH GREEN LED RING

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!

Grumpy_Mike:
The pins will always read high.

I see. Just wondering could using too high of a pulldown resistor do any permanent damage?

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

Are you not using a pull down resistor?

Pull down resistors are not the best thing in a project. Much better is pull up. See this:- http://www.thebox.myzen.co.uk/Tutorial/Inputs.html

It is only in the Arduino world that people use pull down resistors, this is due to a rather suspect tutorial.