Analog Pins printing Wrong values

Hi i m new to Arduino. Now i m at interfacing basic sensors with arduino. and my issue is while getting data from the simple IR Sensors and printing in the serial port, i m getting some others values which is not corresponds to the sensor's output. Even when i unplug the sensors from the input port i m getting values(Without any input i m getting some values in serial)!!!. whats the problem? Why it is giving me some floating Values?

Why it is giving me some floating Values?

Because when you read a analog input pin that has nothing wired to it, you have a "floating" input pin condition and the value your read will just be noise and capacitive coupling to other input pins, etc, that is normal. Wire the pin to ground and see if you have a steady zero value, then wire the pin to +5vdc and you should see a steady 1023 count value. The analog input pins like to 'see' a signal source impedance of 5k ohms or less for most stable readings. What is the sensor type and do you know it's output impedance value? Perhaps a link to the sensor would help us.

Lefty

See:-
http://www.thebox.myzen.co.uk/Tutorial/Inputs.html

By the way the description of this section says:-

For problems with Arduino itself, NOT your project

In what way does your problem conform to this description?

Pleas post in the correct section!

Hey Retrolefty Really Thanks For your Quick Reply .As u said i did the Analog pin reading with the Ground and Vcc(+5V) of the arduino it was not exactly o and 1023 but it was (+ or -)10 to that and I'm Using Arduino Diecimila its Fine i think the Board is good and i'm able to read Analog Values :slight_smile: But When i connect this Analog Sensor(http://bit.ly/uME9Mb ) When I connect Vcc and Ground to the Board and Signal to the 0th pin of Analog Port to output signal of the Sensor,And when Sensor is Placed without Any movement, I'm getting these values

386
320
374
389
429
482
514
421
445
452
466
460
477
458
364
396
387
372
336
343
388
402
390
439
452
482
488
522
426
433
449
450
465
470
467
464
462
476
464
421
405
390
402
335
346
396
390
413
449
491
522
427
434
454
454
471
471
467
474
405
385
346
333
405
418
465
459
429
440
456
468
473
477
464
406
378
332
389
399
454
489
515
436
453
471
476
468
354
393
341
395
391
453
509
429
447
466
466
467
421
426
366
345
382
439
482
436
452
467
477
479
483
406
379
353
399
399
476
525
431
459
465
466
467
418
381
363
402
436
454
507
440
461
464
462
459
394
357
399
402
486
512
445
474
464
465
402
368
361
394
473
527
438
468
474
467
389
352
401
457
516
428
453
470
466
403
361
401
447
516
422
450
472
469
388
379
325
394
476
520
434
461
471
461
393
348
413
469
498
424
450
469
481
469
394
338
405
418
487
512
445
464
458
491
406
364
348
341
373
438
498
499
452
478
483
483
478
450
398
370
306
324
380
378
444
479
564
435
452
459
466
470
474
478
464
418
419
415
404
379
382
373
390
385
391
397
425
429
451
518
524
560
540
434
436
445
460
461
470
460
467
478
482
479
484
478
483
486
484
491
479

And i'm using Standard Arduino Analog Serial Read Sketch Which is given Below:

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

void loop() {
int sensorValue = analogRead(A0);
Serial.println(sensorValue, DEC);
}

Thanks in Advance :slight_smile:

Moderator edit: Whitespace trimmed. Obnoxiously long list put inside [code] [/code] tags.

Sorry As Grumpy_Mike quoted my post shouldn't to be here so i'm posted my Post on This link (http://arduino.cc/forum/index.php/topic,78393.0.html) And Thanks to Retrolefty For Your Quick Reply :slight_smile:

I've used a similar (but a shorter range model) module. The device doesn't have a accuracy or variation spec but there are two things I can think of that you can try and do to help stabilize the readings.

  1. Mount a filter capacitor, say 10 ufd right at the + and - terminals on the sensor.
  2. Learn to use averaging methods in your coding, say take 8 readings in a row, sum them and then divide by 8 and then send that value out the serial port. See if that doesn't give you smoother values.

Lefty

Yaahhhh.... It's working good(But the Values are Little Bit Not Accurate :)). I'm Happy and Thanks :slight_smile: