What to do when I run out of analog inputs?

I'm using the analog inputs on the Arduino Uno R3 to measure voltage values between 0-5V. I ran out of analog inputs. Is there a way to expand the amount of analog inputs? Can the digital pins be used as analog input pins?

Sorta un-related side question: Whenever I have the Arduino Motor shield on top of the Arduino board, I notice that the A1 + A0 inputs no longer are able to sense any voltage values and the A2+A3 inputs are always measuring 5V, even when open. Is the motor shield broken? Is this abnormal behavior? Therefore, Im looking for other ways to increase the analog input sensors.

Well the simplest approach would be to upgrade your UNO to a Nano (8 analog inputs), Mega (16 analog inputs) or Leonardo (12 analog inputs).

Failing that, you would probably want to go to i2c or spi, which are serial protocols. You would issue a command to say which value you want to read, and then read that value.

I’ve not used this product, but this is the first product that came up via google for i2c analog input arduino, and it looks like it would give you 8 ports of 12-bit (0…4095) reads (a5/a4 would be used to read the i2c values): http://www.gravitech.us/i2c128anco.html. Combined with the other 4 inputs, this would give you 12 inputs.

You can use an external ADC as Michael said or an external MUX chip. Pros and cons either way.

I've not used the motor shield but looking at the schematic there are two opamps with outputs on A0/1, they handle sensing of motor current I think so that would explain those two pins.

A2/3 are connected to some TinkerKit headers, so they should work if you have signals on those headers.


Rob

There are lots of external ADCs you can add. I recently used MPC3208 for 8 channels of 12 bit ADC. Use 2 for 16 channels.

Can't you do something like have a counter and a npn transistor array so that only one pot is connected to 5V and gnd, all others are neither receiving 5V or connected to ground ?

Question aimed at anyone who can advise whether this will work ?

Duane B

rcarduino.blogspot.com

Seems like a lot of trouble to wire up 16 transistors and base/gate current limit resistors (pretty much a roll-your-own mux), when a $3.66, 16 pin part could be used with more accuracy and fewer control pins needed. http://www.mouser.com/ProductDetail/Microchip-Technology/MCP3208-CI-P/?qs=sGAEpiMZZMvTvDTV69d2QoQs%252brzkIhGnRBZ4Kz%2fV75Q%3d Depends on what you have access to I suppose.

Depends on what you have access to I suppose.

Always my problem in Dubai.

Thanks

Duane B

I dont get the purpose of the two Tinkerkit header pins, which connect to A2 +A3, on the Arduino Motor Shield.Both analog pins are always outputting 5V, rather than measuring the voltage. I want to configure them as input analog pins rather than output pins, but I am unsuccessful in doing that. I’m using Arduino UNO + Arduino Motor Shield together. Help, please?

Clown_of_God: I'm using the analog inputs on the Arduino Uno R3 to measure voltage values between 0-5V. I ran out of analog inputs. Is there a way to expand the amount of analog inputs? Can the digital pins be used as analog input pins?

Sorta un-related side question: Whenever I have the Arduino Motor shield on top of the Arduino board, I notice that the A1 + A0 inputs no longer are able to sense any voltage values and the A2+A3 inputs are always measuring 5V, even when open. Is the motor shield broken? Is this abnormal behavior? Therefore, Im looking for other ways to increase the analog input sensors.

I suggest the Teensy board. It's only $16 and has 12 analog inputs. It's also wonderfully small and complete with USB. It's like a micro version of a Leonardo. Love it!

Tim

Clown_of_God: I dont get the purpose of the two Tinkerkit header pins, which connect to A2 +A3, on the Arduino Motor Shield.Both analog pins are always outputting 5V, rather than measuring the voltage. I want to configure them as input analog pins rather than output pins, but I am unsuccessful in doing that. I'm using Arduino UNO + Arduino Motor Shield together. Help, please?

They should be configured as inputs - note that they have schottky protection diodes on them so they won't be floating (schottky's have significant leakage current - did you just measure their voltage with a very high-impedance meter?)

I want to configure them as input analog pins rather than output pins, but I am unsuccessful in doing that.

All you have to do is an analogRead() so I think you must have been successful in configuring the pin, it's the returned value you aren't happy with.

Have you applied a variable voltage to the TinkerKit headers? And as MarkT said have toy verified the voltage with an external meter?


Rob