analog bug?

i don´t know if this related as a 'bug' but here goes..

i´m using an FSR sensor connected to an analog pin, and it was working fine with precise reading values.. if i didn´t touch he sensor the read value was always at 0, and if i touch it the value changes smoothly until 400.. 600.. sometimes more...

i don´t know what happened but now all the analog pins are retrieving (random?) values, and even if nothing is connected to the pins the weird reading values remain.. and another weird behavior is, sometimes the idle value is at 1023 and if the sensor is touched the value decreases...

i´ve restarted the system (Mac OS Panther), reuploaded the script onto arduino diemicila and it remains the same!

can someone explain why this happens? and if there is some solution?

thanx!

and cheers for this wonderful device ;)

If you suspect there is a problem with the analog inputs, you should conduct some meaningful tests (observing the input voltages on floating pins is not a meaningful test).

Try connecting your analog pin to Vcc through a resistor and see if you get a consistent 1023. Try connecting it to ground through a resistor and see if you get a consistent 0. Make a voltage divider with two resistors (or use a potentiometer) and see if you get reasonable results. My assumption is that you are using your FSR incorrectly or it is malfunctioning (as opposed to some malfunction/bug with the analog inputs). Tests like this should help you figure out whether it's your Arduino or your sensor that is having problems. If the problem is with your Arduino, I think it will most likely come from your code, which perhaps you should post here (at least the simplified, relevant section).

Additionally, if you have a multimeter, you can use that to measure the output of your sensor. This will give you an idea of how well your sensor is working independent of the Arduino and your code.

  • Ben

thnx for replying Ben! i will make those testes as you say and post my code as soon as possible regards

Hi once again Ben!

I´m in front of the arduino now, and reading the test procedure you´ve suggested, and i have some doubts:

  • what is the Vcc?
  • when you say to use a resistor what should be the value?

Here´s the code.. please take a look and tell me if i´m doing it the right way.. what intrigues me is that it was working really fine!! :)

thanks once more!

int sensor1 = 0;
int sensor1Val = 0;

void setup() {
  Serial.begin(9600);
}

void loop(){
  sensor1Val = analogRead(sensor1);
  Serial.print("sensor1 = ");
  Serial.println(sensor1Val);
}

hi groove,

Vcc is the 5 volt power pin.

Use a 1k resistor if you have one, but the resistor is not critical anything between a few hundred ohms and 10k would work

You may want to put a delay(100); at the end of your loop so that your not swamped with serial messages.

hello mem! thank you for answering! ::)

well, i don´t know how to explain this, i´ve disassembled the sensors and wires on the breadboard and assembled again and now everything seems to be ok!

i appreciate your help!!

regards grooove

I had some trouble a while ago with very odd readings from my analog inputs. After a lot of testing I was convinced that the ATmega168 chip was faulty. Replacing the chip seemed to fix the problem but when I mistakenly used the 'bad' chip in another project it worked perfectly!

The problem turned out to be due to one of the wires to a sensor not making good contact. Perhaps you had a similar problem ;)

yes!! i think some the same was happening with me!! :)