1

So I've been trying to get a small project set up for the upcoming eclipse, just to read changes in the humidity and temp during the eclipse.

I have two DHT11 sensors, I'm only using one.

I have downloaded this library (it's at the bottom), and this is the code I'm using.

#include <dht.h>
#define pin 13
dht DHT;
void setup() {
 Serial.begin(9600);
 delay(2500);
 Serial.print("DHT11 Sensor: April 8 Solar eclipse data\n\n");
 delay(1500);
}
void loop() {
 DHT.read11(pin);
 Serial.print(" ");
 Serial.print(DHT.humidity);
 Serial.print(" ");
 Serial.print(DHT.temperature);
 Serial.print(",\n");
 delay(2500);
 
}

The goal here is to have csv's that I can copy/paste into a .csv and import to matlab to do what I need on there.

I keep getting the title and "0.00 0.00," for the two data sets. With other libraries and borrowed code sometimes I get -999 for the datasets.

My set up

schematic

simulate this circuit – Schematic created using CircuitLab

My schematic isn't super accurate, the sensor's on the breadboard. LMK your thoughts.

jsotola
1,5342 gold badges12 silver badges20 bronze badges
asked Apr 5, 2024 at 18:03
5
  • 1
    @StarCat just delete the comment then Commented Apr 5, 2024 at 18:36
  • I attempted the resistor, I put one end in the power row between the 5V into the breadboard and the power pin for the sensor, and the other end into a slot between the data wire out to the Mega, and the pin for the sensor. Still zeros. Commented Apr 5, 2024 at 19:01
  • Try a pin other than 13. There is additional circuitry around pin 13 for the built in LED. Commented Apr 6, 2024 at 2:33
  • Can be a bad sensor or bad cable too. Commented Apr 6, 2024 at 10:32
  • You can cross-check your sensor with this tutorial. theengineeringprojects.com/2017/08/… If your sensor does not work after following this, maybe you have to replace your sensor. Commented Apr 8, 2024 at 15:09

1 Answer 1

1

If you are using a standalone DHT11 sensor (Without breakout board) you will need a 1KΩ pullup-resistor between 5v and Data.

The DHT's data pin is an open collector, meaning it can only pull a wire to ground to transmit data. If that wire wasn't pulled up to begin with, it won't have anything to pull down.

If your DHT11 is on a breakout board with the 1KΩ resistor already in place, I would suspect a bad sensor...

answered Apr 8, 2024 at 12:05
1

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.