Arduino Forum

Using Arduino => LEDs and Multiplexing => Topic started by: CyberBob on Nov 22, 2013, 02:26 pm

Title: RESOLVED: CD4051BE Demux and digital write (ing) to LEDs
Post by: CyberBob on Nov 22, 2013, 02:26 pm
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?
Title: RESOLVED CD4051BE Demux and digital write (ing) to LEDs
Post by: CyberBob on Nov 22, 2013, 02:32 pm
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.
Title: Re: RESOLVED: CD4051BE Demux and digital write (ing) to LEDs
Post by: Paul__B on Nov 22, 2013, 10:12 pm
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.
Title: Re: RESOLVED: CD4051BE Demux and digital write (ing) to LEDs
Post by: Grumpy_Mike on Nov 23, 2013, 10:39 pm
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. 
Title: Re: RESOLVED: CD4051BE Demux and digital write (ing) to LEDs
Post by: CyberBob on Nov 26, 2013, 06:09 pm
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.

Regards