Connecting Multiple Sensors to a Single Arduino UNO (5V)

I’m working on a project with an Arduino UNO, ethernet shield, and multiple sensors.

My question is in regards to the 5V connection…

I have the 5V connection running from the Arduino to the breadboard. Then I have all the sensors plugged in to the same 5v connection through the breadboard.

Am I wiring the sensors correctly to the 5V? Do they all share the same 5V connection like shown in the picture?

I have three sensors: air temperature, soil moisture, and water level

The reason I’m asking about the 5V is because when I dip the soil moisture sensor into the water the air temperature also rises immediately (and it rises a lot)! That doesn’t make sense to me…

#include <SPI.h>
#include <Ethernet.h>

// MAC address from Ethernet shield sticker under board
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(222,338,1,XX); // IP address, may need to change depending on network
EthernetServer server(80);  // create a server at port 80

String HTTP_req;            // stores the HTTP request

void setup()
{
    Ethernet.begin(mac, ip);  // initialize Ethernet device
    server.begin();           // start to listen for clients
    Serial.begin(9600);       // for diagnostics
    pinMode(13, INPUT);        // switch is attached to Arduino pin 13
}

void loop()
{
    EthernetClient client = server.available();  // try to get client

    if (client) {  // got client?
        boolean currentLineIsBlank = true;
        while (client.connected()) {
            if (client.available()) {   // client data available to read
                char c = client.read(); // read 1 byte (character) from client
                HTTP_req += c;  // save the HTTP request 1 char at a time
                // last line of client request is blank and ends with \n
                // respond to client only after last line received
                if (c == '\n' && currentLineIsBlank) {
                    // send a standard http response header
                    client.println("HTTP/1.1 200 OK");
                    client.println("Content-Type: text/html");
                    client.println("Connection: keep-alive");
                    client.println();
                    // AJAX request for switch state
                    if (HTTP_req.indexOf("ajax_switch") > -1) {
                        // read switch state and send appropriate paragraph text
                        GetSwitchState(client);
                    }
                    else {  // HTTP request for web page
                        // send web page - contains JavaScript with AJAX calls
                        client.println("<!DOCTYPE html>");
                        client.println("<html>");
                        client.println("<head>");
                        client.println("<title>Arduino Web Page</title>");
                        client.println("<script>");
                        client.println("function GetSwitchState() {");
                        client.println("nocache = \"&nocache=\"\
                                                         + Math.random() * 1000000;");
                        client.println("var request = new XMLHttpRequest();");
                        client.println("request.onreadystatechange = function() {");
                        client.println("if (this.readyState == 4) {");
                        client.println("if (this.status == 200) {");
                        client.println("if (this.responseText != null) {");
                        client.println("document.getElementById(\"switch_txt\")\
.innerHTML = this.responseText;");
                        client.println("}}}}");
                        client.println(
                        "request.open(\"GET\", \"ajax_switch\" + nocache, true);");
                        client.println("request.send(null);");
                        client.println("setTimeout('GetSwitchState()', 1000);");
                        client.println("}");
                        client.println("</script>");
                        client.println("</head>");
                        client.println("<body onload=\"GetSwitchState()\">");
                        client.println("<h1>Arduino Aquaponics System Status</h1>");
                        client.println(
                        "<p id=\"switch_txt\">Loading data...</p>");
                        client.println("</body>");
                        client.println("</html>");
                    }
                    // display received HTTP request on serial port
                    Serial.print(HTTP_req);
                    HTTP_req = "";            // finished with request, empty string
                    break;
                }
                // every line of text received from the client ends with \r\n
                if (c == '\n') {
                    // last character on line of received text
                    // starting new line with next character read
                    currentLineIsBlank = true;
                } 
                else if (c != '\r') {
                    // a text character was received from client
                    currentLineIsBlank = false;
                }
            } // end if (client.available())
        } // end while (client.connected())
        delay(1);      // give the web browser time to receive the data
        client.stop(); // close the connection
    } // end if (client)
}

// send the state of the switch to the web browser
void GetSwitchState(EthernetClient cl)
{
  
    cl.print("<h2>Sensors</h2>");

    int airTemp;
    airTemp = analogRead(0); 
    
    // Cnvert ADC reading to voltage
    float voltage = (airTemp/1024.0 * 5.0);
    Serial.print("Volts: ");
    Serial.print(voltage);
    Serial.print("\n");
  
    // Convert the voltage to temperature in degrees celsius
    float temperature = ((voltage - 0.5) * 100);
    Serial.print("Temperature C: ");
    Serial.print(temperature);
    Serial.print("\n");
  
    // Convert celsius into farenheight
    float temperatureF = ( ( (temperature * 9) / 5) + 32);
    
    cl.print("<p>Air Temp: ");
    cl.print(temperatureF);
    cl.println("</p>");
 
    int waterLevel;
    waterLevel = analogRead(1); 
    
    cl.print("<p>Water Level: ");
    cl.print(waterLevel);
    cl.println("</p>");
    
    int soilMoisture;
    soilMoisture = analogRead(2);
    
    cl.print("<p>Soil Moisture: ");
    cl.print(soilMoisture);
    cl.println("</p>");
    
}

I just want to make sure I have everything on the breadboard wired correctly.

You almost certainly don't. It might pay to make a drawing with pencil and paper, rather than a photo which doesn't show much and may even be incomplete.

Assuming that none require much current, and that is unlikely to be a problem, the sensors should all come of the one 5v line and use a common ground. You can do that on the breadboard with just one 5v and one gnd wire going back to Arduino.

Your breadboard has rails on both sides, labeld + and -. Connect these to the Arduino VCC and GND, and to all sensors.

Note: every active sensor must be connected to both GND and VCC.

What sensors are you using? If the input impedance is higher than 10K then one reading will affect another due to there not being enough time for the sample and hold capacitor to charge up or down to the next input selected.

If so try reading each input twice in succession and only use the second reading.