Wednesday, May 17

A Few of Our Favorite Chips: 4051 Analog Mux

Raindrops on roses, and whiskers on kittens? They’re alright, I suppose. But when it comes down to it, I’d probably rather have a bunch of 4051, 4052, and 4053 analog multiplexers on the component shelf. Why? Because the ability to switch analog signals around, routing them at will, under control of a microcontroller is tremendously powerful.

Whether you want to read a capacitive-sensing keyboard or just switch among audio signals, nothing beats a mux! Read on and see if you agree.

The Basics

An ideal analog multiplexer routes a single common pin on one side through multiple switches to multiple pins on the other. In the case of the 4051 (an eight-way analog multiplexer) there are eight of these multiplexed switches. Close any one of the eight switches, and you’ve chosen where you’d like to send (or source) your signal.

In reality, these switches are made with transistors, and they have a non-zero on-resistance. Unlike wire-to-wire switches, the current capability of analog multiplexers is limited. But switches are opened and closed with digital logic voltages, which means that it’s a snap to put them under microcontroller control.

The basic trio of analog multiplexers stems from the venerable 4000-series CMOS logic chips: the 4051 is a single eight-way multiplexer, the 4052 has two four-way multiplexers, and the 4053 has three two-way switches. Despite a hefty on resistance (around 200 Ω), these chips still have their place because they’re able to switch analog signals up to twenty volts peak-to-peak, while only requiring five volt logic inputs.

The 74HC405x series chips trade off this wide voltage range for lower on-resistance and higher switching speed: passing ten-volt signals with something like 50 Ω resistance. Finally, there are low-voltage analog multiplexers meant for battery-powered use: 74LV405x run on a single-ended two volt to five volt supply and pass signals of the same size with just slightly lower on resistances.

While the various 405x series chips are a go-to of mine, you may also want to know about the 3251, 3252, and 3253 series chips: CBT3251, FST3252, SN74CBT3253, etc. They are a high-speed, low-resistance take on the same theme. They have a switching speed usually under ten nanoseconds, and resistances under ten ohms. These are actually fast enough that they can be used to make RF mixers that work up to 30 MHz.

None of these chips are meant to push significant currents, but you can get ten to twenty milliamps through most variants. They can pass signals up to roughly ten megahertz, so they’re not useful for high-frequency applications but you could use them for routing lower speed digital data in a pinch.

All of these different chips are pin-compatible across varieties, and I tend to think of them as the same thing, though you’ll want the low-voltage variety for 3.3 V projects and the old-fashioned kind for ground-referenced DC voltage signals, for instance.

Applications

If an analog multiplexer isn’t on your list of favorite things, maybe the short list of applications here will inspire you.

The most obvious use of an analog multiplexer is, um, multiplexing analog signals. A single 4052 (two four-way switches) makes a great logic-controlled source selector for your home stereo, for instance. If you have eight sources, that’s a pair of 4051s. Everyone grumbles about the ESP8266’s single ADC pin, but connecting a $0.20 74LV4051 to that single pin gives you eight choices for the ADC.

Speaking of ADCs, it’s common to need to scale up or down an input voltage range to match the ADC’s. This is often done with a pair of resistors configured as a voltage divider. Using an analog multiplexer and routing the input through up to eight different resistors can put control of the input range under control of the microcontroller in question. When the input signal is too small, the multiplexer and resistors can be used to control the gain of an amplifier. You might be tempted to use a digipot for either of these scenarios when you need more resolution, but an analog mux can get the job done in broad ranges for a lot less money.

You can make a quick-and-dirty 8×8 crosspoint switch with two 4051s by simply tying the two “commons” together. Now one of eight inputs on one side is routeable to one of eight outputs on the other. Make eight of these and you’ve got a completely flexible 8×8 routing matrix.

And then there are the niches that only an analog multiplexer can fill. For instance, you can make a simple filter with selectable cutoff frequency with a series resistor and using the multiplexer to select among multiple capacitors to ground — you can’t buy a digicap. Similarly, you can use an analog mux to pick among a set of voltage references for more precision than you could get with a digipot. If you read [Al Williams]’s piece on relay logic, you’ve doubtless got other oddball ideas about what you could do with a mux in mind.

It’s impossible to list all the cool things you can do with these chips, though, so if you have an itch that is perfectly scratched by an analog mux, tell us in the comments.


Filed under: Engineering, Hackaday Columns, parts

No comments:

Post a Comment