Step-by-step procedure to connect the NRF24L01+ to the GPIO pins and use the Raspberry as a Serial Gateway (MySensors 1.x)
-
You can "fake" a later version (e.g, 1.5) on the Raspberry by changing the version code in the version.h file and recompiling the Gateway software.
As far as I understand, the gateway will still pass the messages to the controller, even is there is a version mismatch message on the console.
-
@alexsh1 I know the sensors are on v1.5. As for the Raspberry Gateway, it looks like based on the info here, that is running v1.4.
-
@hek I'm running a custom 1Mhz build bootloader on a Pro Mini for the Sensor side. This was paired with the standard Serial Gateway running on another Pro Mini with v1.5 on both gateway and sensor. That setup was working. But I moved over to using the Pi gatway+nRF24+ radio and have this issue. I don't believe the hookup is the problem. I've seen the 0 readings before, and that usually meant node side issue or uninitiated Gateway. I have not changed the Node, so it must be the Pi gateway that is the problem. Any thoughts on what to test?
-
Noob question. Any one have an idea on solving the "Permission denied" error.
-
Solved my own problem. Using the following command did the trick.
sudo chown -h pi:pi ttyUSB20
-
weird. Permission Denied problem again.
What is the USER : GROUP that is needed for this to work?
-
@den2k I think your best chance is to post in the Home Assistant category. I don't have any experience with Home Assistant unfortunately.
-
@jpbabou said:
Hi
something is missing..Is there a problem with the repository
Tks a lot for your job!pi@domoticjp ~ $ sudo git clone https://github.com/mysensors/Raspberry.git Cloning into 'Raspberry'... remote: Counting objects: 273, done. remote: Compressing objects: 100% (3/3), done. remote: Total 273 (delta 0), reused 0 (delta 0), pack-reused 270 Receiving objects: 100% (273/273), 215.00 KiB | 0 bytes/s, done. Resolving deltas: 100% (114/114), done. Checking connectivity... done. pi@domoticjp ~ $ cd Raspberry/librf24-bcm -bash: cd: Raspberry/librf24-bcm: No such file or directory
The guide has been updated to reflect the updated in the MySensors Raspberry repository now. Thanks @jpbabou !
-
Hi!
Have you added the user that runs homeassistant to the dialout group? This group is usually owner of serial ports.
Check default group of serial port (change for your port below) after connecting it:
pi@martin-pi:~ $ ls -l /dev/ttyUSB0 crw-rw---- 1 root dialout 188, 0 dec 18 03:21 /dev/ttyUSB0
Check groups that user pi is in:
pi@martin-pi:~ $ groups pi pi : pi adm dialout cdrom sudo audio video plugdev games users input netdev spi i2c gpio
If pi runs homeassistant, which should be the case, and is not in dialout, add pi to dialout:
sudo adduser pi dialout
Changing owner of a port will only work until you disconnect it. Default owner will be restored upon reconnect, if you haven't written a special udev rule.
Edit:
According to the readme in the mysensors raspberry repo (https://github.com/mysensors/Raspberry), the group of the device is tty. So you should probably use that, and not dialout. But you will know, when you check withls -l
.
-
@mfalkvidd Hi there and thanks for a great and super detailed step-by-step tutorial.
I've got mine running in no time with your instructions, but after a couple of minutes I've got the following error:
2015-12-30 20:51:30.356 Error: MySensors: Unhandled sensor (sub-type=32), please report with log!
2015-12-30 20:52:01.390 Error: Serial Port closed!... Error: End of file
2015-12-30 20:52:02.315 MySensors: retrying in 30 seconds...
2015-12-30 20:52:31.319 MySensors: Using serial port: /dev/ttyUSB20
2015-12-30 20:52:31.320 Error: MySensors: Error opening serial port!
2015-12-30 20:52:32.321 MySensors: retrying in 30 seconds...
2015-12-30 20:53:01.324 MySensors: Using serial port: /dev/ttyUSB20I also attached a partial screen capture showing that it was working before 8-)
Any idea on why is this happening and how to solve it?
Southern regards and happy new year to all!
-
You are using a sensor type that your version of Domoticz doesn't support. What type os sensor is it? Which version of Domoticz are you using? Upgrading Domoticz might solve the problem (if the newer version supports this sub-type).
-
When I try to run the init.d script:
sudo /etc/init.d/PiGatewaySerial start
I get the following error:
[....] Starting PiGatewaySerial (via systemctl): PiGatewaySerial.serviceFailed to start PiGatewaySerial.service: Unit PiGatewaySerial.service failed to load: No such file or directory. failed!
No such file or directory.... Obviously a missing folder or file, but I am not savvy enough to debug this.... Any help appreciated..
-
@Sander-Teunissen my guess is that you forgot the sudo make install part of the installation instructions.
-
@mfalkvidd Yesterday I stopped trying and shutdown the Pi. This morning I tried the same again and it works !!
Pretty sure I haven't done anything else.
Thanks anyway.Sander
-
Hello, If followed the instruction and everything seemed to work without any problem.
However when I enter the command : sudo cat /dev/ttyMySensorsGateway
I get the message : cat: /dev/ttyMySensorsGateway: No such file or directory
Does anybody have any idea how to solve this ?
-
@MrRikkie what output did you get when you ran sudo /etc/init.d/PiGatewaySerial start ?
-
@mfalkvidd said:
sudo /etc/init.d/PiGatewaySerial start
No output and no error message. Just a new command line.
pi@raspberrypi ~ $ sudo /etc/init.d/PiGatewaySerial start
pi@raspberrypi ~ $
-
When I
ls -l ttyMySensorsGateway
I get
lrwxrwxrwx 1 root root 10 Jan 3 20:21 ttyMySensorsGateway -> /dev/pts/0
It's all root. This results in all kinds of acessability issues. I followed all instructions exactly. Anyone any ideas how to change this ?
Sander.
-
Try writing a udev rule to set owner of the device (ttyMysensorsGateway) at boot. If you don't need to use the link you could write a rule that names the pts device to the same name every boot, I think. At least for usb devices this works. Haven't tried it in this particular case.
-
@Sander-Teunissen said:
When I
ls -l ttyMySensorsGateway
I get
lrwxrwxrwx 1 root root 10 Jan 3 20:21 ttyMySensorsGateway -> /dev/pts/0
It's all root. This results in all kinds of acessability issues. I followed all instructions exactly. Anyone any ideas how to change this ?
The permissions for a soft link are not used (and if they were, any user would be allowed to do anything since everything is rwx). The permissions for the target is used instead. So it is the result of
ls -l /dev/pts/0
you need to worry about.
-
Hello @mfalkvidd , I read the topic again but I am a bit confused. Normally we have a sketch on the Arduino board to enable signing for example or implement our desired code. I don't understand how to edit this before compiling ?
-
Sorry @ahmedadelhosni, I haven't tried to compile the Raspberry gateway for signing. @Anticimex will probably chide me for that, and rightly so
It should just be a matter of modifying MyConfig.h to enable signing, as per the instructions in http://forum.mysensors.org/topic/1021/security-introducing-signing-support-to-mysensors but maybe the MySensor files in the Raspberry repo haven't been updated with the signing features.
-
The signing backends are updated for multi arch support thanks to @tbowmo and his SAMD gateway project, but they still assume Arduino compatible api:s for io, so if the raspberry repo/port provide that, it should work. If not, it should just be a matter of adding support for the raspberry spi:s for setting pin direction and states and (if sw backend is to be used) provide a random number generator. The code is C/C++ and hw independent in other aspects.
-
If anyone would like to add support for rPi to the signing backends, I suggest using a Linux generic approach using sysfs to handle io. Same for rng (using an appropriate device node, rpi has a hw rng that should be used).
If the design is Linux generic and uses proper design to abstract raspberry board specifics, it opens up for reuse by any hw that uses a Linux kernel
-
I've been struggling with this setup for a few weeks now. I've resisted posting to try and figure it out, but I'm not making any progress. When I first setup the rpi with the nrf24 directly connected, everything worked great. I was running a node with temp and motion pretty reliably. I had some difficulty getting the relay node to work, but I got that working eventually as well, but not reliably. While trying to resolve this, I started getting these errors (log from Domoticz):
2016-02-19 10:43:36.007 MySensors: Using serial port: /dev/ttyUSB20
2016-02-19 10:43:36.008 Error: MySensors: Error opening serial port!
2016-02-19 10:43:37.008 MySensors: retrying in 30 seconds...I see the post above about this being related to using sensors not supported. Since it started with the relay node, I took that out of the setup, but I'm still getting the error.
I've rebuilt the entire rpi, mysensors, and domoticz, but I can't get it to work reliably. If I start the gateway manually via a putty session, it will work for a few minutes, but then it stops and goes back to the command prompt in putty and I can see the log in Domoticz start showing the above errors.
I have setup the gateway to start automatically, but it doesn't seem to restart correctly after a reboot.
I suspect I have a version mismatch in my code somewhere, but I can't seem to find it. My last effort was to remove all code from my computer and start over, ie reinstall Arduino and a fresh download of MySensors code (v1.5).
I've also tried changing the permissions on the tty devices, but that didn't seem to help either.
I was real excited about this project when I first read about it. When I finally got some parts in, I had some quick success that kept me motivated, but my enthusiasm is waning a bit with my total lack of progress on this issue.
Thanks in advance for any help.
-
Which capacitor(s) are you using?
Do you use a power amplified version of the nrf24l01+ or the regular version?
What is the output of /usr/local/sbin/PiGatewaySerial until the gateway stops working?
-
@mfalkvidd
I have a 4.7uf electrolytic cap soldered directly to the pins on the radio module.
Radio is standard, ie antenna via board traces.I just did another batch of testing to try and answer your last question.
I started the gateway manually, ie sudo /usr/local/sbin/PiGatewaySerial
I plugged in a temp sensor (dallas 18b20, 3.3v apm, via 3.3v FTDI) into the computer so I could monitor the serial port.The first time I turned on the temp sensor, the gateway closed after 5 "read:"'s. I tried it again and the gateway stopped (meaning I was back at the prompt in putty) after 2 reads.
I decided to reboot the rpi. When it came back up, I had the Domoticz log open and I could see the gateway start before I could reopen a putty session. It appears the auto start worked correctly, and so far, it's still up.
I've been sending temp data successfully for ~10 minutes now....time passes...
I typed out the above, but didn't hit submit as I wanted to go put the relay node back together and test it.After gathering up those parts, I check the Domoticz log and it's still reading temp. While it IS working, the temps are displaying wrong in Domoticz. My sensor is sending F, but domoticz thinks it's C and it converts.
I'm mentioning this because, when I open the serial monitor to confirm the node was sending F values, it of course resets the node. This killed the gateway. I got the following in my domoticz log:
2016-02-19 15:00:30.362 (MySensorsSerial) Temp (Temp)
2016-02-19 15:00:38.371 (MySensorsSerial) Temp (Temp)
2016-02-19 15:00:46.380 (MySensorsSerial) Temp (Temp)
2016-02-19 15:00:50.384 (MySensorsSerial) Temp (Temp)
2016-02-19 15:00:54.389 (MySensorsSerial) Temp (Temp)
2016-02-19 15:00:58.393 (MySensorsSerial) Temp (Temp)
2016-02-19 15:01:02.398 (MySensorsSerial) Temp (Temp)
2016-02-19 15:01:06.403 Error: Serial Port closed!... Error: End of file
2016-02-19 15:01:06.864 MySensors: retrying in 30 seconds...
2016-02-19 15:01:35.867 MySensors: Using serial port: /dev/ttyUSB20
2016-02-19 15:01:35.868 Error: MySensors: Error opening serial port!
2016-02-19 15:01:36.869 MySensors: retrying in 30 seconds...
2016-02-19 15:02:05.871 MySensors: Using serial port: /dev/ttyUSB20
2016-02-19 15:02:05.872 Error: MySensors: Error opening serial port!
2016-02-19 15:02:06.872 MySensors: retrying in 30 seconds...
2016-02-19 15:02:20.010 Active notification subsystems: (0/10)
2016-02-19 15:02:35.875 MySensors: Using serial port: /dev/ttyUSB20
2016-02-19 15:02:35.875 Error: MySensors: Error opening serial port!
2016-02-19 15:02:36.875 MySensors: retrying in 30 seconds...I ran sudo cat /dev/ttyMySensorsGateway and get 'No such file' message. I interpret this to mean the gateway has stopped running, right?
Next I manually started the gateway again. It immediately starts reading the temp sensor again. After the next 30 second timer expires, Domoticz picks it right back up too.
I think I figured something out... If I restart a node with the gateway running, it kills the gateway and my above symptoms start. I'm able to repeat this without failure.
I'm going to do some more testing, but it seems that when the node sends the s=255 message, the gateway is dieing.
I want to see what happens if I turn on another node while the first is alraedy running. Perhaps I have to have all my nodes on before I start the gateway?I am very encouraged as I at least finally feel like I'm moving forward. Was getting frustrated for awhile there.
Thanks again for the write to help me get started.
-
Did some more testing. Now I know why it seemed related to the relay node.
The relay node needs the gateway to be listening when it wakes up. If it fails when it presents, ie the gateway is down, it doesn't try again.I did have the relay sketch working at some point, so I don't think it's that sketch. I'm thinking I have a problem with the gateway. I work as a developer, so I've been trying to acquaint myself with the code. I mostly use SQL and VB.net in my day job. I loved C++ in college, but it's been almost that long since I used it.
Does anyone have any ideas what might be causing this? I'm going to go reread the section on the mysensors protocol and see I can spot anything wrong in those presentation messages.
-
This post is deleted!
-
Hi there
I did everything according to the instructions. Installing went without complications. However, when trying to verify the gateway problems arise.After typing
sudo /usr/local/sbin/PiGatewaySerial
I receive the message: command not found.
Also, no /dev/ttyMySensorsGateway file has been created.When I am entering
sudo /etc/init.d/PiGatewaySerial start
nothing happens. I only get a new command line.
I can start the gateway, however, when I am entering
sudo ./PiGatewaySerial
in the Raspberry folder.
I already tried to uninstall and re-install everything, without success. Has anybody any suggestions how to solve this issue?
-
@Justinian looks like you forgot to run "sudo make install" after "make all"
-
@mfalkvidd said:
@Justinian looks like you forgot to run "sudo make install" after "make all"
I took a little break from this project, but I worked on it again this weekend. I decided to start from scratch and rebuild the gateway completely. I put a fresh Domoticz image onto the SD card, updated and upgraded, cloned, compiled, and installed the RF24 and Raspberry code.
Now I have the exact same symptom as Justinian
Since this used to work for me at some point, next I will try using an older Dmoticz image. I read somewhere that people had better success by NOT using apt-get update. Perhaps it's a problem with Jessie vs Wheezy? Domoticz switched kernels during on of the version upgrades.
Winter is over, so I can live without getting my furnace controls working right now. I know relays have an issue, but now I'm just needing to monitor the temperature in an egg incubator.
I'm surprised that using a rpi with this radio module directly attached is not a more popular platform. Is it just not a reliable platform? With the rpi3 out now, there shouldn't be a CPU load issue trying to act as an HA controller even with a large installation. I've got lots of ideas I want to implement if I can ever get a stable backend.
-
@mfalkvidd thanks for your help. Unfortunately, this didn't resolve the issue. I repeated the installation, this time deliberately executing sudo make install, but the problem remained.
@hayduke Maybe this indeed is an issue with Raspbian Jessie as I am on Jessie.
-
Jessie uses a different init system than Wheezy. Systemd should be able to handle most old init scripts, but this case might be an exception.
Has anyone successfully installed this on Jessie?
A unit file for systemd would be a good addition, in any case, in my opinion.
-
I'm on the latest Jessie version. Prior to that I also used DietPi as a platform for Domoticz and Mysensors. I have not done an apt-get update or apt-upgrade since the install (I used the Jessie image from the Raspberry Org site).
As for load, here is the image of Domoticz CPU load of the last year:
As you can see, combining the Gateway function with the Controller function on the Raspberry 2 gives virtually no load. I could probably add the Plex Media Player software to this and still have room for some more cron jobs.
-
Hi - I saw enquires months ago about getting RF69 working - has anyone done so? thanks!
-
@shabba the best discussion I've seen so far is http://forum.mysensors.org/topic/1918/what-radio-to-use-nrf24l01-rfm69-rfm73/
-
Thanks @mfalkvidd - will check it out.
-
Ps. I followed https://github.com/abouillot/HomeAutomation/tree/master/piGateway and now have a MQTT service running. But I do not know how to connect this to domoticz or even debug that it can actually see my test sensor etc.
-
This thread has been great - thanks @mfalkvidd!
@hayduke I had a similar problem earlier. I haven't fixed it yet, but here's where I'm at:
Clean install (Jessie, RF24, Raspberry) March 25th 2016 has the problem where it works for a few minutes, then stops (/dev/pts/0 dissapears, which breaks the symbolic links - ttyMySensorsGateway and ttyUSB20). This is at home where I have a bunch of nodes around and a Vera with serial gateway, so there are lots of different signals coming in.
But when I move to another location with just one node (that just sends a light status update regularly), it works fine - at least, I've been sitting here with it running for 30 minutes so far.
I know this might not help much, I'm new to all this and still getting my head around everything. I would probably agree with what you suggested earlier: something in one of the messages that causes a problem with the gateway (possibly to do with already having another serial gateway nearby).
I'll try to do some more testing by changing this gateway to a different channel to my other one, and gradually bringing nodes across to see when it breaks.
-
@stranger just to make sure - you said you have two gateways at home. Did you change the channel so that they do not interfere with each other?
-
Hello, im just starting to set up some mysensors nodes and have already set up a gateway with nodemcu (esp).
But to eliminate the number of devices i am thinking about moving the gateway directly to the Raspberry pi as mentioned in this thread. Is there any downsides (or upsides) by connecting the nrf24 chip directly to the RPI?And btw:
"The radio module NRF24L01+ is cheap and power efficient, but it is unable to communicate with regular wifi."
That is not entirely correct, the nrf24 can connecct to wifi and send TCP/IP packets with an arduino.
-
@alexsh1 No actually. I didn't want to go around and reprogram all my nodes, and I forgot to turn off my other gateway. That is what I was going to do next, but I've just been running it for a few hours with no problems (with a heap of nodes and another gateway a few metres away, all on the same channel).
I then Home Assistant and tested out a few nodes, and now it sometimes breaks, but mostly works fine.
All that being said, I've realised I need signing (I have a few electronic locks), so I'm going back to a hardware serial gateway. If anyone has got signing working I'd love to hear how - I had a look but couldn't figure it out and don't have much time to spare on it.
-
pi@Domoticz3:~/Raspberry$ sudo ./PiGatewaySerial Starting PiGatewaySerial... Protocol version - 1.4 Created PTY '/dev/pts/1' Gateway tty: /dev/ttyMySensorsGateway ================ SPI Configuration ================ CSN Pin = CE0 (PI Hardware Driven) CE Pin = Custom GPIO25 Clock Speed = 8 Mhz ================ NRF Configuration ================ STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0 RX_ADDR_P0-1 = 0xa8-------------------------------- RX_ADDR_P2-5 = 0xff 0xc----------------- TX_ADDR = 0xe7e7e7e7e7 RX_PW_P0-6 = 0x20 0x20 0x20 0x00 0x00 0x00 EN_AA = 0x3b EN_RXADDR = 0x06 RF_CH = 0x4c RF_SETUP = 0x23 CONFIG = 0x0e DYNPD/FEATURE = 0x3f 0x06 Data Rate = 250KBPS Model = nRF24L01+ CRC Length = 16 bits PA Power = PA_LOW ^[read: 1-1-0 s=0,c=1,t=0,pt=7,l=5:16.1 read: 1-1-0 s=0,c=1,t=23,pt=2,l=2:1022 read: 1-1-0 s=1,c=1,t=23,pt=2,l=2:1023 read: 1-1-0 s=2,c=1,t=23,pt=2,l=2:1021 Received SIGINT^C Exiting... pi@Domoticz3:~/Raspberry$ sudo cat /dev/ttyMySensorsGateway cat: /dev/ttyMySensorsGateway: No such file or directory pi@Domoticz3:~/Raspberry$ sudo /etc/init.d/PiGatewaySerial start [....] Starting PiGatewaySerial (via systemctl): PiGatewaySerial.serviceFailed to start PiGatewaySerial.service: Unit PiGatewaySerial.service failed to load: No such file or directory. failed! pi@Domoticz3:~/Raspberry$
Playing with a RPI 3 B and a NRF24+ radio I got this error message above.
Running Jessie but with no luck...Anybody else got this problem?
-
@Sander-Stolk did you run
sudo make install
?
What happens if you runsudo /usr/local/sbin/PiGatewaySerial
?
-
@mfalkvidd
Tnx that worked but this is not in the tutorial I'm I right?If this happens, double-check your wiring and correct any problems. Press Ctrl+Z and type sudo killall PiGatewaySerial to get rid of the non-functioning Gateway. Then run sudo /usr/local/sbin/PiGatewaySerial again If all is well, exit PiGatewaySerial by pressing Ctrl+C. Then run sudo /etc/init.d/PiGatewaySerial start to start the gateway as a background process. Verify that it started correctly by running```
-
Yes it is. See the section under
COMPILING THE GATEWAYalso, you ran sudo ./PiGatewaySerial instead of sudo /usr/local/sbin/PiGatewaySerial described in the instructions.
-
I have added a
TROUBLESHOOTING
section in the original post to cover for this error. Hopefully it can help if someone else makes the same mistake.
-
Any thoughts on making a version for the 2.0 dev branch?
I recently switched my in-progress builds to 2.0 and am in the process of "trying" to get my Raspberry Pi2 setup with OpenHab and Mosquito. And the idea of not having to have an ethernet gateway arduino in the mix is appealing to me.
I would do it myself but I probably only have 3.275% of the required knowledge at this point
-
I'm unfortunately at about the same level as you. I can compile stuff and do basic troubleshooting, but merging the dev branch with the gateway code is way out of my league.
-
@mfalkvidd said:
I'm unfortunately at about the same level as you. I can compile stuff and do basic troubleshooting, but merging the dev branch with the gateway code is way out of my league.
There is no way you are at 3.275% knowledge like me... I've seen many of your posts on here and you are at least a 4.532%... lol.... no honestly I've liked your posts and you seem very knowledgeable. You've got to be at least a 84.5%
-
Can somebody tell me how to change the channel after compiling and using the Gateway for a couple of days?
Changing the channel in MyConfig.h in the dir Raspberry doesnt bother even after a reboot.
Still 0x4c channel / 76 when I run the PiSerialGateway program.
-
@Sander-Stolk said:
Can somebody tell me how to change the channel after compiling and using the Gateway for a couple of days?
Changing the channel in MyConfig.h in the dir Raspberry doesnt bother even after a reboot.
Still 0x4c channel / 76 when I run the PiSerialGateway program.Did you recompile the code after changing the channel?
-
@alexsh1 I did this after changeing the channel in MyConfig.h: make all && sudo make install
Rebooted after that but no luck
-
That should be sufficient but you could see if running make clean before make all helps.
-
@mfalkvidd I did the make clean and the make install and rebooted.
Still 0x4c eq. 76Using username "pi". Server refused our key pi@192.168.1.14's password: ______ _ _ | _ \ | | (_) | | | |___ _ __ ___ ___ | |_ _ ___ ____ | | | / _ \| '_ ` _ \ / _ \| __| |/ __|_ / | |/ / (_) | | | | | | (_) | |_| | (__ / / |___/ \___/|_| |_| |_|\___/ \__|_|\___/___| Last login: Sat Apr 9 18:41:17 2016 from 192.168.1.34 Monday, 11 April 2016, 12:10:24 pm CEST Linux 4.1.18-v7+ armv7l GNU/Linux Uptime.............: 1 days, 17h29m13s Memory.............: 520336kB (Free) / 948056kB (Total) Load Averages......: 0.00, 0.01, 0.05 (1, 5, 15 min) Running Processes..: 97 IP Addresses.......: 192.168.1.14 pi@Domoticz3:~$ cd Raspberry/ pi@Domoticz3:~/Raspberry$ cat MyConfig.h /* The MySensors library adds a new layer on top of the RF24 library. It handles radio network routing, relaying and ids. Created by Henrik Ekblad <henrik.ekblad@gmail.com> 12/10/14 - Ported to Raspberry Pi by OUJABER Mohamed <m.oujaber@gmail.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. */ #ifndef MyConfig_h #define MyConfig_h /*** * Configure Sensor Network */ #define RF24_CHANNEL 111 //RF channel for the sensor net, 0-127 #define RF24_DATARATE RF24_250KBPS //RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps, or RF24_2MBPS for 2Mbps #define RF24_PA_LEVEL RF24_PA_MAX //Sensor PA Level == RF24_PA_MIN=-18dBm, RF24_PA_LOW=-12dBm, RF24_PA_HIGH=-6dBM, and RF24_PA_MAX=0dBm #define RF24_PA_LEVEL_GW RF24_PA_MAX //Gateway PA Level, defaults to Sensor net PA Level. Tune here if using an amplified nRF2401+ in your gateway. #define BASE_RADIO_ID ((uint64_t)0xA8A8E1FC00LL) // This is also act as base value for sensor nodeId addresses. Change this (or channel) if you have more than one sensor network. // MySensors online examples defaults #define DEFAULT_CE_PIN 9 #define DEFAULT_CS_PIN 10 /*** * Enable/Disable debug logging */ #define DEBUG #ifdef __Raspberry_Pi #define vsnprintf_P vsnprintf #define snprintf_P snprintf #define PSTR(x) (x) #define printf_P printf #define strlen_P strlen #endif #endif pi@Domoticz3:~/Raspberry$ make clean rm -rf MyGateway MySensor MyMessage PiEEPROM PiGateway PiGatewaySerial MyGateway.o MySensor.o MyMessage.o PiEEPROM.o PiGateway.o PiGatewaySerial.o pi@Domoticz3:~/Raspberry$ make all g++ -c -o MyGateway.o MyGateway.cpp -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -mtune=arm1176jzf-s -D_TTY_NAME=\"/dev/ttyMySensorsGateway\" -D_TTY_GROUPNAME=\"tty\" -march=armv6zk -I. -I/usr/local/include/RF24 g++ -c -o MySensor.o MySensor.cpp -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -mtune=arm1176jzf-s -D_TTY_NAME=\"/dev/ttyMySensorsGateway\" -D_TTY_GROUPNAME=\"tty\" -march=armv6zk -I. -I/usr/local/include/RF24 g++ -c -o MyMessage.o MyMessage.cpp -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -mtune=arm1176jzf-s -D_TTY_NAME=\"/dev/ttyMySensorsGateway\" -D_TTY_GROUPNAME=\"tty\" -march=armv6zk -I. -I/usr/local/include/RF24 g++ -c -o PiEEPROM.o PiEEPROM.cpp -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -mtune=arm1176jzf-s -D_TTY_NAME=\"/dev/ttyMySensorsGateway\" -D_TTY_GROUPNAME=\"tty\" -march=armv6zk -I. -I/usr/local/include/RF24 g++ -c -o PiGateway.o PiGateway.cpp -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -mtune=arm1176jzf-s -D_TTY_NAME=\"/dev/ttyMySensorsGateway\" -D_TTY_GROUPNAME=\"tty\" -march=armv6zk -I. -I/usr/local/include/RF24 g++ -o PiGateway MyGateway.o MySensor.o MyMessage.o PiEEPROM.o PiGateway.o -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -mtune=arm1176jzf-s -D_TTY_NAME=\"/dev/ttyMySensorsGateway\" -D_TTY_GROUPNAME=\"tty\" -march=armv6zk -I. -I/usr/local/include/RF24 -lrf24-bcm g++ -c -o PiGatewaySerial.o PiGatewaySerial.cpp -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -mtune=arm1176jzf-s -D_TTY_NAME=\"/dev/ttyMySensorsGateway\" -D_TTY_GROUPNAME=\"tty\" -march=armv6zk -I. -I/usr/local/include/RF24 g++ -o PiGatewaySerial MyGateway.o MySensor.o MyMessage.o PiEEPROM.o PiGatewaySerial.o -Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -mtune=arm1176jzf-s -D_TTY_NAME=\"/dev/ttyMySensorsGateway\" -D_TTY_GROUPNAME=\"tty\" -march=armv6zk -I. -I/usr/local/include/RF24 -lrf24-bcm -lutil pi@Domoticz3:~/Raspberry$ sudo reboot Broadcast message from pi@Domoticz3 on pts/1 (Mon 2016-04-11 12:12:17 CEST): The system is going down for reboot NOW! pi@Domoticz3:~/Raspberry$ Using username "pi". Server refused our key pi@192.168.1.14's password: ______ _ _ | _ \ | | (_) | | | |___ _ __ ___ ___ | |_ _ ___ ____ | | | / _ \| '_ ` _ \ / _ \| __| |/ __|_ / | |/ / (_) | | | | | | (_) | |_| | (__ / / |___/ \___/|_| |_| |_|\___/ \__|_|\___/___| Last login: Mon Apr 11 12:10:24 2016 from 192.168.1.34 Monday, 11 April 2016, 12:12:45 pm CEST Linux 4.1.18-v7+ armv7l GNU/Linux Uptime.............: 0 days, 00h00m25s Memory.............: 770952kB (Free) / 948056kB (Total) Load Averages......: 0.59, 0.16, 0.05 (1, 5, 15 min) Running Processes..: 100 IP Addresses.......: 192.168.1.14 pi@Domoticz3:~$ ls bash_scripts domoticz Dropbox-Uploader Raspberry RF24 pi@Domoticz3:~$ sudo /etc/init.d/PiGatewaySerial start [ ok ] Starting PiGatewaySerial (via systemctl): PiGatewaySerial.service. pi@Domoticz3:~$ sudo /etc/init.d/PiGatewaySerial start [ ok ] Starting PiGatewaySerial (via systemctl): PiGatewaySerial.service. pi@Domoticz3:~$ sudo ln -s /dev/ttyMySensorsGateway /dev/ttyUSB20 ln: failed to create symbolic link β/dev/ttyUSB20β: File exists pi@Domoticz3:~$ sudo /usr/local/sbin/PiGatewaySerial Starting PiGatewaySerial... Protocol version - 1.4 Created PTY '/dev/pts/2' Gateway tty: /dev/ttyMySensorsGateway ================ SPI Configuration ================ CSN Pin = CE0 (PI Hardware Driven) CE Pin = Custom GPIO25 Clock Speed = 8 Mhz ================ NRF Configuration ================ STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0 RX_ADDR_P0-1 = 0xa8a8e RX_ADDR_P2-5 = 0xff 0xc4 TX_ADDR = 0xa8a8e1fc07 RX_PW_P0-6 = 0x20 0x20 0x20 0x00 0x00 0x00 EN_AA = 0x3b EN_RXADDR = 0x06 RF_CH = 0x4c RF_SETUP = 0x23 CONFIG = 0x0e DYNPD/FEATURE = 0x3f 0x06 Data Rate = 250KBPS Model = nRF24L01+ CRC Length = 16 bits PA Power = PA_LOW read: 5-5-5 s=5,c=5,t=5,pt=0,l=0: version mismatch ^CReceived SIGINT Exiting... pi@Domoticz3:~$
-
@Sander-Stolk I don't see a new make install in your output. Did you miss that or is the output just not included?
make all compiles the code. The result is a binary file in the Raspberry folder
make install copies the binary (and some scripts I think) from the Raspberry folder to the system folders.
-
Ok here's the deal to change the channel or other settings:
cd Raspberry
make clean
make all
sudo make install
Done!
-
Does anyone know what this error is about?
RPi2, NRF24l01, OSMC (Debian jessie), Domoticz v3.5051.osmc@osmc:~/Raspberry$ sudo make install Installing PiGatewaySerial to /usr/local/sbin Installing PiGateway to /usr/local/sbin Installing initscripts to /etc/init.d Installing syslog config to /etc/rsyslog.d Failed to restart rsyslog.service: Unit rsyslog.service failed to load: No such file or directory. Makefile:79: recipe for target 'install-initscripts' failed make: *** [install-initscripts] Error 6
I can run the gateway even with the error, i can also add it to Domoticz and send/receive data.
But after a few minutes i get a massive error in domoticz saying "(24) Too many files open" on every logentry and my domoticz loose connection to the Logitech mediaserver, remote Kodi hardware, mqtt server etc.osmc@osmc:~/Raspberry$ sudo ./PiGatewaySerial Starting PiGatewaySerial... Protocol version - 1.4 Created PTY '/dev/pts/2' Gateway tty: /dev/ttyMySensorsGateway ================ SPI Configuration ================ CSN Pin = CE0 (PI Hardware Driven) CE Pin = Custom GPIO25 Clock Speed = 8 Mhz ================ NRF Configuration ================ STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0 RX_ADDR_P0-1 = 0xa8a8e1fc00 0xa8a8e1fc00 RX_ADDR_P2-5 = 0xff 0xc4 0xc5 0xc6 TX_ADDR = 0xa8a8e1fc02 RX_PW_P0-6 = 0x20 0x20 0x20 0x00 0x00 0x00 EN_AA = 0x3b EN_RXADDR = 0x06 RF_CH = 0x4c RF_SETUP = 0x23 CONFIG = 0x0e DYNPD/FEATURE = 0x3f 0x06 Data Rate = 250KBPS Model = nRF24L01+ CRC Length = 16 bits PA Power = PA_LOW
-
Hi, is signing supported using this library? thanks.
-
@cingolanifede the Raspberry Pi gateway does not support signing.
-
I'm looking for some help in getting "PiGatewaySerial" running properly. I am having no issue running "PiGateway" and receiving all data from a counter node I'm using for testing. When I try to run "PiGatewaySerial", only intermittent data appears. For this example, I have my counter sending increasing integers at 1 second intervals, and receives fewer than 1 in 25 through the "PiGatewaySerial" script. I previously had this working reliably on a RPi2, reading in the tty output and logging it to a file. Now, I cannot repeat that on either that device, nor the current RPi B+ I'm working with. I'm sure there's some basic setting that I'm missing, but I can't seem to figure it out. Thanks!
An example of "PiGateway" correctly receiving all messages:
pi@raspberrypi:/dev/pts $ sudo /usr/local/sbin/PiGateway Starting Gateway... ================ SPI Configuration ================ CSN Pin = CE0 (PI Hardware Driven) CE Pin = Custom GPIO25 Clock Speed = 8 Mhz ================ NRF Configuration ================ STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0 RX_ADDR_P0-1 = 0xa8a8e1fc00 0xa8a8e1fc00 RX_ADDR_P2-5 = 0xff 0xc4 0xc5 0xc6 TX_ADDR = 0xe7e7e7e7e7 RX_PW_P0-6 = 0x20 0x20 0x20 0x00 0x00 0x00 EN_AA = 0x3b EN_RXADDR = 0x06 RF_CH = 0x4c RF_SETUP = 0x23 CONFIG = 0x0e DYNPD/FEATURE = 0x3f 0x06 Data Rate = 250KBPS Model = nRF24L01+ CRC Length = 16 bits PA Power = PA_LOW [CALLBACK]0;0;3;0;14;Gateway startup complete. read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:906 [CALLBACK]0;33;1;0;38;906 read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:907 [CALLBACK]0;33;1;0;38;907 read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:908 [CALLBACK]0;33;1;0;38;908 read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:909 [CALLBACK]0;33;1;0;38;909 read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:910 [CALLBACK]0;33;1;0;38;910 read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:911 [CALLBACK]0;33;1;0;38;911 read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:912 [CALLBACK]0;33;1;0;38;912 read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:913 [CALLBACK]0;33;1;0;38;913
an example of "PiGatewaySerial" missing most messages:
pi@raspberrypi:/dev/pts $ sudo /usr/local/sbin/PiGatewaySerial Starting PiGatewaySerial... Protocol version - 1.4 Created PTY '/dev/pts/1' Gateway tty: /dev/ttyMySensorsGateway ================ SPI Configuration ================ CSN Pin = CE0 (PI Hardware Driven) CE Pin = Custom GPIO25 Clock Speed = 8 Mhz ================ NRF Configuration ================ STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0 RX_ADDR_P0-1 = 0xa8a8e1fc00 0xa8a8e1fc00 RX_ADDR_P2-5 = 0xff 0xc4 0xc5 0xc6 TX_ADDR = 0xe7e7e7e7e7 RX_PW_P0-6 = 0x20 0x20 0x20 0x00 0x00 0x00 EN_AA = 0x3b EN_RXADDR = 0x06 RF_CH = 0x4c RF_SETUP = 0x23 CONFIG = 0x0e DYNPD/FEATURE = 0x3f 0x06 Data Rate = 250KBPS Model = nRF24L01+ CRC Length = 16 bits PA Power = PA_LOW read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:301 read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:302 read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:303 read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:328 read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:353 read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:378 read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:403 read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:428 read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:454 read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:479 read: 0-0-0 s=33,c=1,t=38,pt=2,l=2:504
I'm running a RPi B+, NRF24l01+, on a clean install of Jessie, and using only a few percent of the CPU power.
-
I have been thinking about giving this a try But:-
The Raspberry port is using protocol version 1.4.
Do the sensors also have to use version 1.4?
-
@rmtucker
No, the sensors can be running 1.5 or 2.0-beta, the PI will run a 1.4 version.
The only thing not supported by the PiGateway is message signing.
But I have a mix of sensors in 1.5, 1.6-beta and 2.0-beta in my home network, so it certainly works.
-
Is it best to start with a blank jessie image and manually install/compile domoticz or just use the domoticz sd image?
The latter would be the easiest for me because i am useless with the CLI but if the first method is best??
-
Adding support for signing on a pi gw should just be a matter of implementing random number generation and use software signing. With slight modification in the software signing backend as it assumes Arduino api:s for obtaining a seed for the rng.
-
@rmtucker if you want to be able to run the very latest version of Domoticz, use the Debian image and compile Domoticz from git.
I use the Domoticz image. The downside is that I need to wait for new "official" Domoticz builds before upgrading, but the upside is that getting up and running was very easy.
-
@mfalkvidd
Actually ... I started with an official Domoticz build, and then I indicated in the settings that I wanted to update with the beta version. Since then I'm always on the latest beta (v5143 at the moment).
-
@GertSanders cool. How often is the beta updated? Every build?
-
Just set this up on my existing Raspberry pi B+ Domoticz server and it is working perfectly so i have managed to get rid of the uno Gateway.
Thank you so much,I can now try and squeeze it all in the Raspi case and the job is finished.
-
This is the cpu usage,the spike is me compiling the software as above.
-
@mfalkvidd
Well, that seems to be the case. Sometimes I see daily updates, sometimes a week passes by without any changes. I selected the BETA channel for updates and since then I have seen new functionality come in on a regular basis. Not all of it is relevant to Mysensors of course, but none the less it's fun to see Domoticz is developed actively.
-
@GertSanders I have seen no issues in Domoticz stable with CPU usage. Thing just purrs along. Will have to check when I get home but i believe my system uptime is approaching 1 year. It "just works" as they say.
I would like to upgrade to mysensors 2.0 library by it looks like the Pi repo has not being updated as often (last I checked, anyway).
-
@wergeld
Correct, the PI repo is basically unchanged. But it still is compatible with the 2.0-beta Mysensors library.
-
@GertSanders What? I was under the impression that some features (like sending messages to nodes from domitcz wouldn't work).
-
@wergeld
Did not notice that, I can send values and "switch on" messages to nodes. The only thing I miss is the signing via ATSHA204. Even V_TEXT sending to and from nodes works.
-
I have some trouble with the gateway not storing the network map, if i restart the gateway my non-sensor nodes need to send some kind of heartbeat to reconnect to the gateway.
Is this a known problem or is it something wrong with my setup?
-
Yes, known problem.
I had some hopes on @marceloaqno and @aaron832 providing a PR into development branch (so we can scrap the old RPI code). But there hasn't been any activity in a while.
https://forum.mysensors.org/topic/2759/mysensors-raspberry-port-suggestions/12
-
@hek But insted of including heartbeats from every non sensor node (trying to keep 2.4 ghz traffic to a minimum), can i solve this by using an arduino repeater node? So the repeater knows the network map and sends heartbeat to the gateway.
-
No, not possible. The repeater won't propagate it's knowledge about all sub-nodes.
-
@Sander-Stolk hi
how do you achieve to have a nice 'logon' screen ou your PI: Domotics Logo, @ip,memory,date... etc etc..
Im' newbee on raspberry from france
HAve a nice day
JP
i really want to have the same or any available sample like yours
| _ \ | | ()
| | | |__ _ __ ___ ___ | |_ _ ___ ____
| | | / _ | '_ ` _ \ / _ | | |/ | /
| |/ / () | | | | | | () | |_| | ( / /
|/ _/|| || ||___/ _||_/|Last login: Mon Apr 11 12:10:24 2016 from 192.168.1.34
Monday, 11 April 2016, 12:12:45 pm CEST
Linux 4.1.18-v7+ armv7l GNU/Linux
Uptime.............: 0 days, 00h00m25s
Memory.............: 770952kB (Free) / 948056kB (Total)
Load Averages......: 0.59, 0.16, 0.05 (1, 5, 15 min)
Running Processes..: 100
IP Addresses.......: 192.168.1.14
-
@jpbabou That is the Message of the day (motd) and you can edit it to fit your needs.
This guide should work on debian weezy and jessie
https://oitibs.com/debian-wheezy-dynamic-motd/
-
@Tore-AndrΓ©-Rosander
Tks a lot for your answer.. It seems to look like what i want at logon..Iwill test it.
I keep you in touch!
-
@Tore-AndrΓ©-Rosander
Tks a lot
It works's fine!!
pi@JpPi2 ~ $ ssh JpPi3
_ ____ _ _____
| |_ __ | _ ()__ /
_ | | '_ | |) | | |
| || | |) | /| |) |
_/| ._/|| ||___/
||Welcome to Raspbian GNU/Linux 8.0 (jessie) (4.4.7-v7+).
System information as of: Wed Jun 1 09:10:09 CEST 2016
System load: 0.01 IP Address:
Memory usage: 17.9% System uptime: 1 day
Usage on /: 27% Swap usage: 0.0%
Local Users: 1 Processes: 126Last login: Wed Jun 1 09:03:53 2016 from raspberryjp
-
I have been struggeling with this for some time now. It seems my compiler is not the standard for raspberry pi? (I have a pi 2). I have used the domoticz sdcard as ground for my system and it works (a bit sketchy with random freezes and I cannot access the domotics webserver from chrome) but still. Anyway, I get stuck on making the RF24 package. Any ideas?
pi@raspberrypi ~/RF24 $ make all && sudo make install arm-linux-gnueabihf-g++ -fPIC -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -Ofast -Wall -pthread -c RF24.cpp cc1plus: error: bad value (cortex-a7) for -mtune switch Makefile:40: recipe for target 'RF24.o' failed make: *** [RF24.o] Error 1
-
Did anyone setup rfm69 successfully on the raspberry pi
-
Has anyone used the Raspberry GW software in combination with nodes that run the new 2.0.0 MySensors code ?
-
It's not supported, 2.0.0 nodes require a 2.0.0 GW. And the raspberry pi port is not updated to 2.0.0 (and unfortunately there is currently no one in the core group that uses the rpi gw.. We all use serial / ethernet gw's of some sort)
-
@tbowmo
I was afraid of that. In my enthusiasm I updated to 2.0.0, but now my new nodes play dead.
At least I know why.
Time to make that old ethernet gateway functional again.
Since Breda meetup is this weekend, I will have no more time to figure this out (if I could ever, this is UNIX). Maybe after I can try something.
-
What would be required to get the RPi gateway up and running? Having single controller/gateway is great.
-
@tbowmo
Is a 2.0.0 based gateway backward compatible with nodes in an older version ?
-
@wergeld
Probably porting the Arduino lib to Raspberry and compiling again ?
-
@tbowmo
Is the last 2.0.0-dev version (before the new 2.0.0 official release) still available somewhere ?
That DEV version seemed to still work with my Raspi GW.
-
Time to start reading up on converting the lib! Might have a go at it in week or so. Work is holding me hostage at the moment.
-
Praise Apple for making TimeMachine. I was able to set back the last version of MySensors lib I know was working with my gateway in a bout 1 minute.
Back in business now. Upgrading the gateway and nodes to full 2.0.0 is for later.
-
you need to port the mysensors core library.. It is however filled with arduino specifics at the moment (we have had some talks about removing arduino dependencies, but it's not made yet).
Ideally someone should make a raspberry pi port, that we can merge into the main repository, so the same codebase can be build for both raspberryPi and arduino based hardware.
A 2.0.0 GW should be compatible with 1.5.x nodes, but 2.0.0 nodes require a 2.0.0 GW.. (I can't remember the specifics in what the changes are, @tekka is the brain behind that stuff). That said, we do recommend that both nodes and GW will be updated to same mysensors versions, as to avoid any problems.
-
@tbowmo @wergeld @GertSanders a port is already available, see https://forum.mysensors.org/topic/2759/mysensors-raspberry-port-suggestions/11 (and github)
It would be awesome if someone could merge that great work with the MySensors repo.
-
Ok, didn't know that it was updated to 2.0.0 "final", thanks for the hint
-
Would it be safe to say a RPI gateway 2.0 is not available yet for beginners ? (like the instructions @mfalkvidd made are not usable for this ?)
-
@Sander-Teunissen
At the moment I would advise beginners to use a separate GW for the official 2.0.0 (ethernet or serial based). I found the ethernet based gateway the easiest to use in various setups, espcially since Domoticz (my controller of choice) supported this.