Just got my Arduino board last week, but Ive played with an ATMega168 on a breadboard in the past, with limited success.
Im designing a servo control platform for a satellite dish solar collector project, and I seem to be having issues with crosstalk on the analog pins.
My design goes something like this: An LED and resistor between an analog pin and digital pin of the Arduino (x2), and Ive just added a small pot voltage divider on another analog pin. Pretty simple. The LED's are acting as light level sensors based on the example here LED Sensing . The pot was added because the returned values tended to be slightly offset, so I was going to use this as a tuner, to bring them to the same level in software.
Problem is, when I turn the pot, even without modifying the values in software, the values seem to be varying proportionally to the value on the pot.
Any ideas why? Do I need some form of filter? Sorry for the noobness, have to learn somehow tho!
ok, well ive implemented an "auto-tune" into the program - basicly an array of last delta values between the sensors. taking the average of that gives me a very VERY accurate offset. booyah!
still interested to find out why the pot did what it did, however!
When i have used a pot on an analog in, i have always had small seemingly random varations, like the value i get back from the analogRead() is "jittering", jumping back and forth between 2-3 values.
i belive this is natural behavior becaus each of the 1024 values represent only 4.8 mV, so even the smallest changes in the 5V reference voltage can easily introduce an error of a couple of "steps".
But i don't remember the change being proportionate with the position of the pot.
LED sensing is a novelty rather than a good technique. As you have found it is subject to cross talk and is very susceptible to noise pick-up.
It can be useful when you want to combine the light function with the sensing function and have little resource. However, for any practical project do it correctly and use a photo transistor or LDR.