I can't get my 74HC595 shift register setup working

Thread Starter

FelixB

Joined Dec 26, 2022
33
Hello everyone!
Im currently testing a shift registor setup, and when I power it, all Outputs are on (1 / HIGH) and I cant change them with the "control-pins".
Here some pictures irl:
IMG_7950.jpg
IMG_7951.jpg
Here a breadbord view of Fritzing:
schemetic.png
The Pico is only for powering the system. My Idea is to hold the midle Button, give an input (on/off) at the left button and output the data via the right button. All cables are connected(I checked every single one of them). When I now start powering the pico and therefore the system all LED turn on and I can't change them with the buttons.
Do you guys see an error in my schematic or logic?

Thanks in advance
Felix
 

Attachments

ElectricSpidey

Joined Dec 2, 2017
2,757
At first glance I don't see any pull resistors on your buttons.

I would also advise you place a decoupling cap.

I also fret to think about inputting to those "control pins" without debounce.
 
Last edited:

Thread Starter

FelixB

Joined Dec 26, 2022
33
Thanks for the quick answer!
You are right. I didn't added a resistor. Im new to electronics, can you maybe explain why I should use a pull-down resistor and when I have to, maybe give a formula, so I can calculate the required resistor value.
 

Papabravo

Joined Feb 24, 2006
21,158
Looking at the datasheet:
https://www.ti.com/lit/ds/symlink/s...ttps%3A%2F%2Fwww.ti.com%2Fproduct%2FSN74HC595
Is there anything you can see that might explain that behavior?
Unfortunately, fritzing is a suboptimal way to analyze and troubleshoot a circuit. Among other things it requires a pin diagram of the part so a symbolic schematic can be created. You should do that work if you want help from us.
1684081555188.png
From this block diagram you can see that there a five (5) inputs. In order to get meaningful behavior you can ignore all the outputs and focus on the inputs. In particular OE* (pin 13) must be held low to enable the outputs. You must create a positive edge on RCLK (pin12) when you wan to move data from the shift register to the output register. No "bouncy" pushbuttons for this function. SRCLR* (pin 10) is taken low to CLEAR (set to zero) the shift register and must be returned to the high state to allow normal operation. You need a positive edge on SRCLK (pin 11) to move the data in to the low order stage and shift each bit forward one stage. SER (pin 14) is the data that is shifted in to the low order stage on the rising edge of SRCLK.

Draw us a proper schematic and we might be able to help.
 

Papabravo

Joined Feb 24, 2006
21,158
Thanks for the quick answer!
You are right. I didn't added a resistor. Im new to electronics, can you maybe explain why I should use a pull-down resistor and when I have to, maybe give a formula, so I can calculate the required resistor value.
It is not clear whether the buttons need a pullup or a pull down. Since you are new to electronics, I STRONGLY suggest that you make a proper schematic diagram that conveys the intentions of your circuit in a symbolic, meaningful and recognizable way. The method you have chosen is horse puckey.
 

Thread Starter

FelixB

Joined Dec 26, 2022
33
Screenshot 2023-05-14 185243.png
Sorry for not sending the schematic at the start. I hope this one helps better.

That is my current schematic exkluding the outputs. My idea is to hold the Shift Register Input Button, give data through the Data Button (hold it or leave it) and then releasing the Shift Registor Button.
Doing this 8 times should store the input inside the 74HC595 and then pressing the Storage Register Button should output the stored data.
 

Thread Starter

FelixB

Joined Dec 26, 2022
33
I just see that the labels of the 74HC595 schematic I used are different then the ones you send (from TI).
 

WBahn

Joined Mar 31, 2012
29,976
Consider the following: When one of your switches is closed, the voltage going to the corresponding pin on the IC is about 3.3 V. But what is the voltage on that pin when the switch is open?

