Soil Sensors problem

I seem to be having some trouble with my soil sensors, I originally bought a capacitive sensor and now a resistive one, both run at 5v. I have tried calibrating both of them separately but i seem to be getting strange readings.

i am using this code

void setup() {
  Serial.begin(9600);
}
void loop() {
  int val;
  val = analogRead(0);
  Serial.println(val);
  delay(100);
}

With both sensors the readings go up and down continually, if i put either in water or in the air it makes no difference, the readings are still all over the place and are never stable.

I have tried all the analog inputs on my uno and still no go.

I have also put a pin between all the analog inputs and GND and 5V and the readings are stable at 0 and 1023, so I know its not a problem with that.

Am I doing something wrong or by chance both sensors are knackered?

The https://www.arduino.cc/en/Tutorial/AnalogReadSerial link shows what you are doing. It appears you may have violated rule 1. Connect all grounds (reference point). also allow time for the analog channel to read. On ATmega based boards (UNO, Nano, Mini, Mega), it takes about 100 microseconds (0.0001 s) to read an analog input, so the maximum reading rate is about 10,000 times a second. You have more then adequate delay time. Try putting the delay between analogRead(0) and the print statement, I doubt it will help. I have also seen this with a noisy power supply. Some laptops are very noisy, others are not. If the above does not help try a different computer.

I have tried several power supplies and cables, reading the values on a LCD, still jumping all over the place. i moved the delay as well, no difference.

I did contemplate using similar sensors to monitor some of my indoor plants, but then, by the time you add the price of the sensor, the Arduino, and other non-tangibles … it was easier (for me) to buy Bluetooth-enabled multi-sensors that do exactly (and more) what I think you're after.

Such sensors (link below) measure water/light/fertilizer/temperature for a mere $20.00. Not sure an Arduino can compete with that.

Check your wires - are they connected properly?
Are all pins that have to be soldered in, actually soldered in?
What is the actual voltage you measure at the pin of the Arduino, and at the output of the sensor?