Announcement

Collapse
No announcement yet.

DHT11 DHT22 Humidity sensors API

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Yes it does work.
    I'm away at the moment, but will post what I have in the next few days.

    Comment


      #17
      Maybe a stupid question, but if you load this API on the arduino.
      Is there still a possibility to use the other functions from the standard API as well ?
      Or is it only active for the api in this case running the dht sensors ?

      Comment


        #18
        I don't see any reason not, as long as the things you want to do fit within the memory and work alongside each other.

        I'm just writing up a full document on controlling a bathroom fan with this.

        Comment


          #19
          As promised my write up of using a DHT22 to control my bathroom fan in the attached PDF.

          You will need to copy my API code into your own empty generated API template, as each one is specific to your system (ip address etc)

          I use a VB script in an event to compare values and control a relay output, which is also attached.

          The only problem I've seen is the DHT22 sensors report "1" for the humidity level (but with the correct temperature) - I'm not sure if its a dodgy sensor or a code/timing problem as it seems to come and go depending on how many sensors I have connected at the same time. At the moment I have just one sensor connected on the end of 6 meters of cat6 cable and its been reliable for at least a month now.
          Attached Files

          Comment


            #20
            ecuboss, i tested and works.
            Thank you verry much.

            Comment


              #21
              I have been using my arduino in normal mode and it is working well.

              I have a DTH22 and would like to connect this. Do I need to set the board to API mode and how do I include all of the other devices. Do I then have to provide code for each input/output in API mode?

              Comment


                #22
                Just purchase a 2nd Arduino (which is what i did)

                Comment


                  #23
                  Originally posted by ozinnewy View Post
                  I have been using my arduino in normal mode and it is working well.

                  I have a DTH22 and would like to connect this. Do I need to set the board to API mode and how do I include all of the other devices. Do I then have to provide code for each input/output in API mode?
                  As ecuboss said the best thing to do is add another board. You are correct that you would need to add all the code for all your devices in API mode.

                  Originally posted by ecuboss View Post
                  Just purchase a 2nd Arduino (which is what i did)


                  Greig.

                  Sent from my HTC One using Tapatalk
                  Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
                  X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
                  Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
                  Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
                  Scripts =
                  Various

                  Comment


                    #24
                    Thanks, I have set up another mega as an API, but I am getting the following error in the log:

                    Arduino Plugin Exception in RecievedText: Object reference not set to an instance of an object.

                    Comment


                      #25
                      Drop. Me an email and I will send you a fix.

                      Sent from my HTC One using Tapatalk
                      Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
                      X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
                      Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
                      Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
                      Scripts =
                      Various

                      Comment


                        #26
                        Originally posted by ozinnewy View Post
                        Thanks, I have set up another mega as an API, but I am getting the following error in the log:

                        Arduino Plugin Exception in RecievedText: Object reference not set to an instance of an object.
                        Hi ozinnewy.

                        I received your mail through the board but can not reply as you have the board set to not receive mail.
                        Can you email me direct from the link at the top of the plugin page by clicking on my name.

                        Thanks,

                        Greig.
                        Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
                        X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
                        Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
                        Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
                        Scripts =
                        Various

                        Comment


                          #27
                          My DHT22 sensor packed up this week - reads 1% humidity. Lasted about 4 months, the previous one lasted about 2 weeks!
                          So I've either bought a dodgy batch of ebay or they are just unreliable.

                          Comment


                            #28
                            Perfect timing I was just looking at adding humidity reading. Thanks everyone for putting this up.

                            I do have one question though, is there a way to adopt this to run on Arduino Tiny or something small form factor like that but over a serial port. I think its a bit of an over kill to run eithernet plus it adds to the overall cost.

                            How would this be done?

                            THanks
                            Mark

                            Comment


                              #29
                              Originally posted by ecuboss View Post
                              As promised my write up of using a DHT22 to control my bathroom fan in the attached PDF.

                              You will need to copy my API code into your own empty generated API template, as each one is specific to your system (ip address etc)

                              I use a VB script in an event to compare values and control a relay output, which is also attached.

                              The only problem I've seen is the DHT22 sensors report "1" for the humidity level (but with the correct temperature) - I'm not sure if its a dodgy sensor or a code/timing problem as it seems to come and go depending on how many sensors I have connected at the same time. At the moment I have just one sensor connected on the end of 6 meters of cat6 cable and its been reliable for at least a month now.


                              Hello ecuboss,

                              The code works great however there is one issue, if I preconfigure pins say 5 ,6 ,7 and sensor is only on pin 5 or 6 and not 7 the code stops.
                              Is there a way to enable pins only populate them with sensors as neded and code to run through with out reporting values as it does when say sensor is only on the last pin defined. Unless the solution is to start populating sensors with the last. If only the last pin (in this case 7) is connected to sensor then it seems to work fine with reporting no values for pin 5 and 6.

                              Any sugestions?

                              THanks
                              Mark

                              Comment


                                #30
                                Originally posted by marekd1 View Post
                                Hello ecuboss,

                                The code works great however there is one issue, if I preconfigure pins say 5 ,6 ,7 and sensor is only on pin 5 or 6 and not 7 the code stops.
                                Is there a way to enable pins only populate them with sensors as neded and code to run through with out reporting values as it does when say sensor is only on the last pin defined. Unless the solution is to start populating sensors with the last. If only the last pin (in this case 7) is connected to sensor then it seems to work fine with reporting no values for pin 5 and 6.

                                Any sugestions?

                                THanks
                                Mark

                                Mark I guess you are using USB and not Ethernet so you need to delete all the lines with Serial.print in them as this will confuse the plugin.

                                all you need in the loop is
                                PHP Code:
                                 if (IsConnected == true) {
                                   
                                /*Execute ONLY when HomeSeer is connected*/
                                    
                                if(millis() - LastSend SendDelay){ 
                                       
                                   
                                SendToHS(1,dht1.readHumidity()); 
                                   
                                SendToHS(2,dht1.readTemperature()); 
                                   
                                SendToHS(3,dht2.readHumidity()); 
                                   
                                SendToHS(4,dht2.readTemperature()); 
                                   
                                SendToHS(5,dht3.readHumidity()); 
                                   
                                SendToHS(6,dht3.readTemperature()); 



                                    
                                LastSend=millis(); 
                                    } 
                                  }

                                Greig.
                                Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
                                X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
                                Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
                                Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
                                Scripts =
                                Various

                                Comment

                                Working...
                                X