💬 Air Humidity Sensor - DHT


  • Mod

    I don't know about DHT22, but NRF24 can work down to 1.8 or 1.9V so you can connect it directly to battery (take a look ad EasyPCB)


  • Hero Member

    @Digdogger it's better to get rid of the DHT and use something more reliable and operating at lower voltages. Like si7021, sht21 or Bme280



  • Thanx for your answers. @AWI, the BME280 looks great and not expansive i will replace the DHT by this one. Thank you.



  • @Digdogger
    Out of curiosity, do you expect there to be a big savings in power consumption by removing the regulator and power LED? I've never used the Mini Pro (the smallest I get to is the Nano) but I understand it already is very efficient with power usage.



  • @jwosnick: please take a look here: http://www.home-automation-community.com/arduino-low-power-how-to-run-atmega328p-for-a-year-on-coin-cell-battery/.
    You'll see that the current saving is significant (almost 40% saving)


  • Mod

    @jwosnick
    Arduino is efficient for a live node, but for a battery powered sleeping node voltage regulators have a small drain on battery; led also consumes some power. The Nano has also the usb chip that is powered but not used that also increases battery drain. So, as rule of thumb, everything that is not really used/necessary will drain some battery over time.


  • Mod

    @jwosnick with the led and regulator, battery life on 2xAA is about three weeks. Removing them will usually give you 2-5 years.



  • @mfalkvidd

    Thank you. I didn't realize the differences were so stark.

    I have some Pro Mini 3.3V units on order and hope to convert my sensors to that platform, when they arrive.



  • hello I ran it but i didnt see anthing except the garbage in com monitor


  • Hardware Contributor

    @hashem25 said in 💬 Air Humidity Sensor:

    hello I ran it but i didnt see anthing except the garbage in com monitor

    Hello, you need to change the baud rate at the bottom right of the Arduino serial monitor window until you see clear text.



  • thanks it works



  • How do i get 2 dht22's working in the code?


  • Mod

    If you already have one, it is a matter of just repeating your code for the first sensor and just change the pin number where you connected the second one



  • This example doesn't seem to be included in the latest library version - am I being blind or is this deliberate?


  • Mod

    @ianatkin that is correct. Follow the instructions under the "Example" headline on the build page.



  • @mfalkvidd Thanks 🙂


  • Mod

    @ianatkin you're welcome. Great to see a new forum member 🙂



  • Is it the same code that i will burn to the controller circuit. Can someone help me with a little explanation on the code for the controller circuit so as to be receiving the temperature values



  • Hi ! Thank's for working 🙂
    I add the libraries in "MySensors external examples" to Arduino IDE but when I want to compile I have this one log error :

    DhtTemperatureAndHumiditySensor.ino:43:25: fatal error: MySensors.h: No such file or directory
    compilation terminated.

    In MySensors folder's libraries, I have a MySensor.h, without 's' . This is one? Do I forget something?

    Thanks


  • Mod

    @MrVince sounds like MySensors 1.x is installed. Remove the MySensors folder and install the latest version. Instructions: https://www.mysensors.org/about/arduino#installing-the-sensor-libraries



  • Please can someone help me on how I can be able to access the temperature and humidity data sent by the sensor on the gateway. I am recently working on sending temperature and humidity data to a controller. I used the above .ino code( /mysensors/MySensorsArduinoExamples/examples/DhtTemperatureAndHumiditySensor/DhtTemperatureAndHumiditySensor.ino) as it is and ensured my data pin is pin3 and for my gateway am using this(/mysensors/MySensors/examples/GatewayW5100/GatewayW5100.ino). I did not make any changes on both codes as i am new and do not have knowledge of what to do. I was receiving the following on the sensor serial monitor
    0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
    3 TSM:INIT
    4 TSF:WUR:MS=0
    11 TSM:INIT:TSP OK
    13 TSM:FPAR
    15 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2022 !TSM:FPAR:NO REPLY
    2024 TSM:FPAR
    2026 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    4034 !TSM:FPAR:NO REPLY
    4036 TSM:FPAR
    5636 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    7644 !TSM:FPAR:NO REPLY
    7646 TSM:FPAR
    7648 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    9656 !TSM:FPAR:FAIL
    9657 TSM:FAIL:CNT=1
    9659 TSM:FAIL:PDT
    19662 TSM:FAIL:RE-INIT
    19664 TSM:INIT
    19672 TSM:INIT:TSP OK
    19674 TSM:FPAR
    19676 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    21684 !TSM:FPAR:NO REPLY
    21686 TSM:FPAR
    21688 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    23696 !TSM:FPAR:NO REPLY
    23698 TSM:FPAR
    23700 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    25708 !TSM:FPAR:NO REPLY
    25710 TSM:FPAR
    27310 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    29318 !TSM:FPAR:FAIL
    29319 TSM:FAIL:CNT=2
    29321 TSM:FAIL:PDT
    39324 TSM:FAIL:RE-INIT
    39326 TSM:INIT
    39333 TSM:INIT:TSP OK
    39335 TSM:FPAR
    39337 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    41346 !TSM:FPAR:NO REPLY
    41348 TSM:FPAR
    41357 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    43365 !TSM:FPAR:NO REPLY
    43367 TSM:FPAR
    43397 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    45405 !TSM:FPAR:NO REPLY
    45407 TSM:FPAR
    45409 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    47417 !TSM:FPAR:FAIL
    47418 TSM:FAIL:CNT=3
    47420 TSM:FAIL:PDT
    57423 TSM:FAIL:RE-INIT
    57425 TSM:INIT
    57433 TSM:INIT:TSP OK
    57435 TSM:FPAR
    57437 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    59445 !TSM:FPAR:NO REPLY
    59447 TSM:FPAR
    59456 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    61464 !TSM:FPAR:NO REPLY
    61466 TSM:FPAR
    61475 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    63484 !TSM:FPAR:NO REPLY
    63486 TSM:FPAR
    63489 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    65497 !TSM:FPAR:FAIL
    65498 TSM:FAIL:CNT=4
    65500 TSM:FAIL:PDT
    75503 TSM:FAIL:RE-INIT
    75505 TSM:INIT
    75512 TSM:INIT:TSP OK
    75514 TSM:FPAR
    75516 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    77526 !TSM:FPAR:NO REPLY
    77528 TSM:FPAR
    77537 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    79545 !TSM:FPAR:NO REPLY
    79547 TSM:FPAR
    79556 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    81564 !TSM:FPAR:NO REPLY
    81566 TSM:FPAR
    81568 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    83576 !TSM:FPAR:FAIL
    83577 TSM:FAIL:CNT=5
    83579 TSM:FAIL:PDT
    93582 TSM:FAIL:RE-INIT
    93584 TSM:INIT
    93591 TSM:INIT:TSP OK
    93593 TSM:FPAR
    93595 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    95603 !TSM:FPAR:NO REPLY
    95605 TSM:FPAR
    95618 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    97625 !TSM:FPAR:NO REPLY
    97627 TSM:FPAR
    97637 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    99645 !TSM:FPAR:NO REPLY
    99647 TSM:FPAR
    99649 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    101657 !TSM:FPAR:FAIL
    101659 TSM:FAIL:CNT=6
    101661 TSM:FAIL:PDT
    111664 TSM:FAIL:RE-INIT
    111666 TSM:INIT
    111673 TSM:INIT:TSP OK
    111675 TSM:FPAR
    111678 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    113685 !TSM:FPAR:NO REPLY
    113687 TSM:FPAR
    113700 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    115709 !TSM:FPAR:NO REPLY
    115712 TSM:FPAR
    115720 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    117728 !TSM:FPAR:NO REPLY
    117730 TSM:FPAR
    and on the gateway monitor i received this:

    0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.1
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSF:WUR:MS=0
    0;255;3;0;9;!TSM:INIT:TSP FAIL
    0;255;3;0;9;TSM:FAIL:CNT=1
    0;255;3;0;9;TSM:FAIL:PDT
    0;255;3;0;9;TSM:FAIL:RE-INIT
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;!TSM:INIT:TSP FAIL
    0;255;3;0;9;TSM:FAIL:CNT=2
    0;255;3;0;9;TSM:FAIL:PDT
    0;255;3;0;9;TSM:FAIL:RE-INIT
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;!TSM:INIT:TSP FAIL
    0;255;3;0;9;TSM:FAIL:CNT=3
    0;255;3;0;9;TSM:FAIL:PDT
    0;255;3;0;9;TSM:FAIL:RE-INIT
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;!TSM:INIT:TSP FAIL
    0;255;3;0;9;TSM:FAIL:CNT=4
    0;255;3;0;9;TSM:FAIL:PDT
    0;255;3;0;9;TSM:FAIL:RE-INIT
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;!TSM:INIT:TSP FAIL
    0;255;3;0;9;TSM:FAIL:CNT=5
    0;255;3;0;9;TSM:FAIL:PDT
    0;255;3;0;9;TSM:FAIL:RE-INIT
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;!TSM:INIT:TSP FAIL
    0;255;3;0;9;TSM:FAIL:CNT=6
    0;255;3;0;9;TSM:FAIL:PDT
    0;255;3;0;9;TSM:FAIL:RE-INIT
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;!TSM:INIT:TSP FAIL
    0;255;3;0;9;TSM:FAIL:CNT=7
    0;255;3;0;9;TSM:FAIL:PDT
    0;255;3;0;9;TSM:FAIL:RE-INIT
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;!TSM:INIT:TSP FAIL
    0;255;3;0;9;TSM:FAIL:CNT=7
    0;255;3;0;9;TSM:FAIL:PDT
    0;255;3;0;9;TSM:FAIL:RE-INIT
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;!TSM:INIT:TSP FAIL
    0;255;3;0;9;TSM:FAIL:CNT=7
    0;255;3;0;9;TSM:FAIL:PDT

    Please can someone tell me what to do and how I can access the sent temperature and humidity value at the gateway. If there is further code to add to the one I have referenced, please do let me know.
    Thanks


  • Hardware Contributor

    TSM:INIT:TSP FAIL

    @godwinguru - your radio on the gw isnt initialised.
    Check wiring and power.



  • Thank you @sundberg84
    I just handled it and this is what i saw at the gateway

    0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.1
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSF:WUR:MS=0
    0;255;3;0;9;TSM:INIT:TSP OK
    0;255;3;0;9;TSM:INIT:GW MODE
    0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
    0;255;3;0;9;MCO:REG:NOT NEEDED
    IP: 192.168.178.66
    0;255;3;0;9;MCO:BGN:STP
    0;255;3;0;9;MCO:BGN:INIT OK,TSP=1
    0;255;3;0;9;TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSF:MSG:BC
    0;255;3;0;9;TSF:MSG:FPAR REQ,ID=255
    0;255;3;0;9;TSF:PNG:SEND,TO=0
    0;255;3;0;9;TSF:CKU:OK
    0;255;3;0;9;TSF:MSG:GWL OK
    0;255;3;0;9;TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    0;255;3;0;9;TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSF:MSG:BC
    0;255;3;0;9;TSF:MSG:FPAR REQ,ID=255
    0;255;3;0;9;TSF:CKU:OK,FCTRL
    0;255;3;0;9;TSF:MSG:GWL OK
    0;255;3;0;9;TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    0;255;3;0;9;TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
    0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.1
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSF:WUR:MS=0
    0;255;3;0;9;TSM:INIT:TSP OK
    0;255;3;0;9;TSM:INIT:GW MODE
    0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
    0;255;3;0;9;MCO:REG:NOT NEEDED
    IP: 192.168.178.66
    0;255;3;0;9;MCO:BGN:STP
    0;255;3;0;9;MCO:BGN:INIT OK,TSP=1
    0;255;3;0;9;TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
    0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.1
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSF:WUR:MS=0
    0;255;3;0;9;TSM:INIT:TSP OK
    0;255;3;0;9;TSM:INIT:GW MODE
    0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
    0;255;3;0;9;MCO:REG:NOT NEEDED
    IP: 192.168.178.66
    0;255;3;0;9;MCO:BGN:STP
    0;255;3;0;9;MCO:BGN:INIT OK,TSP=1
    0;255;3;0;9;TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSF:MSG:BC
    0;255;3;0;9;TSF:MSG:FPAR REQ,ID=255
    0;255;3;0;9;TSF:PNG:SEND,TO=0
    0;255;3;0;9;TSF:CKU:OK
    0;255;3;0;9;TSF:MSG:GWL OK
    0;255;3;0;9;TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    0;255;3;0;9;TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSF:MSG:BC
    0;255;3;0;9;TSF:MSG:FPAR REQ,ID=255
    0;255;3;0;9;TSF:CKU:OK,FCTRL
    0;255;3;0;9;TSF:MSG:GWL OK
    0;255;3;0;9;TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    0;255;3;0;9;TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
    0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.1
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSF:WUR:MS=0
    0;255;3;0;9;TSM:INIT:TSP OK
    0;255;3;0;9;TSM:INIT:GW MODE
    0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
    0;255;3;0;9;MCO:REG:NOT NEEDED
    IP: 192.168.178.66
    0;255;3;0;9;MCO:BGN:STP
    0;255;3;0;9;MCO:BGN:INIT OK,TSP=1
    0;255;3;0;9;TSF:MSG:READ,255-255-0,s=255,c=3,t=3,pt=0,l=0,sg=0:
    0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.1
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSF:WUR:MS=0
    0;255;3;0;9;TSM:INIT:TSP OK
    0;255;3;0;9;TSM:INIT:GW MODE
    0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
    0;255;3;0;9;MCO:REG:NOT NEEDED
    IP: 192.168.178.66
    0;255;3;0;9;MCO:BGN:STP
    0;255;3;0;9;MCO:BGN:INIT OK,TSP=1
    0;255;3;0;9;TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSF:MSG:BC
    0;255;3;0;9;TSF:MSG:FPAR REQ,ID=255
    0;255;3;0;9;TSF:CKU:OK,FCTRL
    0;255;3;0;9;TSF:MSG:GWL OK
    0;255;3;0;9;TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    0;255;3;0;9;TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSF:MSG:BC
    0;255;3;0;9;TSF:MSG:FPAR REQ,ID=255
    0;255;3;0;9;TSF:CKU:OK,FCTRL
    0;255;3;0;9;TSF:MSG:GWL OK
    0;255;3;0;9;TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    
    while on the sensor i saw this:
    0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
    3 TSM:INIT
    4 TSF:WUR:MS=0
    11 TSM:INIT:TSP OK
    13 TSM:FPAR
    15 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2022 !TSM:FPAR:NO REPLY
    2024 TSM:FPAR
    2026 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    4034 !TSM:FPAR:NO REPLY
    4036 TSM:FPAR
    4038 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    5029 TSF:MSG:READ,0-0-255,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    5035 TSF:MSG:FPAR OK,ID=0,D=1
    6046 TSM:FPAR:OK
    6047 TSM:ID
    6048 TSM:ID:REQ
    6081 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    8089 TSM:ID
    8090 TSM:ID:REQ
    9690 !TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=NACK:
    11698 TSM:ID
    11699 TSM:ID:REQ
    11702 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=1,st=OK:
    13709 TSM:ID
    13710 TSM:ID:REQ
    13713 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    15720 !TSM:ID:FAIL
    15721 TSM:FAIL:CNT=1
    15723 TSM:FAIL:PDT
    25726 TSM:FAIL:RE-INIT
    25729 TSM:INIT
    25736 TSM:INIT:TSP OK
    25738 TSM:FPAR
    25740 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    27748 !TSM:FPAR:NO REPLY
    27750 TSM:FPAR
    27760 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    29768 !TSM:FPAR:NO REPLY
    29770 TSM:FPAR
    29779 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    30552 TSF:MSG:READ,0-0-255,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    30557 TSF:MSG:FPAR OK,ID=0,D=1
    31788 TSM:FPAR:OK
    31789 TSM:ID
    31790 TSM:ID:REQ
    31793 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    33801 TSM:ID
    33802 TSM:ID:REQ
    35401 !TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=NACK:
    37409 TSM:ID
    37410 TSM:ID:REQ
    37413 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=1,st=OK:
    39421 TSM:ID
    39422 TSM:ID:REQ
    41022 !TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=NACK:
    43030 !TSM:ID:FAIL
    43031 TSM:FAIL:CNT=2
    43033 TSM:FAIL:PDT
    53036 TSM:FAIL:RE-INIT
    53038 TSM:INIT
    53045 TSM:INIT:TSP OK
    53047 TSM:FPAR
    53049 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=1,st=OK:
    55057 !TSM:FPAR:NO REPLY
    55059 TSM:FPAR
    55061 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    57069 !TSM:FPAR:NO REPLY
    57071 TSM:FPAR
    57073 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    58068 TSF:MSG:READ,0-0-255,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    58074 TSF:MSG:FPAR OK,ID=0,D=1
    59081 TSM:FPAR:OK
    59082 TSM:ID
    59084 TSM:ID:REQ
    60684 !TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=NACK:
    62692 TSM:ID
    62693 TSM:ID:REQ
    64292 !TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=1,st=NACK:
    66301 TSM:ID
    66302 TSM:ID:REQ
    66306 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=2,st=OK:
    68313 TSM:ID
    68314 TSM:ID:REQ
    69913 !TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=NACK:
    71921 !TSM:ID:FAIL
    71922 TSM:FAIL:CNT=3
    71924 TSM:FAIL:PDT
    81927 TSM:FAIL:RE-INIT
    81929 TSM:INIT
    81936 TSM:INIT:TSP OK
    81938 TSM:FPAR
    81940 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=1,st=OK:
    83948 !TSM:FPAR:NO REPLY
    83950 TSM:FPAR
    83952 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    84979 TSF:MSG:READ,0-0-255,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    84984 TSF:MSG:FPAR OK,ID=0,D=1
    85960 TSM:FPAR:OK
    85961 TSM:ID
    85963 TSM:ID:REQ
    85965 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    87973 TSM:ID
    87974 TSM:ID:REQ
    89574 !TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=NACK:
    91582 TSM:ID
    91583 TSM:ID:REQ
    91586 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=1,st=OK:
    93593 TSM:ID
    93594 TSM:ID:REQ
    95194 !TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=NACK:
    97202 !TSM:ID:FAIL
    97203 TSM:FAIL:CNT=4
    97205 TSM:FAIL:PDT
    107208 TSM:FAIL:RE-INIT
    107210 TSM:INIT
    107217 TSM:INIT:TSP OK
    107219 TSM:FPAR
    107223 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=1,st=OK:
    109230 !TSM:FPAR:NO REPLY
    109232 TSM:FPAR
    109235 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    111242 !TSM:FPAR:NO REPLY
    111244 TSM:FPAR
    112843 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    114851 !TSM:FPAR:NO REPLY
    114853 TSM:FPAR
    116453 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    118461 !TSM:FPAR:FAIL
    118463 TSM:FAIL:CNT=5
    118465 TSM:FAIL:PDT
    128468 TSM:FAIL:RE-INIT
    128471 TSM:INIT
    128478 TSM:INIT:TSP OK
    128480 TSM:FPAR
    128483 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    129348 TSF:MSG:READ,0-0-255,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    129353 TSF:MSG:FPAR OK,ID=0,D=1
    130109 TSF:MSG:READ,0-0-255,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    130490 TSM:FPAR:OK
    130491 TSM:ID
    130493 TSM:ID:REQ
    130496 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    132503 TSM:ID
    132504 TSM:ID:REQ
    134105 !TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=NACK:
    136112 TSM:ID
    136113 TSM:ID:REQ
    136116 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=1,st=OK:
    138123 TSM:ID
    138124 TSM:ID:REQ
    138127 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    140134 !TSM:ID:FAIL
    140135 TSM:FAIL:CNT=6
    140138 TSM:FAIL:PDT
    150140 TSM:FAIL:RE-INIT
    150142 TSM:INIT
    150150 TSM:INIT:TSP OK
    150152 TSM:FPAR
    150155 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    152162 !TSM:FPAR:NO REPLY
    152164 TSM:FPAR
    152167 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    154174 !TSM:FPAR:NO REPLY
    154176 TSM:FPAR
    154179 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    154945 TSF:MSG:READ,0-0-255,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    154950 TSF:MSG:FPAR OK,ID=0,D=1
    156186 TSM:FPAR:OK
    156187 TSM:ID
    156189 TSM:ID:REQ
    157789 !TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=NACK:
    159797 TSM:ID
    159798 TSM:ID:REQ
    161398 !TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=1,st=NACK:
    163405 TSM:ID
    163406 TSM:ID:REQ
    163409 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=2,st=OK:
    165417 TSM:ID
    165419 TSM:ID:REQ
    167019 !TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=NACK:
    169026 !TSM:ID:FAIL
    169027 TSM:FAIL:CNT=7
    169030 TSM:FAIL:PDT
    229032 TSM:FAIL:RE-INIT
    229035 TSM:INIT
    229042 TSM:INIT:TSP OK
    229044 TSM:FPAR
    229047 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=1,st=OK:
    231054 !TSM:FPAR:NO REPLY
    231056 TSM:FPAR
    231065 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    232098 TSF:MSG:READ,0-0-255,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    232103 TSF:MSG:FPAR OK,ID=0,D=1
    233073 TSM:FPAR:OK
    233074 TSM:ID
    233076 TSM:ID:REQ
    233079 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    235086 TSM:ID
    235087 TSM:ID:REQ
    236688 !TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=NACK:
    238695 TSM:ID
    238696 TSM:ID:REQ
    238699 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=1,st=OK:
    240706 TSM:ID
    240707 TSM:ID:REQ
    242308 !TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=NACK:
    244315 !TSM:ID:FAIL
    244316 TSM:FAIL:CNT=7
    244318 TSM:FAIL:PDT
    

    Is it now ok, how can i get my data at the gatewa?


  • Hardware Contributor

    @godwinguru - I dont know why but it seems like your gw is restarting. I dont know anything about a Raspberry GW so you need to wait for someone else to answer.

    Top of my mind is a power issue.

    Also I added ``` around your code which makes it easier for others to read. Please use this when you post logs.



  • @sundberg84, thank you for your reply, my gateway is Ethernet with arduino, am not using rhaspberry pi., thanks once again.


  • Hardware Contributor

    @godwinguru - then I would say you have a power issue. As something is using power the gw restarts due to this. What controller do you use? Do you see any connection status there? How do you power the gw? This is crucial that you use a capacitor on the radio and have a stable power supply för the radio.



  • @sundberg84, as i said, am new to mysensors, i dont know where and how to select a controller, it is in my mind to use homegenie, but i still dont know how to integrate it with the gateway, am using adapter to power it, it may not be power problem, i think i still to know a lot about how mysensors works. This is because i used this code (/mysensors/MySensors/examples/GatewayW5100/GatewayW5100.ino) on the gateway without changing anything. i doubt if that is okay, because i never added any other thing to the code.


  • Hardware Contributor

    @godwinguru - ok, then thats your problem. The GW cant be used on its own - it require a controller to work. The controller hand out ID and collect all the data. The controller can be used on a raspberry pi for example.



  • Hello,
    problem, after each restart of gateway or restore database, all my temp/humity sensors are seen as 2 sensors.
    Seen like that:
    2017-07-15 15:23:53.758 (Mysensor) Temp (Temp)
    2017-07-15 15:23:53.763 (Mysensor) Humidity (Hum)
    Should be (on another sensor):
    2017-07-15 15:26:45.610 (Mysensor) Temp + Humidity (Salon)

    After 3 hours one sensor is still doing the same. I restarted it, no change.
    Restarted the gateway again, no change. There is still one sensor which has this behaviour and it's never the same sensor...


  • Mod

    It's a Domoticz problem, sometimes just rebooting everything can solve but try to search on domoticz forum too.



  • 2 issues I see with the example:
    a) I'm not a native english speaker, but to me, on top of the page, "sampling rate" of "2 times/sec" for dht-22 is wrong. From code and pdf you can see that you can't ask for data faster than at 2 seconds.
    As such, I would change the top of the page to read either "0.5 times/sec" or "1 time at 2 seconds".

    b) use of SENSOR_TEMP_OFFSET is wrong. Because depending on how the controller wants this sensor's data (Celsius | Fahrenheit), the offset will be different. If you happen to change the metric system value in the controller and ask for the data (after sensor restart let's say), you'll get a different value than expected).
    I would do:

      • add to the comment for SENSOR_TEMP_OFFSET that we're talking about a Celsius offset
      • and move the statement "temperature += SENSOR_TEMP_OFFSET;" before the conversion to Fahrenheit.

    Regards.


  • Mod

    Thanks @cristi
    I have updated the table with the sample rate. Could you check if it looks good?

    For the code change a pull request will be needed. Could you do one? If you can't I'll add it to my todo but it might take a while.



  • @mfalkvidd

    • there's a typo in the table for DHT-11: it should be '1s per sample' instead of '10s per sample'
    • I created a pull request

  • Mod

    @cristi according to http://www.micropik.com/PDF/dht11.pdf typical response time is 10s. Am I looking at the wrong number?

    Great work on the pull request. I'm adding a link in case someone needs it in the future. https://github.com/mysensors/MySensorsArduinoExamples/pull/29/



  • @mfalkvidd Indeed, I see that 10 seconds in pdf, but it looks strange. I'd have to re-read to see if I can get what it is supposed to be for.
    But, meanwhile, in the same pdf, you get this note (chapter 6): "Note: Sampling period at intervals should be no less than 1 second.". Also, DHT library is using 1second sampling period.


  • Mod

    @cristi thanks. I have updated the table.



  • I've created a DHT11 sensor based on this sketch. However the temperatures (and humidities) are reported as integer numbers in domoticz (either by looking at the devices and setup tabs). In the sketch I've specified the number of decimals like send(msgHum.set(temperatire, 2)). Even if I try larger decimal numbers, nothing change when the value is received in domoticz. What can I do?
    Thanks in advance.


  • Mod

    What kind of variable did you set for your "temperature"? If you can post your code it would help


  • Mod

    @ricmail85 you mean you're only getting integers here?
    0_1516118501351_97c9afbc-5d93-4fc1-8886-2d8e6fd7c22c-image.png



  • @mfalkvidd yes I see only integer numbers here and in devices.

    @gohan I've declared the variable temperature as float. However after I bit of debugging I found that it seems to be related to the dht lib included in the mysensors examples. If the model is dht11 the library is set for 0 decimals. For the dht22 it would be 1 decimal.

    Am I right? Thanks in advance



  • NEWBIE ALERT -- Has anyone else had trouble getting the code above to compile? I'm getting the following error.

    ysensors_Humidity:91: error: 'class DHT' has no member named 'setup'
    dht.setup(DHT_DATA_PIN); // set data pin of DHT sensor
    ^
    Mysensors_Humidity:92: error: 'class DHT' has no member named 'getMinimumSamplingPeriod'
    if (UPDATE_INTERVAL <= dht.getMinimumSamplingPeriod()) {
    ^
    Mysensors_Humidity:97: error: 'class DHT' has no member named 'getMinimumSamplingPeriod'
    sleep(dht.getMinimumSamplingPeriod());
    ^
    /Users/scottdube/Documents/Arduino/Mysensors_Humidity/Mysensors_Humidity.ino: In function 'void loop()':
    Mysensors_Humidity:104: error: 'class DHT' has no member named 'readSensor'
    dht.readSensor(true);
    ^
    Mysensors_Humidity:107: error: 'class DHT' has no member named 'getTemperature'
    float temperature = dht.getTemperature();
    ^
    Mysensors_Humidity:114: error: 'class DHT' has no member named 'toFahrenheit'
    temperature = dht.toFahrenheit(temperature);
    ^
    Mysensors_Humidity:131: error: 'class DHT' has no member named 'getHumidity'
    float humidity = dht.getHumidity();
    ^
    exit status 1
    no matching function for call to 'DHT::DHT()'

    Thanks


  • Mod

    I guess you are using a different dht library version



  • @gohan I got it past that point... Now I can't tell what the humidity or temp is? I cannot seem to find where (what file) controls what is being output. See below this is from my serial gateway, I can't figure out what these values represent. :READ,255-255-0,s=36,c=3,t=3,pt=0,l=0,sg=0:
    255;36;3;0;3;

    0;255;3;0;9;0 MCO:BGN:INIT GW,CP=RNNGA---,VER=2.2.0
    0;255;3;0;9;4 TSM:INIT
    0;255;3;0;9;6 TSF:WUR:MS=0
    0;255;3;0;9;14 TSM:INIT:TSP OK
    0;255;3;0;9;17 TSM:INIT:GW MODE
    0;255;3;0;9;20 TSM:READY:ID=0,PAR=0,DIS=0
    0;255;3;0;9;23 MCO:REG:NOT NEEDED
    0;255;3;0;14;Gateway startup complete.
    0;255;0;0;18;2.2.0
    0;255;3;0;9;28 MCO:BGN:STP
    0;255;3;0;9;34 MCO:BGN:INIT OK,TSP=1
    0;255;3;0;9;30224 TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;30231 TSF:MSG:BC
    0;255;3;0;9;30233 TSF:MSG:FPAR REQ,ID=255
    0;255;3;0;9;30237 TSF:PNG:SEND,TO=0
    0;255;3;0;9;30240 TSF:CKU:OK
    0;255;3;0;9;30243 TSF:MSG:GWL OK
    0;255;3;0;9;30832 TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    0;255;3;0;9;32237 TSF:MSG:READ,255-255-0,s=36,c=3,t=3,pt=0,l=0,sg=0:
    255;36;3;0;3;
    0;255;3;0;9;34249 TSF:MSG:READ,255-255-0,s=1,c=3,t=3,pt=0,l=0,sg=0:
    255;1;3;0;3;
    0;255;3;0;9;36260 TSF:MSG:READ,255-255-0,s=220,c=3,t=3,pt=0,l=0,sg=0:
    255;220;3;0;3;
    0;255;3;0;9;38270 TSF:MSG:READ,255-255-0,s=183,c=3,t=3,pt=0,l=0,sg=0:
    255;183;3;0;3;


  • Mod

    The is the log parser on the mysensors site. Anyway that means you didn't set a node ID on your node and it is asking for one but there is no controller providing one.



  • I have some problem...

    C:\Users\ibaturin\Desktop\DHT\DHT.ino: In function 'void loop()':

    DHT:104: error: no matching function for call to 'DHT::readSensor(bool)'

    dht.readSensor(true);

                      ^
    

    C:\Users\ibaturin\Desktop\DHT\DHT.ino:104:22: note: candidate is:

    In file included from C:\Users\ibaturin\Desktop\DHT\DHT.ino:44:0:

    C:\ARDUINO\arduino-nightly\portable\sketchbook\libraries\arduino-DHT-master/DHT.h:83:8: note: void DHT::readSensor()

    void readSensor();

        ^
    

    C:\ARDUINO\arduino-nightly\portable\sketchbook\libraries\arduino-DHT-master/DHT.h:83:8: note: candidate expects 0 arguments, 1 provided

    exit status 1
    no matching function for call to 'DHT::readSensor(bool)'


  • Mod



  • @gohan Thank you I was able to resolve that issue and get it communication with the gateway, the vera and now mqtt. Thanks again!



  • For the ones looking for a library that makes this DHT sketch work, mysensors have compiled a set of libraries that include this DHT.h and many others. Just go to https://www.mysensors.org/about/arduino#optional---install-external-mysensors-examples (yes, the name is not intuitive, maybe the keyword library would make it more obvious?), or jump directly to here and follow the standard library instructions. It took me two hours to find this, hope it saves time for future followers of mysensors like myself.

    Good luck!



  • Here is the set of libraries where you can find the DHT.h: https://github.com/mysensors/MySensorsArduinoExamples/archive/master.zip



  • If I use this string in a code "sleep(dht.getMinimumSamplingPeriod());" DHT22 (AM2320) always read NaN
    else DHT22 working, but never sleeping
    What im doing wrong?



  • Where are you reading this "NaN"?
    I sometimes also have it in my OpenHab controller webpage when the node doesn't communicate for a while... But when it does, it changes to the value it read from the sensor.

    Try to see in the GW if there is traffic comming from that node. Usualy you can read there the values.

    Good luck!



  • In a serial debug of the sensor module
    It write something like "Failed to read data humidity (temperature)
    Also no send any data to gateway

    Without getMinimumSamplingPeriod I've receiving hum & temp through gateway


  • Mod

    DHT sensor is not very fast, it needs some times between initialization and the different readings



  • Hi
    this program doesn’t work with my setup. For the Gateway I am using a Ardunio nano as a serial Gateway. Thus, I am using the GatewaySerial.ino. Even the Node is based on an Arduino nano with a DHT22 connected. The general communication between both seems to work. But I do not receive any sensor data. When testing the setup with another library for the dht sensor, it works fine (without sending to the gateway, only serial Monitor). Because I am new in the mysensors community there is perhaps a simple mistake which I don’t see… I hope you can help me finding my mistake.
    Here is a short extract of the Debugging Information’s. As far as I see there are no data transferred.
    Gateway:

    0;255;3;0;9;0 MCO:BGN:INIT GW,CP=RRNGA---,VER=2.3.0
    0;255;3;0;9;4 TSM:INIT
    0;255;3;0;9;6 TSF:WUR:MS=0
    0;255;3;0;9;9 TSM:INIT:TSP OK
    0;255;3;0;9;12 TSM:INIT:GW MODE
    0;255;3;0;9;15 TSM:READY:ID=0,PAR=0,DIS=0
    0;255;3;0;9;19 MCO:REG:NOT NEEDED
    0;255;3;0;14;Gateway startup complete.
    0;255;0;0;18;2.3.0
    0;255;3;0;9;23 MCO:BGN:STP
    0;255;3;0;9;29 MCO:BGN:INIT OK,TSP=1
    0;255;3;0;9;1907 TSF:MSG:READ,255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;1913 TSF:MSG:BC
    0;255;3;0;9;1916 TSF:MSG:FPAR REQ,ID=255
    0;255;3;0;9;1920 TSF:CKU:OK,FCTRL
    0;255;3;0;9;1923 TSF:MSG:GWL OK
    0;255;3;0;9;4047 TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    0;255;3;0;9;5136 TSF:MSG:READ,255-255-0,s=187,c=3,t=3,pt=0,l=0,sg=0:
    255;187;3;0;3;
    0;255;3;0;9;7150 TSF:MSG:READ,255-255-0,s=155,c=3,t=3,pt=0,l=0,sg=0:
    255;155;3;0;3;
    0;255;3;0;9;9164 TSF:MSG:READ,255-255-0,s=123,c=3,t=3,pt=0,l=0,sg=0:
    255;123;3;0;3;
    0;255;3;0;9;11179 TSF:MSG:READ,255-255-0,s=91,c=3,t=3,pt=0,l=0,sg=0:
    255;91;3;0;3;
    Sensor:
    16 MCO:BGN:INIT NODE,CP=RRNNA---,VER=2.3.0
    25 TSM:INIT
    26 TSF:WUR:MS=0
    29 TSM:INIT:TSP OK
    30 TSM:FPAR
    1250 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    1368 TSF:MSG:READ,0-0-255,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    1373 TSF:MSG:FPAR OK,ID=0,D=1
    1571 TSF:MSG:READ,0-0-255,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    1774 TSF:MSG:READ,0-0-255,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    1977 TSF:MSG:READ,0-0-255,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    3257 TSM:FPAR:OK
    3258 TSM:ID
    3259 TSM:ID:REQ
    3267 TSF:MSG:SEND,255-255-0-0,s=187,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    5274 TSM:ID
    5275 TSM:ID:REQ
    5283 TSF:MSG:SEND,255-255-0-0,s=155,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    7290 TSM:ID
    7291 TSM:ID:REQ
    7299 TSF:MSG:SEND,255-255-0-0,s=123,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    9306 TSM:ID
    9307 TSM:ID:REQ
    9315 TSF:MSG:SEND,255-255-0-0,s=91,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
    11322 !TSM:ID:FAIL
    11323 TSM:FAIL:CNT=1
    11325 TSM:FAIL:DIS
    11327 TSF:TDI:TSL
    21330 TSM:FAIL:RE-INIT
    21332 TSM:INIT
    21335 TSM:INIT:TSP OK
    21337 TSM:FPAR



  • Hi!
    What controller are you using?
    From the logs it seems that the sensor is asking for an ID but does not get any.
    Node ID is handed out by the controller. Or else you have to set the node ID in the sketch. What does the sketch look like?



  • Hi
    thanks for reply. I am using this sketch: https://github.com/mysensors/MySensors/blob/development/examples/GatewaySerial/GatewaySerial.ino
    The only thing I changed is the radio type and I disabled the inclusion mode.



  • Yes but the issue is with the sensor node. What sketch are you using there?



  • Oh. I am using the sketch in from above and only changed the radio module.



  • @bgunnarb
    You are right. I had to define a sensor id and now it works perfectly 🙂 Thank you very much!



  • Note: Double check your DHT11 module! The pinouts of the PCB of my DHT11 module differed from those in this article. My leftmost pin was Data out, the middle pin was VCC and the right was GND.



  • Hi all,
    I recoded this sketch and I posted on GitHub (1 year ago, and I updated it today). It runs good from 1 year with no issues.
    I don't know why it's still not merged in master branch. I forgot to do some action??
    Can anyone help me? please.
    Meanwhile you can download and use it; this is its link:
    https://github.com/cnerone/MySensorsArduinoExamples/blob/master/examples/DhtTemperatureAndHumiditySensor/DhtTemperatureAndHumiditySensor.ino


  • Mod

    @cnerone no you did 't forget anything. It is just that the external examples don't get much attention and are a bit truoublesome (due to the need of handling third party libraries).



  • I used the code that cnerone has in his comment below with a nano and DHT22 and it worked great. For my nano I did have to use the 'old' bootloader for the program to download into the nano correctly with the arduino IDE. The code in the example here wouldn't compile for me, I think because someone changed the DHT library but for some reason kept the name the same so I ran into some kind of conflicts with variables. I wish when people modified libraries they would give them new/different names because the IDE does not have a good way of handling multiple libraries with the same name. BTW: That is not a MySensors issue, it's the IDE.



  • Also, I could not get a clean compile/download to a arduino mini 3.3v with 168 processor. From what I could find there is not enough memory to handle the newest mysensor libraries, at least that's what some people are saying in forums. I didn't spend much time on it and moved on to other arduinos.



  • For any one that needs it this is how I got the DHT22 to work.
    This is my poor attempt at trying to get the DHT22 to work as the original code
    https://github.com/cnerone/MySensorsArduinoExamples/blob/master/examples/DhtTemperatureAndHumiditySensor/DhtTemperatureAndHumiditySensor.ino
    will not compile for me.

    // Enable debug prints
    #define MY_DEBUG
    
    // Enable and select radio type attached 
    #define MY_RADIO_RF24
    //#define MY_RADIO_RFM69
    //#define MY_RS485
    
    #define MY_RF24_CE_PIN 9
    #define MY_RF24_CS_PIN 10
    
    #include <SPI.h>
    #include <MySensors.h>  
    #include <DHT.h>
    
    // Set this to the pin you connected the DHT's data pin to
    #define DHTPIN 2     // what digital pin we're connected to
    #define DHTTYPE DHT22   // DHT 22  (AM2302), AM2321
    
    #define CHILD_ID_HUM 0
    #define CHILD_ID_TEMP 1
    
    MyMessage msgHum(CHILD_ID_HUM, V_HUM);
    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
    DHT dht(DHTPIN, DHTTYPE);
    
    void presentation()  
    { 
      // Send the sketch version information to the gateway
      sendSketchInfo("TemperatureAndHumidity", "1.1");
      
      // Register all sensors to gw (they will be created as child devices)
      present(CHILD_ID_HUM, S_HUM);
      present(CHILD_ID_TEMP, S_TEMP);
      
    }
    
    void setup()
    {
      dht.begin(); // set data pin of DHT sensor
    
    }
    
    void loop()      
    {  
     delay(2000);
     // Reading temperature or humidity takes about 250 milliseconds!
      // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
      float h = dht.readHumidity();
      // Read temperature as Celsius (the default)
      float t = dht.readTemperature();
      // Read temperature as Fahrenheit (isFahrenheit = true)
      float f = dht.readTemperature(true);
    
      // Check if any reads failed and exit early (to try again).
      if (isnan(h) || isnan(t) || isnan(f)) {
        return;
      }
    
      // Compute heat index in Fahrenheit (the default)
      float hif = dht.computeHeatIndex(f, h);
      // Compute heat index in Celsius (isFahreheit = false)
      float hic = dht.computeHeatIndex(t, h, false);
      
    
        send(msgTemp.set(f, 1));
        send(msgHum.set(h, 1));
    
      }
    


  • @catchra This bit might be important.....
    "This example uses a modified version of the external DHT library, which is included in the MySensors external examples. Please install it and restart the Arduino IDE before trying to compile."

    Did you do this already?



  • @skywatch
    ya i did try that 1st but it did not work so I tried to get it to work with the updated lib and so far it has been working well


Log in to reply
 

Suggested Topics

  • 3
  • 10
  • 347
  • 164
  • 2
  • 584

75
Online

11.4k
Users

11.1k
Topics

112.7k
Posts