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. Porting MySensors to work with the RadioHead library

Porting MySensors to work with the RadioHead library

Scheduled Pinned Locked Moved Development
portingradiohead
288 Posts 24 Posters 187.5k Views 12 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.
  • K Offline
    K Offline
    kolaf
    Hero Member
    wrote on last edited by
    #185

    I mean that I have to place the RadioHead library inside the main my sensors folder for everything to work. If I were to place it in the "utility" folder, I would have to change every include inside the library to use" instead of brackets.

    Anyway, I have gotten it to compile, and there is some radio communication going on. Trouble is that there seems to be some issues with the buffer sizes (I guess?).

    Here was what the sensor is sending:
    find parent
    send: 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,st=bc:

    And this is what the Gateway is receiving (with an additional debug message from me):
    0;0;3;0;9;read: 0-0-0 s=255,c=3,t=6,pt=1,l=1:0
    0;0;3;0;9;version: 0
    0;0;3;0;9;version mismatch

    Obviously something is getting mangled along the way...

    1 Reply Last reply
    0
    • hekH Online
      hekH Online
      hek
      Admin
      wrote on last edited by
      #186

      Good that something is transmitted.

      But should you really use RadioHead? That seems a bit redundant.

      Felix over at LowPowerLab directed me to: https://github.com/LowPowerLab/RFM69/

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kolaf
        Hero Member
        wrote on last edited by
        #187

        I got something working with a new library. Requesting node ID, and sending all initialisation stuff seems to work correctly. I was not able to place the libraries in the correct place this time either, but perhaps you can move them and re-factor the code?

        I created a pulled request so that you can look at it.

        This is happening in the gateway with the new code:
        0;0;3;0;14;Gateway startup complete.
        0;0;3;0;9;read: 1-1-255 s=255,c=3,t=7,pt=0,l=0:
        0;0;3;0;9;send: 0-0-1-1 s=255,c=3,t=8,pt=1,l=1,st=ok:0
        0;0;3;0;9;read: 0-1-1 s=255,c=3,t=8,pt=1,l=1:0
        0;0;3;0;9;send: 0-0-0-1 s=255,c=3,t=8,pt=1,l=1,st=fail:0
        0;0;3;0;9;read: 1-1-0 s=255,c=3,t=6,pt=1,l=1:0
        1;255;3;0;6;0
        0;0;3;0;9;read: 1-1-0 s=255,c=3,t=11,pt=0,l=13:Wave switch 3
        1;255;3;0;11;Wave switch 3
        0;0;3;0;9;read: 1-1-0 s=255,c=3,t=12,pt=0,l=3:1.1
        1;255;3;0;12;1.1
        0;0;3;0;9;read: 1-1-0 s=1,c=0,t=3,pt=0,l=3:1.4
        1;1;0;0;3;1.4
        0;0;3;0;9;read: 1-1-0 s=3,c=0,t=6,pt=0,l=3:1.4
        1;3;0;0;6;1.4
        0;0;3;0;9;read: 1-1-0 s=2,c=2,t=2,pt=0,l=3:1.4
        1;2;2;0;2;1.4
        0;0;3;0;9;read: 1-1-0 s=1,c=1,t=2,pt=2,l=2:0
        1;1;1;0;2;0
        0;0;3;0;9;read: 1-1-0 s=3,c=1,t=0,pt=7,l=5:23.2
        1;3;1;0;0;23.2
        0;0;3;0;9;read: 1-1-0 s=3,c=1,t=0,pt=7,l=5:23.3
        1;3;1;0;0;23.3

        1 Reply Last reply
        0
        • hekH Online
          hekH Online
          hek
          Admin
          wrote on last edited by
          #188

          Great @kolaf. I'll take a look.

          1 Reply Last reply
          0
          • hekH Online
            hekH Online
            hek
            Admin
            wrote on last edited by
            #189

            Ok merged! Seems to compile fine with the library in utility after some minimal changes. Thanks @kolaf.

            1 Reply Last reply
            0
            • K Offline
              K Offline
              kolaf
              Hero Member
              wrote on last edited by
              #190

              Excellent. I took a quick look at the changes you did to move the library, I'm a bit ashamed that I didn't manage to do that myself...

              I'm very happy to have a solution in the development branch that allows the radios I bought to be brought along into the future of MySensors :-)

              1 Reply Last reply
              0
              • B Offline
                B Offline
                bbbio24
                wrote on last edited by
                #191

                Since I have four moteino , I wanted to test your code. Unfortunately, I have made ​​a mistake , because the compiler return this error :

                In file included from My_Sensor.ino:2:
                C:\Program Files (x86)\Arduino\libraries\MySensors/MySensor.h:32:1: warning: "debug" redefined
                In file included from C:\Program Files (x86)\Arduino\libraries\MySensors/MySensor.h:16,
                from My_Sensor.ino:2:
                C:\Program Files (x86)\Arduino\libraries\MySensors/MyDriver.h:9:1: warning: this is the location of the previous definition
                In file included from C:\Program Files (x86)\Arduino\libraries\MySensors/MyConfig.h:27,
                from C:\Program Files (x86)\Arduino\libraries\MySensors/MySensor.h:17,
                from My_Sensor.ino:2:
                C:\Program Files (x86)\Arduino\libraries\MySensors/MyDriverRF69.h:40: error: ISO C++ forbids initialization of member 'radio'
                C:\Program Files (x86)\Arduino\libraries\MySensors/MyDriverRF69.h:40: error: making 'radio' static
                C:\Program Files (x86)\Arduino\libraries\MySensors/MyDriverRF69.h:40: error: invalid in-class initialization of static data member of non-integral type 'RFM69*'

                hekH 1 Reply Last reply
                0
                • B bbbio24

                  Since I have four moteino , I wanted to test your code. Unfortunately, I have made ​​a mistake , because the compiler return this error :

                  In file included from My_Sensor.ino:2:
                  C:\Program Files (x86)\Arduino\libraries\MySensors/MySensor.h:32:1: warning: "debug" redefined
                  In file included from C:\Program Files (x86)\Arduino\libraries\MySensors/MySensor.h:16,
                  from My_Sensor.ino:2:
                  C:\Program Files (x86)\Arduino\libraries\MySensors/MyDriver.h:9:1: warning: this is the location of the previous definition
                  In file included from C:\Program Files (x86)\Arduino\libraries\MySensors/MyConfig.h:27,
                  from C:\Program Files (x86)\Arduino\libraries\MySensors/MySensor.h:17,
                  from My_Sensor.ino:2:
                  C:\Program Files (x86)\Arduino\libraries\MySensors/MyDriverRF69.h:40: error: ISO C++ forbids initialization of member 'radio'
                  C:\Program Files (x86)\Arduino\libraries\MySensors/MyDriverRF69.h:40: error: making 'radio' static
                  C:\Program Files (x86)\Arduino\libraries\MySensors/MyDriverRF69.h:40: error: invalid in-class initialization of static data member of non-integral type 'RFM69*'

                  hekH Online
                  hekH Online
                  hek
                  Admin
                  wrote on last edited by
                  #192

                  @bbbio24

                  IDE version?

                  B 1 Reply Last reply
                  0
                  • FrancoisF Offline
                    FrancoisF Offline
                    Francois
                    wrote on last edited by
                    #193
                    This post is deleted!
                    1 Reply Last reply
                    0
                    • FrancoisF Offline
                      FrancoisF Offline
                      Francois
                      wrote on last edited by
                      #194
                      This post is deleted!
                      1 Reply Last reply
                      0
                      • FrancoisF Offline
                        FrancoisF Offline
                        Francois
                        wrote on last edited by
                        #195

                        Hi I now have my first MySensor RFM69 node up and running in PiDome :-) :+1: This is great as with the NFR24L01 I battle to get coverage in my House. I put the RFm69 node in the farthest point in my house any it just work. To get the NFR24L01+ to work at the same location I have to use an repeater node. The other thing I like about the RFM69 solution like Moteino (https://lowpowerlab.com) or Anarduino (http://www.anarduino.com/miniwireless) is the size you don't have to use any wires to connected the radio and it comes fitted to the arduino board. So if you look for a small sensor I think that this is the way to go for automation.

                        AnticimexA 1 Reply Last reply
                        0
                        • FrancoisF Francois

                          Hi I now have my first MySensor RFM69 node up and running in PiDome :-) :+1: This is great as with the NFR24L01 I battle to get coverage in my House. I put the RFm69 node in the farthest point in my house any it just work. To get the NFR24L01+ to work at the same location I have to use an repeater node. The other thing I like about the RFM69 solution like Moteino (https://lowpowerlab.com) or Anarduino (http://www.anarduino.com/miniwireless) is the size you don't have to use any wires to connected the radio and it comes fitted to the arduino board. So if you look for a small sensor I think that this is the way to go for automation.

                          AnticimexA Offline
                          AnticimexA Offline
                          Anticimex
                          Contest Winner
                          wrote on last edited by
                          #196

                          @Francois Cool! Is this compatible with RF24, as in, you can have RF24 based GW and other sensors, and "plug in" a RFM69 unit? With its better RF properties it sounds like an excellent candidate for use as repeater node as well.
                          Or is it required to set up a separate GW?

                          Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

                          1 Reply Last reply
                          0
                          • hekH Online
                            hekH Online
                            hek
                            Admin
                            wrote on last edited by
                            #197

                            You cannot mix radios in one network.

                            AnticimexA 1 Reply Last reply
                            0
                            • hekH hek

                              You cannot mix radios in one network.

                              AnticimexA Offline
                              AnticimexA Offline
                              Anticimex
                              Contest Winner
                              wrote on last edited by
                              #198

                              @hek ok, så it is a different carrier frequency, or modulation, and not protocol-compatible on the "physical" layer? Pity.

                              Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

                              1 Reply Last reply
                              0
                              • hekH hek

                                @bbbio24

                                IDE version?

                                B Offline
                                B Offline
                                bbbio24
                                wrote on last edited by bbbio24
                                #199

                                @hek IDE Version : 1.0.5 r2
                                I tried with version 1.0.6 without success.

                                CARSTENC 1 Reply Last reply
                                0
                                • T Offline
                                  T Offline
                                  ToSa
                                  Code Contributor
                                  wrote on last edited by
                                  #200

                                  @kolaf
                                  I've been busy with other stuff for some time but looking at the driver separation now once again. With nRF24 working (even bootloader adjusted to pick the right header files etc.) and two Moteinos at hand (Moteino RFM69W 868/915), I compiled and flashed a serial gateway and a simple temperature sensor node. Both appear to work fine looking at the debug messages except the fact that they don't listen to eachother. Both are sending but none is receiving anything (2m distance).
                                  I did not touch or even closely look at the RFM69 driver code yet but will try to do so over the weekend. Do you have any hint where to check first?

                                  L 1 Reply Last reply
                                  0
                                  • T Offline
                                    T Offline
                                    ToSa
                                    Code Contributor
                                    wrote on last edited by
                                    #201

                                    I have the RFM69 setup working now with a couple of additional tweaks mainly for code optimization. Working fine for some time but stops after a few hours - I'll have a closer look the next couple of days.
                                    Felix added three bytes to the payload (source address / destination address / control byte) to manage the acknowledge etc. in the lowpowerlab library. For our specific needs this is redundant as the current message format in development already includes this data. The three additional bytes are not that bad though and I'd propose to leave it like that for now and reconsider when we get to the revised message format :).

                                    blaceyB 1 Reply Last reply
                                    0
                                    • T ToSa

                                      I have the RFM69 setup working now with a couple of additional tweaks mainly for code optimization. Working fine for some time but stops after a few hours - I'll have a closer look the next couple of days.
                                      Felix added three bytes to the payload (source address / destination address / control byte) to manage the acknowledge etc. in the lowpowerlab library. For our specific needs this is redundant as the current message format in development already includes this data. The three additional bytes are not that bad though and I'd propose to leave it like that for now and reconsider when we get to the revised message format :).

                                      blaceyB Offline
                                      blaceyB Offline
                                      blacey
                                      Admin
                                      wrote on last edited by
                                      #202

                                      @ToSa :+1::+1::+1:

                                      1 Reply Last reply
                                      0
                                      • T Offline
                                        T Offline
                                        ToSa
                                        Code Contributor
                                        wrote on last edited by
                                        #203

                                        RFM69 is stable now for >48h.
                                        The OTA bootloader version for RFM69 is in progress. I'm stuck right now where the node debug messages show that it's sending a packet but the gateway doesn't receive anything... I moved the full initialization code back in that I thought would be ok to skip but still the same behavior. Only difference to the full blown driver at this point is that I don't attach the interrupt but that should not be relevant for tx as I'm polling the interrupt register for status (ready to send / send complete etc.).

                                        K 1 Reply Last reply
                                        0
                                        • T Offline
                                          T Offline
                                          ToSa
                                          Code Contributor
                                          wrote on last edited by
                                          #204

                                          I had some time today to look at the bootloader code for RFM69 modules. Got the bootloader code to a point where it appears to be working fine - but the instability of the full MySensors RFM69 code is back - the serial gateway stops receiving packets after some time and it appears that the attempt to download a firmware by the bootloader just makes this problem more obvious due to the high volume of packets...
                                          My prime suspect at the moment is the interrupt driven RFM69 library using a single packet buffer. As long is it's used sequentially everything should be fine but with e.g. submission or retrieval of ack messages it opens up the transceiver while the last packet was not fully processed yet potentially causing this... I'll go ahead and replace the routines in the library with the non-interrupt-driven version I coded for the bootloader just to see if this is the right place to dig deeper...

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


                                          19

                                          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