I am using analog read to get the values from a tilt sensor. The specs say that the sensor outputs from 0.5 to 4.5 volts depending on the angle. I checked the output with a multimeter and got the expected results. Then I fixed the tilt sensor so that it should output ~2.5V and checked it again with the multimeter. I connected it to the arduino, but the values from analog read start at 0 go up all the way to 1023, go back down to 0 and the cycle repeats. The strangest thing for me is that the reading varies even though the sensor is fixed at the same angle.
Not sure if this is relevant, but the sensor is connected to a 12V battery since it needs >9V.
I think you'll need to show us how the Arduino board is powered. I believe your problem could be related to a lack of a common ground between the Arduino board and the sensor.
It's better to post pictures directly to the forum. Some forum members won't bother to follow external links so hosting the picture outside the forum can mean you'll have a lesser chance of getting help. The way to host pictures on the Arduino forum and embed them in your post is described here: http://forum.arduino.cc/index.php?topic=364156
The board is powered by USB. You're right there is no common ground, thanks for the suggestion! Is there a simple way to get them a common ground? I cannot connect the Arduino directly to the battery because the voltage is too big, right?
Also thanks for the tip on how to insert images directly!
the board is a Sodaq Sara N211 . They also have their own arduino library, maybe it has something to do with that. I'm not sure though since it's the only board I've used (and, as you can probably tell, I haven't been using it for too long )
the board is a Sodaq Sara N211 . They also have their own arduino library, maybe it has something to do with that. I'm not sure though since it's the only board I've used (and, as you can probably tell, I haven't been using it for too long )