Relay Box

Home Forums English support forum Relay Box

Viewing 6 posts - 16 through 21 (of 21 total)
  • Author
  • #726

    Hi again,

    today I had a couple of hours to test the simple dht library. Finally I discovered that I was doing the connections with the DHT sensor wrong (the GND wire was connected to the serial pin in the dht). :-S

    After that, I got the DHT to work and I tested the Simple DHT library, and compared it with the DHTStable library.

    It is true that the SimpleDHT library seems more “stable”. That means that if I do a lot of requests with short intervals (each 5 seconds more or less), the SimpleDHT library returns always values, and never errors.

    The DHTStable library seems not to tolerate very fast requests but it works well when requesting data each 10 seconds or greater.

    BUT, using the DHTSimple, I received a wrong value for the humidity (always values like 3,30% or 3.50%). ANd using the DHTStable, I received accurate values (the right humidity at this moment should be around 50%).

    Because of that I will remain using the DHTStable but thank you again for the suggestion.

    And, very important: I found a bug. You are right: under certain circumstances, the thermostat may poll the sensor very fast, two or three times per second! That is a bug in the old relic app, is fixed now. I will release an update in the next weeks, I think this bug should not impact you always…

    Thanks for the feedback!

    David De LaetDavid De Laet


    I changed the code to a specific ESP/DHT library.
    – Added time stamp logging to the serial port.
    – Scaled down the CPU to 160Mhz instead of 240Mhz (line 57; Change RTC_CPU_FREQ_160M to RTC_CPU_FREQ_240M etc.. )
    for lower power consumption and heat.
    – Added the error status in the logging header, and a status drop when it fails.
    – Auto detect Sensor type, or manual selection for DHT11, DHT22, AM2302, RHT03.

    Things I could improve:
    – Fahrenheit <-> Celsius conversion is built in the library and could be simplified.
    – Maybe multiple sensors on a second webserver port?
    – Code cleanup

    Some features I would like to look in for feasibility if time permits 🙂
    – Deep sleep by using one Sensor collector (for example the ESP32_RELAY)
    Send the Sensor data to the collector by low power BT or WIFI.
    – Designing a thermostat head to control separate radiators.

    And of course you can use my code 🙂
    Let me know if you can use any of the code.


    David De LaetDavid De Laet

    .ino files where not allow to upload. trying .txt


    Hi David,

    your new sketch looks very good! A lot cleaner now, and I find some details very interesting (for example, scaling down the cpu to 160Mhz to reduce heat and power consumption. Is it really so noticeable?).

    I have a couple of questions.

    – What do you mean with “Maybe multiple sensors on a second webserver port”?
    – And the same for the “deep sleep using one sensor collector”

    Design a collector head to control separate radiator would be fantastic! Unfortunately my knowledge in electronics is not so advanced. Do you think it is possible?

    I will try the new library, and I think I will use your new code, it looks a lot cleaner. You will have to say me your name to add it to the credits 😉

    Where are you from, David?


    David De LaetDavid De Laet


    For the power consumption I still need to some extra measuring.
    The heat in my enclosure was +-1.5°C higher than a sensor without enclosure on 240Mhz
    It lowered down to +-1.1 °C on 160Mhz. Unfortunately this is not an constant value as this depends on the room temp. Or I have to design a bigger case where the ESP and DHT are even more separated.

    My thoughts was to run an XML/SOAP server or any other usable protocol on the ESP/relay , which receives sensor data from multiple ESP/DHT.
    Where the ESP/DHT polls the temp, sends it to the Relay ESP, and goes back to deep sleep.(for example every minute or even longer). This should lower the power consumption to a point where it could operate on a battery. There is a easy to understand guide for how and why:

    As for a radiator head we need an “mini” linear actuator that can be controller by 0-100 value with a small controller; ESP32 or other controller. The radiator has a small metal pin when pushed the valve closes and visa versa.
    To drive a small motor we only need a NPN transistor, 1 resistor and one diode. (only on or off type)
    If we want to know the position of the motor, we need a stepper motor and this can be driven by a driver on chip, for example the L293 series.

    Example of a slightly bigger linear motor.

    I have designed some electronic boards in fritzing, but mostly for hobby purposes.

    There are also commercial versions of this system. Unfortunately closed, expensive and thus no fun!

    These where just some thoughts for a fun hobby project.
    PS: name is David De Laet from Belgium.


    Hi David,

    If I understand you correctly, your desire would be to have “nodes” with a very low consumption to operate them with batteries. But, for what? I mean, to use it as… remote thermostat for individual radiators maybe?

    To have individual controllers for the radiators is an idea that I had already in the past, but my knowledge in electronics is not enough. I developed the original app in 2013 for my personal use in Spain, where normally a little house has only one thermostat on the wall in the main room.

    Now I’m living in NRW – Germany, and I realized that there is not only one thermostat on the wall. There are many, one on each radiator. I dismantled one of them, and I thought it was too much for my knowledge. Besides that, the actually app can not control multiple relays. It should be adapted. It is not impossible, and not very difficult, but it requires work (a lot of hours of work).

    Do you think that it may be possible to buy all the components for the radiator thermostat and only have to mount it? Or do we need to print ourselves the parts?

    Greets from Leverkusen!


Viewing 6 posts - 16 through 21 (of 21 total)
  • You must be logged in to reply to this topic.