Arduino PT100 AnalogRead reading incorrect numbers

I'm trying to measure temperature using an PT100 temperature sensor. I've done this using a voltage divider with the sensor and 100 ohms. The problem is that it's reading 100 degrees celsius when it's 21 degrees. When i move the cable connecting the sensor and the board, then the value changes +/- 10 bits. I've put the code and the output below.

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

void loop() {
  Serial.println(analogRead(5));
  delay(50);
}
576
575
575
577
576
576
581
584
584
586
586
586
587
587
585
577
583
591
593
602
598
601
599
599
597
602

What’s your hardware setup?
You can get very good results using a chip designed for that, MAX31865.
https://www.maximintegrated.com/en/products/analog/sensors-and-sensor-interface/MAX31865.html
2 or 3 100nF caps (0.1uF) and a 400 ohm resistor for PT100 and you’re good to go.

Change these two lines to put in your values:

float Reference_Resistor; //Reference Resistor installed on the board.<< 400 for PT100

float RTD_Resistance; //RTD Resistance at 0 Degrees. Please refer to your RTD data sheet. << 100 for PT100

max31865Hani.ino (9.97 KB)

My hardwaresetup is a 100 ohm resistor and the PT100 running on the arduino 5V, like showed below. Is it possible to run it without using any additional chips (only using resistors and the arduino). I don't need it to be very precise. +/- 5 degrees is fine.

5V ---- Sensor --- A5 ---- 100 Ohm ------ Ground