views:

148

answers:

3

Hello

i have tried meassuring the analogpin value using the provided standard sketch in the arduino IDE. But even when there is no connection to the pin, it prints out random values. is there anything that has to be taken care of?

i have a FSR sensor connected from 5V+ to analog ping 0

+5  A: 

No connection giving you random value is completely expected. The pin is floating, and may or may not have a charge on it at any time, giving random values.

Attach the analog input to ground - it should return a number approaching zero (within the accuracy and noise of the ADC).

Yann Ramin
Thank you very much for the answer, following this tutorial i got the right reading:http://www.ladyada.net/learn/sensors/fsr.htmlanother question then, why is it necessary to connect the fsr to the ground?
Casper Marcussen
It is not. The attach to ground is a test to determine if your analog input code is doing what you expect.
Yann Ramin
+2  A: 

You have to use "Pull-up" or "Pull-down" resistor. Read here about this circuit: http://www.ladyada.net/learn/arduino/lesson5.html

meneldor
+1  A: 

Providing a path of higher resistance to ground ensures that when that portion of the circuit is open, the static electricity remaining in the portion connected to the pin gets grounded. It also splits the voltage between both paths to allow you to properly throttle the voltage to the pin.

diatrevolo