Go Down

Topic: Arduino Analog Inputs acting funny (random noise) (Read 987 times) previous topic - next topic

nikescar

I'm trying to get some reading from a pot using the example sketch and it is not working. It might be possible that my board is shot.

Here is the sketch:
Code: [Select]

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

void loop() {
 
  int sensorValue = analogRead(A1); 
 
  Serial.print("1 ");
  Serial.println(sensorValue);
 
  delay(100);
 
}


When I run it and have nothing plugged into A1 the reading is around 340 and only varies slightly. When I plug in a wire and have the wire laying there not connected to anything the readings jump from 200s to 500s. When I grab the wire insulation the readings go even crazier.

video here:
http://www.youtube.com/watch?v=yeXR8W1gw9I

retrolefty

That is normal. When you have nothing electrically wired to a analog pin it is said to be in a floating input pin condition and will be subject to reading random electrical noise. Wire the analog input pin to ground or +5vdc and see how steady the readings become. What and how you wire things to the analog input pin is important, if you expect them to work correctly.

What is the ohm value of the pot you are trying to use and how have you wired it up? 10k or less is the pot value you should be looking for.

Lefty

nikescar

Okay. That makes sense. I guess I should move this out of troubleshooting then.

I need to start a new thread about why this still happens when I solder that pin to the pot on a xbox 360 controller. The readings look exactly the same. Do I need to take the 3.3v from the controller to the AREF?

retrolefty


Okay. That makes sense. I guess I should move this out of troubleshooting then.

I need to start a new thread about why this still happens when I solder that pin to the pot on a xbox 360 controller. The readings look exactly the same. Do I need to take the 3.3v from the controller to the AREF?


Did you also wire a ground wire from the arduino to the xbox? That would be required.

Lefty

Grumpy_Mike


nikescar

Thanks Lefty. That did the trick. Works like a charm.

Mike, thanks for the link. I learned something.

Go Up