I put a 74HCT08, four AND gates in one package, on a breadboard. All I wanted was to check that AND does what it should: the output is high only when both inputs are high. I fed a square wave from my homemade generator into input 1A and connected an LED with a series resistor to output 1Y. Input 1B stayed unconnected for now, you can probably guess where this is going 😀.
The LED was blinking exactly in step with the generator.
I stared at it for a while. An AND gate with only one input connected has nothing to pass through. But an input without a pull-down resistor doesn't mean zero. It means anything.
Why an unconnected input isn't zero
The input of a CMOS gate has a very high input impedance and almost no current flows into it. When nothing holds it, the voltage on it is set by whatever charge the input picks up from its surroundings: noise, a touch of a finger, neighbouring wires. On top of that, the HCT family reads its inputs at TTL levels, it takes anything from 2.0 V up as high and only up to 0.8 V as low. So it doesn't take much to reach a one.
I don't know for sure why exactly 1B ended up high. Pins 1 and 2 sit right next to each other on the package and adjacent breadboard rows have a capacitance in the order of picofarads between them. It takes very little for the edges of the signal on the neighbouring pin to drag an unconnected input along. Or it was simply floating a bit above the high threshold. The result is the same: the gate saw two ones and the LED blinked.
Don't count on an unconnected input behaving the same way every time. Move your hand closer or reroute a wire and it flips somewhere else. And when the voltage gets stuck between the levels, both input transistors open halfway and the chip draws current for nothing.
A pull-down on every input
The fix is a classic: I put a 10 kΩ pull-down resistor to ground on both inputs. An unconnected input now holds zero and only goes high when something actively pulls it up.
The pull-down doesn't bother the generator. Its output gives 3.3 V through a 220 Ω series resistor, together with the pull-down that makes a divider and the input still sees about 3.2 V, safely above the 2.0 V threshold. This is where HCT comes in handy. The plain HC family at 5 V would want about 3.5 V for a high and wouldn't reliably recognise a 3.3 V signal.
Only now does the AND gate follow its truth table. With 1B at ground the LED stays dark, with 1B at 5 V it blinks with the generator.
Don't leave the inputs of the three unused gates in the package unconnected either. Just tie them straight to ground, no resistor needed here.