AM2302 DHT sensor does not measure negative temp, reports as positive...

one of the sensors (the one on the far end, with approximately 10 m signal cable) drops out of sight after some time of working fine....

The fact that reloading the code doesn't help but that cycling the power does, suggests that one way or another, the power supply to the device is insufficient. What are you using to supply the 5V? Are there other loads on that supply?

You referred to section 7.1 in the datasheet but the only datasheet I can find, from Adafruit, does not have that information. Please post a link to the datasheet you are using.

One interesting thing I noticed while perusing the Adafruit datasheet is that, on the first page under Technical Specifications, it says (with my emphasis):

Sensing element: Polymer humidity capacitor & DS18B20 for detecting temperature

But that's not (directly) the interesting bit. What is interesting is that the DS18B20 reports temperatures as 16-bit twos complement numbers whereas the AM2302 reports them as signed magnitude! So, the AM2302 must have some sort of mcu (or fpga?) inside to convert from twos-complement to signed magnitude. It would also have to handle communicating with the DS18B20 using the OneWire protocol and then using its own protocol to handle the communications with the outside world.

Pete

My power supply to the whole setup is a 12V DC supply capable of 1A at 12V.
This supply feeds a DC/DC converter "brick" regulator that produces 1A of 3.3V feeding the ESP-07.
It also feeds (now after my rework) a linear 5V regulator (7805 family type), which connects the 5V to the sensor interface connection board where it hooks up to the power wires in the cables to the 3 sensors.
Since the sensors themselves pull less than a 1 mA apiece and the pull-up resistors in use are 1K the whole shebang should pull less than 20 mA off of 5V. But this is probably more like 2 mA since the communication is idle on all sensors that are not sending and the firmware talks to one sensor at a time only. And current is only drawn when a zero is output.

My sensors are from two batches purchased a few years ago (4 sensors) and at beginning of 2018 (10 sensors). The sensors working OK AFAICT could be from the first batch and the 3rd from the 2nd batch.

Regarding the AM2302 data sheet I attach it with this post.

The sensors have some kind of built-in processor and the DHT library I use has a setting to define which type of sensor is in use, so it will adapt the data format decoding depending on that. This works OK for the other 3 sensors and mostly also for the problem sensor.

DHT22 (Humid + Temp).pdf (596 KB)

That datasheet is from the same company as, and looks a bit newer than, the one from Adafruit.

This new problem cropped up when you changed the circuit to that shown in your message #17. I suspect that your use of the zener diode has something to do with it but I don't have enough background in electronics to know. Maybe someone with some real education in electronics (as opposed to me) can jump in and help.

Pete

el_supremo:
This new problem cropped up when you changed the circuit to that shown in your message #17. I suspect that your use of the zener diode has something to do with it but I don't have enough background in electronics to know. Maybe someone with some real education in electronics (as opposed to me) can jump in and help.

Well I am an MScEE in electronics and have worked my whole life with electronic design and software development.
40+ years of professional life.
The zener diodes will have no influence apart from limiting the input voltage on the GPIO lines to the ESP-07 below the 3.3V max even though the sensor is driven with 5V supply.
There is no latch or similar that can trigger and stop the further communications on that line towards the ESP GPIO pin.
Also note that the other 3 sensors continue working fine. If there was a problem in the ESP firmware it must be connected to the actual pin usage because that is the only difference between the 4 sensors, all use the same code for communications. But if the GPIO pin gets into a non-working state for some reason then this would be cleared by an ESP reset, but that has been proven not to be the case. A reset does not clear the problem.
Only a power cycle does.
My problem in dealing with this is difficult because of two issues:

  1. The controller is built into a box now located in the attic behind a hatch reachable only via a ladder on the outside of my house. And it is snowing now...
  2. The problem only shows up on one sensor line and it may take a week before it happens...
    If I disconnect the controller and bring it down to my study, then I would need to connect different sensors to it since the ones in the attic are now "built into" the structure.
    So if it is a sensor problem then it might not even materialize in my test environment...
    This is a hard one to handle. What I can do is to get the controller down and hook in a 5V power ON/OFF switch controlled in firmware via a GPIO pin. Then I could modify the firmware to contain a function to power cycle the 5V drive to the sensors only. This could be used first to verify that it works by waiting for a sensor failure and then execute a 5V power cycle and repeat the measurement.

I think you should connect the pull up resistor to the ESP supply (3.3volt), and remove the zener.
Then you can power the sensor, if needed, from 5volt.

A zener is basically useless if the ESP is not powered up (yet).
Pin voltage limitation is NOT 3.3volt, but VCC+0.3volt.
A better protection is a schottky clamp diode between pin and VCC.
But not needed if you power the one-wire bus from VCC of the ESP.
Leo..

I see your point, and I would have done it like that were it not for the fact that the sensors already deployed have local pull-ups soldered in between pins 1 and 2...

And these sensors are really hard to get at now.
It can be done but is difficult and dangerous because of the slippery winter conditions...
They were placed on location before the roof planking was put in place. Now I only have a small hatch to reach them through.

I just found my schematics so I could see if there was a free pin and I found that GPIO5 is available. Sensor #3 is attached to GPIO13 (pin 7).

I am an MScEE in electronics

Well, you are slightly more qualified than I am then ;D
I'm glad that @Wawa has joined in. I hope between the two of you, you can get this sorted.

Pete

UPDATE
I have now breadboarded a new DHT sensor power feed circuit and tested that it works in my "lab".
It does this:

  • Switching transistor (PNP darlington) feeds a 5V standard linear regulator from +12V
  • The PNP transistor is controlled from GPIO5 via an NPN transistor (and some resistors)
  • The +5V output from the regulator is fed to the DHT sensors

This is used as follows for a read cycle:
1- Switch on feed to regulator
2- Wait 2 seconds
3- Run a standard DHT measure cycle on all sensors and store the results
4- Switch off feed to regulator
5- Send the measured data out

This repeats every hour. Sensors are non-powered most of the time.
Values seem to be consistent with what was previously measured.