You are probably tempted to think that it is 0 V, but that is not correct. You don't know what it is. It is undefined. That is what you need a pull-down resistor for. Place a pull-down resistor between the pin and the negative side of your supply (the supply terminal that is connected to the IC's GND pin). Since this is an HC family part, that resistor can be pretty large. For CMOS parts, a lot of people just blindly use a 10 kΩ to 100 kΩ resistor. Some use a 1 MΩ resistor, and this generally works fine.

To see how large, look at the datasheet. The Input Current (V_I) is specified to not exceed 1 µA over the temperature range (with a supply voltage of 6 V, so it is likely less at 3.3 V). To be seen a a logic-LO, your input voltage needs to be less than 0.5 V (at Vcc = 2 V, at 3.3 V it is probably more like 0.8 V). So let's choose a resistor value that will keep the input below 500 mV when it is having to handle 10 µA of current flowing out of the input to pull it down to that voltage. That works out to 50 kΩ. We have a factor-of-ten margin, so we could go with 500 kΩ pretty confidently (so you can see why many people just go for 100 kΩ, which is what I normally do). You can also see that 1 MΩ is a bit dicey, but for most parts at typical temperatures, it would work okay.
 

djsfantasi

Joined Apr 11, 2010
9,156
First with your push-buttons wired like that, when they aren’t pressed the input to the 74HC595 shift register is undefined. It could be low; it could be high. Since you’re switching the positive side (VCC) into the pins, you need a pull-down resistor to ensure that the pin sees a low when the button isn’t depressed. Wire a 10k resistor from each input pin to ground.

Secondly, a push-button does NOT send one high or low signal when it’s pressed. It sends a lot of high/low signals. This is called switch bounce This is a whole topic in itself, so I suggest you start by reading about “switch bounce” and “debouncing circuits” before we can make a specific recommendation.

There may be other problems with your circuit but these two issues need to be addressed first.
 

MrChips

Joined Oct 2, 2009
30,707
It is a common error to assume that an input is at logic LOW when nothing is connected to it. This is far from reality.

Logic inputs are generally high impedance inputs. You need to provide a path to a proper logic level source at all times.
 

Papabravo

Joined Feb 24, 2006
21,158
I rest my case on the importance of a proper schematic diagram. In ALL CMOS circuits that you will ever see, besides all the ones that you won't, it is critically important to NEVER EVER under ANY circumstances allow a CMOS input to float. It must HIGH or LOW except for a very short transition time (nanoseconds) between those two levels.

Those pushbuttons are going to "bounce" like crazy and the operation may tend to be erratic. You are going to need a more sophisticated test jig for this part.
 

Thread Starter

FelixB

Joined Dec 26, 2022
33
I rest my case on the importance of a proper schematic diagram. In ALL CMOS circuits that you will ever see, besides all the ones that you won't, it is critically important to NEVER EVER under ANY circumstances allow a CMOS input to float. It must HIGH or LOW except for a very short transition time (nanoseconds) between those two levels.

Those pushbuttons are going to "bounce" like crazy and the operation may tend to be erratic. You are going to need a more sophisticated test jig for this part.
I loke into it! Can you maybe recomend buttons which aren't gonna bounce and just deliver a proper ON/OFF state?
 

WBahn

Joined Mar 31, 2012
29,976
I just see that the labels of the 74HC595 schematic I used are different then the ones you send (from TI).
The labels (i.e., the words or symbols) used varies from one manufacturer or a part to another. What is important is that the functionality of each pin remain the same.

As others have already noted, your simple switching scheme is subject to bounce. When mechanical switches either opened or closed, there is a brief period when the contacts are so close together that they make and break contact, from an electrical viewpoint, repeatedly. For some inputs, this doesn't matter and can be ignored. But for other inputs, particularly clock inputs, it is critical that it be addressed so that you have exactly one transition, at the device pin, for each switch activation. This is known as switch debouncing and there are several ways to do it. Look up switch debouncing and, if you have issues, bring them up and we can go into it.

The simple test for whether you need to debounce your switches is ask yourself whether the circuit should behave the same way whether you press the button once, or if you press the button ten times really fast. If the answer is that it should, then you need to debounce that switch. Example: The master reset -- if you reset the part ten times real fast, so what? The serial clock -- if you press that ten times, you expect things to shift ten time, not one, so that matters.
 

