Is it worth it adding a reset circuit to MySensors nodes?



  • Helloes 👋

    I am back on the forums with a quite simple question for you 🙂

    I am currently finishing to design a PCB for a MySensors project with "elementary" components: an ATMEGA328P as microcontroller, an HLK-PM03 as power supply, an RFM69W as radio...
    This node will be directly connected to mains, therefore the only way to reboot it is to remove the fuse at the fuse box, which isn't very handy.

    This made me wonder: is it worth adding a reset circuit (connected to the RESET pin of the microcontroller) to a MySensors node?
    In other words, have you ever experienced issues with your nodes that required a power cycle / reset?

    I'm in touch with a MySensors user (brianx) over IRC (#mysensors on Freenode, which I invite you to join 😛 ). He told me that one of his nodes sometimes freezes and power cycling isn't very easy.

    On my side, I built a MySensors "pilot wire" node a few months ago. Sometimes, after something like 15 days to a month, the node also freezes: it stops responding to any command, including network discovery requests.
    I didn't add an electrolytic capacitor to the prototype -- which probably doesn't help -- but I guess a reset circuit could be worth in the final version of the board.

    So what are your opinions / experiences?


  • Hardware Contributor

    @Encrypt - i have a reset on My boards and use them.



  • I didn't experience a node which stopped working after a certain time so far, but I recently had an incident where I lost the contents of my persistence file in Home Assistant - a file where all presented nodes are listed, so that Home Assistant can display their values, toggle switches, etc.

    Since then I regret not having added a reset button to my nodes. Most of them are small battery / coin cell powered units, which means I had to open their enclosures and force re-presentation through a reset by removing the batteries.

    So I certainly learned my lesson there.

    • Make regular backups of the persistance file
    • Include hardware reset into new designs

    I guess I could also use smart sleep and send either I_REQUEST or I_REBOOT to my nodes in this case, but this would reduce battery life drastically due to the extended uptime.



  • Try to perform a system reset, not only a MCU reset. If only the MCU is reset, initializing the radio may fail (because it's in an undefined state) and the node does not start.

    Happened to me a few times with a nrf24 radio, I don't know how the RFM69 will behave.



  • Hello everyone and thank you for your feedback so far!

    @BearWithBeard gave a good argument since I'm also using HomeAssistant.

    Moreover, adding such a circuit will only add €0.50 per board, so it sounds good!



  • Just wondering why not use Watchdog?, it's supposed to restart MCU when it freese.
    The watchdog shall be disabled before entering sleep state and enabled when wake up.

    I would recommend to set the watchdog to max time=8seconds. then you only need to clear the wdt every 7 sec 🙂
    As I recall the default bootloader in Arduino, doesn't have the WDT enabled, so you shall flash Optiboot or similar bootloader

    I searched for an example:
    https://www.electronicwings.com/arduino/watchdog-in-arduino



  • @bjacobse Good point, but what happens if it freezes during sleep?



  • @skywatch said in Is it worth it adding a reset circuit to MySensors nodes?:

    @bjacobse Good point, but what happens if it freezes during sleep?

    It's NOT possible, it's in sleep, it's an integrated part of the IC design, and such a bug would have been found many years ago. The ATmeag328 will go into a well defined state, which is sleep, until it's getting woken up, by an interrupt or a timer.
    Naturally the registers are required to be setup up properly

    As I wrote, you SHALL disable WDT (watchdog) prior entering sleepmode, and after wakeup then you enable WDT again, else the WDT will reset the Atmega328 while you are in sleeep 😉

    ATMeag328 documentation:
    http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7810-Automotive-Microcontrollers-ATmega328P_Datasheet.pdf


  • Mod

    @bjacobse I think MySensors will store the wdt state before going into sleep(), and restore the wdt state after waking up from sleep(). So I don't think sketch developers need to take care of that.


  • Admin



  • @bjacobse Thank you - I learn something new! 🙂

    I have WDT enabled on one of the RF gateways and still it crashes (ir never sleeps as it is a GW node). I am using the stock bootloader (chinese clone uno) so I wonder if this is the issue. I will try and upload the optiboot to that GW node and see if it helps.

    I also run a script in mycontroller to reboot the GW node if it is down, but that isn't working as I expected either..... Luckily I have plenty of time at home now, unluckily I have a lot of domestic chores and support a vulnerable person living at another address, so time for mysensors is still limited, at least for now.


Log in to reply
 

Suggested Topics

  • 87
  • 8
  • 10
  • 2
  • 7
  • 1

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts