Go Down

Topic: RESOLVED: CD4051BE Demux and digital write (ing) to LEDs (Read 3350 times) previous topic - next topic


Nov 22, 2013, 02:26 pm Last Edit: Nov 22, 2013, 02:33 pm by CyberBob Reason: 1
I have successfully used a CD4051BE as a Mux and read analog sensor signals via anaolog pin 0 of the Arduino.

I thought that I would try and use the CD4051BE as a Demux. I also wanted to see if I could use this to light up some LEDs. I used a digital pin and using analogWrite(pin, 255); in the sketch I was able to light the LEDs. The problem is that I have 8 LEDs connected and only the first 6 light up. The LEDs are connected to Y0 to Y7.

Is there any reason why the LEDs on Y6 and Y7 don't light up?


First mistake was "digital write (ing)". I am in fact using analog write

Secondondly, I discovered that I had a dodgy 4051 IC. I swapped this out for one that I knew worked and all is well.


Bad choice of device.

The CD4051 in particular has a relatively high "on" resistance, about 300 ohms, so you are using it as the current limiting resistor for the LEDs.  This is probably outside the specifications (current limit) for the device and not recommended.

The 74HC4051 has a lower "on" resistance, but even then is not really designed for the purpose.


Using a 4051 for an output device while possible is quite a dumb thing to do. This is because when not addressed the output is not being connected to anything. So if they are LEDs you have to multiplex to give the illusion they are on all the time. This uses a lot of your CPU time for no benefit, just use the right chip in the first place. 


Paul & Mike

Thanks for your comments.

It may have been a dumb thing to do but I was only trying to prove a concept (that concept you may think is me being dumb). Thanks for letting me know that this could fry my chips (every pun intended) and I have been a very naughty boy.

Anyway, I'm working with 595 chips now so there shouldn't be any similar issues.

Thank you both for your vigilance and advice.


Go Up