Nice. Your pulldowns are kinda low at 1k as your source needs to provide 5mA (at 5V). 10k or so might be gentler. Also, with HC parts, your source signals need to be 5V logic. Alternatively, you can use HCT parts and allow it to work with either 5V or 3.3V input signals.
Actually I was talking about adding a series resistor to provide some esd protection since you are running these signals off on wires somewhere, but yes, pullup or down is needed as well as you cannot have a floating cmos input. It seems like a lot of extra parts but you don’t want to zap the chip. Static zaps are common here so I am a bit sensitive to it. You can add other protective devices, but the simple series resistor (in conjunction with the protection diodes inside the chip) helps limit current when there is a transient spike that exceeds the rails. I have used a series resistor from say 1k to 47k – the cmos input is very hi-z so it does not affect normal operation.
In the above schematic, have a 1k (?) resistor between J1 ports and U1 ports?
I am a bit confused with the screenshot you pasted from the nexperia HC guide, could you link the reference? So is this diagram included in the chip or should be “outside” the chip before the input is fed to the shift register?
I am fairly new to electronics engineering, so excuse my noobness, just trying to understand what you meant and what I need to do.
In a more general approach, are the HC165 shift-registers the way to go for reducing multiple inputs (buttons) into a few pins for the microcontroler to handle or there are better practices?
If I am reading this table correctly, the “HC” type accepts input voltage ranging from 2v to 6v, while the HCT model accepts voltage from 4.5 to 5.5, so what I see here is in reverse from what you’re stating…
Can you clarify / enlighten me as to what’s going on here?
Seems nobody mentoned using the MCP23017 port expander to increase the I/O pins of your microcontroller. An advantage is that I2C is often supported by the silicon in the microcontroller so you don’t have to bit-bang shift register control lines. And the I/O pins are bidirectional so you can support both reading and writing the lines. The disadvantage is that the MCP23017 costs more than simple shiift registers. You can even buy expansion boards using hte MCP23017 off the shelf but then you miss out on fun with KiCad and ordering from fabs.
Well the HC family, which often runs on a VCC of 5V, can be powered from 2 to 6V (it is quite happy running at 3.3V). On the other hand the HCT family is only designed to run at 5V and it provides TTL-compatible input thresholds. It was designed to provide a way to interface to the many LS and other ttl families of the day – this feature can be exploited to convert a 3.3V signal (common today) to a 5V signal (getting less common).
If your circuit is powered by 5V you can use either part, so what is the difference? The input thresholds. Standard cmos inputs like HC require a low input (VIL) to be below about 30% of vcc and a high input (VIH) to be above about 70%, while the HCT part has a lower VIH, allowing to be driven from 3.3V signals.
HC: VIL=1.5V, VIH=3.5V (cannot be driven by a 3.3V signal)
HCT: VIL=0.8V, VIH=2.0V (CAN be driven by a 3.3V signal)
The HC and HCT inputs have input protection diodes to the rails. So when an input transient goes above vcc by a diode drop it gets clamped. Likewise, if it goes below ground by a diode drop it gets clamped. It has a small effective series resistor of about 100 ohms. For a more robust design (when you are running inputs off-board on some cable), you can add a series resistor at the chip input (not at the connector, where it forms a voltage divider with your pull-down). Probably not needed for your proto application – just something to consider. I live in the desert and can see blue sparks when I touch a light switch, so I am always thinking about esd zapping a circuit I design. The nexperia doc: https://assets.nexperia.com/documents/user-manual/HCT_USER_GUIDE.pdf
Note that AHC/AHCT is a different family from HC/HCT.
For 3.3V applications, LV-A is a nice family, and it is “5V-tolerant” on the inputs – they remove that upper clamp diode on the input for that. So that is a nice way to convert a 5V signal to a 3.3V signal. However, LV-A can also run at 5V.
LVC and LCX are also nice families but cannot run at 5V.