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. Can't figure out what I'm doing wrong with test setup

Can't figure out what I'm doing wrong with test setup

Scheduled Pinned Locked Moved Troubleshooting
32 Posts 4 Posters 4.3k Views 4 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.
  • linus72982L Offline
    linus72982L Offline
    linus72982
    wrote on last edited by
    #8

    Okay, I made a lot of progress with your guys' help. I added a capacitor and checked the output from the pro mini. It said Radio Init Failed or something similar. I checked for that error and it looks like bad power or wiring. I tried rewiring and checking power -- nothing wrong, so I switched out the radio and that seemed to work. Now when I check the serial monitor for the nano, I get this:

    0;0;3;0;9;gateway started, id=0, parent=0, distance=0
    0;0;3;0;14;Gateway startup complete.

    like usual, but now I also get this when I separate the magnets:

    0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;
    0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;
    0;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;

    So, one more problem left -- I only ever can get three outputs from separating and repairing the magnets. Those three above. Thereafter, I get nothing when I separate even if I wait for minutes. I try to separate and repair a few different times, tried waiting in between each, still nothing after the first three. When I restart the serial monitor, I get three more, but no more after that.

    Thanks so much for your help so far, I'm getting close -- any ideas about this last glitch? Is that just a problem with the serial monitor or is it a problem with my setup?

    1 Reply Last reply
    0
    • linus72982L Offline
      linus72982L Offline
      linus72982
      wrote on last edited by
      #9

      I wrote up a python serial reading script and figured out that I only ever can get one response for separating the magnets before it stops, so it can't be the arduino serial monitor as I just tested it on my own and still it stalls out. Not sure if there's a setting for this somewhere in the sketch or what.

      1 Reply Last reply
      0
      • martinhjelmareM Offline
        martinhjelmareM Offline
        martinhjelmare
        Plugin Developer
        wrote on last edited by
        #10

        The message read by the gateway was an internal message of subtype 3, which is a request for node id. The node will send this message if no manual node id is set in the sketch. If using automatic node id, a controller needs to be connected to the gateway, and the controller needs to be able to hand out node ids.

        Read about this on the api page on the mysensors web.

        1 Reply Last reply
        0
        • linus72982L Offline
          linus72982L Offline
          linus72982
          wrote on last edited by
          #11

          So, the actual message is a subtype 9, trace-log a message and it's sending "read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0: 255;255;3;0;3;" correct? So, it's trace-logging a node-id request? The thing is, these messages only happen when I separate or re-pair the magnet sensors.

          Two questions: Is this a normal message -- I mean, is everything working well? I don't care how node-ids get passed out. I assume the serial gateway example sketch has it handing out node-ids?

          If everything is working well -- how do I get my sensor open/closed messages? I don't seem to be getting those. I know the sensor is doing something as the trace-log messages only happen when I trigger the sensor.

          I'm not sure where to go from here.

          AWIA 1 Reply Last reply
          0
          • linus72982L linus72982

            So, the actual message is a subtype 9, trace-log a message and it's sending "read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0: 255;255;3;0;3;" correct? So, it's trace-logging a node-id request? The thing is, these messages only happen when I separate or re-pair the magnet sensors.

            Two questions: Is this a normal message -- I mean, is everything working well? I don't care how node-ids get passed out. I assume the serial gateway example sketch has it handing out node-ids?

            If everything is working well -- how do I get my sensor open/closed messages? I don't seem to be getting those. I know the sensor is doing something as the trace-log messages only happen when I trigger the sensor.

            I'm not sure where to go from here.

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

            @linus72982 You need a "controller" to issue node id's. If you don't have one you can assign a fixed id. This will allow your sketch to move on and show it's real Tricks.

            1 Reply Last reply
            0
            • linus72982L Offline
              linus72982L Offline
              linus72982
              wrote on last edited by
              #13

              I have the nano connected to the gateway radio -- isn't that the controller?

              mfalkviddM 1 Reply Last reply
              0
              • linus72982L Offline
                linus72982L Offline
                linus72982
                wrote on last edited by
                #14

                If I do fixed ID's, where do I do that? I assume I do that in the BinarySwitchSleepSensor sketch, I'm just not sure where. It looks like there is already a PRIMARY_CHILD_ID and SECONDARY_CHILD_ID assigned (3 and 4 respectively). Is that what those are?

                1 Reply Last reply
                0
                • linus72982L Offline
                  linus72982L Offline
                  linus72982
                  wrote on last edited by
                  #15

                  Okay, I tooled around and figured it out. I assigned a manual id in the begin() on the pro mini. But, I still have a problem:

                  I get the sensor open and closed messages just fine -- for about 30 seconds. After that, I get nothing through the serial port. I restart the serial monitor and I can get 30 seconds more. I opened my Python script and same thing. I get about 10 seconds of messages on that. I'm not sure what's going on here. Does anyone else know?

                  mfalkviddM 1 Reply Last reply
                  0
                  • linus72982L linus72982

                    I have the nano connected to the gateway radio -- isn't that the controller?

                    mfalkviddM Offline
                    mfalkviddM Offline
                    mfalkvidd
                    Mod
                    wrote on last edited by
                    #16

                    @linus72982 said:

                    I have the nano connected to the gateway radio -- isn't that the controller?

                    The nano is the gateway.

                    See https://www.mysensors.org/about/network for a description of the different parts. https://www.mysensors.org/controller/ has a list of supported controllers.

                    1 Reply Last reply
                    0
                    • linus72982L linus72982

                      Okay, I tooled around and figured it out. I assigned a manual id in the begin() on the pro mini. But, I still have a problem:

                      I get the sensor open and closed messages just fine -- for about 30 seconds. After that, I get nothing through the serial port. I restart the serial monitor and I can get 30 seconds more. I opened my Python script and same thing. I get about 10 seconds of messages on that. I'm not sure what's going on here. Does anyone else know?

                      mfalkviddM Offline
                      mfalkviddM Offline
                      mfalkvidd
                      Mod
                      wrote on last edited by mfalkvidd
                      #17

                      @linus72982 said:

                      Okay, I tooled around and figured it out. I assigned a manual id in the begin() on the pro mini. But, I still have a problem:

                      I get the sensor open and closed messages just fine -- for about 30 seconds. After that, I get nothing through the serial port. I restart the serial monitor and I can get 30 seconds more. I opened my Python script and same thing. I get about 10 seconds of messages on that. I'm not sure what's going on here. Does anyone else know?

                      Great progress!
                      My guess would be a power problem or an error in the sketch. Could you post your sketch so we can take a look?

                      1 Reply Last reply
                      0
                      • linus72982L Offline
                        linus72982L Offline
                        linus72982
                        wrote on last edited by
                        #18

                        Ahh, I got a bit tripped up in the terminology. The controller is my computer. I'm going to be using a custom python script to control, I'm using the gateway as a sort of dongle from the radio network to the computer. Either way, I prefer the hard-coded node-ids so handing out IDs is moot now, anyway.

                        So, to my problem, it can't be power because everything works again when I restart the serial controller. It also works more when I stop and restart my python serial monitor. It's weird, there is no communication from the computer to the gateway when I restart the monitor so I don't think it can be anything in the gateway at all, it has to be from the USB, operating system of the computer (win 10), or the monitors (unlikely because I'm using two different ones). It's almost like there's a timeout on the port or something.

                        In any case, here's the sketch in case my reasoning above isn't sound and there is something there that is affecting operation (this sketch is, literally, just the example SerialGateway from MySensors but with the added arguments in the begin() line:

                        /**
                         * 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.
                         *
                         *******************************
                         *
                         * DESCRIPTION
                         *
                         * Simple binary switch example 
                         * Connect button or door/window reed switch between 
                         * digitial I/O pin 3 (BUTTON_PIN below) and GND.
                         * http://www.mysensors.org/build/binary
                         */
                        
                        
                        #include <MySensor.h>
                        #include <SPI.h>
                        #include <Bounce2.h>
                        
                        #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, CHILD_ID, false);
                        
                         // 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
                             gw.send(msg.set(value==HIGH ? 1 : 0));
                             oldValue = value;
                          }
                        } 
                        
                        1 Reply Last reply
                        0
                        • linus72982L Offline
                          linus72982L Offline
                          linus72982
                          wrote on last edited by
                          #19

                          I did a little reading and found out my earlier statement that there is no communication between the computer and the gateway when I start the serial monitor is incorrect. Starting a connection resets the board, auto-reset. I know this is happening because there is a green led blink when I click on the serial monitor.

                          So, now there are more options for what it could be -- I'll check power and some other things and come back. Let me know if there's anything in the sketch that looks like it could be doing it. I don't know C well at all.

                          AWIA 1 Reply Last reply
                          0
                          • linus72982L linus72982

                            I did a little reading and found out my earlier statement that there is no communication between the computer and the gateway when I start the serial monitor is incorrect. Starting a connection resets the board, auto-reset. I know this is happening because there is a green led blink when I click on the serial monitor.

                            So, now there are more options for what it could be -- I'll check power and some other things and come back. Let me know if there's anything in the sketch that looks like it could be doing it. I don't know C well at all.

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

                            @linus72982 what does the serial monitor on your node show when you strart the node now. Any radio failures?
                            Your sketch looks fine.

                            1 Reply Last reply
                            0
                            • linus72982L Offline
                              linus72982L Offline
                              linus72982
                              wrote on last edited by
                              #21

                              The monitor only shows Gateway Startup Complete or whatever the initial message is. I don't have two of the cables needed so I can't check the pro mini at the same time. If I check the pro mini, then I can't get power to gateway.

                              I checked power to the pro mini, the pro mini's radio, and the nano's radio -- all good, even after I "time it out".

                              I noticed one thing, though -- after a reset, I can go for many minutes without triggering the sensor but once I do, I only get one sensor trigger before it stops reporting. If I start triggering the sensor immediately after a reset, I can get about 5 seconds of triggering before it stops reporting. If I do REALLY fast triggering of the sensor on and off I can go indefinitely. Weird?

                              1 Reply Last reply
                              0
                              • linus72982L Offline
                                linus72982L Offline
                                linus72982
                                wrote on last edited by
                                #22

                                Also, keep in mind, I can only start getting data again after a timeout by resetting the nano. Even if I reset it manually with the same serial monitor left open, I can get data back by triggering the sensors -- but again, only for a few seconds. If I reset the pro-mini, I don't get data back, just the nano.

                                1 Reply Last reply
                                0
                                • linus72982L Offline
                                  linus72982L Offline
                                  linus72982
                                  wrote on last edited by
                                  #23

                                  Just a thought -- does the nano require I respond that I'm receiving the messages? As I'm only monitoring and not sending anything, could it just time out sending it if I don't tell it I'm still listening? Being that I'm not yet using a controller, if it does require some sort of response, could that be the problem?

                                  AWIA 1 Reply Last reply
                                  0
                                  • linus72982L linus72982

                                    Just a thought -- does the nano require I respond that I'm receiving the messages? As I'm only monitoring and not sending anything, could it just time out sending it if I don't tell it I'm still listening? Being that I'm not yet using a controller, if it does require some sort of response, could that be the problem?

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

                                    @linus72982 it sounds a little confusing..
                                    Let's start again.

                                    The nano is your serial gateway node. The pro mini is your sensor node.
                                    The MySensors protocol needs a communication between two nodes to work. So both the nodes must be switched on.
                                    As far as I can see your gateway seems to function. So connect that to a powered usb port (or charger). Then connect the pro mini to a serial monitor (with ftdi) and tell us what it is doing.

                                    1 Reply Last reply
                                    0
                                    • linus72982L Offline
                                      linus72982L Offline
                                      linus72982
                                      wrote on last edited by
                                      #25

                                      Yes, both nodes were switched on -- what I was saying was that I don't have two of the mini-USB cables, just one that came with the FTDI. So, if I have it plugged into the nano to power everything, I can't see the pro mini's output. If I have it plugged into the pro mini, I can't power the nano unless I move around some cables. I will head to the store in a bit and grab another usb cable in a bit and let you know the output of both.

                                      1 Reply Last reply
                                      0
                                      • linus72982L Offline
                                        linus72982L Offline
                                        linus72982
                                        wrote on last edited by
                                        #26

                                        Okay, I got another cable and now have the pro-mini's output:

                                        It starts up and does this automatically:

                                        send: 3-3-0-0 s=255,c=3,t=15,pt=2,l=2,sg=0,st=fail:0
                                        send: 3-3-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,st=fail:1.5.4
                                        send: 3-3-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=fail:0
                                        sensor started, id=3, parent=0, distance=1
                                        send: 3-3-0-0 s=3,c=0,t=0,pt=0,l=0,sg=0,st=fail:
                                        send: 3-3-0-0 s=3,c=1,t=16,pt=2,l=2,sg=0,st=fail:0
                                        

                                        Then, when I trigger the sensor open:

                                        
                                        send: 3-3-0-0 s=3,c=1,t=16,pt=2,l=2,sg=0,st=fail:1
                                        find parent
                                        send: 3-3-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
                                        

                                        Then closed:

                                        
                                        send: 3-3-0-0 s=3,c=1,t=16,pt=2,l=2,sg=0,st=fail:0
                                        

                                        And opened again:

                                        
                                        send: 3-3-0-0 s=3,c=1,t=16,pt=2,l=2,sg=0,st=fail:1
                                        

                                        After a few opens/closes, I get the find parent again:

                                        find parent
                                        send: 3-3-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
                                        
                                        
                                        AWIA 1 Reply Last reply
                                        0
                                        • linus72982L linus72982

                                          Okay, I got another cable and now have the pro-mini's output:

                                          It starts up and does this automatically:

                                          send: 3-3-0-0 s=255,c=3,t=15,pt=2,l=2,sg=0,st=fail:0
                                          send: 3-3-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,st=fail:1.5.4
                                          send: 3-3-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=fail:0
                                          sensor started, id=3, parent=0, distance=1
                                          send: 3-3-0-0 s=3,c=0,t=0,pt=0,l=0,sg=0,st=fail:
                                          send: 3-3-0-0 s=3,c=1,t=16,pt=2,l=2,sg=0,st=fail:0
                                          

                                          Then, when I trigger the sensor open:

                                          
                                          send: 3-3-0-0 s=3,c=1,t=16,pt=2,l=2,sg=0,st=fail:1
                                          find parent
                                          send: 3-3-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
                                          

                                          Then closed:

                                          
                                          send: 3-3-0-0 s=3,c=1,t=16,pt=2,l=2,sg=0,st=fail:0
                                          

                                          And opened again:

                                          
                                          send: 3-3-0-0 s=3,c=1,t=16,pt=2,l=2,sg=0,st=fail:1
                                          

                                          After a few opens/closes, I get the find parent again:

                                          find parent
                                          send: 3-3-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,st=bc:
                                          
                                          
                                          AWIA Offline
                                          AWIA Offline
                                          AWI
                                          Hero Member
                                          wrote on last edited by
                                          #27

                                          @linus72982 as expected, there is no radio contact between the node and gateway. If the node can't find a parent node (gateway) it will keep on searching. Make sure the radio is working by following the flowchart mentioned by @mfalkvidd.

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


                                          18

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          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