Arduino Pro micro dht11 reading error

sorry i found it but there is a small problem

Check, double check, triple check, ...... the wiring. That's the only advise that I can give.

Please post a photograph of the wiring that shows clearly how exactly the sensor is connected to the Arduino. Also upload the sketch you are currently testing with.


// Pin, an dem der DHT11 angeschlossen ist
#define DHTPIN 2

// DHT Sensortyp (DHT11)
#define DHTTYPE DHT11

// DHT-Objekt erstellen
DHT dht(DHTPIN, DHTTYPE);

void setup() {
  // Serielle Kommunikation starten
  Serial.begin(9600);
  // DHT-Sensor initialisieren
  dht.begin();
}

void loop() {
  // Warte 2 Sekunden zwischen den Messungen
  delay(2000);

  // Temperatur und Luftfeuchtigkeit lesen
  float humidity = dht.readHumidity();
  float temperature = dht.readTemperature();

  // Überprüfen, ob die Messwerte valide sind
  if (isnan(humidity) || isnan(temperature)) {
    Serial.println("Fehler beim Lesen vom DHT-Sensor!");
    return;
  }

  // Messwerte über die serielle Schnittstelle ausgeben
  Serial.print("Luftfeuchtigkeit: ");
  Serial.print(humidity);
  Serial.print(" %\t");
  Serial.print("Temperatur: ");
  Serial.print(temperature);
  Serial.println(" °C");
}

thats the test code


sorry guys i hot glued it again

OK, the soldering really needs to improve:
image
You have most likely a short between pins 2 & 3. Possibly between 1 & 2 as well.

The photo still doesn't clearly show how the sensor is connected to the Arduino.

What can I say. It's your project. If you want to do stuff that's counterproductive, that's your prerogative. It's not going to get you anywhere though.
If the soldered connections don't hold, the solution is not to apply hot glue. The solution is to get better at soldering.

Also, consider soldering some header pins to your Arduino (or get one with the headers already soldered in place) and use a solderless breadboard for your experiments. It'll save you lots of time at least in the short run. Ultimately it'll be handy to learn to solder properly.

PS:

No, it isn't:
image

No der is no short.
Also its my first time that i solder so iknow its not good but i tried to get better

How have you determined this?

Sure, we all have to start somewhere.
There are tutorials on soldering online. Maybe look at some youtube videos that explain the process. By the looks of it, you either have your temperature set too high or too low, and/or you're not applying flux.

Please look up a pinout diagram of a Pro Micro. E.g. here : Pro Micro & Fio V3 Hookup Guide - SparkFun Learn what the function of pins 2 and 3 are.

Next check your code; why did you use pin 2 for your DHT?

What is connected to pins at the left of A2?

Die pin plan is fine ich alredy check it.
Yes in had to incres the temp

@sterretje has a point - pins 2 & 3 are the I2C bus. You'll need that later on for the OLED display. Don't use either of these for your DHT11 sensor.

It's still not clear how you've connected the sensor to the Arduino.

Yes, that makes sense. Don't set it too high either because you'll run into the same problem.
Have a look at this:

Note what a good solder connection should look like.

Leaving aside the questionable wiring for a moment, I found your sketch somewhat perplexing.

Unless I am very much mistaken, pin 2 on the Pro Micro is the I2C SDA pin.

The SDA pin that you'll need to communicate with the I2C OLED display.

That was perplexing.

Furthermore, your sketch doesn't even compile. SSD1306_I2C_ADDRESS is not defined anywhere in your sketch.

That was also perplexing.

Furthermore, the parameter you've placed that value in is not the I2C address, but the method the display will generate 3.3V by. Usually, that is SSD1306_SWITCHCAPVCC, which is defined in Adafruit_SSD1306.h, if memory serves.

But anyhow... with the DHT11 output connected to pin 4 (and the sketch updated to reflect that), and using SSD1306_SWITCHCAPVCC as the first parameter of the display.begin call, and using more conventional wiring methods, here's the result. I'll just leave it with you to ponder.

1 Like

Thank you guys for your help.

I had to check the calendar as I scrolled thru this topic... Nope, that date was 10 weeks ago.

@Grumpy_Mike your catchphrase hasn't quite been understood here!

2 Likes

Indeed. But the Forum has dropped those many revisions back.

For @farday information the tag line on my posts used to be:-
"Solder is Electric Glue"

Sadly none of your attempts to solder look anything like remotely close to being soldered and making a connection.

The trick to soldering is to observe closely what is happening. The Iron should be held on the joint until you see it flow round both the wire and the pad on the board.

You should use a rosin core solder as thin as you can find, with a 60/40 Lead / Tin composition. Lead free solder needs a much higher melting point and is harder to learn to solder correctly with.

So i improved it but it doesnt work

The soldering, as far as I can see it, still looks really bad. You probably have some bad connections there.
What's the hot glue doing on that Arduino? If the headers are soldered properly, there's no need for hot glue.

Have you modified your sketch so that it now uses the pin you've connected the sensor to?

Yes and it works now thanks for your help.

1 Like

Congratulations. Good luck on your further projects and keep practicing on the soldering!