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. Hardware
  3. Sleeping with RFM95 ?

Sleeping with RFM95 ?

Scheduled Pinned Locked Moved Hardware
8 Posts 4 Posters 39 Views 3 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.
  • A Offline
    A Offline
    Aymeric
    wrote last edited by
    #1

    Hi,
    I'm trying to put a node to sleep that consists of an Arduino Pro Mini board (3.3 V, 8 MHz) and an RFM95 module (SX1276 chip) using MySensors (2.4.0). In the code below, the node does not go to sleep. I've tried with and without transportDisable/transportReinitialise, and also cutting power to the RFM95 module using powerDownRadio / powerUpRadio, but whenever sleep actually works, the radio transmission no longer works after waking up… I don’t know what else to test. Any idea? Is it a hardware problem ?

    #define MY_DEBUG
    #define MY_RADIO_RFM95
    #define MY_RFM95_FREQUENCY (RFM95_868MHZ)
    #define MY_IRQ_PIN 2
    #define MY_RST_PIN 9
    #define MY_NODE_ID 22

    #include <MySensors.h>

    MyMessage msgTestRfm(100, V_CUSTOM);

    void presentation() {
    sendSketchInfo("Test RFM", "1.1");
    present(100, S_CUSTOM);
    }

    void loop() {

    send(msgTestRfm.set(1));
    wait(200);

    // couper la radio (sinon sleep() bloque)
    transportDisable();
    wait(50);

    // sommeil — pas de LowPower ici !
    sleep(5000);

    // réactiver la radio
    transportReInitialise();
    wait(200);

    Serial.println("Réveillé !");
    }

    1 Reply Last reply
    1
    • TheoLT Offline
      TheoLT Offline
      TheoL
      Contest Winner
      wrote last edited by
      #2

      I don't think you should have to disable the transport. Just look at the example of the Sensebener https://www.mysensors.org/hardware/micro

      A simple sleep should be sufficient .... I didn't even know the transportDisable and transportReinitialise were part of the library :)

      And not really sure with what you mean with sleep not working. If you remove the transportDisable, the waits and the transportReinitialise you should see a reading every 5 seconds in your controller.

      1 Reply Last reply
      0
      • tekkaT Offline
        tekkaT Offline
        tekka
        Admin
        wrote last edited by
        #3

        @Aymeric As @TheoL mentioned, the library automatically handles putting the radio to sleep when you call sleep(). The functions transportDisable() and transportReinitialize() are internal to the library and not meant to be used directly.

        If you can share the serial/console output, we may be able to better understand what’s going on.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Aymeric
          wrote last edited by
          #4

          Thanks for your answers. I tried the code keeping only sleep without the other functions, and it worked once. When I uploaded another, more complex sketch, it didn’t work anymore, and even if I put back the one that used to work, it no longer works :
          4098 TSF:MSG:SEND,22-22-0-0,s=100,c=1,t=48,pt=2,l=2,sg=0,ft=0,st=OK:1
          4306 MCO:SLP:MS=5000,SMS=0,I1=255,M1=255,I2=255,M2=255
          4311 TSF:TDI:TSL
          4315 MCO:SLP:WUP=-1
          4317 TSF:TRI:TSB
          Réveillé !
          4419 TSF:MSG:SEND,22-22-0-0,s=100,c=1,t=48,pt=2,l=2,sg=0,ft=0,st=OK:1
          4628 MCO:SLP:MS=5000,SMS=0,I1=255,M1=255,I2=255,M2=255
          4632 TSF:TDI:TSL
          4636 MCO:SLP:WUP=-1
          4638 TSF:TRI:TSB
          Réveillé !

          I think there is a problem with PIN 2 / IRQ because if I connect the IRQ to GND, there is a 5 s sleep, but then the radio no longer works.

          13764 MCO:SLP:MS=5000,SMS=0,I1=255,M1=255,I2=255,M2=255
          13770 TSF:TDI:TSL
          13772 MCO:SLP:WUP=-1
          13774 TSF:TRI:TSB
          Réveillé !
          20779 !TSF:MSG:SEND,22-22-0-0,s=100,c=1,t=48,pt=2,l=2,sg=0,ft=1,st=NACK:1

          mfalkviddM 1 Reply Last reply
          0
          • A Aymeric

            Thanks for your answers. I tried the code keeping only sleep without the other functions, and it worked once. When I uploaded another, more complex sketch, it didn’t work anymore, and even if I put back the one that used to work, it no longer works :
            4098 TSF:MSG:SEND,22-22-0-0,s=100,c=1,t=48,pt=2,l=2,sg=0,ft=0,st=OK:1
            4306 MCO:SLP:MS=5000,SMS=0,I1=255,M1=255,I2=255,M2=255
            4311 TSF:TDI:TSL
            4315 MCO:SLP:WUP=-1
            4317 TSF:TRI:TSB
            Réveillé !
            4419 TSF:MSG:SEND,22-22-0-0,s=100,c=1,t=48,pt=2,l=2,sg=0,ft=0,st=OK:1
            4628 MCO:SLP:MS=5000,SMS=0,I1=255,M1=255,I2=255,M2=255
            4632 TSF:TDI:TSL
            4636 MCO:SLP:WUP=-1
            4638 TSF:TRI:TSB
            Réveillé !

            I think there is a problem with PIN 2 / IRQ because if I connect the IRQ to GND, there is a 5 s sleep, but then the radio no longer works.

            13764 MCO:SLP:MS=5000,SMS=0,I1=255,M1=255,I2=255,M2=255
            13770 TSF:TDI:TSL
            13772 MCO:SLP:WUP=-1
            13774 TSF:TRI:TSB
            Réveillé !
            20779 !TSF:MSG:SEND,22-22-0-0,s=100,c=1,t=48,pt=2,l=2,sg=0,ft=1,st=NACK:1

            mfalkviddM Offline
            mfalkviddM Offline
            mfalkvidd
            Mod
            wrote last edited by
            #5

            @Aymeric are you sure the node isn’t sleeping for 5 seconds? WUP=-1 means it woke up by timer.

            Check using an external clock, and/or turn on timestamps on the Arduino IDE log.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              Aymeric
              wrote last edited by
              #6

              Hello, it was a hardware problem. I had tried with two different Pro Mini boards, but after trying with a third one, everything is working now. Thank you for your help.

              mfalkviddM 1 Reply Last reply
              3
              • A Aymeric

                Hello, it was a hardware problem. I had tried with two different Pro Mini boards, but after trying with a third one, everything is working now. Thank you for your help.

                mfalkviddM Offline
                mfalkviddM Offline
                mfalkvidd
                Mod
                wrote last edited by
                #7

                Nice work @Aymeric, thanks for reporting back!

                1 Reply Last reply
                1
                • TheoLT Offline
                  TheoLT Offline
                  TheoL
                  Contest Winner
                  wrote last edited by
                  #8

                  I learned my lessons about bread boards. Slowly replacing my cheap AliExpress ones with good quality ones. I blew up 2 nano's and 1 nrf this week because of a bad breadboard

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


                  11

                  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