# 3 to 8 line Decoder not switching off LEDs

I'm currently working with a SN74AHCT138N 3-8 line decoder and the whole point of this circuit is to switch on and switch off a series of LEDs. I connected buttons to the inputs of the IC and LEDs to the outputs and the SN74AHCT138N is hooked up to 5VDC from a Raspberry Pi (I also have a bench power supply). When I switch the power on, all the LEDs switch on and when I click the buttons, they go dim and they go normal.

I tried adding pull-down resistors to get rid of a possible float, but that still didn't work. (It was pointless as well, as the LEDs are 5V LEDs). The setup is shown below:

Something else to add: On the datasheet, the required amount of input current (Icc) is 1.5mA and I did the calculations and it said a 3.3k resistor should be put in place where Vcc is. I just want to know how I get this working, so if I press input A (first input), it activates Y0 (output 1) and so on.

• No, you should never have a resistor in series with Vcc. Note also that the outputs are active-low, so your LEDs should be connected to Vcc, not ground. Commented Jun 11, 2019 at 10:53
• i got rid of the resistor and put the negative leg of the led to Vcc and it doesnt light up put when i put the positve leg of the LED to Vcc it works but its very dim. Commented Jun 11, 2019 at 11:02
• IF it's connected to ground it's a pull-down resistor, not a pull-up.; Commented Jun 11, 2019 at 11:31

You haven't got any of your enable pins connected.

You should have pull downs on your inputs.

According to the datasheet, the SN74AHCT138N is not qualified for output currents greater than 8 mA. If your LEDs truly are 5 V devices (in that they have current limiting built-in), what is their typical operating current at 5 V? As the CMOS output current demand increases, the output voltage rises above GND, decreasing the voltage across the LED.

As above, do not have any resistance between the Vdd and Vss pins and power and GND.

Add a 0.1 uF (100 nF) decoupling capacitor across the chip from pin 8 to pin 16. The leads should be as short as possible.

The 138 has six input pins. Each one must be connected to Vdd or Vss at all times.

A safer way to experiment with this chip is to use standard LEDs (without internal current limiting) and an external current limit resistor that sets a safe value you can control. I would start with 1 K. The LEDs will be a bit dim, and you can measure the output pin voltage. As you decrease the resistor value, you will see that the LEDs get brighter but the output voltage rises. Do not go lower than 330 ohms.