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. Development
  3. Adding sensors and relays to serial gateway
  • Getting Started
  • Controller
  • Build
  • Hardware
  • Download/API
  • Forum
  • Store

Adding sensors and relays to serial gateway

Scheduled Pinned Locked Moved Development
serial protocolchild-sensor-idopenhabserial gatewayarduino nano
12 Posts 4 Posters 5.9k Views
  • 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.
  • sundberg84S Offline
    sundberg84S Offline
    sundberg84
    Hardware Contributor
    wrote on last edited by sundberg84
    #2

    Hi! Do you have a gateway and a node working as a relay?

    Child ID is assigned 0 for first sensor/accutor 1 for the next and so on... this is done automaticly if you use the relay sketch from http://www.mysensors.org/build/relay

    for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) {
        // Register all sensors to gw (they will be created as child devices)
        gw.present(sensor, S_LIGHT);```
    

    Maybe if you post your code and version its easier to help you, or what you have done so far.

    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
    • T Offline
      T Offline
      Tino
      wrote on last edited by
      #3

      Thanks for the fast reply!

      At this point I have my arduino nano with the mysensors serial gateway sketch uploaded to it and I have a 4 relayboard connected to the arduino. As I said, i'm new to Arduino programming and such. So the first question is, what to do next? Upload that relay code and include the code you sent?

      AWIA 1 Reply Last reply
      0
      • T Tino

        Thanks for the fast reply!

        At this point I have my arduino nano with the mysensors serial gateway sketch uploaded to it and I have a 4 relayboard connected to the arduino. As I said, i'm new to Arduino programming and such. So the first question is, what to do next? Upload that relay code and include the code you sent?

        AWIA Offline
        AWIA Offline
        AWI
        Hero Member
        wrote on last edited by
        #4

        @Tino Do you have only one nano for the gateway and relay node? or do you have two (a gateway nano and a node nano)?

        1 Reply Last reply
        0
        • T Offline
          T Offline
          Tino
          wrote on last edited by
          #5

          @AWI

          I do have one arduino nano for the gateway, which is connected to my raspberry pi with the openHAB server. And furthermore I have four arduinos that I can use as nodes to connect sensors and relays to.

          AWIA 1 Reply Last reply
          0
          • T Tino

            @AWI

            I do have one arduino nano for the gateway, which is connected to my raspberry pi with the openHAB server. And furthermore I have four arduinos that I can use as nodes to connect sensors and relays to.

            AWIA Offline
            AWIA Offline
            AWI
            Hero Member
            wrote on last edited by
            #6

            @Tino Then next thing to do is get the gateway (with radio) running with the gateway sketch and verify the working with the serial monitor.

            If you completed that step, build the sensor node (with radio), load the relay sketch and verify if it connects to the gateway.

            1 Reply Last reply
            0
            • T Offline
              T Offline
              Tino
              wrote on last edited by
              #7

              @AWI

              As said, I've uploaded the gateway code and received this: 0;0;3;0;14;Gateway startup complete
              And I uploaded the http://www.mysensors.org/build/relay sketch to the other arduino, only changed the number of relays in the sketch. This is what I got from the relay sketch:

              find parent
              send: 105-105-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
              find parent
              send: 105-105-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
              find parent
              send: 105-105-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
              repeater started, id=105, parent=255, distance=255
              find parent
              send: 105-105-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
              find parent
              send: 105-105-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
              find parent
              send: 105-105-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
              find parent
              send: 105-105-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
              find parent
              send: 105-105-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
              find parent
              send: 105-105-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:

              1 Reply Last reply
              0
              • T Offline
                T Offline
                Tino
                wrote on last edited by
                #8

                How to find out what the ChildIDs are of the relays? Or is this just guessing?

                1 Reply Last reply
                0
                • HoffanH Offline
                  HoffanH Offline
                  Hoffan
                  wrote on last edited by
                  #9

                  What are you use as controller??

                  T 1 Reply Last reply
                  0
                  • HoffanH Hoffan

                    What are you use as controller??

                    T Offline
                    T Offline
                    Tino
                    wrote on last edited by Tino
                    #10

                    @Hoffan I am using OpenHAB as automation on a Raspberry PI 2B and connected to a Arduino Nano.
                    Next to that multiple (wireless) Nano's. The Nanos are connected with a serial gateway, atleast thats whats I am trying to achieve

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

                      Find parent means the node sends a request and trying to find its way to the gateway.
                      Do you see anything in the gateway log during this time?

                      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
                      • T Offline
                        T Offline
                        Tino
                        wrote on last edited by Tino
                        #12

                        @AWI @Hoffan @sundberg84
                        I can see both sketches are working, this is what the gateway prints out:

                        0;0;3;0;14;Gateway startup complete.
                        0;0;3;0;9;read: 105-105-0 s=255,c=0,t=18,pt=0,l=5:1.5.1
                        105;255;0;0;18;1.5.1
                        0;0;3;0;9;read: 105-105-0 s=255,c=3,t=6,pt=1,l=1:0
                        105;255;3;0;6;0
                        0;0;3;0;9;read: 105-105-0 s=255,c=3,t=11,pt=0,l=5:Relay
                        105;255;3;0;11;Relay
                        0;0;3;0;9;read: 105-105-0 s=255,c=3,t=12,pt=0,l=3:1.0
                        105;255;3;0;12;1.0
                        0;0;3;0;9;read: 105-105-0 s=1,c=0,t=3,pt=0,l=0:
                        105;1;0;0;3;
                        0;0;3;0;9;read: 105-105-0 s=2,c=0,t=3,pt=0,l=0:
                        105;2;0;0;3;
                        0;0;3;0;9;read: 105-105-0 s=3,c=0,t=3,pt=0,l=0:
                        105;3;0;0;3;
                        0;0;3;0;9;read: 105-105-0 s=4,c=0,t=3,pt=0,l=0:
                        105;4;0;0;3;

                        Is this correct?

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


                        1

                        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