Skip to content
  • 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. find parent [solution found]
  • Getting Started
  • Controller
  • Build
  • Hardware
  • Download/API
  • Forum
  • Store

find parent [solution found]

Scheduled Pinned Locked Moved Troubleshooting
find parent
6 Posts 3 Posters 2.8k 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.
  • J Offline
    J Offline
    jeti
    wrote on last edited by jeti
    #1

    Hi all,

    i just built a motion, lux and dimmer sensor. The sketch is working perfeclty on a UNO+breadboard but does not seem to work on a pro mini+hardwired, i check the wiring already twice...
    The error i get in serial consol is:

    " find parent"

    what could be the trigger for this?
    thanks

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Mickey
      wrote on last edited by
      #2

      try to delete eeprom of gateway and node...

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jeti
        wrote on last edited by
        #3

        just tried cleared the sensors eeprom, did not show any difference.
        As the "find parent" is the only line in the serial consol, do you think it can be related to the gateway?

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jeti
          wrote on last edited by
          #4

          this is my sketch:

          #include <SPI.h>
          #include <MySensor.h>  
          #include <BH1750.h>
          #include <Wire.h> 
          
          
          #define NODE_ID 136
          
          unsigned long SLEEP_TIME = 10000; // Sleep time between reports (in milliseconds)
          #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
          #define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
          #define LED_PIN 5      // Arduino pin attached to MOSFET Gate pin
          #define FADE_DELAY 25  // Delay in ms for each percentage fade up/down (10ms = 1s full-range dim)
          #define PIR_ID 0   // Id of the sensor child
          #define DIM_ID 1  // Id of the sensor child
          #define CHILD_ID_LIGHT 2
          boolean lasttripped = false;
          
          BH1750 lightSensor;
          MySensor gw;
          
          
          MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
          // MyMessage msg(CHILD_ID_LIGHT, V_LEVEL);  
          uint16_t lastlux;
          MyMessage pirMsg(PIR_ID, V_TRIPPED);
          // Initialize Dimmer
          static int currentLevel = 0;  // Current dim level...
          MyMessage dimmerMsg(DIM_ID, V_DIMMER);
          MyMessage lightMsg(DIM_ID,  V_LIGHT);
          
          void setup()  
          { 
            gw.begin(incomingMessage, NODE_ID, false);
          
            // Send the sketch version information to the gateway and Controller
            gw.sendSketchInfo("PIR & DIM & LUX", "1.0");
          
            // Register all sensors to gateway (they will be created as child devices)
            gw.present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
            gw.present(DIM_ID, S_DIMMER );
            gw.request(DIM_ID, V_DIMMER );
          
              pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
            // Register all sensors to gw (they will be created as child devices)
            gw.present(PIR_ID, S_MOTION);
            
            lightSensor.begin();
          }
          
          void loop()      
          {   
           gw.process();
             boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
              if (lasttripped != tripped) {
              lasttripped = tripped; 
            Serial.print("PIR ");        
            Serial.println(tripped);
            gw.send(pirMsg.set(tripped?"1":"0"));  // Send tripped value to gw 
              }
          
              
            uint16_t lux = lightSensor.readLightLevel();// Get Lux value
            
            if ((round(lux/25))*25 != lastlux) {
              Serial.print("LUX ");
              Serial.println(lux);
                gw.send(msg.set(lux));
                lastlux = (round(lux/25))*25;
            }
            
          }
          void incomingMessage(const MyMessage &message) {
            if (message.type == V_LIGHT || message.type == V_DIMMER) {
              
              //  Retrieve the power or dim level from the incoming request message
              int requestedLevel = atoi( message.data );
              
              // Adjust incoming level if this is a V_LIGHT variable update [0 == off, 1 == on]
              requestedLevel *= ( message.type == V_LIGHT ? 100 : 1 );
              
              // Clip incoming level to valid range of 0 to 100
              requestedLevel = requestedLevel > 100 ? 100 : requestedLevel;
              requestedLevel = requestedLevel < 0   ? 0   : requestedLevel;
              
              Serial.print( "Changing level to " );
              Serial.print( requestedLevel );
              Serial.print( ", from " ); 
              Serial.println( currentLevel );
          
              fadeToLevel( requestedLevel );
              
              // Inform the gateway of the current DimmableLED's SwitchPower1 and LoadLevelStatus value...
              gw.send(lightMsg.set(currentLevel > 0 ? 1 : 0));
          
              // hek comment: Is this really nessesary?
              gw.send( dimmerMsg.set(currentLevel) );
          
              
              }
          }
          
          /***
           *  This method provides a graceful fade up/down effect
           */
          void fadeToLevel( int toLevel ) {
          
            int delta = ( toLevel - currentLevel ) < 0 ? -1 : 1;
            
            while ( currentLevel != toLevel ) {
              currentLevel += delta;
              analogWrite( LED_PIN, (int)(currentLevel / 100. * 255) );
              delay( FADE_DELAY );
            }
          }
          
          
          1 Reply Last reply
          0
          • J Offline
            J Offline
            jeti
            wrote on last edited by jeti
            #5

            found it, it was a not stable 3.3V for the radio... :( added a cap now everything works!
            topic can be closed

            Thorsten MuhlakT 1 Reply Last reply
            0
            • J jeti

              found it, it was a not stable 3.3V for the radio... :( added a cap now everything works!
              topic can be closed

              Thorsten MuhlakT Offline
              Thorsten MuhlakT Offline
              Thorsten Muhlak
              wrote on last edited by
              #6

              @jeti said:

              found it, it was a not stable 3.3V for the radio... :( added a cap now everything works!
              topic can be closed

              Thanks...you pushed me in the right direction! Same issue with the same solution here!

              Raspberry Pi - FHEM (Controller)
              Arduino UNO R3 - W5100 Shield Ethernet GW

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


              6

              Online

              11.7k

              Users

              11.2k

              Topics

              113.0k

              Posts


              Copyright 2019 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
              • OpenHardware.io
              • Categories
              • Recent
              • Tags
              • Popular