Go Down

Topic: Is my arduino broken? very strange sensor reading? (Read 781 times) previous topic - next topic

raniat123

Hi,
I'm having trouble with my Arduino. I've connected a simple photoresistor and printed the sensor reading to find out that the reading is jumpy and not realistic no matter what the light level is.  I tried multiple sensors and different analog pins and still no use. I finally decided to run the same sketch without connecting any sensors to my Arduino, I found out that I still get the same readings although no sensors are connected. Does this mean that my Arduino is broken somehow?

AWOL

No, it isn't broken
Quote
I've connected a simple photoresistor and printed the sensor reading to find out that the reading is jumpy and not realistic
Post code, post schematic.

pert

With no sensor connected the pin is floating and so random readings are to be expected.

ballscrewbob

Really hard to tell from here.

Maybe wrong coloured wire ?

However if you post the sketch and include a schematic I am sure we may be able to get a better idea.

BTW the I/O 's are generally floating so its very easy to get a random reading if you want to.

It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

ballscrewbob

LOL its like buses...Nothing then 3 come all at once
It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

raniat123

I failed to mention that I have two arduino borads, I used the same Sketch and same wiring methods. I get accurate results with one arduino and very strange results with the other!

ballscrewbob

Are they IDENTICAL boards ?

Same computer ?

Same IDE ?

I know they look like silly questions but in all honesty they are not.

It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

raniat123

WOW. It turned out the reason was the wires. it hit me when Ballscrewbob mentioned the wires, I decided to change the wires I've been using and everything worked fine. Is there a way to test my wires beforehand? I'm kind of a newbie in the Arduino world.

One last question, my photoresistor shows reversed readings, so when I block the light my reading will be around 700 and when I permit more light to fall on the sensor I will get a reading around 100. What could be the reason?
Thanks

AWOL

Quote
What could be the reason?
Who knows?
You didn't post any code or a schematic.

ballscrewbob

It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.


pert

Is there a way to test my wires beforehand?
Sure, you could use an LED on a breadboard or if you have a multimeter you can do a continuity test. You're likely to find a bad jumper wire from time to time and it can really cause some confusion and wasted time so it might be worth the time to test every one in the batch. Of course it's possible they can go bad later with use but at least you'll know you're starting with all good wires.

raniat123

Here is the code and the wiring

Code: [Select]
void setup() {
    Serial.begin(9600);
}


void loop() {
  int sensorValue = analogRead(A0); 
  float voltage = sensorValue * (5.0 / 1023.0);. 
  Serial.println(voltage);
}



raniat123

Sure, you could use an LED on a breadboard or if you have a multimeter you can do a continuity test. You're likely to find a bad jumper wire from time to time and it can really cause some confusion and wasted time so it might be worth the time to test every one in the batch. Of course it's possible they can go bad later with use but at least you'll know you're starting with all good wires.
Thanks that was very helpful. I think I wasted like 3 hours trying to figure out what was wrong and because that I had the same configuration on the other board I thought that the arduino board broke.

Go Up