crutschow

Joined Mar 14, 2008
34,280
The first thing to do when you are building a circuit is to generate a complete schematic of it.
Otherwise you are very likely to generate errors when you build it.
Also it makes it much easier for us to help you troubleshoot it.
 

Papabravo

Joined Feb 24, 2006
21,158
I loke into it! Can you maybe recomend buttons which aren't gonna bounce and just deliver a proper ON/OFF state?
There is no mechanical switch that does not bounce. When working with a microprocessor you can debounce a switch in the firmware program you write so no additional hardware is required. In circuits where you do not have that luxury there are a number of techniques that you can use. Off the top of my head and in no particular order we have:
  1. The Set-Reset flip flop. A simple combinatorial circuit that does a nice job of handling the problem
  2. The One-shot or monostable multivibrator
  3. A state machine (Moore or Mealy) that samples the state of the button over a period time longer than the "bounce" time and uses a majority voting system to determine the state of the switch.
  4. An RC time delay that slows the individual transitions down followed by a Schmitt Trigger.
Google the various terms in the list and it will expose you to a wealth of useful information.
 

djsfantasi

Joined Apr 11, 2010
9,156
Those pushbuttons are going to "bounce" like crazy and the operation may tend to be erratic.
Can you maybe recomend buttons which aren't gonna bounce and just deliver a proper ON/OFF state?
All mechanical switches will “bounce”. As WBahn notes, this may or may not be important.

As others have already noted, your simple switching scheme is subject to bounce. When mechanical switches either opened or closed, there is a brief period when the contacts are so close together that they make and break contact, from an electrical viewpoint, repeatedly. For some inputs, this doesn't matter and can be ignored. But for other inputs, particularly clock inputs, it is critical that it be addressed so that you have exactly one transition, at the device pin, for each switch activation. This is known as switch debouncing and there are several ways to do it. Look up switch debouncing and, if you have issues, bring them up and we can go into it.

The simple test for whether you need to debounce your switches is ask yourself whether the circuit should behave the same way whether you press the button once, or if you press the button ten times really fast. If the answer is that it should, then you need to debounce that switch. Example: The master reset -- if you reset the part ten times real fast, so what? The serial clock -- if you press that ten times, you expect things to shift ten time, not one, so that matters.
 

Thread Starter

FelixB

Joined Dec 26, 2022
33
There is no mechanical switch that does not bounce. When working with a microprocessor you can debounce a switch in the firmware program you write so no additional hardware is required. In circuits where you do not have that luxury there are a number of techniques that you can use. Off the top of my head and in no particular order we have:
  1. The Set-Reset flip flop. A simple combinatorial circuit that does a nice job of handling the problem
  2. The One-shot or monostable multivibrator
  3. A state machine (Moore or Mealy) that samples the state of the button over a period time longer than the "bounce" time and uses a majority voting system to determine the state of the switch.
  4. An RC time delay that slows the individual transitions down followed by a Schmitt Trigger.
Google the various terms in the list and it will expose you to a wealth of useful information.
I watched the (105) Debounce a Switch - YouTube video of TI and added a Ceramic capacitor like in their schematic and the bounce effekt is already a lot lower! For now this setup is perfect for my little educational project. Thanks everyone for helping. Tomorrow I will upload a full schematic of my current project for the people in the future and to complete the thread.
 

Papabravo

Joined Feb 24, 2006
21,158
You might want to have a moderator edit the thread title. The way it is written suggests that you unable take your circuit to your place of employment. That is clearly not your intention. something like:

I can't get my 74HC595 shift register setup working

The choice is completely up to you, however.
 

MrChips

Joined Oct 2, 2009
30,707
There is one circuit that is unlikely to produce switch bounce. It requires a single pole double throw (SPDT) switch and uses an S-R flip-flop circuit.

1684092596931.png
 
Top