I admit it: I'm a total geek. I love electronics, programming, 3D art, vintage Apple hardware, and whisky. I'm always juggling half a dozen projects. I also enjoy documenting it all: my successes, my failures, my experiences... and everything geeky along the way.

Seeed Studio Fusion - $9.90 for 10pcs 2 layer 10x10cm boards


 
 
 
 
 

74154 4-to-16 Decoder/Demultiplexer | Kevin Rye.net - Main

Kevin Rye

Geek Extraordinaire. Yeh, I said it.

74154 4-to-16 Decoder/Demultiplexer

About 15 years ago, when I was in school for Electronics, we were given a pretty large toolkit containing of all the things we'd need for the course: multimeter, breadboard, components, etc.

Within that kit of components was the usual assemblage of TTL chips: 7400, 7402, 7408, etc. The basic gates. However, there were a few other gems in there. I don't remember the other ones, but I do remember the 74154. The reason being, this chip is huge! Well, comparatively speaking. Compared to most of the other 7 or 8-pin TTL chips, this 24-pin chip is a monster! Here it is next to a 7400.

74154

I remember asking my teacher what it did, to which he replied, "Don't worry about it. We don't use that chip in this course. It just comes with the kit.” I don't remember if I ever Googled to see what it did, but I do know that it's been sitting in my parts organizer in a drawer marked "Random Chips" for 15 years.

I recently went through all the drawers in an attempt to better organize all my components. Also, to refresh my memory as to exactly what I have. There have been a few times I've ordered a part, to find out a few months later, I already had one.

So what is this 74154? Well, it's a 4-line to 16-line decoder/demultiplexer of course! So what's it do? Let's find out!

Looking at the data sheet, it takes a binary input and decodes it on one of the 16 outputs. If you feed it "0001" on the ABCD inputs, output 1 goes LOW. Feed it "1111", and output 15 goes LOW, etc.

Sound easy enough.

I connected 16 LEDs to the 74154's output pins and connected the ABCD inputs to my Arduino.

LED Thing

Here’s the hookup:

74154 hookup

I wrote a sketch to output a binary number from 0 -15. That's really easy to do.

const int A = 2;
const int B = 3;
const int C = 4;
const int D = 5;

void setup() {
  pinMode(A, OUTPUT);
  pinMode(B, OUTPUT);
  pinMode(C, OUTPUT);
  pinMode(D, OUTPUT);
}

void loop() {

  //0000 - 0
  digitalWrite(A, LOW);
  digitalWrite(B, LOW);
  digitalWrite(C, LOW);
  digitalWrite(D, LOW);
delay(1000);

  //0001 - 1
  digitalWrite(A, HIGH);
  digitalWrite(B, LOW);
  digitalWrite(C, LOW);
  digitalWrite(D, LOW);
delay(1000);
 
 //0010 - 2
  digitalWrite(A, LOW);
  digitalWrite(B, HIGH);
  digitalWrite(C, LOW);
  digitalWrite(D, LOW);
delay(1000);

//etc.....
}

Here it is in action:

74154 Test

Cool! It works.

I thought it would be cool to see the lights strobe back and forth like Cylon eyes, or Knight Rider's KITT.

I simply modified my sketch to count down, as well as up.

74154 Strobe

Wouldn't it be cool to be able to adjust the speed? For that, I'd need to add a potentiometer.

LED Thing

I modified the sketch to adjust the delay based on the analogRead value.

74154 Speed Adjust

Awesome.

This is such a silly little thing, but I can't imagine using this chip for anything other than to mess around with some LEDs. Rather than throw it back in my parts organizer for another 15 years, I figured I might as well use it up. I'm going to throw together a quick little battery-operated PCB just to make use of this chip. It's no big deal, just a silly little LED thing.

With that said, counting to 15 in binary is sort of a waste of an ATmega328. While only needing 5 pins, this sounds like the perfect job for an ATtiny.

I modified my sketch for the ATtiny and uploaded it to my chip using my ATtiny Programming Shield.

LED Thing

Here’s the hookup:

LED Thing

It works like a charm.

74154 with ATtiny

I threw together a quick PCB and sent it off to OSH Park.

LED Thing

The original plan was to have it run off two CR1220 coin cell batteries, but unfortunately, they just don’t have enough juice. Instead, I just connected it to a 3xAA battery pack.

LED Thing

Here it is in action…

LED Thing

This was a fun little project. A great way to kill a lazy Sunday afternoon.