Skip to main content
deleted 40 characters in body
Source Link
dda
  • 1.6k
  • 1
  • 12
  • 18

I am trying to connect to my Arduino Uno board two temperature sensors: DHT11 and DS18B20. The The problem is with the DHT11 sensor,: apparently there's an error with reading the temperature at every two measurements.

Here's what I get on the serial monitor  (temperature 1 is from the DHT sensor):

enter image description here

As I am new to this, I was wondering what the problem may be. I have read about the one wire interface used by the DS18B20, but I noticed that the DHT is not using the same protocol.

If I use the DHT11 alone, it works perfectly fine.

Also, I am using 4k7 pull-up resistors for both sensors.

Here's the code:

#include <DallasTemperature.h>
#include <OneWire.h>
#include <dht.h>

dht DHT;

#define ONE_WIRE_BUS 8
#define DHT11_PIN 7

OneWire oneWire(ONE_WIRE_BUS);
 
DallasTemperature sensors(&oneWire);

void setup(void)
  {
  Serial.begin(9600);
  Serial.println("Dallas Temperature IC Control Library Demo");
  sensors.begin();
 }
 

 void loop(void)
  {
  int chk = DHT.read11(DHT11_PIN);  
  sensors.requestTemperatures(); 
  Serial.print("Temperature1: ");
  Serial.print(DHT.temperature);
  Serial.print(" Temperature 2 : ");
  Serial.println(sensors.getTempCByIndex(0)); 
 
 }

I am trying to connect to my Arduino Uno board two temperature sensors: DHT11 and DS18B20. The problem is with the DHT11 sensor, apparently there's an error with reading the temperature at every two measurements.

Here's what I get on the serial monitor(temperature 1 is from the DHT sensor):

enter image description here

As I am new to this I was wondering what the problem may be. I have read about the one wire interface used by the DS18B20, but I noticed that the DHT is not using the same protocol.

If I use the DHT11 alone, it works perfectly fine.

Also, I am using 4k7 pull-up resistors for both sensors.

Here's the code:

#include <DallasTemperature.h>
#include <OneWire.h>
#include <dht.h>

dht DHT;

#define ONE_WIRE_BUS 8
#define DHT11_PIN 7

OneWire oneWire(ONE_WIRE_BUS);
 
DallasTemperature sensors(&oneWire);

void setup(void)
 {
 Serial.begin(9600);
 Serial.println("Dallas Temperature IC Control Library Demo");
 sensors.begin();
 }
 

 void loop(void)
  {
 int chk = DHT.read11(DHT11_PIN);  
 sensors.requestTemperatures(); 
 Serial.print("Temperature1: ");
 Serial.print(DHT.temperature);
 Serial.print(" Temperature 2 : ");
 Serial.println(sensors.getTempCByIndex(0)); 
 
 }

I am trying to connect to my Arduino Uno board two temperature sensors: DHT11 and DS18B20. The problem is with the DHT11 sensor: apparently there's an error with reading the temperature every two measurements.

Here's what I get on the serial monitor  (temperature 1 is from the DHT sensor):

enter image description here

As I am new to this, I was wondering what the problem may be. I have read about the one wire interface used by the DS18B20, but I noticed that the DHT is not using the same protocol.

If I use the DHT11 alone, it works perfectly fine.

Also, I am using 4k7 pull-up resistors for both sensors.

Here's the code:

#include <DallasTemperature.h>
#include <OneWire.h>
#include <dht.h>

dht DHT;

#define ONE_WIRE_BUS 8
#define DHT11_PIN 7

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

void setup(void) {
  Serial.begin(9600);
  Serial.println("Dallas Temperature IC Control Library Demo");
  sensors.begin();
}

void loop(void) {
  int chk = DHT.read11(DHT11_PIN);  
  sensors.requestTemperatures(); 
  Serial.print("Temperature1: ");
  Serial.print(DHT.temperature);
  Serial.print(" Temperature 2 : ");
  Serial.println(sensors.getTempCByIndex(0)); 
}
deleted 34 characters in body
Source Link
elena A
  • 31
  • 1
  • 3

I am trying to connect to my Arduino Uno board two temperature sensors: DHT11 and DS18B20. The problem is with the DHT11 sensor, apparently there's an error with reading the temperature at every two measurements.

Here's what I get on the serial monitor(temperature 1 is from the DHT sensor):

enter image description hereenter image description here

As I am new to this I was wondering what the problem may be. I have read about the one wire interface used by the DS18B20, but I noticed that the DHT is not using the same protocol.

If I use the DHT11 alone, it works perfectly fine.

Also, I am using 4k7 pull-up resistors for both sensors.

Here's the code:

#include <DallasTemperature.h>
#include <OneWire.h>
#include <dht.h>

