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. Controllers
  3. Vera
  4. Ethernet Gateway without NRF24L01+

Ethernet Gateway without NRF24L01+

Scheduled Pinned Locked Moved Vera
22 Posts 5 Posters 6.4k Views 5 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.
  • hekH Offline
    hekH Offline
    hek
    Admin
    wrote on last edited by
    #3

    Yes, use the development branch and move the relevant parts of the motion sensor to the GatewayW5100 sketch. With relevant, I mean the stuff inside setup() and loop().

    The gateway should not not be put into sleep, so you have to remove that line and make sure to send the value only when it changes from the last reading.

    https://github.com/mysensors/Arduino/blob/development/libraries/MySensors/examples/MotionSensor/MotionSensor.ino#L70

    M 1 Reply Last reply
    0
    • hekH hek

      Yes, use the development branch and move the relevant parts of the motion sensor to the GatewayW5100 sketch. With relevant, I mean the stuff inside setup() and loop().

      The gateway should not not be put into sleep, so you have to remove that line and make sure to send the value only when it changes from the last reading.

      https://github.com/mysensors/Arduino/blob/development/libraries/MySensors/examples/MotionSensor/MotionSensor.ino#L70

      M Offline
      M Offline
      mlg
      wrote on last edited by mlg
      #4

      @hek

      // Enable debug prints to serial monitor
      #define MY_DEBUG 
      
      // Enable and select radio type attached
      // #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      // Enable gateway ethernet module type 
      #define MY_GATEWAY_W5100
      
      // W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
      //#define MY_W5100_SPI_EN 4  
      
      // Enable Soft SPI for NRF radio (note different radio wiring is required)
      // The W5100 ethernet module seems to have a hard time co-operate with 
      // radio on the same spi bus.
      #if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD)
        #define MY_SOFTSPI
        #define MY_SOFT_SPI_SCK_PIN 14
        #define MY_SOFT_SPI_MISO_PIN 16
        #define MY_SOFT_SPI_MOSI_PIN 15
      #endif  
      
      // When W5100 is connected we have to move CE/CSN pins for NRF radio
      //#define MY_RF24_CE_PIN 5
      //#define MY_RF24_CS_PIN 6
      
      // Enable to UDP          
      //#define MY_USE_UDP
      
      #define MY_IP_ADDRESS 192,168,1,169   // If this is disabled, DHCP is used to retrieve address
      // Renewal period if using DHCP
      //#define MY_IP_RENEWAL_INTERVAL 60000
      // The port to keep open on node server mode / or port to contact in client mode
      #define MY_PORT 5003      
      
      // Controller ip address. Enables client mode (default is "server" mode). 
      // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere. 
      //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254   
       
      // The MAC address can be anything you want but should be unique on your network.
      // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
      // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
      #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
      
      // Flash leds on rx/tx/err
      #define MY_LEDS_BLINKING_FEATURE
      // Set blinking period
      #define MY_DEFAULT_LED_BLINK_PERIOD 300
      
      // Enable inclusion mode
      #define MY_INCLUSION_MODE_FEATURE
      // Enable Inclusion mode button on gateway
      #define MY_INCLUSION_BUTTON_FEATURE
      // Set inclusion mode duration (in seconds)
      #define MY_INCLUSION_MODE_DURATION 60 
      // Digital pin used for inclusion mode button
      #define MY_INCLUSION_MODE_BUTTON_PIN  4 
      
      // Uncomment to override default HW configurations
      //#define MY_DEFAULT_ERR_LED_PIN 7  // Error led pin
      //#define MY_DEFAULT_RX_LED_PIN  8  // Receive led pin
      //#define MY_DEFAULT_TX_LED_PIN  9  // the PCB, on board LED
      
      #include <SPI.h>
      
      #if defined(MY_USE_UDP)
        #include <EthernetUdp.h>
      #endif
      #include <Ethernet.h>
      #include <MySensor.h>
      
      //unsigned long SLEEP_TIME = 120000; // 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 CHILD_ID 1   // Id of the sensor child
      
      // Initialize motion message
      MyMessage msg(CHILD_ID, V_TRIPPED);
      
      void setup()  
      {  
        pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
      }
      
      void presentation()  {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Motion Sensor", "1.0");
      
        // Register all sensors to gw (they will be created as child devices)
        present(CHILD_ID, S_MOTION);
      }
      
      void loop()     
      {     
        // Read digital motion value
        boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
              
        Serial.println(tripped);
        send(msg.set(tripped?"1":"0"));  // Send tripped value to gw 
       
         // Sleep until interrupt comes in on motion sensor. Send update every two minute. 
        //sleep(INTERRUPT,CHANGE, SLEEP_TIME);
      }
      

      dont work :(

      alt text
      alt text

      1 Reply Last reply
      0
      • hekH Offline
        hekH Offline
        hek
        Admin
        wrote on last edited by
        #5

        Two problems.

        1. The sketch will flood the gateway with messages, You should only send when tripped value is updated.

        2. The error in Vera indicates a problem in communication with the gateway. Did you set it up correctly (ip address in Vera).

        M 1 Reply Last reply
        0
        • hekH hek

          Two problems.

          1. The sketch will flood the gateway with messages, You should only send when tripped value is updated.

          2. The error in Vera indicates a problem in communication with the gateway. Did you set it up correctly (ip address in Vera).

          M Offline
          M Offline
          mlg
          wrote on last edited by mlg
          #6

          @hek

          Tks , I changed the code

          void loop()     
          {     
            // Read digital motion value
            boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
          
              if (lastTripped != tripped ) {
                send(msg.set(tripped?"1":"0")); // Send new state and request ack back
                Serial.println(tripped);
                lastTripped=tripped;
             // Sleep until interrupt comes in on motion sensor. Send update every two minute. 
            //sleep(INTERRUPT,CHANGE, SLEEP_TIME);
          }
          

          but vera continues with the same status :(

          alt text

          some additional info

          alt text

          M 1 Reply Last reply
          0
          • M mlg

            @hek

            Tks , I changed the code

            void loop()     
            {     
              // Read digital motion value
              boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
            
                if (lastTripped != tripped ) {
                  send(msg.set(tripped?"1":"0")); // Send new state and request ack back
                  Serial.println(tripped);
                  lastTripped=tripped;
               // Sleep until interrupt comes in on motion sensor. Send update every two minute. 
              //sleep(INTERRUPT,CHANGE, SLEEP_TIME);
            }
            

            but vera continues with the same status :(

            alt text

            some additional info

            alt text

            M Offline
            M Offline
            mlg
            wrote on last edited by
            #7

            @hek

            Ok , the message "cant decect device" has disappeared, however not appear the motion sensor, how can I make inclusion?

            M 1 Reply Last reply
            0
            • M mlg

              @hek

              Ok , the message "cant decect device" has disappeared, however not appear the motion sensor, how can I make inclusion?

              M Offline
              M Offline
              mlg
              wrote on last edited by
              #8

              Connected but motion sensor not appear, someone help?

              <a class=@mlg " class=" img-fluid img-markdown" />

              1 Reply Last reply
              0
              • hekH Offline
                hekH Offline
                hek
                Admin
                wrote on last edited by
                #9

                Did you turn on inclusion mode on Vera and restart sensor a few times?

                M 1 Reply Last reply
                0
                • hekH hek

                  Did you turn on inclusion mode on Vera and restart sensor a few times?

                  M Offline
                  M Offline
                  mlg
                  wrote on last edited by mlg
                  #10

                  @hek

                  Yes but Start the button does not work :(
                  I press but the state does not change, the start it is always green.

                  alt text

                  M 1 Reply Last reply
                  0
                  • M mlg

                    @hek

                    Yes but Start the button does not work :(
                    I press but the state does not change, the start it is always green.

                    alt text

                    M Offline
                    M Offline
                    mlg
                    wrote on last edited by
                    #11

                    Any idea?
                    Already I realized the factory reset Vera , erase the eeprom arduino and inclusion using the Pin 4, but no effect :(

                    the code that currently have the Arduino

                    // Enable debug prints to serial monitor
                    #define MY_DEBUG 
                    
                    // Enable gateway ethernet module type 
                    #define MY_GATEWAY_W5100
                    
                    // W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
                    //#define MY_W5100_SPI_EN 4  
                    
                    // Enable Soft SPI for NRF radio (note different radio wiring is required)
                    // The W5100 ethernet module seems to have a hard time co-operate with 
                    // radio on the same spi bus.
                    //#if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD)
                      //#define MY_SOFTSPI
                      //#define MY_SOFT_SPI_SCK_PIN 14
                      //#define MY_SOFT_SPI_MISO_PIN 16
                      //#define MY_SOFT_SPI_MOSI_PIN 15
                    //#endif  
                    
                    // When W5100 is connected we have to move CE/CSN pins for NRF radio
                    //#define MY_RF24_CE_PIN 5
                    //#define MY_RF24_CS_PIN 6
                    
                    
                    
                    #define MY_IP_ADDRESS 192,168,1,169   // If this is disabled, DHCP is used to retrieve address
                    // Renewal period if using DHCP
                    //#define MY_IP_RENEWAL_INTERVAL 60000
                    // The port to keep open on node server mode / or port to contact in client mode
                    #define MY_PORT 5003        
                     
                    // The MAC address can be anything you want but should be unique on your network.
                    // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
                    // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
                     #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
                    
                    // Flash leds on rx/tx/err
                     #define MY_LEDS_BLINKING_FEATURE
                    // Set blinking period
                     #define MY_DEFAULT_LED_BLINK_PERIOD 300
                    
                    // Enable inclusion mode
                     #define MY_INCLUSION_MODE_FEATURE
                    // Enable Inclusion mode button on gateway
                     #define MY_INCLUSION_BUTTON_FEATURE
                    // Set inclusion mode duration (in seconds)
                     #define MY_INCLUSION_MODE_DURATION 60 
                    // Digital pin used for inclusion mode button
                     #define MY_INCLUSION_MODE_BUTTON_PIN  4 
                    
                    #include <SPI.h>
                    #include <Ethernet.h>
                    #include <MySensor.h>
                    
                    
                    #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 CHILD_ID 1   // Id of the sensor child
                    boolean lastTripped = 0;
                    
                    
                    // Initialize motion message
                    MyMessage msg(CHILD_ID, V_TRIPPED);
                    
                    void setup()  
                    {  
                       
                    
                      // Send the sketch version information to the gateway and Controller
                      sendSketchInfo("Motion Sensor", "1.0");
                    
                      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)
                      present(CHILD_ID, S_MOTION);
                    }
                    
                    
                    
                    void loop()     
                    {     
                      
                      // Read digital motion value
                      boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
                    
                        if (lastTripped != tripped ) {
                          send(msg.set(tripped?"1":"0")); // Send new state and request ack back
                          Serial.println(tripped);
                          lastTripped=tripped;
                    }
                    }
                    
                    1 Reply Last reply
                    0
                    • hekH Offline
                      hekH Offline
                      hek
                      Admin
                      wrote on last edited by
                      #12

                      Strange...you are using the UI7 branch of the Vera plugin right?

                      You could try commenting these two lines away:

                      //  #define MY_INCLUSION_BUTTON_FEATURE
                      //  #define MY_INCLUSION_MODE_BUTTON_PIN  4 
                      

                      In case a floating pin causing troubles.

                      M 1 Reply Last reply
                      0
                      • hekH hek

                        Strange...you are using the UI7 branch of the Vera plugin right?

                        You could try commenting these two lines away:

                        //  #define MY_INCLUSION_BUTTON_FEATURE
                        //  #define MY_INCLUSION_MODE_BUTTON_PIN  4 
                        

                        In case a floating pin causing troubles.

                        M Offline
                        M Offline
                        mlg
                        wrote on last edited by mlg
                        #13

                        @hek

                        Yes UI7 branch, I already commented these two lines and check the cables, when I press start button the rx and tx lights flashing

                        M 1 Reply Last reply
                        0
                        • M mlg

                          @hek

                          Yes UI7 branch, I already commented these two lines and check the cables, when I press start button the rx and tx lights flashing

                          M Offline
                          M Offline
                          mlg
                          wrote on last edited by
                          #14

                          for restart sensor a few times, simply disconnect the gnd cable or all cables?

                          1 Reply Last reply
                          0
                          • einarthE Offline
                            einarthE Offline
                            einarth
                            wrote on last edited by
                            #15

                            Isn't digital pin 4 used by the Ethernet shield?

                            Probably not the cause of your problems but just noticed when looking over your code..

                            M 1 Reply Last reply
                            0
                            • einarthE einarth

                              Isn't digital pin 4 used by the Ethernet shield?

                              Probably not the cause of your problems but just noticed when looking over your code..

                              M Offline
                              M Offline
                              mlg
                              wrote on last edited by
                              #16

                              @einarth

                              I already commented this line in the code , my final code

                              // Enable debug prints to serial monitor
                              #define MY_DEBUG 
                              
                              // Enable gateway ethernet module type 
                              #define MY_GATEWAY_W5100
                              
                              // W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
                              //#define MY_W5100_SPI_EN 4  
                              
                              // Enable Soft SPI for NRF radio (note different radio wiring is required)
                              // The W5100 ethernet module seems to have a hard time co-operate with 
                              // radio on the same spi bus.
                              //#if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD)
                                //#define MY_SOFTSPI
                                //#define MY_SOFT_SPI_SCK_PIN 14
                                //#define MY_SOFT_SPI_MISO_PIN 16
                                //#define MY_SOFT_SPI_MOSI_PIN 15
                              //#endif  
                              
                              // When W5100 is connected we have to move CE/CSN pins for NRF radio
                              //#define MY_RF24_CE_PIN 5
                              //#define MY_RF24_CS_PIN 6
                              
                              
                              
                              #define MY_IP_ADDRESS 192,168,1,169   // If this is disabled, DHCP is used to retrieve address
                              // Renewal period if using DHCP
                              //#define MY_IP_RENEWAL_INTERVAL 60000
                              // The port to keep open on node server mode / or port to contact in client mode
                              #define MY_PORT 5003        
                               
                              // The MAC address can be anything you want but should be unique on your network.
                              // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
                              // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
                               #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
                              
                              // Flash leds on rx/tx/err
                               #define MY_LEDS_BLINKING_FEATURE
                              // Set blinking period
                               #define MY_DEFAULT_LED_BLINK_PERIOD 300
                              
                              // Enable inclusion mode
                               #define MY_INCLUSION_MODE_FEATURE
                              // Enable Inclusion mode button on gateway
                              // #define MY_INCLUSION_BUTTON_FEATURE
                              // Set inclusion mode duration (in seconds)
                               #define MY_INCLUSION_MODE_DURATION 60 
                              // Digital pin used for inclusion mode button
                              // #define MY_INCLUSION_MODE_BUTTON_PIN  4 
                              
                              #include <SPI.h>
                              #include <Ethernet.h>
                              #include <MySensor.h>
                              
                              
                              #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 CHILD_ID 1   // Id of the sensor child
                              boolean lastTripped = 0;
                              
                              
                              // Initialize motion message
                              MyMessage msg(CHILD_ID, V_TRIPPED);
                              
                              void setup()  
                              {  
                                 
                              
                                // Send the sketch version information to the gateway and Controller
                                sendSketchInfo("Motion Sensor", "1.0");
                              
                                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)
                                present(CHILD_ID, S_MOTION);
                              }
                              
                              
                              
                              void loop()     
                              {     
                                
                                // Read digital motion value
                                boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
                              
                                  if (lastTripped != tripped ) {
                                    send(msg.set(tripped?"1":"0")); // Send new state and request ack back
                                    Serial.println(tripped);
                                    lastTripped=tripped;
                              }
                              }
                              

                              @hek
                              After other factory reset , start button now work !! but the inclusion no ! I press start and after 1 minute change automatically to stop.

                              M 1 Reply Last reply
                              0
                              • M mlg

                                @einarth

                                I already commented this line in the code , my final code

                                // Enable debug prints to serial monitor
                                #define MY_DEBUG 
                                
                                // Enable gateway ethernet module type 
                                #define MY_GATEWAY_W5100
                                
                                // W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
                                //#define MY_W5100_SPI_EN 4  
                                
                                // Enable Soft SPI for NRF radio (note different radio wiring is required)
                                // The W5100 ethernet module seems to have a hard time co-operate with 
                                // radio on the same spi bus.
                                //#if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD)
                                  //#define MY_SOFTSPI
                                  //#define MY_SOFT_SPI_SCK_PIN 14
                                  //#define MY_SOFT_SPI_MISO_PIN 16
                                  //#define MY_SOFT_SPI_MOSI_PIN 15
                                //#endif  
                                
                                // When W5100 is connected we have to move CE/CSN pins for NRF radio
                                //#define MY_RF24_CE_PIN 5
                                //#define MY_RF24_CS_PIN 6
                                
                                
                                
                                #define MY_IP_ADDRESS 192,168,1,169   // If this is disabled, DHCP is used to retrieve address
                                // Renewal period if using DHCP
                                //#define MY_IP_RENEWAL_INTERVAL 60000
                                // The port to keep open on node server mode / or port to contact in client mode
                                #define MY_PORT 5003        
                                 
                                // The MAC address can be anything you want but should be unique on your network.
                                // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
                                // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
                                 #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
                                
                                // Flash leds on rx/tx/err
                                 #define MY_LEDS_BLINKING_FEATURE
                                // Set blinking period
                                 #define MY_DEFAULT_LED_BLINK_PERIOD 300
                                
                                // Enable inclusion mode
                                 #define MY_INCLUSION_MODE_FEATURE
                                // Enable Inclusion mode button on gateway
                                // #define MY_INCLUSION_BUTTON_FEATURE
                                // Set inclusion mode duration (in seconds)
                                 #define MY_INCLUSION_MODE_DURATION 60 
                                // Digital pin used for inclusion mode button
                                // #define MY_INCLUSION_MODE_BUTTON_PIN  4 
                                
                                #include <SPI.h>
                                #include <Ethernet.h>
                                #include <MySensor.h>
                                
                                
                                #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 CHILD_ID 1   // Id of the sensor child
                                boolean lastTripped = 0;
                                
                                
                                // Initialize motion message
                                MyMessage msg(CHILD_ID, V_TRIPPED);
                                
                                void setup()  
                                {  
                                   
                                
                                  // Send the sketch version information to the gateway and Controller
                                  sendSketchInfo("Motion Sensor", "1.0");
                                
                                  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)
                                  present(CHILD_ID, S_MOTION);
                                }
                                
                                
                                
                                void loop()     
                                {     
                                  
                                  // Read digital motion value
                                  boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
                                
                                    if (lastTripped != tripped ) {
                                      send(msg.set(tripped?"1":"0")); // Send new state and request ack back
                                      Serial.println(tripped);
                                      lastTripped=tripped;
                                }
                                }
                                

                                @hek
                                After other factory reset , start button now work !! but the inclusion no ! I press start and after 1 minute change automatically to stop.

                                M Offline
                                M Offline
                                mlg
                                wrote on last edited by
                                #17

                                Any Ideia?

                                1 Reply Last reply
                                0
                                • hekH Offline
                                  hekH Offline
                                  hek
                                  Admin
                                  wrote on last edited by
                                  #18

                                  Inclusion mode is supposed to stop after 1 minute. So it sounds like communication between controller and gateway is fine.

                                  Did you reset the sensor node during inclusion mode was activated?
                                  Have you looked in the gateway debug log (while gateway is connected to your computer)?

                                  M 2 Replies Last reply
                                  0
                                  • hekH hek

                                    Inclusion mode is supposed to stop after 1 minute. So it sounds like communication between controller and gateway is fine.

                                    Did you reset the sensor node during inclusion mode was activated?
                                    Have you looked in the gateway debug log (while gateway is connected to your computer)?

                                    M Offline
                                    M Offline
                                    mlg
                                    wrote on last edited by mlg
                                    #19

                                    @hek

                                    How I make sensor node reset ? Disconnected all cables ? digital pin 3 + gnd + 5v ?

                                    If I disconect all cables I log that

                                    0;255;3;0;9;Starting gateway (R-NGA-, 2.0.0-beta)
                                    IP: 192.168.1.169
                                    0;255;3;0;9;Init complete, id=0, parent=0, distance=0
                                    0;255;3;0;9;Eth: connect
                                    0;255;3;0;9;Eth: 0;0;3;0;5;1
                                    0;255;3;0;9;Eth: 
                                    1
                                    0
                                    1
                                    0
                                    1
                                    0
                                    1
                                    0
                                    1
                                    0
                                    1
                                    0
                                    1
                                    0
                                    1
                                    0
                                    
                                    M 1 Reply Last reply
                                    0
                                    • M mlg

                                      @hek

                                      How I make sensor node reset ? Disconnected all cables ? digital pin 3 + gnd + 5v ?

                                      If I disconect all cables I log that

                                      0;255;3;0;9;Starting gateway (R-NGA-, 2.0.0-beta)
                                      IP: 192.168.1.169
                                      0;255;3;0;9;Init complete, id=0, parent=0, distance=0
                                      0;255;3;0;9;Eth: connect
                                      0;255;3;0;9;Eth: 0;0;3;0;5;1
                                      0;255;3;0;9;Eth: 
                                      1
                                      0
                                      1
                                      0
                                      1
                                      0
                                      1
                                      0
                                      1
                                      0
                                      1
                                      0
                                      1
                                      0
                                      1
                                      0
                                      
                                      M Offline
                                      M Offline
                                      mlg
                                      wrote on last edited by
                                      #20

                                      @hek

                                      It's normal? If I disconnect the cables get 1/0/1/0 and not stopped

                                      1 Reply Last reply
                                      0
                                      • hekH hek

                                        Inclusion mode is supposed to stop after 1 minute. So it sounds like communication between controller and gateway is fine.

                                        Did you reset the sensor node during inclusion mode was activated?
                                        Have you looked in the gateway debug log (while gateway is connected to your computer)?

                                        M Offline
                                        M Offline
                                        mlg
                                        wrote on last edited by mlg
                                        #21

                                        @hek

                                        I found one solution,I turn on sensor in ethernet gateway and press start inclusion and reload engine in Vera .In this way automatically add the sensor

                                        However compiled another code by adding a relay but is not added is something wrong?
                                        it is necessary void before, presentation ? and assign a child ID to RELAY ?

                                        /**
                                         * The MySensors Arduino library handles the wireless radio link and protocol
                                         * between your home built sensors/actuators and HA controller of choice.
                                         * The sensors forms a self healing radio network with optional repeaters. Each
                                         * repeater and gateway builds a routing tables in EEPROM which keeps track of the
                                         * network topology allowing messages to be routed to nodes.
                                         *
                                         * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
                                         * Copyright (C) 2013-2015 Sensnology AB
                                         * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
                                         *
                                         * Documentation: http://www.mysensors.org
                                         * Support Forum: http://forum.mysensors.org
                                         *
                                         * This program is free software; you can redistribute it and/or
                                         * modify it under the terms of the GNU General Public License
                                         * version 2 as published by the Free Software Foundation.
                                         *
                                         *******************************
                                         *
                                         * REVISION HISTORY
                                         * Version 1.0 - Henrik EKblad
                                         * Contribution by a-lurker and Anticimex,
                                         * Contribution by Norbert Truchsess <norbert.truchsess@t-online.de>
                                         * Contribution by Tomas Hozza <thozza@gmail.com>
                                         *
                                         *
                                         * DESCRIPTION
                                         * The EthernetGateway sends data received from sensors to the ethernet link.
                                         * The gateway also accepts input on ethernet interface, which is then sent out to the radio network.
                                         *
                                         * The GW code is designed for Arduino 328p / 16MHz.  ATmega168 does not have enough memory to run this program.
                                         *
                                         * LED purposes:
                                         * - To use the feature, uncomment WITH_LEDS_BLINKING in MyConfig.h
                                         * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
                                         * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
                                         * - ERR (red) - fast blink on error during transmission error or recieve crc error
                                         *
                                         * See http://www.mysensors.org/build/ethernet_gateway for wiring instructions.
                                         *
                                         */
                                        
                                        // Enable debug prints to serial monitor
                                        #define MY_DEBUG 
                                        
                                        // Enable gateway ethernet module type 
                                        #define MY_GATEWAY_W5100
                                        
                                        #define MY_IP_ADDRESS 192,168,1,169   // If this is disabled, DHCP is used to retrieve address
                                        // Renewal period if using DHCP
                                        //#define MY_IP_RENEWAL_INTERVAL 60000
                                        // The port to keep open on node server mode / or port to contact in client mode
                                        #define MY_PORT 5003        
                                         
                                        // The MAC address can be anything you want but should be unique on your network.
                                        // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
                                        // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
                                         #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
                                        
                                        // Flash leds on rx/tx/err
                                        // #define MY_LEDS_BLINKING_FEATURE
                                        // Set blinking period
                                        // #define MY_DEFAULT_LED_BLINK_PERIOD 300
                                        
                                        // Enable inclusion mode
                                         #define MY_INCLUSION_MODE_FEATURE
                                        // Enable Inclusion mode button on gateway
                                        // #define MY_INCLUSION_BUTTON_FEATURE
                                        // Set inclusion mode duration (in seconds)
                                         #define MY_INCLUSION_MODE_DURATION 60 
                                        // Digital pin used for inclusion mode button
                                        // #define MY_INCLUSION_MODE_BUTTON_PIN  4 
                                        
                                        #include <SPI.h>
                                        #include <Ethernet.h>
                                        #include <MySensor.h>
                                        
                                        
                                        #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 CHILD_ID 1   // Id of the sensor child
                                        boolean lastTripped = 0;
                                        
                                        #define RELAY_1  2  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
                                        #define NUMBER_OF_RELAYS 1 // Total number of attached relays
                                        #define RELAY_ON 1  // GPIO value to write to turn on attached relay
                                        #define RELAY_OFF 0 // GPIO value to write to turn off attached relay
                                        
                                        
                                        // Initialize motion message
                                        MyMessage msg(CHILD_ID, V_TRIPPED);
                                        
                                        void setup()  
                                        {  
                                           
                                          // Send the sketch version information to the gateway and Controller
                                            sendSketchInfo("Motion Relay", "1.0");
                                         
                                            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)
                                            present(CHILD_ID, S_MOTION);
                                        
                                            for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) {
                                            present(sensor, S_LIGHT);
                                          // Then set relay pins in output mode
                                            pinMode(pin, OUTPUT);   
                                          // Set relay to last known state (using eeprom storage) 
                                            digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF);
                                          }
                                        }
                                        
                                        
                                        void loop()     
                                        {     
                                          
                                          // Read digital motion value
                                          boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
                                        
                                            if (lastTripped != tripped ) {
                                              send(msg.set(tripped?"1":"0")); // Send new state and request ack back
                                              Serial.println(tripped);
                                              lastTripped=tripped;
                                        }
                                        }
                                        
                                        void incomingMessage(const MyMessage &message) {
                                          // We only expect one type of message from controller. But we better check anyway.
                                          if (message.type==V_LIGHT) {
                                             // Change relay state
                                             digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);
                                             // Store state in eeprom
                                             saveState(message.sensor, message.getBool());
                                             // Write some debug info
                                             Serial.print("Incoming change for sensor:");
                                             Serial.print(message.sensor);
                                             Serial.print(", New status: ");
                                             Serial.println(message.getBool());
                                           } 
                                        }
                                        
                                        1 Reply Last reply
                                        0
                                        • stofakillerS Offline
                                          stofakillerS Offline
                                          stofakiller
                                          wrote on last edited by
                                          #22

                                          Hi,

                                          I did'nt have much succes with the radiodevice, and i have made the gateway :-)

                                          But have i missed the code eg for the sensors???

                                          Regards,
                                          Jan

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


                                          22

                                          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