Go Down

Topic: Reading more than one sensor in one analog pin (Read 497 times) previous topic - next topic

itiohs

Dec 04, 2012, 11:12 am Last Edit: Dec 04, 2012, 03:30 pm by itiohs Reason: 1


http://imageshack.us/photo/my-images/10/sensoresw.jpg/

Basically I wanted 2 more analag pins so I thought something like this might work. S1 and S2 are simple soil moisture sensors(nails) D1 and D2 are digital outputs from Arduino and A1 is the analog input.

So if  D1(hight) + D2(low)=  I get readings from S2 and D1(low) + D2(high) = readings from S1, right?

* I have almost zero experience with eletronics.

thanks in advance :)

strykeroz

#1
Dec 04, 2012, 11:31 am Last Edit: Dec 04, 2012, 11:49 am by strykeroz Reason: 1
Hi

To add extra analog inputs to your Arduino you'll be wanting to use an additional chip, something like the 74HC4051 (click for datasheet) which acts like a switch box - you tell it which of the up to 8 sensors attached to it you want to read from, and it connects that physical leg with the leg that you have wired to a single analog pin on your Arduino.  There will be lots of tutorials about on how to use these and they're quite straightforward to set up and use too.

* I have almost zero experience with eletronics.
You've come to the right community to learn, in my experience :)

There are plenty of examples of how to get started with this chip online.  Start with this one on the Arduino Playground but there are lots if you google search terms like Arduino 4051 tutorial (link to result).

Geoff

Edit: fixed some of that appalling spelling!
"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

Grumpy_Mike

Here is another example of expanding the number of analogue inputs, the application is different but the principal is the same:-
http://www.thebox.myzen.co.uk/Hardware/MIDI_Footsteps.html

pluggy

#3
Dec 04, 2012, 12:19 pm Last Edit: Dec 04, 2012, 12:21 pm by pluggy Reason: 1
With a RC circuit its possible to 'emulate' an analog input with a pure digital pin with the 'R' being made by your nail in the soil.. In simple terms you set the pin to output, set it high to charge the capacitor, switch it low and then to input and time how long it takes to discharge to the point where it registers as being a low.  The lower the resistance of what is connected to the pin, the quicker it discharges.  You'd need to use something (multimeter or an analogue pin) to determine an approximation of 'R' the (resistance of your nail through the soil) to determine a suitable value for C.  Plenty of stuff on google to work it out but heres a start : http://www.allaboutcircuits.com/vol_1/chpt_16/4.html.  The digital input will register as low when it reaches approximately 2.5 volts.  This probably appeals more if you're a cheapskate...........  ;)

dhenry

Using an analog switch would be my choice.

Go Up