newbie: ethernet gw and first sensor



  • Hi forum,

    I am just trying to build up my first ethernet gateway and first test sensor and I am kind of desperated....

    What I did:

    I built an ethernet gateway using this tutorial: http://www.mysensors.org/build/ethernet_gateway
    I am using a W5100 shield (which I just stuck onto the arduino) and a UNO R3.

    Terminal message when starting the gateway:

    0;0;3;0;14;Gateway startup complete.
    

    My fhem instance looks fine connecting to the gateway.
    Then I build a sensor using a second UNO R3, but all i get is:

    send: 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail:
    sensor started, id 1
    send: 1-1-255-0 s=255,c=0,t=17,pt=0,l=5,st=fail:1.4.1
    send: 1-1-255-0 s=255,c=3,t=6,pt=1,l=1,st=fail:255
    send: 1-1-255-0 s=3,c=0,t=0,pt=0,l=5,st=fail:1.4.1
    send: 1-1-255-0 s=3,c=1,t=16,pt=2,l=2,st=fail:1
    

    This is the sketch I used:

    // Simple binary switch example 
    // Connect button or door/window reed switch between 
    // digitial I/O pin 3 (BUTTON_PIN below) and GND.
    
    #include <MySensor.h>
    #include <SPI.h>
    #include <Bounce2.h>
    #include <MyConfig.h>
    
    //int node_id = 1;
    #define CHILD_ID 3
    #define BUTTON_PIN  3  // Arduino Digital I/O pin for button/reed switch
    
    MySensor gw;
    Bounce debouncer = Bounce(); 
    int oldValue=-1;
    
    // Change to V_LIGHT if you use S_LIGHT in presentation below
    MyMessage msg(CHILD_ID,V_TRIPPED);
    
    void setup()  
    {  
    //  gw.begin(NULL, node_id);
      gw.begin();
     // Setup the button
      pinMode(BUTTON_PIN,INPUT);
      // Activate internal pull-up
      digitalWrite(BUTTON_PIN,HIGH);
      
      // After setting up the button, setup debouncer
      debouncer.attach(BUTTON_PIN);
      debouncer.interval(5);
      
      // Register binary input sensor to gw (they will be created as child devices)
      // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage. 
      // If S_LIGHT is used, remember to update variable type you send in. See "msg" above.
      gw.present(CHILD_ID, S_DOOR);  
    }
    
    
    //  Check if digital input has changed and send in new value
    void loop() 
    {
      debouncer.update();
      // Get the update value
      int value = debouncer.read();
     
      if (value != oldValue) {
         // Send in the new value
         delay(100);
         gw.send(msg.set(value==HIGH ? 1 : 0));
         oldValue = value;
      }
    } 
    

    What else to tell? I am using Fedora Linux and have both arduinos connected using USB. I am using NRF24L01+ transceiver module which I wired according to the tutorials. I do not use any external resistors or capacitors....
    Help would be VERY appreciated...

    Thanks in advance!

    Otto


  • Mod

    You don't say anything about the/a controller 😟



  • /a controller? I am using two UNOs R3 if you mean those?



  • You will need a controller that gives your sensors an Id and will process the data that is generated by them. The sensors connect to the gateway and the gateway connects to the controller.

    Have a look at this page for the possible controllers you can use. I'm using Domoticz on a Raspberry Pi but you can install that on a Windows, Linux or Apple computer as well.



  • Oh sorry - I am using fhem...
    The gateway is recognized by fhem already, but obviously no connection between gateway and sensor 😞



  • ahm... just to understand it:
    I have connected the gateway to the controller (fhem), but did not define any sensors yet in fhem.
    Shouldnt the sensor connect to the gateway nevertheless?????



  • If I understood correctly (I'm new with MySensors myself) the controller hands out the id's used by the sensors and gateway. Try adding the sensor to fhem and see if that helps.



  • oh no - got it 🙂
    I bought some 4.7 uF capacitors today and now everything works fine arghhhh
    but thanks for your help!


Log in to reply
 

Suggested Topics

  • 3
  • 2
  • 1
  • 24
  • 3
  • 2

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts