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. loungeroom sketch transport failure

loungeroom sketch transport failure

Scheduled Pinned Locked Moved Troubleshooting
18 Posts 4 Posters 3.2k Views 3 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.
  • markjgabbM markjgabb

    god i need new glasses...back to fornt capacitor on the antenna module....

    ok thanks guys...that parts resolved, now just gotta go though no parent found part....other devices in the same location works, just not this one...time to start swapping capacitors

    sundberg84S Offline
    sundberg84S Offline
    sundberg84
    Hardware Contributor
    wrote on last edited by
    #5

    @markjgabb - no reply means the node can't find its way to the radio. Just as you are saying look over that you have all the right capacitors. Sometimes you need a 47uF capacitor instead of the 4,7uF on the radio. (Sometimes you need to try different ones).

    How do you power the node?

    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

    1 Reply Last reply
    0
    • markjgabbM Offline
      markjgabbM Offline
      markjgabb
      wrote on last edited by
      #6

      its battery powered, i have the jumpers, i just got registration on node....but not all sensors are sending data....

      @sundberg84 would it be possible for you to review the below code....have i missed something?

      // Enable debug prints
      #define MY_DEBUG
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      #define MY_NODE_ID 4
      
      #include <SPI.h>
      #include <MySensors.h>  
      #include <DHT.h>  
      
      #define CHILD_ID_HUM 0
      #define CHILD_ID_TEMP 1
      #define CHILD_ID_LIGHT 2
      #define HUMIDITY_SENSOR_DIGITAL_PIN 6
      #define LIGHT_SENSOR_ANALOG_PIN A1
      unsigned long SLEEP_TIME = 60000; // Sleep time between reads (in milliseconds)
      
      #define SKETCH_NAME "loungeroom living sensor #1"        // Change to a fancy name you like
      #define SKETCH_VERSION "1"                    // Your version
      
      DHT dht;
      float lastTemp;
      float lastHum;
      boolean metric = true; 
      int LightLevel = 0;
      int lastLightLevel;
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      MyMessage LightMsg(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
      
      //=========================
      // BATTERY VOLTAGE DIVIDER SETUP
      // 1M, 470K divider across battery and using internal ADC ref of 1.1V
      // Sense point is bypassed with 0.1 uF cap to reduce noise at that point
      // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts
      // 3.44/1023 = Volts per bit = 0.003363075
      #define VBAT_PER_BITS 0.003363075  
      #define VMIN 1.9                                  //  Vmin (radio Min Volt)=1.9V (564v)
      #define VMAX 3.0                                  //  Vmax = (2xAA bat)=3.0V (892v)
      int batteryPcnt = 0;                              // Calc value for battery %
      int batLoop = 0;                                  // Loop to help calc average
      int batArray[3];                                  // Array to store value for average calc.
      int BATTERY_SENSE_PIN = A0;                       // select the input pin for the battery sense point
      //=========================
      
      void setup()  
      { 
       analogReference(INTERNAL);             // For battery sensing
      
        delay(500); // Allow time for radio if power used as reset
        
        dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
      
        metric = getControllerConfig().isMetric;
      }
      
      void presentation()  
      { 
        // Send the Sketch Version Information to the Gateway
       // Send the Sketch Version Information to the Gateway
        sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
      
        // Register all sensors to gw (they will be created as child devices)
        present(CHILD_ID_HUM, S_HUM);
        present(CHILD_ID_TEMP, S_TEMP);
        present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
      }
      
      void loop()      
      {  
        delay(500); // Allow time for radio if power used as reset
        delay(dht.getMinimumSamplingPeriod());
       
        // Fetch temperatures from DHT sensor
        float temperature = dht.getTemperature();
        if (isnan(temperature)) {
            Serial.println("Failed reading temperature from DHT");
        } else if (temperature != lastTemp) {
          lastTemp = temperature;
          send(msgTemp.set(temperature, 1));
          Serial.print("T: ");
          Serial.println(temperature);
        }
        
        // Fetch humidity from DHT sensor
        float humidity = dht.getHumidity();
        if (isnan(humidity)) {
            Serial.println("Failed reading humidity from DHT");
        } else if (humidity != lastHum) {
            lastHum = humidity;
            send(msgHum.set(humidity, 1));
            Serial.print("H: ");
            Serial.println(humidity);
        }
        int lightLevel = (1023-analogRead(LIGHT_SENSOR_ANALOG_PIN))/10.23; 
        Serial.println(lightLevel);
        if (lightLevel != lastLightLevel) {
            send(LightMsg.set(lightLevel));
            lastLightLevel = lightLevel;
        }
            
        batM();
        sleep(SLEEP_TIME); //sleep a bit
      }
      
      void batM() //The battery calculations
      {
         delay(500);
         // Battery monitoring reading
         int sensorValue = analogRead(BATTERY_SENSE_PIN);    
         delay(500);
         
         // Calculate the battery in %
         float Vbat  = sensorValue * VBAT_PER_BITS;
         int batteryPcnt = static_cast<int>(((Vbat-VMIN)/(VMAX-VMIN))*100.);
         Serial.print("Battery percent: "); Serial.print(batteryPcnt); Serial.println(" %");  
         
         // Add it to array so we get an average of 3 (3x20min)
         batArray[batLoop] = batteryPcnt;
        
         if (batLoop > 2) {  
           batteryPcnt = (batArray[0] + batArray[1] + batArray[2] + batArray[3]);
           batteryPcnt = batteryPcnt / 3;
       
         if (batteryPcnt > 100) {
           batteryPcnt=100;
       }
       
           Serial.print("Battery Average (Send): "); Serial.print(batteryPcnt); Serial.println(" %");
             sendBatteryLevel(batteryPcnt);
             batLoop = 0;
            }
           else 
           {
           batLoop++;
           }
      }
      
      sundberg84S 1 Reply Last reply
      0
      • markjgabbM markjgabb

        its battery powered, i have the jumpers, i just got registration on node....but not all sensors are sending data....

        @sundberg84 would it be possible for you to review the below code....have i missed something?

        // Enable debug prints
        #define MY_DEBUG
        
        // Enable and select radio type attached
        #define MY_RADIO_NRF24
        //#define MY_RADIO_RFM69
        #define MY_NODE_ID 4
        
        #include <SPI.h>
        #include <MySensors.h>  
        #include <DHT.h>  
        
        #define CHILD_ID_HUM 0
        #define CHILD_ID_TEMP 1
        #define CHILD_ID_LIGHT 2
        #define HUMIDITY_SENSOR_DIGITAL_PIN 6
        #define LIGHT_SENSOR_ANALOG_PIN A1
        unsigned long SLEEP_TIME = 60000; // Sleep time between reads (in milliseconds)
        
        #define SKETCH_NAME "loungeroom living sensor #1"        // Change to a fancy name you like
        #define SKETCH_VERSION "1"                    // Your version
        
        DHT dht;
        float lastTemp;
        float lastHum;
        boolean metric = true; 
        int LightLevel = 0;
        int lastLightLevel;
        MyMessage msgHum(CHILD_ID_HUM, V_HUM);
        MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
        MyMessage LightMsg(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
        
        //=========================
        // BATTERY VOLTAGE DIVIDER SETUP
        // 1M, 470K divider across battery and using internal ADC ref of 1.1V
        // Sense point is bypassed with 0.1 uF cap to reduce noise at that point
        // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts
        // 3.44/1023 = Volts per bit = 0.003363075
        #define VBAT_PER_BITS 0.003363075  
        #define VMIN 1.9                                  //  Vmin (radio Min Volt)=1.9V (564v)
        #define VMAX 3.0                                  //  Vmax = (2xAA bat)=3.0V (892v)
        int batteryPcnt = 0;                              // Calc value for battery %
        int batLoop = 0;                                  // Loop to help calc average
        int batArray[3];                                  // Array to store value for average calc.
        int BATTERY_SENSE_PIN = A0;                       // select the input pin for the battery sense point
        //=========================
        
        void setup()  
        { 
         analogReference(INTERNAL);             // For battery sensing
        
          delay(500); // Allow time for radio if power used as reset
          
          dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
        
          metric = getControllerConfig().isMetric;
        }
        
        void presentation()  
        { 
          // Send the Sketch Version Information to the Gateway
         // Send the Sketch Version Information to the Gateway
          sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
        
          // Register all sensors to gw (they will be created as child devices)
          present(CHILD_ID_HUM, S_HUM);
          present(CHILD_ID_TEMP, S_TEMP);
          present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
        }
        
        void loop()      
        {  
          delay(500); // Allow time for radio if power used as reset
          delay(dht.getMinimumSamplingPeriod());
         
          // Fetch temperatures from DHT sensor
          float temperature = dht.getTemperature();
          if (isnan(temperature)) {
              Serial.println("Failed reading temperature from DHT");
          } else if (temperature != lastTemp) {
            lastTemp = temperature;
            send(msgTemp.set(temperature, 1));
            Serial.print("T: ");
            Serial.println(temperature);
          }
          
          // Fetch humidity from DHT sensor
          float humidity = dht.getHumidity();
          if (isnan(humidity)) {
              Serial.println("Failed reading humidity from DHT");
          } else if (humidity != lastHum) {
              lastHum = humidity;
              send(msgHum.set(humidity, 1));
              Serial.print("H: ");
              Serial.println(humidity);
          }
          int lightLevel = (1023-analogRead(LIGHT_SENSOR_ANALOG_PIN))/10.23; 
          Serial.println(lightLevel);
          if (lightLevel != lastLightLevel) {
              send(LightMsg.set(lightLevel));
              lastLightLevel = lightLevel;
          }
              
          batM();
          sleep(SLEEP_TIME); //sleep a bit
        }
        
        void batM() //The battery calculations
        {
           delay(500);
           // Battery monitoring reading
           int sensorValue = analogRead(BATTERY_SENSE_PIN);    
           delay(500);
           
           // Calculate the battery in %
           float Vbat  = sensorValue * VBAT_PER_BITS;
           int batteryPcnt = static_cast<int>(((Vbat-VMIN)/(VMAX-VMIN))*100.);
           Serial.print("Battery percent: "); Serial.print(batteryPcnt); Serial.println(" %");  
           
           // Add it to array so we get an average of 3 (3x20min)
           batArray[batLoop] = batteryPcnt;
          
           if (batLoop > 2) {  
             batteryPcnt = (batArray[0] + batArray[1] + batArray[2] + batArray[3]);
             batteryPcnt = batteryPcnt / 3;
         
           if (batteryPcnt > 100) {
             batteryPcnt=100;
         }
         
             Serial.print("Battery Average (Send): "); Serial.print(batteryPcnt); Serial.println(" %");
               sendBatteryLevel(batteryPcnt);
               batLoop = 0;
              }
             else 
             {
             batLoop++;
             }
        }
        
        sundberg84S Offline
        sundberg84S Offline
        sundberg84
        Hardware Contributor
        wrote on last edited by
        #7

        @markjgabb said in loungeroom sketch transport failure:

        if (lightLevel != lastLightLevel) {

        This means it will only send if the value is changed... could that be the cause?

        Any logs from the node? Ack ok?

        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

        1 Reply Last reply
        0
        • markjgabbM Offline
          markjgabbM Offline
          markjgabb
          wrote on last edited by markjgabb
          #8
          7778 MCO:SLP:WUP=-1
          9306 TSF:MSG:SEND,3-3-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:20.0
          T: 20.00
          9316 TSF:MSG:SEND,3-3-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:18.0
          H: 18.00
          0
          Battery percent: -89 %
          10326 MCO:SLP:MS=120000,SMS=0,I1=255,M1=255,I2=255,M2=255
          10332 MCO:SLP:TPD
          

          this is my current log....

          so temp and hum is wrking...but my lux level keeps coming back 0 i think thats what its saying....can i insert more logging on that one to see how its doing the math?

          sundberg84S 1 Reply Last reply
          0
          • markjgabbM markjgabb
            7778 MCO:SLP:WUP=-1
            9306 TSF:MSG:SEND,3-3-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:20.0
            T: 20.00
            9316 TSF:MSG:SEND,3-3-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:18.0
            H: 18.00
            0
            Battery percent: -89 %
            10326 MCO:SLP:MS=120000,SMS=0,I1=255,M1=255,I2=255,M2=255
            10332 MCO:SLP:TPD
            

            this is my current log....

            so temp and hum is wrking...but my lux level keeps coming back 0 i think thats what its saying....can i insert more logging on that one to see how its doing the math?

            sundberg84S Offline
            sundberg84S Offline
            sundberg84
            Hardware Contributor
            wrote on last edited by
            #9

            @markjgabb - ok, communication looks good! Great!
            It looks like you are not getting anything out of the sensor. Is it powered? Did you connect it to analog output? (Some sensors have both digital and analog out).

            There is not much else to log.
            You could do: Serial.println(LIGHT_SENSOR_ANALOG_PIN); to see the raw value (should be 0-1v). on the analog input.
            You can also measure the voltage coming on the analog output pin on the sensor and see.

            The battery measurment looks strange though... negative 89? :)

            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

            1 Reply Last reply
            0
            • markjgabbM Offline
              markjgabbM Offline
              markjgabb
              wrote on last edited by markjgabb
              #10

              ok raw lux is 15

              good point...ive used a 47k resistor instead of a 470k, ill change that in the morning
              Raw Lux: 15
              send Lux: 0

              obviously a sensor error, ive moved the photo resistor into diffrent light like 4 times, and no change in reading

              sundberg84S 1 Reply Last reply
              0
              • markjgabbM markjgabb

                ok raw lux is 15

                good point...ive used a 47k resistor instead of a 470k, ill change that in the morning
                Raw Lux: 15
                send Lux: 0

                obviously a sensor error, ive moved the photo resistor into diffrent light like 4 times, and no change in reading

                sundberg84S Offline
                sundberg84S Offline
                sundberg84
                Hardware Contributor
                wrote on last edited by sundberg84
                #11

                @markjgabb - if you can confirm that with a multimeter, its defenetly a error in the sensor... but verify because it can be a fault in the pro mini hardware/software as well.

                Raw lux (Serial.println(LIGHT_SENSOR_ANALOG_PIN);) should be between value 0 and 1023.

                I probably wrote wrong above though... if you are using a 5v pro mini, the input voltage range should be 0 to 5 volts

                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

                1 Reply Last reply
                0
                • markjgabbM Offline
                  markjgabbM Offline
                  markjgabb
                  wrote on last edited by markjgabb
                  #12

                  nah its a 3.3 pro mini
                  photo

                  back

                  1 Reply Last reply
                  0
                  • markjgabbM Offline
                    markjgabbM Offline
                    markjgabb
                    wrote on last edited by
                    #13

                    photo resistor is now working...domoticz is showing varied amounts of reading though the night and morning....
                    but its back to front....

                    its reads 90ish in the middle of the night and this morning fluxuated between 50-10 and is now sitting at 30 with an empty house......did i math backwards? or is this expected behaviour due to the way the resistance works?

                    in domoticz would i just use low values as my brightness

                    Nca78N 1 Reply Last reply
                    0
                    • markjgabbM markjgabb

                      photo resistor is now working...domoticz is showing varied amounts of reading though the night and morning....
                      but its back to front....

                      its reads 90ish in the middle of the night and this morning fluxuated between 50-10 and is now sitting at 30 with an empty house......did i math backwards? or is this expected behaviour due to the way the resistance works?

                      in domoticz would i just use low values as my brightness

                      Nca78N Offline
                      Nca78N Offline
                      Nca78
                      Hardware Contributor
                      wrote on last edited by
                      #14

                      @markjgabb said in loungeroom sketch transport failure:

                      photo resistor is now working...domoticz is showing varied amounts of reading though the night and morning....
                      but its back to front....

                      its reads 90ish in the middle of the night and this morning fluxuated between 50-10 and is now sitting at 30 with an empty house......did i math backwards? or is this expected behaviour due to the way the resistance works?

                      in domoticz would i just use low values as my brightness

                      Resistance gets lower when you have light. So higher when you have no light, meaning you have higher voltage when you measure voltage across the photoresistor.

                      sundberg84S 1 Reply Last reply
                      0
                      • Nca78N Nca78

                        @markjgabb said in loungeroom sketch transport failure:

                        photo resistor is now working...domoticz is showing varied amounts of reading though the night and morning....
                        but its back to front....

                        its reads 90ish in the middle of the night and this morning fluxuated between 50-10 and is now sitting at 30 with an empty house......did i math backwards? or is this expected behaviour due to the way the resistance works?

                        in domoticz would i just use low values as my brightness

                        Resistance gets lower when you have light. So higher when you have no light, meaning you have higher voltage when you measure voltage across the photoresistor.

                        sundberg84S Offline
                        sundberg84S Offline
                        sundberg84
                        Hardware Contributor
                        wrote on last edited by
                        #15

                        @Nca78 - what kind of sensor are you using? Or just a single photoresistor as Nca78 suggested?

                        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

                        1 Reply Last reply
                        0
                        • markjgabbM Offline
                          markjgabbM Offline
                          markjgabb
                          wrote on last edited by
                          #16

                          just a single photoresistor,
                          i just wasnt sure if there was a way to reverse map the numbers so that if it says 1 it sends 99

                          sundberg84S 1 Reply Last reply
                          0
                          • markjgabbM markjgabb

                            just a single photoresistor,
                            i just wasnt sure if there was a way to reverse map the numbers so that if it says 1 it sends 99

                            sundberg84S Offline
                            sundberg84S Offline
                            sundberg84
                            Hardware Contributor
                            wrote on last edited by
                            #17

                            @markjgabb - a single photoresistor can be extremly sensitive, ie 0 to full in a small change in light. There are alot of guides out there, just google around.

                            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

                            1 Reply Last reply
                            0
                            • markjgabbM Offline
                              markjgabbM Offline
                              markjgabb
                              wrote on last edited by
                              #18

                              @sundberg84 solved the light sensitivity level by swapping the 10k for a 100k...
                              makes it more acurate in lighter enviroments, but less so in dark enviroments

                              but by my theory after its a little dim im counting it as dark all the way to full dark for lighting purposes anyway

                              cheers for all your help....

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


                              20

                              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