weird/random values from a Inclination sensor

So for my first arduino project i bought an inclination sensor.
The output is 0,5 to 4,5 V, so it should be readable for the analog pins without using a Voltage divider. The problem is that the arduino reads values that are extremly inconsistant and moving the sensor has
no effect at all.

So my questions are:

  1. Do I need any pulldown resistors or anything like that or can I connect the output of the sensor directly to an analog pin?

2.is the sensor maybe not working correctly?

this is my first project so please dont mind if I have forgotten anything or done smth stupid :smiley:

It would be helpful (mandatory acrually) to know which inclination sensor that you are using. Post a data sheet for the sensor.

Datasheet:

Should be ok , need wiring diagram and code next !

Btw you could just power the transducer and measure its output with a multimeter to see if all is well .

So I tried with a multimeter and it worked, and it worked fine. But still not on the arduino.
Heres the code:

int analogPin = 0; // potentiometer wiper (middle terminal) connected to analog pin 3
// outside leads to ground and +5V
int val = 0; // variable to store the value read

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

void loop()
{
val = analogRead(analogPin); // read the input pin
Serial.println(val); // debug value

}

its just copied from the arduino page, bc i wanted to see if the problem is in the code or not.
Wiring:

  • Output of the sensor connected to A0
  • arduino is powered via usb
  • sensor is powered by an external 10V power supply.

Did you forget to connect the grounds together?

Delta_G:
Did you forget to connect the grounds together?

do I have to connect the ground of the arduino and the external power source??
If yes, why is that?

So I connected the grounds together and now it works! Thanks to everyone for your Help!!

Brozo:
do I have to connect the ground of the arduino and the external power source??
If yes, why is that?

Yes so they'll have a common voltage reference.