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. Development
  3. {DEV} Multi-Sensor Node goes into boot loop

{DEV} Multi-Sensor Node goes into boot loop

Scheduled Pinned Locked Moved Development
21 Posts 8 Posters 5.2k Views 8 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.
  • D Offline
    D Offline
    drock1985
    wrote on last edited by
    #11

    Getting there.... I had to re-add the OneWire, Wire and DallasTemperature sensor and make a few modifications to the sketch, but I have the beginnings now and it is showing up properly in Home-Assistant and responding nicely. I'm off to make supper, but the only thing I can see needing to modify big time is adding "send temp on change only" and getting the temp to show to a decimal place.

    Here is the sketch for now:

    /**
     * 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
     * 
     * DESCRIPTION
     * Motion Sensor example using HC-SR501 
     * http://www.mysensors.org/build/motion
     *
     */
    
    // Enable debug prints
    #define MY_DEBUG
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    #define MY_NODE_ID 21
    #include <SPI.h>
    #include <MySensors.h>
    #include <DallasTemperature.h>
    #include <OneWire.h>
    #include <BH1750.h>
    #include <Wire.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 COMPARE_TEMP 1 // Send temperature only if changed? 1 = Yes 0 = No
    #define ONE_WIRE_BUS 4 // Pin where dallase sensor is connected 
    #define MAX_ATTACHED_DS18B20 16
    OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
    DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature. 
    float lastTemperature[MAX_ATTACHED_DS18B20];
    int numSensors=0;
    boolean receivedConfig = false;
    boolean metric = true;
    
    
    #define CHILD_ID_MOTION 1   // Id of the sensor child
    #define CHILD_ID_TEMP 2   // ID of Temperature Sensor
    #define CHILD_ID_LUX 3  // ID of Lux Sensor
    
    BH1750 lightSensor;
    
    // Initialize motion message
    MyMessage msgMotion(CHILD_ID_MOTION, V_TRIPPED);
    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
    MyMessage msgLux(CHILD_ID_LUX, V_LIGHT_LEVEL);
    
    uint16_t lastlux;
    
    void setup()  
    {  
      pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
      lightSensor.begin();
      // Startup up the OneWire library
      sensors.begin();
      // requestTemperatures() will not block current thread
      sensors.setWaitForConversion(false);
      
    }
    
    void presentation()  {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("yes", "1.0");
    
      // Register all sensors to gw (they will be created as child devices)
      present(CHILD_ID_MOTION, S_MOTION);
      present(CHILD_ID_TEMP, S_TEMP);
      present(CHILD_ID_LUX, S_LIGHT_LEVEL);
    }
    
    void loop()     
    {     
      // Read digital motion value
      boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
            
      Serial.println(tripped);
      send(msgMotion.set(tripped?"1":"0"));  // Send tripped value to gw 
    
      {     
      uint16_t lux = lightSensor.readLightLevel();// Get Lux value
      Serial.println(lux);
      if (lux != lastlux) {
          send(msgLux.set(lux));
          lastlux = lux;
      }
    
       // Fetch temperatures from Dallas sensors
      sensors.requestTemperatures();
    
    
        // Fetch and round temperature to one decimal
        int temperature = (((sensors.getTempCByIndex(0)) * 10.)) / 10.;
     
          // Send in the new temperature
          send(msgTemp.set(temperature));
        }
      
    
      // Sleep until interrupt comes in on motion sensor. Send update every two minute.
      sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);
    }
    
    
    

    My Projects
    2 Door Chime Sensor
    Washing Machine Monitor

    1 Reply Last reply
    0
    • D drock1985

      hi @rollercontainer

      Thanks for looking into this with me. I had some more luck believe it or not after upgrading to 2.0.0 on my Gateway. Using the same sketch as I posted for my node, and updating my ESP8266 Gateway to the 2.0 sketch solved the reboot issue. Only problem now is the DallasTemperature sensor does not seem to be registering with the gateway.

      Of curious notice, when I looked through the example sketches in the new MySensors 2.0 Library, i did not see an example sketch for the DallasTemperature sensors this time around.

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

      @drock1985 I had similar problems with the failure messages. After an upgrade of my repeater it functions again. Development seems to have some issues with backward compatibility. Hard to reproduce the errors..

      D 1 Reply Last reply
      0
      • AWIA AWI

        @drock1985 I had similar problems with the failure messages. After an upgrade of my repeater it functions again. Development seems to have some issues with backward compatibility. Hard to reproduce the errors..

        D Offline
        D Offline
        drock1985
        wrote on last edited by
        #13

        @AWI

        Ah, never thought about that. I do have a node/repeater still on 1.5 running. Thanks; now I know my next project.

        My Projects
        2 Door Chime Sensor
        Washing Machine Monitor

        1 Reply Last reply
        0
        • E Offline
          E Offline
          emc2
          Hardware Contributor
          wrote on last edited by emc2
          #14

          @rollercontainer said:

          TSP:CHKUPL:FAIL (hops=255)
          !TSM:UPL:FAIL
          

          Did you end up finding what was the problem?
          I have the same errors on new nodes compiled with the stable release. It was working fine on the dev branch before, and my old sensors still works, but not the new ones...

          Edit:
          I had to revert to https://github.com/mysensors/MySensors/tree/244f79771acb60588c6b4fd6dd0fa4b5daf4cb64
          June 26th commit break everything for me. Unfortunately a lot of changes were made this day...

          mitchellM 1 Reply Last reply
          0
          • rollercontainerR Offline
            rollercontainerR Offline
            rollercontainer
            wrote on last edited by
            #15

            read above again:
            Gateway 2.0.0beta with Node 2.0.0 = UPL:FAIL (which means UPLink)
            Gateway 2.0.0 with Node 2.0.0 = FPAR:FAIL (which means FindPARent)

            my error is reported to github, maybe you should do this too with yours?
            https://github.com/mysensors/MySensors/issues

            1 Reply Last reply
            0
            • E Offline
              E Offline
              emc2
              Hardware Contributor
              wrote on last edited by emc2
              #16

              Oh, so just switching from beta to 2.0 master "fixed" UPL:FAIL by switching it to a FPAR:FAIL?
              I thought you did some fixes and then ended up with another error, my bad. Github it is I guess...

              1 Reply Last reply
              0
              • rollercontainerR Offline
                rollercontainerR Offline
                rollercontainer
                wrote on last edited by
                #17

                I am not a coder, just a user. So I am not able to fix errors here.

                1 Reply Last reply
                0
                • E emc2

                  @rollercontainer said:

                  TSP:CHKUPL:FAIL (hops=255)
                  !TSM:UPL:FAIL
                  

                  Did you end up finding what was the problem?
                  I have the same errors on new nodes compiled with the stable release. It was working fine on the dev branch before, and my old sensors still works, but not the new ones...

                  Edit:
                  I had to revert to https://github.com/mysensors/MySensors/tree/244f79771acb60588c6b4fd6dd0fa4b5daf4cb64
                  June 26th commit break everything for me. Unfortunately a lot of changes were made this day...

                  mitchellM Offline
                  mitchellM Offline
                  mitchell
                  wrote on last edited by mitchell
                  #18

                  @emc2 said:

                  @rollercontainer said:

                  TSP:CHKUPL:FAIL (hops=255)
                  !TSM:UPL:FAIL
                  

                  Did you end up finding what was the problem?
                  I have the same errors on new nodes compiled with the stable release. It was working fine on the dev branch before, and my old sensors still works, but not the new ones...

                  Edit:
                  I had to revert to https://github.com/mysensors/MySensors/tree/244f79771acb60588c6b4fd6dd0fa4b5daf4cb64
                  June 26th commit break everything for me. Unfortunately a lot of changes were made this day...

                  Thank you, had the same problem, replaced it with the files from the 26th and got it working.

                  1 Reply Last reply
                  0
                  • E Offline
                    E Offline
                    emc2
                    Hardware Contributor
                    wrote on last edited by
                    #19

                    @mitchell Glad it was useful.
                    Do you also have a Raspberry Pi Gateway with the radio module directly on the GPIO? It seems the problem come from here, issue can now be tracked on https://github.com/mysensors/Raspberry/issues/31

                    Also if needed you can replace core/MyHwESP8266.h and core/MyMainESP8266.cpp with the release version so you can use an ESP8266 device too.

                    mitchellM 1 Reply Last reply
                    0
                    • E emc2

                      @mitchell Glad it was useful.
                      Do you also have a Raspberry Pi Gateway with the radio module directly on the GPIO? It seems the problem come from here, issue can now be tracked on https://github.com/mysensors/Raspberry/issues/31

                      Also if needed you can replace core/MyHwESP8266.h and core/MyMainESP8266.cpp with the release version so you can use an ESP8266 device too.

                      mitchellM Offline
                      mitchellM Offline
                      mitchell
                      wrote on last edited by
                      #20

                      @emc2 Indeed on a Raspberry with direct connection. Thank you for the link, I will follow the progress.

                      1 Reply Last reply
                      0
                      • joachimJ Offline
                        joachimJ Offline
                        joachim
                        wrote on last edited by
                        #21

                        I found out that adding a sleep(10) between 2 consecutive 'send' does help a lot

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


                        15

                        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