Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. Trouble combining sketches for temp and motion control

Trouble combining sketches for temp and motion control

Scheduled Pinned Locked Moved Troubleshooting
24 Posts 6 Posters 9.6k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • DwaltD Dwalt

    @davvvvvo Did you re-include the node after changing the sketch? What controller are you using? Post your sketch using the </> tool.

    D Offline
    D Offline
    davvvvvo
    wrote on last edited by
    #12

    @Dwalt yes I removed the node off Vera U7 and re added it as instructions say. Using Nana serial controller. The motion sensor works perfectly. I'm using hek sketch, I just cut and paste the sketch into to program and compiled and uploaded. Do I need a resistor with the dht 22 temp sensor because I don't have one on it at the moment.

    DwaltD 1 Reply Last reply
    0
    • D davvvvvo

      @Dwalt yes I removed the node off Vera U7 and re added it as instructions say. Using Nana serial controller. The motion sensor works perfectly. I'm using hek sketch, I just cut and paste the sketch into to program and compiled and uploaded. Do I need a resistor with the dht 22 temp sensor because I don't have one on it at the moment.

      DwaltD Offline
      DwaltD Offline
      Dwalt
      wrote on last edited by
      #13

      @davvvvvo If you used Hek's sketch above and your DHT is connected to pin 6 and the PIR on pin 3, it should work. How are you powering the DHT and PIR? You should be using the nano's 5v. You do not need a separate resistor on the DHT module (3 pins), it has one onboard the module. Are you seeing the temp and hum child devices in Vera? If so, try powering the node off-on and reloading the Vera page.

      Veralite UI5 :: IBoard Ethernet GW :: MyS 1.5

      D 1 Reply Last reply
      0
      • DwaltD Dwalt

        @davvvvvo If you used Hek's sketch above and your DHT is connected to pin 6 and the PIR on pin 3, it should work. How are you powering the DHT and PIR? You should be using the nano's 5v. You do not need a separate resistor on the DHT module (3 pins), it has one onboard the module. Are you seeing the temp and hum child devices in Vera? If so, try powering the node off-on and reloading the Vera page.

        D Offline
        D Offline
        davvvvvo
        wrote on last edited by davvvvvo
        #14

        @Dwalt I'm powering both sensors off the 5v pin on the board so they are sharing the power. Temp is on pin 6. All three nodes added to Vera. I can arm or bypass the motion and this works, the temp and humidity node are on Vera but not showing any numbers. Temp is at 0 degrees and humidity is at 0%. I tried cycling the nodes off and on a few times. With no results.

        DwaltD 1 Reply Last reply
        0
        • D davvvvvo

          @Dwalt I'm powering both sensors off the 5v pin on the board so they are sharing the power. Temp is on pin 6. All three nodes added to Vera. I can arm or bypass the motion and this works, the temp and humidity node are on Vera but not showing any numbers. Temp is at 0 degrees and humidity is at 0%. I tried cycling the nodes off and on a few times. With no results.

          DwaltD Offline
          DwaltD Offline
          Dwalt
          wrote on last edited by
          #15

          @davvvvvo If you eliminate any wiring mistakes, I assume you must have a bad DHT sensor. You could try it without the PIR and load up the basic temp/hum sketch to see if it works or see if you can see anything through the serial log.

          Veralite UI5 :: IBoard Ethernet GW :: MyS 1.5

          D 1 Reply Last reply
          0
          • DwaltD Dwalt

            @davvvvvo If you eliminate any wiring mistakes, I assume you must have a bad DHT sensor. You could try it without the PIR and load up the basic temp/hum sketch to see if it works or see if you can see anything through the serial log.

            D Offline
            D Offline
            davvvvvo
            wrote on last edited by
            #16

            @Dwalt Just used the DHT sensor on its own and loaded the humidity sketch and it works perfectly. did try and load the dallas temp sketch and that didnt work on its own. Question will i need to upload if there is one someting like a dallas.JSON or or another XML onto vera for hek's sketch to work possibly?

            DwaltD 1 Reply Last reply
            0
            • D davvvvvo

              @Dwalt Just used the DHT sensor on its own and loaded the humidity sketch and it works perfectly. did try and load the dallas temp sketch and that didnt work on its own. Question will i need to upload if there is one someting like a dallas.JSON or or another XML onto vera for hek's sketch to work possibly?

              DwaltD Offline
              DwaltD Offline
              Dwalt
              wrote on last edited by
              #17

              @davvvvvo The Dallas sensor is completely different from the DHT and does not factor into your setup. The DHT provides both temp and humidity. The Dallas temp sensor uses a separate library for pulling data from that particular sensor. Can you post your serial log from your sensor with both DHT and PIR connected using the sketch Hek provided above? That would tell us what is happening at the communication level between the sensor node and gateway.

              Veralite UI5 :: IBoard Ethernet GW :: MyS 1.5

              D 3 Replies Last reply
              0
              • DwaltD Dwalt

                @davvvvvo The Dallas sensor is completely different from the DHT and does not factor into your setup. The DHT provides both temp and humidity. The Dallas temp sensor uses a separate library for pulling data from that particular sensor. Can you post your serial log from your sensor with both DHT and PIR connected using the sketch Hek provided above? That would tell us what is happening at the communication level between the sensor node and gateway.

                D Offline
                D Offline
                davvvvvo
                wrote on last edited by
                #18

                @Dwalt how do i go about gathering the serial log. Can i plug in the sensor and download the serial log with the arduino program

                1 Reply Last reply
                0
                • DwaltD Dwalt

                  @davvvvvo The Dallas sensor is completely different from the DHT and does not factor into your setup. The DHT provides both temp and humidity. The Dallas temp sensor uses a separate library for pulling data from that particular sensor. Can you post your serial log from your sensor with both DHT and PIR connected using the sketch Hek provided above? That would tell us what is happening at the communication level between the sensor node and gateway.

                  D Offline
                  D Offline
                  davvvvvo
                  wrote on last edited by
                  #19
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • DwaltD Dwalt

                    @davvvvvo The Dallas sensor is completely different from the DHT and does not factor into your setup. The DHT provides both temp and humidity. The Dallas temp sensor uses a separate library for pulling data from that particular sensor. Can you post your serial log from your sensor with both DHT and PIR connected using the sketch Hek provided above? That would tell us what is happening at the communication level between the sensor node and gateway.

                    D Offline
                    D Offline
                    davvvvvo
                    wrote on last edited by
                    #20

                    @Dwalt
                    sensor started, id 2
                    send: 2-2-0-0 s=255,c=0,t=17,pt=0,l=5,st=ok:1.4.1
                    send: 2-2-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0
                    send: 2-2-0-0 s=255,c=3,t=11,pt=0,l=16,st=ok:Multi Motion+Hum
                    send: 2-2-0-0 s=255,c=3,t=12,pt=0,l=3,st=ok:1.0
                    send: 2-2-0-0 s=0,c=0,t=7,pt=0,l=0,st=ok:
                    send: 2-2-0-0 s=1,c=0,t=6,pt=0,l=0,st=ok:
                    send: 2-2-0-0 s=3,c=0,t=1,pt=0,l=0,st=ok:
                    Tripped: 0
                    send: 2-2-0-0 s=3,c=1,t=16,pt=0,l=1,st=ok:0
                    Failed reading temperature from DHT
                    Failed reading humidity from DHT
                    Tripped: 0
                    send: 2-2-0-0 s=3,c=1,t=16,pt=0,l=1,st=ok:0
                    Failed reading temperature from DHT
                    Failed reading humidity from DHT
                    Tripped: 0
                    send: 2-2-0-0 s=3,c=1,t=16,pt=0,l=1,st=ok:0
                    Failed reading temperature from DHT
                    Failed reading humidity from DHT

                    1 Reply Last reply
                    0
                    • sundberg84S Offline
                      sundberg84S Offline
                      sundberg84
                      Hardware Contributor
                      wrote on last edited by sundberg84
                      #21

                      Its a problem with the DHT, the setup between Arduino and DHT sensor i think...

                      -Tried another DHT-Sensor or bare DHT code?
                      -Tried another inputpin on the arduino (i got this message when i didnt solder the pin properly)
                      -Check/change wiring.

                      Also try the delay(dht.getMinimumSamplingPeriod()); before the motion sensor code and see if this changes anything.

                      Controller: Proxmox VM - Home Assistant
                      MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
                      MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
                      RFLink GW - Arduino Mega + RFLink Shield, 433mhz

                      D 1 Reply Last reply
                      0
                      • sundberg84S sundberg84

                        Its a problem with the DHT, the setup between Arduino and DHT sensor i think...

                        -Tried another DHT-Sensor or bare DHT code?
                        -Tried another inputpin on the arduino (i got this message when i didnt solder the pin properly)
                        -Check/change wiring.

                        Also try the delay(dht.getMinimumSamplingPeriod()); before the motion sensor code and see if this changes anything.

                        D Offline
                        D Offline
                        davvvvvo
                        wrote on last edited by
                        #22

                        @sundberg84 I have two DHT22 sensors which I have tried both. They both work when I run the humidity sketch on its own but not when I try this sketch. Having never written code before this "delay(dht.getMinimumSamplingPeriod());" I have no clue what this is. Also if I used pin 5 for example how would I go changing the code to represent this. Cheers everyone so far for your help fault finding what's wrong with my set up. I don't usually give up but this simple one is testing my patients to the point I might just run a temp sensor on its own.

                        SparkmanS 1 Reply Last reply
                        0
                        • D davvvvvo

                          @sundberg84 I have two DHT22 sensors which I have tried both. They both work when I run the humidity sketch on its own but not when I try this sketch. Having never written code before this "delay(dht.getMinimumSamplingPeriod());" I have no clue what this is. Also if I used pin 5 for example how would I go changing the code to represent this. Cheers everyone so far for your help fault finding what's wrong with my set up. I don't usually give up but this simple one is testing my patients to the point I might just run a temp sensor on its own.

                          SparkmanS Offline
                          SparkmanS Offline
                          Sparkman
                          Hero Member
                          wrote on last edited by
                          #23

                          @davvvvvo

                          "delay(dht.getMinimumSamplingPeriod());" is used to not retrieve info from the DHT22 too often. The sensors don't respond if polled too frequently and this is a function in the DHT library. To change the sketch to use pin 5, change this line:

                          #define HUMIDITY_SENSOR_DIGITAL_PIN 6

                          to

                          #define HUMIDITY_SENSOR_DIGITAL_PIN 5

                          Is the sketch you are using identical to the one @hek posted? How are you powering your board?

                          Cheers
                          Al

                          D 1 Reply Last reply
                          0
                          • SparkmanS Sparkman

                            @davvvvvo

                            "delay(dht.getMinimumSamplingPeriod());" is used to not retrieve info from the DHT22 too often. The sensors don't respond if polled too frequently and this is a function in the DHT library. To change the sketch to use pin 5, change this line:

                            #define HUMIDITY_SENSOR_DIGITAL_PIN 6

                            to

                            #define HUMIDITY_SENSOR_DIGITAL_PIN 5

                            Is the sketch you are using identical to the one @hek posted? How are you powering your board?

                            Cheers
                            Al

                            D Offline
                            D Offline
                            davvvvvo
                            wrote on last edited by
                            #24

                            @Sparkman yes it's the same sketch hek uploaded word for word. Powering using a phone charger 5v 1amp. Im putting it down to I might have a faulty pin 6 or the sketch doesn't play well with Vera and the plugin. Does anyone have another sketch?

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            26

                            Online

                            11.7k

                            Users

                            11.2k

                            Topics

                            113.1k

                            Posts


                            Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • MySensors
                            • OpenHardware.io
                            • Categories
                            • Recent
                            • Tags
                            • Popular