[SeanHodgins] has a project in mind where he needs to sample over 500 analog sensors. To get ready, he made a breakout board for 32-channel analog multiplexer device he wants to use. He put the project out on Hackaday.io and also has a video tutorial you can see below.
There are five input pins to the chip which lets you connect one analog pin to any one of 32 analog pins. Of course, in addition to the five control lines, you need some handshaking lines, too so you could use as many as eight digital pins to control the device.
The device in question is an ADG732. The board layout and the source code is all available on GitHub. Because the switches are analog, they are bidirectional. That is, it isn’t really connecting one output to 32 inputs. It is more like a 32-position switch that connects a single pin out of 32 to one other pin.
Keep in mind that these sort of devices have some practical limitations. For example, the switch resistance is nominally 4 ohms at room temperature. The switches that route the signals also have some capacitance that varies depending on if they are on or off. There’s nothing wrong with any of this, of course. But it isn’t quite the same as having, for example, a 32-position rotary switch. Of course, it can switch faster than a mechanical switch and is easy to control, so — as always — its a tradeoff.
Notice, too, that the mux chip can operate rail-to-rail. However, for some applications, you’ll need a negative supply and the device can accept a +/- 2.5V supply for that purpose.
There are a lot of uses for something like this. Routing audio signals, for example, or switching between multiple test points in an automatic test system. We looked at a mux last year with a paltry eight channels. Then again, you can always go old school and make mechanical multiplexers.
15 thoughts on “Arduino Analog I/O Multiplexer”
The datasheet of the ADG732 says that the address pins are level sensitive. So you don’t need 8 digital IOs of an Arduino to control one of these chips, you can connect EN, WR and CS to GND, and then just change A0-A4 to select the input. Of course, with 500 input and multiple of these chips, the CS signals etc. make sense, to share the address signals with multiple chips.
There are also i2c based analog multiplexers, very handy.
already have a 48 channel mux ii works great 25 bucks
Hmm has me intrigued, is this the type of device worthy of exploiting within a system for muxing multiple cell voltages for the likes of a Tesla type car battery array And seeing how the array responds to transients during driving as well as regenerative braking ? ie I like the idea of observing a graphic arranged to map the batteries as they deliver and absorb charge during around town and highway type cycles…
In series connected cells, measuring is complicated by the large common mode voltage. E.g. the highest cell might have negative terminal at +400V and positive terminal at +404V. You could resistor-divide that to a 5V range, but it would lose a lot of accuracy.
It seems that most reasonable way would be to have individual ADCs for each group of ~10 cells, and then use optocouplers to isolate the digital signals.
An isolation amplifier like AMC1200 would do the trick. Unfortunately it needs 4.5V power supply but maybe there is one which works at lower voltages too?
ADG732 is a >$10 chip, why not buy 4x bluepills instead of one multiplexer. STM32F103C8T6 has 16 ADC inputs, so right of the bat you get double the fun without soldering a single wire.
Or use 4 x 74HC4051D, EUR 0.31 each. It has 80 ohm series resistance, but this is no problem for many applications.
And trading off cost for on resistance – you can get 4051’s all the way down to 1 ohm. But they are $1US. And many in between (going all the way up to 125 ohms).
In my project, I distribute a dac output voltage to several points using sample and hold capacitors using a 74hc4067 : https://www.aliexpress.com/item/mux/32428098670.html
Resistance is much higher, but 16 channel with breakout board for 0.88 eur, s/h included is almost unbeatable.
Didn’t Shakespeare write up something similar?
“Mux Ardu about Nothing”?
He also wrote “Cant Ren just stop the posting of lame jokes in every article for his self-fulfillment?!”. Or was that Hemmingway?…I dont know.
i already built the series array sensor for temperature amperage and voltage in a 20 cell honda insight using 2 unos and a muxii from mayhew labs. the series voltage is overcome using proper galvanic isolation of the sensors. TEMPANERD youtube
I am doing a project that needs to multiplex 64 channel, is there any thing I need to be aware of when using two ADG732 together? should I just directly connect the two sets of A0-A4 in same digital write pins on the microcontroller or do I need to add a buffer or something else, since I need 2 of the channels read at the same time?
Please be kind and respectful to help make the comments section excellent. (Comment Policy)