sensors stop working after time

  • hi every body
    i use some sensors ( all are repeater ) and they are Mounted on the wall. used 5v 2 and 1.5 A adaptor for each one. they are stay in specified distance . used a 4.7 uF capacitor for each one. i test them again and again and they are work well . but after time (for example after 5 or 6 day) dont work suddenly. so i think this problem is not related to power or capacitor . even i test , send code quickly and Frequently but power dont weak and run full of codes. but after 5 day ....
    In your opinion , what is problem ? is that possible arduino or radio is hong ?
    between all of the nodes , one node(relay) dont work and other node (motion sensor) is trigger for always ! relay is a repeater for motion.
    this is Strange for me , without any change and Manipulate there is this problem suddenly.

  • @Reza I have similar problem with a few sensors and I suspect it must be the code. They freeze after quite a few days

  • Hardware Contributor

    +1 @alexsh1
    perhaps a usecase which does not work well, or go to sort infinite stuff. Or something wrong during sleep, without wdt maybe as we like sleeping node without wdt sometimes, or hardware, etc..

    @reza Is it a raw example from the lib without any modification to the code ?

  • @scalz I suspect that it happens during a sleep mode. I do not have the same problem with those nodes which do not go to sleep (powered from 240V). For example, my pulse meter node never froze.
    Unfortunately, I never had time to go into details as to why this is happening. It could be related to hardware or power source unfortunately too.

  • Which MySensors library are you using?
    With 2.0 i had the sleep issue solved (for now) with MY_PARENT_NODE_ID and MY_PARENT_NODE_IS_STATIC(as suggested by tekka).

  • @scalz
    i change some line. for example temp sensor
    add this lines:
    #define MY_RF24_CHANNEL 0
    #define MY_NODE_ID 20

    and change this line:

    also in other device i use a simple code :

    #define MY_DEBUG
    #define MY_RADIO_NRF24
    #define MY_RF24_CHANNEL 0
    #define MY_NODE_ID 22
    #include <SPI.h>
    #include <MySensors.h>
    #define RELAY_1  3
    #define RELAY_2  4
    #define RELAY_ON 1
    #define RELAY_OFF 0
    void before() {
      int sensor = 1;
      pinMode(RELAY_1, OUTPUT);
      pinMode(RELAY_2, OUTPUT);
    void setup() {
    void presentation()
      sendSketchInfo("Roller shutter", "1.0");
      int sensor = 1 ;
      present(sensor, S_COVER);
    void loop() {
    void receive(const MyMessage &message) {
      if (message.type == V_UP) {
        digitalWrite(RELAY_1, HIGH);
        digitalWrite(RELAY_2, LOW);
      if (message.type == V_STOP ) {
        digitalWrite(RELAY_1, HIGH);
        digitalWrite(RELAY_2, HIGH);
      if (message.type == V_DOWN) {
        digitalWrite(RELAY_2, HIGH);
        digitalWrite(RELAY_1, LOW);

    all my devices are repeater, this work well . if my problem was related to code so i see first time this problem . no after 4 or 5 days.

  • @zampedro
    i use 2.0 . but i dont use sleep mode , in all of my sensor i use repeater feature. and delete sleep mode and use "wait"
    one of main repeater (near gateway) have this problem . this node have not a sleep mode. i use adaptor for all device,i dont use battery for my device...

  • @zampedro 2.0b (pre 2.0 stable)

  • @Reza I implemented your sketch, tried to start/stop(up to a few hours) the gateway(serial gateway) and the controller(domoticz on orangepi pc) to see if the logs help in some way. Nothing, it works.
    It should be logged until the freeze occurs.

  • @zampedro said:

    I implemented your sketch, tried to start/stop(up to a few hours) the gateway(serial gateway) and the controller(domoticz on orangepi pc) to see if the logs help in some way. Nothing, it works.
    It should be logged until the freeze occurs.

    i use two 4.7 uF capacitors. so now i don't have any problem currently. also i am testing in next days

  • @alexsh1
    do you found any solution for solve ? i am test again with two 4.7 uF capacitors and a 100 uF capacitors , but after some days so that problem is happen again .

    @scalz @zampedro
    all of my devices are repeater and dont go to sleep . so i think this problem is not related to sleep time.
    also I checked with 5 devices side my controller (relay,motion,temp... and all are repeater) and this days i checked this. this 5 devices are ok and nothing any problem. but this happen is just for devices that are in more distance and repeat data from end node...
    the sketch of motion (more distance) is same sketch for motion (side controller) , so i think problem is not related to sketch(i think this is related to repeater feature and routing or can not reconnect radio some time )because when this problem is happen i reset arduino and this is connect for some days and again... also i change arduino , radio , sensor or relay , power and capacitor . but this problem happen again. so is not related to hardware
    @alexsh1 this problem happen for which your device ? side controller or more distance?

    ***also i found some things(that the problem possible related to this but i dont Attention before) . for example when i small displacement for controller (move 0.5 meter) , some devices (that have more distance with controller) that they have direct connection to controller (weak connection for more distance reason) after small displacement dont work and stop working. while there are some repeater near this device(until when end node could not connect to controller directly , this repeaters help for connect) !
    so this is possible that my device dont auto stop working and this is possible that i Shake radio of device or Shake and small move place of controller.
    @alexsh1 are you test this issue ?

  • @Reza no, I do not have the same experience. Most of my nodes are sleeping. Additionally, I'm not using repeater function as this is not necessary for my needs given that I use nrf25l01+ PA.
    For a long time I have been blaming radio, but as it turned out the culprit was AMS1117 on my GW. It has not failed completely, but made my scene controller as well as other nodes work very erratically. I was troubleshooting the scene controller sketch and radio, which was a wrong blame.

    After changing AMS1117 everything works just fine. I'm still testing to see if any nodes would freeze. And if they do, I think it is more related to a hardware issue. I do not have the same experience of changing the GW locations changes node reception drastically.
    bolded text

  • @alexsh1
    so i think my problem is differnce with your problem , thank you

Log in to reply

Suggested Topics

  • 30
  • 12
  • 11
  • 1
  • 12
  • 7
  • 3