Sensor to SPI bus

I have an issue of transferring sensor data over SPI communication.
I mean the SPI does transfer the value but the sensor not working like it only read 0.
like for example I attach soil moisture sensor on A0 the value it reads is 0 even if I put water in the soil. Is there something I have mess? this the code for sensor

#include <SPI.h>
#include <DHT.h>

const int numSensors = 3;
const int soilMoistureSensor[numSensors] = {A0, A1, A2};
#define DHT_TYPE DHT11
#define DHT_PIN A3
const int lightSensor = A4;

const int masterDataRequest = 2; 
DHT dht(DHT_PIN, DHT_TYPE);
int soilMoistVal; int humidityVal; int lightVal;

void setup() {
    Serial.begin(9600);
    SPI.begin();
  	dht.begin();
  	
    pinMode(SS, INPUT);
  	pinMode(lightSensor, INPUT);
  	pinMode(DHT_PIN, INPUT);
 	for (int s = 0; s < numSensors; s++) {
    	pinMode(soilMoistureSensor[s], INPUT);
  } 
    pinMode(masterDataRequest, INPUT);
}

void loop() {
    if (digitalRead(masterDataRequest) == HIGH) { 
        // Respond to the master's data request
      	float humidity = dht.readHumidity();
      	for (int s = 0; s < numSensors; s++) {
        soilMoistVal = analogRead(soilMoistureSensor[s]);
        } 
      	humidityVal = analogRead(DHT_PIN);
      	lightVal = analogRead(lightSensor);

        // Wait for the master to deselect
        while (digitalRead(SS) == HIGH);

        // Send the sensor data to the master
        SPI.transfer(soilMoistVal >> 8); 
        SPI.transfer(soilMoistVal & 0xFF);
        
      	SPI.transfer(humidityVal >> 8); 
        SPI.transfer(humidityVal & 0xFF);
        
      	SPI.transfer(lightVal >> 8); 
        SPI.transfer(lightVal & 0xFF);

        // Wait for the master to finish
        while (digitalRead(SS) == LOW);
    }
	
  	Serial.print("Soil Moisture: " + String(soilMoistVal) + " | ");
	  Serial.println("Humidity: " + String(humidityVal));   
  	Serial.println("Light: " + String(lightVal));

    delay(1000);
}

this is the for the master

#include <SPI.h>

const int sensorsDataRequest = 2; 

void setup() {
    Serial.begin(9600);
    SPI.begin();
    pinMode(SS, OUTPUT); 
    pinMode(sensorsDataRequest, OUTPUT);

}

void loop() {
    // Request sensor data from the sensor node
    digitalWrite(sensorsDataRequest, HIGH);
    delay(1); 
    digitalWrite(sensorsDataRequest, LOW);

    // Select the control node
    digitalWrite(SS, LOW);

    // Send a request to the sensor node
    SPI.transfer('R');

    // Receive sensor data from the sensor node
    int soilMoistureVal = (SPI.transfer(0) << 8) | SPI.transfer(0);
    int humidityVal = (SPI.transfer(0) << 8) | SPI.transfer(0);
  	int lightVal = (SPI.transfer(0) << 8) | SPI.transfer(0);

    // Deselect the control node
    digitalWrite(SS, HIGH);

    Serial.println("Received Sensor Data:");
    Serial.println("Soil Moisture: " + String(soilMoistureVal));
    Serial.println("Humidity: " + String(humidityVal));
    Serial.println("Light: " + String(lightVal));
                       
    delay(1000); 
}

Welcome to the forum

Which Arduino board are you using ?

What do you see if you print the values read from the sensors before sending them ? Do they look correct ?

How are the moisture sensors wired to the Arduino ?

Can you post an annotated schematic showing exactly how this is wired?

this is how I exactly wired it.

I also forgot to add the load function code

#include <SPI.h>

const int mistPump = 7;
const int dripPump = 6;
const int growLight = 5;

unsigned long commenceTime = 0;
const unsigned long growLightStop = (4L*60L*60L*1000L);

void setup() {
    Serial.begin(9600);
    SPI.begin();
  	lcd.init();
  	lcd.backlight();
  	lcd.print("Load Control: ");
  
    pinMode(SS, INPUT); 
    pinMode(mistPump, OUTPUT);
  	pinMode(dripPump, OUTPUT);
  	pinMode(growLight, OUTPUT);
}

void loop() {
    if (digitalRead(SS) == LOW) { 
        char requestType = SPI.transfer(' '); 
        if (requestType == 'R') { 
            int soilMoistVal = (SPI.transfer(0) << 8) | SPI.transfer(0);
          	int humidityVal = (SPI.transfer(0) << 8) | SPI.transfer(0);
          	int lightVal = (SPI.transfer(0) << 8) | SPI.transfer(0);
          
            if (lightVal > 500) {
                digitalWrite(growLight, HIGH);
              	commenceTime = millis();

            } else if (humidityVal > 25){
                digitalWrite(mistPump, HIGH);
            	
            } else if (soilMoistVal > 500){
              	digitalWrite(dripPump, HIGH);
             
            } else {
                digitalWrite(growLight, LOW);
              	digitalWrite(mistPump, LOW);
              	digitalWrite(dripPump, LOW);
            }  
          if (digitalRead(growLight) == HIGH && millis() - commenceTime >= growLightStop) {
          	   digitalWrite(growLight, LOW);
        }
        while (digitalRead(SS) == LOW);
    }

    delay(1000);
}

I don't know what you did but the image is not displayed

It's not clear from your drawing but it looks like you are using one digital output on the master UNO to select BOTH slave UNOs. With SPI, each slave UNO should have its own slave select signal from the master.

does any pin will do to use as SS? Will it change on how my sensor behave? coz that my problem. The load UNO function like the soil moisture sensor when it received 0 as a reading. The pump function on the set threshold which > 500 as I mention the sensor only read 0.

Ohh, I just realized it might be the problem since the master may get the sensor data through load UNO since it has the same SS. So, I need to change only the SS of one of the slave will it somehow solve my issue? What you think?

I need second opinion to validate my reasoning hahaha.

Correct. The second slave needs a separate SS signal from the master.

Have a read of:

Nick has examples of how to be an SPI slave device.

You must have a good reason to use three Unos (I don't see it).
A classic Nano could do what your diagram shows.

      	for (int s = 0; s < numSensors; s++) {
        soilMoistVal = analogRead(soilMoistureSensor[s]);
        } 

That exits with the value of the last sensor. Sensor A0, A1 are never used.
You also need a 3-element array for the three values.

        SPI.transfer(soilMoistVal >> 8); 
        SPI.transfer(soilMoistVal & 0xFF);

Maybe easier with SPI.transfer16();
Leo..

I did try to use just atmega for all these inputs and outputs but some of it not operating. I'm guessing it was the power distribution so I just solve it by separating input and output. And I use a master to send a data to a mobile app since I'm planning to extend the project scale.