26
\$\begingroup\$

I already know how to extend the number of digital pins on an Arduino using a multiplexer.

I want to increase the number of analog input channels that I have. One solution is to add another Arduino as a slave.

How would I increase the number of analog input channels? (I assume some MUXing and ADCs are involved). If it's too complicated to write in an answer, a general outline of circuit/code would be fine as well.

I am also open to shield suggestions, though I'd prefer it if there was a not-too-hard hardware solution.

\$\endgroup\$
1

3 Answers 3

32
\$\begingroup\$

If you're already familiar with digital multiplexer chips, good news! They can be used for analog signals as well.

http://playground.arduino.cc/Learning/4051

The basic premise is exactly like with digital signal multiplexing. You use the 4051 chip as a "lane changer" and read the signal of whatever lane you tell the chip to switch to. the 4051 uses 3 digital pins and 1 additional analog (or digital) pin on the arduino to create up to 8 lanes of input. Some multiplexers are chainable, so you can fairly easily add 8 more signals without needing to keep taking them away from the arduino itself.

It is exactly like the technique you already know for digital signals, just hook up the channel you read from to an analog pin instead of a digital one, then cycle through the binary states and read the analog values.

I made an animated gif for you.

enter image description here

\$\endgroup\$
6
  • 3
    \$\begingroup\$ While the link does answer the question, could you elaborate a bit? Write about the circuit in short? (Link only answers are discouraged on the network) \$\endgroup\$ Apr 9, 2013 at 18:51
  • \$\begingroup\$ Okay. Answer expanded. \$\endgroup\$ Apr 9, 2013 at 20:24
  • 3
    \$\begingroup\$ One clarification, the 4051 you mention is an analog mux not a digital mux, I would clarify in your answer because there are definitely digital muxes that cannot accomplish this because their output and input drivers are not designed for linear response. Maybe worth an added note that chaining analog muxes may impact the signal depending on characteristics of mux \$\endgroup\$
    – naven87
    Apr 13, 2013 at 7:12
  • 1
    \$\begingroup\$ It is worth noting that analog muxes are not trivial to select, the designer should consider voltage swing (most only operate within the supply range, like opamps), bandwidth, ON resistance, crosstalk, etc. etc., voltage swing being the biggest potential show stopper. \$\endgroup\$ Dec 27, 2015 at 15:07
  • \$\begingroup\$ I believe you can also use digital pin to power a sensor so just turn on one digital pin with respect to sense VCC and share same analog . \$\endgroup\$ Nov 25, 2017 at 19:03
10
\$\begingroup\$

It may be important to remember that the Arduino's ATmega chip itself is using an analog MUX. The Uno-based (ATmega328) chips only have a single ADC. The 6 analog inputs are actually a MUX that connects to that one ADC.

This is why you can only read 1 analog input at a time.

When expanding analog inputs, it may be necessary to consider how much time it takes to do all of this MUXing and whether or not additional external ADCs are necessary in your application.

\$\endgroup\$
1
\$\begingroup\$

Consider this : add ATtiny 85 with serial communication with the Arduino, it uses 2 pins for Rx, Tx, and you have 3 more pins that can be used as analog. This aay you can develop your own protocol, the ATtiny can process the algoritm and send the processed information to Arduino, it is also very cheap, I tried it my self it is nice architecture I think.

Good day

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.