Go Down

Topic: Simple 4051 question (Read 1 time) previous topic - next topic

zenwebb

I'm wiring up a 4051 as a demux to let me control several different LEDs (actually a more complicated custom LED display) using one PWM signal from an Arduino (Teensy, in fact). My question is about the "E" pin (pin 6, i.e. enable pin). Do I need to connect this to anything myself, or is it rather an output pin that I could use if I wanted to know whether the chip is currently active or not?

The Arduino docs (http://www.arduino.cc/playground/Learning/4051) don't specifically state whether I should connect it to anything myself, so I just wanted to be sure.
Grad student, creative technologist, OSHW engineer
http://jason-webb.info

Grumpy_Mike

Please, Please, Please, Please, Please, Please, Please, Please, Please, Please, Please, Please, Please, Please, Please, Please,
DO NOT USE THIS CHIP TO DRIVE AN OUTPUT!!!!!!!
It is such a rubbish idea.

zenwebb

Wow, chill out buddy. When did I say I was driving an output? I'm looking to use the 4051 to control an LED display, not drive it.

The chip is simply to demux a PWM signal. I am using 2n2222 transistors to switch a high-current power supply like so: http://imgur.com/1HREt

Better?

Grad student, creative technologist, OSHW engineer
http://jason-webb.info

Grumpy_Mike

Quote
When did I say I was driving an output?

here
Quote
to let me control several different LEDs


This multiplexer should be only used as an input device. If you are using the multiple outputs to control something note that only one output can be active at any time. When the output is not active it floats. This is not suitable for controlling much.

zenwebb

Re-read the initial post, I said I wanted to control an LED matrix, not drive it. Regardless of who is in the right, there's no need to get so angry over a simple question, all that does is leave me with an incomplete understanding.

I had no idea this chip shouldn't be used as a demux, especially since the official Arduino docs (http://www.arduino.cc/playground/Learning/4051) seem to state that it would work fine as a demux. Also, I posted a separate thread about my LED matrix somewhere and the discussion went on for two pages without any mention about how I should not use the 4051.

What demux chip should I use instead of the 4051?
Grad student, creative technologist, OSHW engineer
http://jason-webb.info

Grumpy_Mike

Quote
I said I wanted to control an LED matrix, not drive it.

Controlling something and driving it is the same thing in this context, you want a logic level that is under your control. You do not get this with a 4051 when you use it in that direction.

Quote
especially since the official Arduino docs ..... seem to state that it would work fine as a demux.

Yes it works fine as a demultiplexer but it is totally stupid to use this as in effect a port expander. This is because only one output can be controlled at any one time, all the other outputs float. I wish that page didn't exist because it traps beginners into thinking it is a good idea and then we have to try and pick up the piece jumping backward somersaults to think of ways to salvage a situation that would not have happened if it was done right. If you want to use a demultiplexer like this you need one with a latch on the end so that it keeps the logic level you set it at. Something like a 74LS259 works in the way I think you might imagine.

Quote
the discussion went on for two pages without any mention about how I should not use the 4051

Two reasons,
1) Multiplexing is different in that you only want one output to be active so that promotes the use of this chip from stupid to simply poor.
2) Not everyone is as good as me. (I did try to phrase that differently so it didn't sound so arrogant but I failed so I am not perfect.  :) )

zenwebb

The 74LS259 looks good to me, I see how that fits my idea better. I will try to contact or post a website request to the Arduino folks about removing or at least updating that page - its one thing if it were just sitting in the site and forgotten about, but its 2nd result when you type "4051" into Google! I can see how that would mislead a few people.

The datasheet for the 74LS259 is a little more clear than the 4051's, so I see that I need to connect the C pin to ground, then connect the E (enable) pin to my Arduino. Whenever I want to turn all the LEDs off, I just bring that E pin to high to clear all the LEDs.
Grad student, creative technologist, OSHW engineer
http://jason-webb.info

MartinGS

so whats wrong with floating if you can pull up/down them?

Grumpy_Mike

In itself nothing, it is just that you don't want to do this with outputs. You have all the inconvenience of having to dive the multiplexer with very few of the advantages. It is like a one dimension matrix. It is a total waste of time (yours and CPU) doing this for outputs.

Go Up