Porting MySensors to work with the RadioHead library
-
Working on it, fighting git about a rolled back rebase...
-
I managed to resolve my git problem, but I'm now back to a problem we have discussed before.
The problem is with how I should include the driver in order to use it without having to modify the header of every driver file. Can't seem to find what we landed on last time...
-
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 mismatchObviously something is getting mangled along the way...
-
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 -
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 :-)
-
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*' -
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*' -
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.
-
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.
@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? -
@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? -
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 :).