Issues with connecting multiple sensors

Hi, I'm working on a project that uses a Temperature Sensor, Pulse Sensor, Buzzer Sensor, and NEO 6M GPS Sensor. Here is my schematic:

I'm having trouble getting all the sensors working together. When I only have my GPS sensor wired (same way as in the schematic but by itself), the sensor works. Same with pulse sensor and temperature sensor. But when I wire them together, it no longer works.

I specifically tried just the GPS sensor and temperature sensor, and the GPS is able to output values but the temperature sensor outputs "nan". How can I fix this and what's the issue?

It looks like the DHT11’s library (which disables interrupts during its timing-critical read) is colliding with the SoftwareSerial you’re using for the GPS, and the DHT11 data line also needs a pull-up. When both are wired, the DHT read fails and returns NaN.

Try this:

  1. Add a pull-up resistor Put a 4.7 kΩ resistor between DATA and VCC on the DHT11 to stabilize its signal.
  2. Stop using SoftwareSerial for GPS
  • On an Uno, SoftwareSerial blocks interrupts needed by the DHT11.
  • If your board has a second hardware UART (e.g. Serial1 on a Nano 33), use that for GPS.
  • Otherwise switch to AltSoftSerial (pins D8/D9 on the Uno) instead of SoftwareSerial.
  1. Sequence your reads Read the GPS serial first, then call dht.read() and delay ~200 ms before the next loop.
  2. Decouple power lines Place a 10 µF capacitor between VCC and GND near the GPS module, and another near the DHT11.
  3. Common ground Make sure all grounds (battery, GPS, DHT11, Arduino) tie to the same point.

With these changes, the DHT11 should stop returning NaN and both sensors can run together. Good luck!

  • Is the GPS RX input 5v tolerant ?

  • Look into level translator when mixing 5v and 3v3 modules.

It seems to show the data pin from the DHT11, the RXD pin from the GPS and the signal pin from the pulse sensor connected together and to 2 Arduino pins. This will not work. Each must be connected to a separate Arduino pin.

Some types of sensors can share pins because they use a "bus" system like i2c, but not the ones you have.

Thanks for your advice! How would I write the code for the AltSoftSerial pins?
This is my code as of now without any changes:

#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#include <DHT.h>

static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 9600;

// The TinyGPS++ object
TinyGPSPlus gps;

// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);

int DHTPIN = 7;
#define DHTTYPE DHT11
DHT dht = DHT(DHTPIN, DHTTYPE);
float celsius;                              //temp (C)
float fahrenheit;                           //temp (F) 

void setup(){
  Serial.begin(9600);
  ss.begin(GPSBaud);
  dht.begin();
}

void loop(){
  // This sketch displays information every time a new sentence is correctly encoded.
  
  //Temperature Sensor 
    celsius = dht.readTemperature();          //read temperature as celsius 
    fahrenheit = celsius * (9/5) + 32;        //calculate temperature as fahrenheit 
    Serial.print("Temperature: ");            //print temperature label 
    Serial.print(celsius);                    //print celsius 
    Serial.println(" C");

  
  
 
  while (ss.available() > 0){
    gps.encode(ss.read());
    if (gps.location.isUpdated()){
      Serial.print("Latitude= "); 
      Serial.print(gps.location.lat(), 6);
      Serial.print(" Longitude= "); 
      Serial.println(gps.location.lng(), 6);

      }

  }
 
}

I don't think it's 5V tolerant, but on my circuit, it's going to 3.3V

This is my schematic, and each of my sensors (pulse, DHT11, and gps) work individually but none of them can work together. I keep getting a nan value on the DHT11 when I try to use it with the other two. Please help me understand why.

I think you better add the full sketch too (remember to use the "<CODE/>" tag).

What is the voltage of the battery?

What is J1 doing?
By the looks of things from your circuit absolutely nothing.

Is this your own design or is it from someone else.

Remove the GPS 3.3 Rx from the 5 volt UNO Tx, or install a level shifter.

This is not when connected to a battery, this is just from computer power.

In your fritzing drawing, your VCC is connected to the Arduino Vin pin, which is wrong. That pin would require at least 7V to work properly. 5V incoming from the computer USB should be connected to the +5V and GND pins. OR, should we assume that we´re talking about the most common situation where you're feeding the UNO directly through the USB cable?

Your DHT11 is a module or the bare sensor? The bare sensor requires a pullup resistor on the data line.

This topic merged with the same topic from @shsethi

I am satisfied that these two are working together on the same project and posted duplicate questions inadvertently.

Please continue to provide help.

Thank you.

Is that what you meant to say? Or did you mean all of them do not work together?

If so, have you tried the DHT11 with the pulse sensor but without the GPS sensor? Or the GPS sensor and the pulse sensor without the dht11? Or the GPS and DHT11 without the pulse sensor?

If some of those combinations work ok, but others do not, that will help us to understand what the problem can be.