dht DHT;

#define ONE_WIRE_BUS 8
#define DHT11_PIN 7

OneWire oneWire(ONE_WIRE_BUS);

DallasTemperature sensors(&oneWire);

void setup(void)
{
 Serial.begin(9600);
 Serial.println("Dallas Temperature IC Control Library Demo");
 sensors.begin();
 }


 void loop(void)
 {
 int chk = DHT.read11(DHT11_PIN);  
 sensors.requestTemperatures(); 
 Serial.print("Temperature1: ");
 Serial.print(DHT.temperature);
 Serial.print(" Temperature 2 : ");
 Serial.println(sensors.getTempCByIndex(0)); 

 }

I am trying to connect to my Arduino Uno board two temperature sensors: DHT11 and DS18B20. The problem is with the DHT11 sensor, apparently there's an error with reading the temperature at every two measurements.

Here's what I get on the serial monitor(temperature 1 is from the DHT sensor):

enter image description here

As I am new to this I was wondering what the problem may be. I have read about the one wire interface used by the DS18B20, but I noticed that the DHT is not using the same protocol.

If I use the DHT11 alone, it works perfectly fine.

Also, I am using 4k7 pull-up resistors for both sensors.

Here's the code:

#include <DallasTemperature.h>
#include <OneWire.h>
#include <dht.h>

dht DHT;

#define ONE_WIRE_BUS 8
#define DHT11_PIN 7

OneWire oneWire(ONE_WIRE_BUS);

DallasTemperature sensors(&oneWire);

void setup(void)
{
 Serial.begin(9600);
 Serial.println("Dallas Temperature IC Control Library Demo");
 sensors.begin();
 }


 void loop(void)
 {
 int chk = DHT.read11(DHT11_PIN);  
 sensors.requestTemperatures(); 
 Serial.print("Temperature1: ");
 Serial.print(DHT.temperature);
 Serial.print(" Temperature 2 : ");
 Serial.println(sensors.getTempCByIndex(0)); 

 }

I am trying to connect to my Arduino Uno board two temperature sensors: DHT11 and DS18B20. The problem is with the DHT11 sensor, apparently there's an error with reading the temperature at every two measurements.

Here's what I get on the serial monitor(temperature 1 is from the DHT sensor):

enter image description here

As I am new to this I was wondering what the problem may be. I have read about the one wire interface used by the DS18B20, but I noticed that the DHT is not using the same protocol.

If I use the DHT11 alone, it works perfectly fine.

Also, I am using 4k7 pull-up resistors for both sensors.

Here's the code:

#include <DallasTemperature.h>
#include <OneWire.h>
#include <dht.h>

dht DHT;

#define ONE_WIRE_BUS 8
#define DHT11_PIN 7

OneWire oneWire(ONE_WIRE_BUS);

DallasTemperature sensors(&oneWire);

void setup(void)
{
 Serial.begin(9600);
 Serial.println("Dallas Temperature IC Control Library Demo");
 sensors.begin();
 }


 void loop(void)
 {
 int chk = DHT.read11(DHT11_PIN);  
 sensors.requestTemperatures(); 
 Serial.print("Temperature1: ");
 Serial.print(DHT.temperature);
 Serial.print(" Temperature 2 : ");
 Serial.println(sensors.getTempCByIndex(0)); 

 }
Source Link
elena A
  • 31
  • 1
  • 3

Problem with DHT11 and DS18B20 temperature sensors

I am trying to connect to my Arduino Uno board two temperature sensors: DHT11 and DS18B20. The problem is with the DHT11 sensor, apparently there's an error with reading the temperature at every two measurements.

Here's what I get on the serial monitor(temperature 1 is from the DHT sensor):

enter image description here

As I am new to this I was wondering what the problem may be. I have read about the one wire interface used by the DS18B20, but I noticed that the DHT is not using the same protocol.

If I use the DHT11 alone, it works perfectly fine.

Also, I am using 4k7 pull-up resistors for both sensors.

Here's the code:

#include <DallasTemperature.h>
#include <OneWire.h>
#include <dht.h>

dht DHT;

#define ONE_WIRE_BUS 8
#define DHT11_PIN 7

OneWire oneWire(ONE_WIRE_BUS);

DallasTemperature sensors(&oneWire);

void setup(void)
{
 Serial.begin(9600);
 Serial.println("Dallas Temperature IC Control Library Demo");
 sensors.begin();
 }


 void loop(void)
 {
 int chk = DHT.read11(DHT11_PIN);  
 sensors.requestTemperatures(); 
 Serial.print("Temperature1: ");
 Serial.print(DHT.temperature);
 Serial.print(" Temperature 2 : ");
 Serial.println(sensors.getTempCByIndex(0)); 

 }