Problem with DHT11.js



  • Hi
    I'm trying to interface with a DHT11, and am running into what I am sure are basic problems, but still puzzling to me.
    I am trying to use the example found at https://github.com/neonious/lowjs_esp32_examples/blob/master/drivers/sensors/dht11.js with this little program:

    const DHT11 = require('../lib/dht11.js');
    let sensor = new DHT11(25);
    
    sensor.measure((err, temp, humidity) => {
        if(err)
            console.log(err);
        else {
            console.log('Temperature: ' + temp + '°C');
            console.log('Humidity: ' + humidity + ' %');
        }
    });
    

    I have connected the DHT11 (I have a three pin version, but I have also attempted this with a four pin version with very much the same result) as shown here:
    DHT11.png

    When I run the program, I get the following:

    Error: not connected
        at [anon] (/lib/dht11.js:108) strict preventsyield
    

    Any suggestions would be greatly appreciated.



  • I have a DHT11 ready to use here and will try it out this week!



  • Hi! It works very well here. Not sure if the version of dht11.js worked which you are using, because before I tried it out I actually rewrote it a bit today... The new version works perfectly for DHT11 and DHT22 (I think I never tried DHT22 before).

    So, the new version is here: https://github.com/neonious/lowjs_esp32_examples/blob/master/drivers/sensors/dht11_22.js

    Can you try again? If it still does not work, please add a console.log(this._n, dur); after
    let dur = stamp - this._riseStamp;
    delete this._riseStamp;
    and post the results!

    Thank you.



  • Thank you for taking the time to work on this.
    I am delighted to report that it works. 🙂



  • I spoke too soon. While I can get measurements out of the DHT, it is not very stable.
    When I try to run the following

    const DHT11_22 = require('../lib/dht11_22.js');
    const sensor = new DHT11_22(25);
    
    sensor.start((err, temp, humidity) => {
      if (err) console.log(err);
      else {
        console.log('Temperature: ' + temp + '°C');
        console.log('Humidity: ' + humidity + ' %');
      }
    }, 1000);
    
    

    I get a log like this:

    [12:53:10 PM] Error: not connected
    [12:53:10 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:53:13 PM] Error: not connected
    [12:53:13 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:53:16 PM] Error: not connected
    [12:53:16 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:53:19 PM] Error: not connected
    [12:53:19 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:53:22 PM] Error: not connected
    [12:53:22 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:53:25 PM] Error: not connected
    [12:53:25 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:53:28 PM] Error: not connected
    [12:53:29 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:53:32 PM] Error: not connected
    [12:53:32 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:53:32 PM] undefined 0.013000000035390258
    [12:53:32 PM] undefined 0.087000000057742
    [12:53:32 PM] 0 0.023999999975785613
    [12:53:32 PM] 1 0.023999999975785613
    [12:53:32 PM] 2 0.023999999975785613
    [12:53:32 PM] 3 0.023999999975785613
    [12:53:32 PM] 4 0.07099999999627471
    [12:53:32 PM] 5 0.06900000013411045
    [12:53:32 PM] 6 0.023999999975785613
    [12:53:33 PM] 7 0.07099999999627471
    [12:53:33 PM] 8 0.023999999975785613
    [12:53:33 PM] 9 0.023999999975785613
    [12:53:33 PM] 10 0.023999999975785613
    [12:53:33 PM] 11 0.023000000044703484
    [12:53:33 PM] 12 0.023999999975785613
    [12:53:33 PM] 13 0.023000000044703484
    [12:53:33 PM] 14 0.023999999975785613
    [12:53:33 PM] 15 0.024999999906867743
    [12:53:33 PM] 16 0.023999999975785613
    [12:53:33 PM] 17 0.023999999975785613
    [12:53:33 PM] 18 0.023999999975785613
    [12:53:34 PM] 19 0.07099999999627471
    [12:53:34 PM] 20 0.07000000006519258
    [12:53:34 PM] 21 0.07000000006519258
    [12:53:34 PM] 22 0.023000000044703484
    [12:53:34 PM] 23 0.07099999999627471
    [12:53:34 PM] 24 0.023999999975785613
    [12:53:34 PM] 25 0.024000000208616257
    [12:53:34 PM] 27 0.024999999906867743
    [12:53:34 PM] 28 0.025000000139698386
    [12:53:34 PM] 29 0.07099999999627471
    [12:53:34 PM] 30 0.07000000006519258
    [12:53:35 PM] 31 0.025999999837949872
    [12:53:35 PM] 32 0.023999999975785613
    [12:53:35 PM] 33 0.024999999906867743
    [12:53:35 PM] 34 0.06899999990127981
    [12:53:35 PM] 35 0.06999999983236194
    [12:53:35 PM] 36 0.023999999975785613
    [12:53:35 PM] 37 0.023999999975785613
    [12:53:35 PM] 38 0.023999999975785613
    [12:53:35 PM] 39 0.024999999906867743
    [12:53:35 PM] Temperature: 29.0234375°C
    [12:53:35 PM] Humidity: 13 %
    [12:53:35 PM] undefined 0.013000000035390258
    [12:53:36 PM] undefined 0.087000000057742
    [12:53:36 PM] 0 0.023000000044703484
    [12:53:36 PM] 1 0.023999999975785613
    [12:53:36 PM] 2 0.023999999975785613
    [12:53:36 PM] 3 0.023999999975785613
    [12:53:36 PM] 4 0.06999999983236194
    [12:53:36 PM] 5 0.06900000013411045
    [12:53:36 PM] 6 0.023999999975785613
    [12:53:36 PM] 7 0.07099999999627471
    [12:53:36 PM] 8 0.023999999975785613
    [12:53:36 PM] 9 0.023999999975785613
    [12:53:36 PM] 10 0.024000000208616257
    [12:53:37 PM] 11 0.023000000044703484
    [12:53:37 PM] 12 0.023999999975785613
    [12:53:37 PM] 13 0.02299999981187284
    [12:53:37 PM] 14 0.024000000208616257
    [12:53:37 PM] 15 0.024999999906867743
    [12:53:37 PM] 16 0.023999999975785613
    [12:53:37 PM] 17 0.023999999975785613
    [12:53:37 PM] 18 0.023999999975785613
    [12:53:37 PM] 19 0.07099999999627471
    [12:53:37 PM] 20 0.07000000006519258
    [12:53:37 PM] 21 0.07000000006519258
    [12:53:37 PM] 22 0.024000000208616257
    [12:53:38 PM] 23 0.06900000013411045
    [12:53:38 PM] 24 0.02299999981187284
    [12:53:38 PM] 25 0.023999999975785613
    [12:53:38 PM] 26 0.024000000208616257
    [12:53:38 PM] 27 0.023000000044703484
    [12:53:38 PM] 28 0.023999999975785613
    [12:53:38 PM] 29 0.07000000006519258
    [12:53:38 PM] 30 0.07000000006519258
    [12:53:38 PM] 31 0.025000000139698386
    [12:53:38 PM] 32 0.023999999975785613
    [12:53:38 PM] 33 0.023999999975785613
    [12:53:39 PM] 34 0.06999999983236194
    [12:53:39 PM] 35 0.07299999985843897
    [12:53:39 PM] 36 0.023999999975785613
    [12:53:39 PM] 37 0.023999999975785613
    [12:53:39 PM] 38 0.023000000044703484
    [12:53:39 PM] 39 0.024999999906867743
    [12:53:39 PM] Temperature: 29.0234375°C
    [12:53:39 PM] Humidity: 13 %
    [12:53:39 PM] undefined 0.013000000035390258
    [12:53:39 PM] undefined 0.087000000057742
    [12:53:39 PM] 0 0.023999999975785613
    [12:53:40 PM] 1 0.023999999975785613
    [12:53:40 PM] 2 0.024999999906867743
    [12:53:40 PM] 3 0.025999999837949872
    [12:53:40 PM] 4 0.06800000020302832
    [12:53:40 PM] 5 0.060000000055879354
    [12:53:40 PM] 6 0.07000000006519258
    [12:53:40 PM] 7 0.024999999906867743
    [12:53:40 PM] 8 0.023999999975785613
    [12:53:40 PM] 9 0.023999999975785613
    [12:53:40 PM] 10 0.023999999975785613
    [12:53:40 PM] 11 0.023999999975785613
    [12:53:41 PM] 12 0.023999999975785613
    [12:53:41 PM] 13 0.023999999975785613
    [12:53:41 PM] 14 0.023999999975785613
    [12:53:41 PM] 15 0.024999999906867743
    [12:53:41 PM] 16 0.023999999975785613
    [12:53:41 PM] 17 0.023999999975785613
    [12:53:41 PM] 18 0.024999999906867743
    [12:53:41 PM] 19 0.07000000006519258
    [12:53:41 PM] 20 0.06999999983236194
    [12:53:41 PM] 21 0.06900000013411045
    [12:53:41 PM] 22 0.023999999975785613
    [12:53:41 PM] 23 0.07099999999627471
    [12:53:42 PM] 24 0.024000000208616257
    [12:53:42 PM] 25 0.023999999975785613
    [12:53:42 PM] 26 0.023999999975785613
    [12:53:42 PM] 27 0.022000000113621354
    [12:53:42 PM] 28 0.023000000044703484
    [12:53:42 PM] 29 0.06999999983236194
    [12:53:42 PM] 30 0.06900000013411045
    [12:53:42 PM] 31 0.024999999906867743
    [12:53:42 PM] 32 0.024999999906867743
    [12:53:42 PM] 33 0.023000000044703484
    [12:53:42 PM] 34 0.06700000003911555
    [12:53:42 PM] 35 0.06899999990127981
    [12:53:43 PM] 36 0.023999999975785613
    [12:53:43 PM] 37 0.023999999975785613
    [12:53:43 PM] 38 0.024999999906867743
    [12:53:43 PM] 39 0.07099999999627471
    [12:53:43 PM] Temperature: 29.0234375°C
    [12:53:43 PM] Humidity: 14 %
    [12:53:43 PM] undefined 0.012999999802559614
    [12:53:43 PM] undefined 0.08699999982491136
    [12:53:43 PM] 0 0.024000000208616257
    [12:53:43 PM] 1 0.023000000044703484
    [12:53:43 PM] 2 0.023999999975785613
    [12:53:43 PM] 3 0.024000000208616257
    [12:53:44 PM] 4 0.07099999999627471
    [12:53:44 PM] 5 0.07000000006519258
    [12:53:44 PM] 6 0.06799999997019768
    [12:53:44 PM] 7 0.024999999906867743
    [12:53:44 PM] 8 0.024000000208616257
    [12:53:44 PM] 9 0.023999999975785613
    [12:53:44 PM] 10 0.023999999975785613
    [12:53:44 PM] 11 0.023999999975785613
    [12:53:44 PM] 12 0.023999999975785613
    [12:53:44 PM] 13 0.023999999975785613
    [12:53:44 PM] 14 0.010999999940395355
    [12:53:44 PM] 15 0.025000000139698386
    [12:53:45 PM] 16 0.023999999975785613
    [12:53:45 PM] 17 0.025000000139698386
    [12:53:45 PM] 18 0.024000000208616257
    [12:53:45 PM] 19 0.07000000006519258
    [12:53:45 PM] 20 0.07000000006519258
    [12:53:45 PM] 21 0.06999999983236194
    [12:53:45 PM] 22 0.023999999975785613
    [12:53:45 PM] 23 0.07099999999627471
    [12:53:45 PM] 24 0.023999999975785613
    [12:53:45 PM] 25 0.023999999975785613
    [12:53:45 PM] 26 0.023999999975785613
    [12:53:45 PM] 27 0.023999999975785613
    [12:53:46 PM] 28 0.023999999975785613
    [12:53:46 PM] 29 0.07700000004842877
    [12:53:46 PM] 30 0.06999999983236194
    [12:53:46 PM] 31 0.024999999906867743
    [12:53:46 PM] 32 0.024000000208616257
    [12:53:46 PM] 33 0.0400000000372529
    [12:53:46 PM] 34 0.06799999997019768
    [12:53:46 PM] 35 0.07000000006519258
    [12:53:46 PM] 36 0.022000000113621354
    [12:53:46 PM] 37 0.024999999906867743
    [12:53:46 PM] 38 0.02299999981187284
    [12:53:46 PM] 39 0.07099999999627471
    [12:53:47 PM] Error: wrong checksum
    [12:53:47 PM]     at _fall (/lib/dht11_22.js:202) strict
    [12:53:47 PM]     at [anon] (/lib/dht11_22.js:62) strict
    [12:53:47 PM]     at emit (lib:events:158) strict
    [12:53:47 PM]     at [anon] (lib:gpio:331) strict preventsyield
    [12:53:50 PM] Error: not connected
    [12:53:51 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:53:54 PM] Error: not connected
    [12:53:54 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:53:57 PM] Error: not connected
    [12:53:57 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:54:00 PM] Error: not connected
    [12:54:00 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:54:03 PM] Error: not connected
    [12:54:03 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:54:06 PM] Error: not connected
    [12:54:06 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:54:09 PM] Error: not connected
    [12:54:09 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:54:12 PM] Error: not connected
    [12:54:12 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:54:15 PM] Error: not connected
    [12:54:16 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:54:19 PM] Error: not connected
    [12:54:19 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:54:19 PM] undefined 0.013000000035390258
    [12:54:19 PM] undefined 0.08699999982491136
    [12:54:19 PM] 0 0.023999999975785613
    [12:54:19 PM] 1 0.023999999975785613
    [12:54:19 PM] 2 0.023999999975785613
    [12:54:19 PM] 3 0.023999999975785613
    [12:54:19 PM] 4 0.06999999983236194
    [12:54:19 PM] 5 0.07000000006519258
    [12:54:20 PM] 6 0.07000000006519258
    [12:54:20 PM] 7 0.024999999906867743
    [12:54:20 PM] 8 0.023999999975785613
    [12:54:20 PM] 9 0.023999999975785613
    [12:54:20 PM] 10 0.023999999975785613
    [12:54:20 PM] 11 0.023999999975785613
    [12:54:20 PM] 12 0.023999999975785613
    [12:54:20 PM] 13 0.023000000044703484
    [12:54:20 PM] 14 0.023999999975785613
    [12:54:20 PM] 15 0.023999999975785613
    [12:54:20 PM] 16 0.023999999975785613
    [12:54:20 PM] 17 0.023999999975785613
    [12:54:21 PM] 18 0.023999999975785613
    [12:54:21 PM] 19 0.07000000006519258
    [12:54:21 PM] 20 0.06999999983236194
    [12:54:21 PM] 21 0.07000000006519258
    [12:54:21 PM] 22 0.023999999975785613
    [12:54:21 PM] 23 0.07099999999627471
    [12:54:21 PM] 24 0.023999999975785613
    [12:54:21 PM] 25 0.023999999975785613
    [12:54:21 PM] 26 0.024999999906867743
    [12:54:21 PM] 27 0.023999999975785613
    [12:54:21 PM] 28 0.03700000001117587
    [12:54:21 PM] 29 0.07000000006519258
    [12:54:22 PM] 30 0.07500000018626451
    [12:54:22 PM] 31 0.024999999906867743
    [12:54:22 PM] 32 0.023999999975785613
    [12:54:22 PM] 33 0.023999999975785613
    [12:54:22 PM] 34 0.07000000006519258
    [12:54:22 PM] 35 0.06999999983236194
    [12:54:22 PM] 36 0.023999999975785613
    [12:54:22 PM] 37 0.023000000044703484
    [12:54:22 PM] 38 0.023999999975785613
    [12:54:22 PM] 39 0.07000000006519258
    [12:54:22 PM] Temperature: 29.0234375°C
    [12:54:22 PM] Humidity: 14 %
    [12:54:25 PM] Error: not connected
    [12:54:25 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:54:29 PM] Error: not connected
    [12:54:29 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:54:32 PM] Error: not connected
    [12:54:32 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:54:35 PM] Error: not connected
    [12:54:35 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:54:38 PM] Error: not connected
    [12:54:38 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:54:41 PM] Error: not connected
    [12:54:41 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:54:44 PM] Error: not connected
    [12:54:44 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:54:47 PM] Error: not connected
    [12:54:47 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:54:50 PM] Error: not connected
    [12:54:50 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:54:53 PM] Error: not connected
    [12:54:53 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:54:53 PM] undefined 0.014000000199303031
    [12:54:54 PM] undefined 0.087000000057742
    [12:54:54 PM] 0 0.02299999981187284
    [12:54:54 PM] 1 0.023999999975785613
    [12:54:54 PM] 2 0.024000000208616257
    [12:54:54 PM] 3 0.023999999975785613
    [12:54:54 PM] 4 0.07000000006519258
    [12:54:54 PM] 5 0.07099999999627471
    [12:54:54 PM] 6 0.07000000006519258
    [12:54:54 PM] 7 0.025000000139698386
    [12:54:54 PM] 8 0.023999999975785613
    [12:54:54 PM] 9 0.023999999975785613
    [12:54:54 PM] 10 0.024000000208616257
    [12:54:55 PM] 11 0.024000000208616257
    [12:54:55 PM] 14 0.024000000208616257
    [12:54:55 PM] 15 0.025000000139698386
    [12:54:55 PM] 16 0.023999999975785613
    [12:54:55 PM] 17 0.025000000139698386
    [12:54:55 PM] 18 0.023999999975785613
    [12:54:55 PM] 19 0.07099999999627471
    [12:54:55 PM] 20 0.06900000013411045
    [12:54:55 PM] 21 0.07000000006519258
    [12:54:56 PM] 22 0.024000000208616257
    [12:54:56 PM] 23 0.06999999983236194
    [12:54:56 PM] 24 0.023999999975785613
    [12:54:56 PM] 25 0.023999999975785613
    [12:54:56 PM] 26 0.023999999975785613
    [12:54:56 PM] 27 0.023999999975785613
    [12:54:56 PM] 28 0.023999999975785613
    [12:54:56 PM] 29 0.07000000006519258
    [12:54:56 PM] 30 0.06999999983236194
    [12:54:56 PM] 31 0.07099999999627471
    [12:54:56 PM] 32 0.025000000139698386
    [12:54:56 PM] 33 0.023999999975785613
    [12:54:57 PM] 34 0.07000000006519258
    [12:54:57 PM] 35 0.05799999996088445
    [12:54:57 PM] 36 0.023000000044703484
    [12:54:57 PM] 37 0.023999999975785613
    [12:54:57 PM] 38 0.07099999999627471
    [12:54:57 PM] 39 0.024999999906867743
    [12:54:57 PM] Temperature: 29.02734375°C
    [12:54:57 PM] Humidity: 14 %
    [12:54:57 PM] undefined 0.013999999966472387
    [12:54:57 PM] undefined 0.087000000057742
    [12:54:57 PM] 0 0.023000000044703484
    [12:54:57 PM] 1 0.023999999975785613
    [12:54:58 PM] 2 0.023999999975785613
    [12:54:58 PM] 3 0.028999999864026904
    [12:54:58 PM] 4 0.06999999983236194
    [12:54:58 PM] 5 0.06299999984912574
    [12:54:58 PM] 6 0.023999999975785613
    [12:54:58 PM] 7 0.07099999999627471
    [12:54:58 PM] 8 0.023999999975785613
    [12:54:58 PM] 9 0.023999999975785613
    [12:54:58 PM] 10 0.023999999975785613
    [12:54:58 PM] 11 0.024999999906867743
    [12:54:58 PM] 12 0.023999999975785613
    [12:54:58 PM] 13 0.023000000044703484
    [12:54:59 PM] 14 0.023999999975785613
    [12:54:59 PM] 15 0.024999999906867743
    [12:54:59 PM] 16 0.024999999906867743
    [12:54:59 PM] 17 0.023999999975785613
    [12:54:59 PM] 18 0.023999999975785613
    [12:54:59 PM] 19 0.06999999983236194
    [12:54:59 PM] 20 0.07000000006519258
    [12:54:59 PM] 21 0.07000000006519258
    [12:54:59 PM] 22 0.023999999975785613
    [12:54:59 PM] 23 0.07099999999627471
    [12:54:59 PM] 24 0.03700000001117587
    [12:55:00 PM] 25 0.019000000087544322
    [12:55:00 PM] 26 0.024000000208616257
    [12:55:00 PM] 27 0.02299999981187284
    [12:55:00 PM] 28 0.023999999975785613
    [12:55:00 PM] 29 0.07099999999627471
    [12:55:00 PM] 30 0.07000000006519258
    [12:55:00 PM] 31 0.07099999999627471
    [12:55:00 PM] 32 0.023999999975785613
    [12:55:00 PM] 33 0.023999999975785613
    [12:55:00 PM] 34 0.06899999990127981
    [12:55:00 PM] 35 0.07000000006519258
    [12:55:00 PM] 36 0.023999999975785613
    [12:55:01 PM] 37 0.023999999975785613
    [12:55:01 PM] 38 0.024000000208616257
    [12:55:01 PM] 39 0.07099999999627471
    [12:55:01 PM] Temperature: 29.02734375°C
    [12:55:01 PM] Humidity: 13 %
    [12:55:04 PM] Error: not connected
    [12:55:04 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:55:07 PM] Error: not connected
    [12:55:07 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:55:10 PM] Error: not connected
    [12:55:10 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:55:13 PM] Error: not connected
    [12:55:13 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:55:16 PM] Error: not connected
    [12:55:16 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:55:19 PM] Error: not connected
    [12:55:20 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:55:23 PM] Error: not connected
    [12:55:23 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:55:26 PM] Error: not connected
    [12:55:26 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:55:29 PM] Error: not connected
    [12:55:29 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:55:32 PM] Error: not connected
    [12:55:33 PM]     at [anon] (/lib/dht11_22.js:106) strict preventsyield
    [12:55:33 PM] undefined 0.01699999999254942
    [12:55:33 PM] undefined 0.087000000057742
    [12:55:33 PM] 0 0.023999999975785613
    [12:55:33 PM] 1 0.023999999975785613
    [12:55:33 PM] 2 0.024999999906867743
    [12:55:33 PM] 3 0.025999999837949872
    [12:55:33 PM] 4 0.06999999983236194
    [12:55:33 PM] 5 0.07199999992735684
    [12:55:33 PM] 6 0.024999999906867743
    [12:55:33 PM] 7 0.07099999999627471
    [12:55:34 PM] 8 0.023999999975785613
    [12:55:34 PM] 9 0.024999999906867743
    [12:55:34 PM] 10 0.024999999906867743
    [12:55:34 PM] 11 0.023999999975785613
    [12:55:34 PM] 12 0.024999999906867743
    [12:55:34 PM] 13 0.023999999975785613
    [12:55:34 PM] 14 0.023999999975785613
    [12:55:34 PM] 15 0.024999999906867743
    [12:55:34 PM] 16 0.023999999975785613
    [12:55:34 PM] 17 0.023999999975785613
    [12:55:34 PM] 18 0.023999999975785613
    [12:55:34 PM] 19 0.06999999983236194
    [12:55:35 PM] 20 0.07000000006519258
    [12:55:35 PM] 21 0.07000000006519258
    [12:55:35 PM] 22 0.023999999975785613
    [12:55:35 PM] 23 0.07099999999627471
    [12:55:35 PM] 24 0.02299999981187284
    [12:55:35 PM] 25 0.024000000208616257
    [12:55:35 PM] 26 0.023999999975785613
    [12:55:35 PM] 27 0.025000000139698386
    [12:55:35 PM] 28 0.024000000208616257
    [12:55:35 PM] 29 0.07099999999627471
    [12:55:35 PM] 30 0.07000000006519258
    [12:55:35 PM] 31 0.07499999995343387
    [12:55:36 PM] 32 0.023999999975785613
    [12:55:36 PM] 33 0.023999999975785613
    [12:55:36 PM] 34 0.07000000006519258
    [12:55:36 PM] 35 0.07000000006519258
    [12:55:36 PM] 36 0.023999999975785613
    [12:55:36 PM] 37 0.023999999975785613
    [12:55:36 PM] 38 0.024000000208616257
    [12:55:36 PM] 39 0.07099999999627471
    [12:55:36 PM] Temperature: 29.02734375°C
    [12:55:36 PM] Humidity: 13 %
    [12:55:36 PM] undefined 0.01500000013038516
    [12:55:37 PM] undefined 0.087000000057742
    [12:55:37 PM] 0 0.023999999975785613
    [12:55:37 PM] 1 0.024999999906867743
    [12:55:37 PM] 2 0.023000000044703484
    [12:55:37 PM] 3 0.023999999975785613
    [12:55:37 PM] 4 0.07000000006519258
    [12:55:37 PM] 5 0.06899999990127981
    [12:55:37 PM] 6 0.023000000044703484
    [12:55:37 PM] 7 0.06999999983236194
    [12:55:37 PM] 8 0.023999999975785613
    [12:55:37 PM] 9 0.023999999975785613
    [12:55:37 PM] 10 0.024000000208616257
    [12:55:38 PM] 11 0.023999999975785613
    [12:55:38 PM] 12 0.023999999975785613
    [12:55:38 PM] 13 0.023000000044703484
    [12:55:38 PM] 14 0.023999999975785613
    [12:55:38 PM] 15 0.025000000139698386
    [12:55:38 PM] 16 0.023999999975785613
    [12:55:38 PM] 17 0.022000000113621354
    [12:55:38 PM] 18 0.023999999975785613
    [12:55:38 PM] 19 0.07099999999627471
    [12:55:38 PM] 20 0.07000000006519258
    [12:55:38 PM] 21 0.06999999983236194
    [12:55:38 PM] 22 0.023000000044703484
    [12:55:39 PM] 23 0.07099999999627471
    [12:55:39 PM] 24 0.023999999975785613
    [12:55:39 PM] 25 0.023999999975785613
    [12:55:39 PM] 26 0.023000000044703484
    [12:55:39 PM] 27 0.023999999975785613
    [12:55:39 PM] 28 0.023999999975785613
    [12:55:39 PM] 29 0.07000000006519258
    [12:55:39 PM] 30 0.07000000006519258
    [12:55:39 PM] 31 0.07099999999627471
    [12:55:39 PM] 32 0.023999999975785613
    [12:55:39 PM] 33 0.023999999975785613
    [12:55:39 PM] 34 0.07000000006519258
    [12:55:40 PM] 35 0.05699999979697168
    [12:55:40 PM] 36 0.023999999975785613
    [12:55:40 PM] 37 0.023999999975785613
    [12:55:40 PM] 38 0.023999999975785613
    [12:55:40 PM] 39 0.07099999999627471
    [12:55:40 PM] Temperature: 29.02734375°C
    [12:55:40 PM] Humidity: 13 %
    [12:55:40 PM] undefined 0.013999999966472387
    [12:55:40 PM] undefined 0.087000000057742
    [12:55:40 PM] 0 0.023999999975785613
    [12:55:40 PM] 1 0.023999999975785613
    [12:55:40 PM] 2 0.023000000044703484
    [12:55:41 PM] 3 0.022000000113621354
    [12:55:41 PM] 4 0.06999999983236194
    [12:55:41 PM] 5 0.07099999999627471
    [12:55:41 PM] 6 0.07000000006519258
    [12:55:41 PM] 7 0.024999999906867743
    [12:55:41 PM] 8 0.023999999975785613
    [12:55:41 PM] 9 0.023999999975785613
    [12:55:41 PM] 10 0.023999999975785613
    [12:55:41 PM] 11 0.023999999975785613
    [12:55:41 PM] 12 0.024000000208616257
    [12:55:41 PM] 13 0.023999999975785613
    [12:55:41 PM] 14 0.023999999975785613
    [12:55:42 PM] 15 0.025000000139698386
    [12:55:42 PM] 16 0.023999999975785613
    [12:55:42 PM] 17 0.023999999975785613
    [12:55:42 PM] 18 0.023999999975785613
    [12:55:42 PM] 18 0.023999999975785613
    [12:55:42 PM] 19 0.06999999983236194
    [12:55:42 PM] 20 0.06900000013411045
    [12:55:42 PM] 21 0.07000000006519258
    [12:55:42 PM] 22 0.023999999975785613
    [12:55:42 PM] 23 0.06999999983236194
    [12:55:42 PM] 24 0.023999999975785613
    [12:55:42 PM] 25 0.023999999975785613
    [12:55:43 PM] 26 0.023999999975785613
    [12:55:43 PM] 27 0.023999999975785613
    [12:55:43 PM] 28 0.023999999975785613
    [12:55:43 PM] 29 0.07000000006519258
    [12:55:43 PM] 30 0.06899999990127981
    [12:55:43 PM] 31 0.07099999999627471
    [12:55:43 PM] 32 0.023999999975785613
    [12:55:43 PM] 33 0.023999999975785613
    [12:55:43 PM] 34 0.06400000001303852
    [12:55:43 PM] 35 0.06600000010803342
    [12:55:43 PM] 36 0.023999999975785613
    [12:55:43 PM] 37 0.024000000208616257
    [12:55:44 PM] 38 0.06900000013411045
    [12:55:44 PM] 39 0.024999999906867743
    [12:55:44 PM] Temperature: 29.02734375°C
    [12:55:44 PM] Humidity: 14 %
    [12:55:44 PM] undefined 0.013000000035390258
    [12:55:44 PM] undefined 0.087000000057742
    [12:55:44 PM] 0 0.023999999975785613
    [12:55:44 PM] 1 0.023999999975785613
    [12:55:44 PM] 2 0.023999999975785613
    [12:55:44 PM] 3 0.023999999975785613
    [12:55:44 PM] 4 0.07000000006519258
    [12:55:44 PM] 5 0.07099999999627471
    [12:55:45 PM] 6 0.07000000006519258
    [12:55:45 PM] 7 0.023999999975785613
    [12:55:45 PM] 8 0.023999999975785613
    [12:55:45 PM] 9 0.023999999975785613
    [12:55:45 PM] 10 0.023000000044703484
    

    If I change the interval to 10000, it works better, but it still exhibits the behaviour listed above.



  • It works well here. The not very often happening checksum problem I do see as something which could be coming from the microcontroller. Maybe exactly during a pulse an interrupt broke the measurement. But the not connected problems are weird, there is no pulse at all.

    Not connected for long periods at a time sounds like a connection issue to me. Not sure why the microcontroller should not work for a few secs... A flacky cable connection could be it however. How have you connected the items? With a breadboard?

    Alternativly it could be that the pulse to start the DHT11 is too long. I do not know if there is a maximum length for the pulse. Hopefully not, then it does not matter if JavaScript adds additional delay.

    I believe more in the first reason. Can you check everything? Maybe rebuild the circuit on another board with other cables? If that does not work, I will have to try on a neonious one (tried on a different board, but that should not change anything).

    Thanks



  • Right,
    it is connected to a breadboard, and twiddling the components a bit do help, so it is probably a poor connection.

    Thank you for your help.


Log in to reply