multiplexing analog inputs?

Hi all,

So whilst I'm doing this with an arduino the question is probably more general electronics related as I can't seem to find an answer in the almighty google but am sure someone has done this before.

Overall I'm building a garduino-esque drip watering system for my garden however instead of it just turning on the whole irrigation system when one plant is getting a bit dry what I want to do is make it water specific plants. I've more or less got the irrigation control working on the output side (opening and closing specific valves in the system according to instructions) but I want to have more than 6 inputs (yes moon on a string and all that) - particularly because I want the sensors in different types of plants in different parts of the garden (some parts are more sunny, shady, wet or dry than others).

I'm already using shift registers to control the open and closing of my valves so was thinking if there's an equivalent for analog input? I looked at using a standard shift register but it would mean the input becomes high/low not variable.

Does anyone know of a component to achieve what I'm setting out to do or can enlighten me as to a way of switching between multiple analog inputs coming onto the same pin?

I don't need something that is performance driven as I don't need constant feedback into the system - even if it had to cycle between each of the inputs in a "round-robin" style that would be sufficiently fast enough for what I need it for (lets face it plants don't dry out that fast so anything faster than once per day will be sufficient).

Cheers ajfisher

The CD4051 ia an 8-way analog multiplexer/demultiplexer. You address it with three digital outputs to connect one of 8 signals to an analog input pin, then read the pin. By using one per analog input pin you can get eight times as many inputs at the cost of three digital output pins.

Remember you can use "analog input pins" as digital output pins.

By using three of the six analog pins as inputs and three as address lines to the 4051 chips you can get 24 analog inputs for very little cost.

Two suggestions, if you don't want shift registers. One is to hook your different water sensors to different resistors, and hook all to one analogue pin. When you get different resistor values read by the Arduino, you can turn on different water valves. Other is to use the PCF8575 I2C chip. It can watch 16 switches at once, and send that info to the Arduino with only two wires on the I2C bus.

Thanks John

That looks really simple - not sure why the almighty google didn't return that page as it was really detailed and exactly what I'm looking to achieve.

Between that for input and shift regs for output I could almost get to "per plant" measurement and watering which would be pretty cool.

Cheers Andrew

Have a look at 4067 and 4051 chips.


I will just say , that

"Posted on: Today at 09:06:31 PM Posted by: johnwasser"

he is right, multiplexing input the best solution , and not just best , the only one. And this chip is good, take a data sheet from

What is a obstacle in design only ON Resistance VIN = VIL or VIH (Control), and RON VDD=10V 120 500 You will have to consider ON resistant, input has to be 100 times more resistive, so you wouldn't lost a info.

ajfisher: That looks really simple - not sure why the almighty google didn't return that page as it was really detailed and exactly what I'm looking to achieve.

You just needed to know the right search terms: analog multiplexer One of Google's suggestions was: analog multiplexer demultiplexer 4051 I selected that suggestion and the Arduino Playground page was the first result! (I was surprised and pleased.)