Step-by-step procedure to connect the NRF24L01+ to the GPIO pins and use the Raspberry as a Serial Gateway (MySensors 1.x)



  • @alexsh1 I did this after changeing the channel in MyConfig.h: make all && sudo make install
    Rebooted after that but no luck


  • Mod

    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. 76

    Using 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:~$
    

  • Mod

    @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.


  • Mod

    @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?


  • Hardware Contributor

    @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.



  • @GertSanders

    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??


  • Contest Winner

    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.


  • Mod

    @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.


  • Hardware Contributor

    @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).


  • Mod

    @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.
    0_1463683081123_chart(2).jpeg


  • Hardware Contributor

    @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).


  • Hardware Contributor

    @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).


  • Hardware Contributor

    @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?


  • Admin

    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.


  • Admin

    @Tore-André-Rosander

    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: 126

    Last 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


  • Hardware Contributor

    Has anyone used the Raspberry GW software in combination with nodes that run the new 2.0.0 MySensors code ?


  • Admin

    @GertSanders

    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)


  • Hardware Contributor

    @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.



  • @tbowmo

    What would be required to get the RPi gateway up and running? Having single controller/gateway is great.


  • Hardware Contributor

    @tbowmo
    Is a 2.0.0 based gateway backward compatible with nodes in an older version ?


  • Hardware Contributor

    @wergeld
    Probably porting the Arduino lib to Raspberry and compiling again ?


  • Hardware Contributor

    @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.



  • @GertSanders

    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.


  • Hardware Contributor

    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.


  • Admin

    @wergeld

    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.

    @GertSanders

    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.


  • Mod

    @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.


  • Admin

    @mfalkvidd

    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 ?)


  • Hardware Contributor

    @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.



  • @GertSanders Thanks Gert !
    I did a quick build of the serial gateway using an arduino which I connect to my RPI. Pretty easy. I'll be watching this when I can switch back to the RPI built gateway...



  • @mfalkvidd said:

    OTHER NOTES

    • The 3.3V power on the Raspberry Pi is rated for a maximum of 50mA. A regular NRF24L01+ only needs 15mA, but if you are using a power amplified version you might exceed what the Raspberry Pi can output. In that case, an external power supply might be required.

    Nice guide thanks.
    when using external power supply i think it is best to connect Ground from Rpi and ext power supply. Maybe write that in the guide?



  • @flopp the best would be to use Raspberry's 5V rail and reduce it to 3.3V via the LDO like @GertSanders did in his board.

    There is one member using 3.3V rail for powering PA+LNA Tranceiver without any issues - check out the latest open hardware. I have not tried it personally


  • Mod

    @alexsh1 I wouldn't want a guide to recommend a solution that is way outside the specifications even if users might not experience problems. Strange problems usually happen outside specs, they are a pain to troubleshoot and in this case might lead to frying someone's Raspberry Pi.

    @flopp thanks for your suggestion, I've amended to guide.



  • @mfalkvidd I"m confused. I noticed the instructions below is for 1.5X or below and will not work with 2.0. The link for 2.0 that is posted doesn't make any sense to me at all. It also takes me to a thread where I start reading the information from the middle of a thread. I'm coming to the conclusion that it doesn't work yet..... Am I right?
    SUPER New here. sorry


  • Mod

    @SeanMarsh I don't know anything more than what's stated in that thread, sorry. That's also why it is the last option of the alternatives. Go with a serial, wifi or ethernet gateway if you can.



  • I also have a serial gateway next to my raspberry (3 in this case) with Domoticz on it.
    If there is an issue than at least a part is still running without breaking everything.
    I am using zwave at most and mysensors now for playing.
    I cannot break the current zwave implementation so for me a serial gateway is the best solution.
    For playing around you might just try as i imaging it could be fun to do it.



  • How can we update the gateway to v1.5? I just tried to rebuild from github today and I am getting really odd errors now that I did not get before:
    cc1: error: bad value (cortex-a7)

    What I could find online states I need to update the gcc compiler on my rPi - it is currently version 4 and latest is 5...but apt-get update gcc says I am already at latest version.

    I am trying to get my slimNodes up and running using v1.5 of mysensors.



  • How can I use "PA power HIGH" with this setup?



  • i can not add device to domoticz controller with serial gateway(1.4)

    MySensors Gateway USB
    Version: 1.4 Setup



  • is this true ?

    
    pi@raspberrypi:~$ sudo make enable-gwserial
    make: *** No rule to make target 'enable-gwserial'.  Stop.
    


  • @Reza try:
    cd Raspberry
    sudo make enable-gwserial



  • @Toyman
    thank you



  • in domoticz i have this problem :

    
    pi@raspberrypi:~$ sudo cat /dev/ttyMySensorsGateway
    cat: /dev/ttyMySensorsGateway: No such file or directory
    


  • How do I remove all that I have installed at the top of this thread so I can revert back to an arduino serial gateway?


  • Mod

    @rmtucker run "sudo make uninstall" when standing in the Raspberry folder



  • @mfalkvidd do you mean the root directory?
    I have had this running for a number of months but I want to go back to the arduino serial setup without losing my domoticz controller or data.


  • Mod

    @rmtucker I mean the folder containing the files from the git repo.



  • Is there a way to manually type messages to the nodes?



  • Hi,
    maybe someone could give me a hint. I installed everything and it looks like it is working, but no sensors are displayed in Domoticz. Any idea what's wrong?

    I used this sensor before with a ESP Wifi gateway and it was working fine. The DallasTemp Sensors got visible in Domoticz right after the gateway was added in the Hardware section.

    After installing the NRF24l01 on the Rasperry Pi 3 and follwing the instructions above, I added MySensorsGateway USB with /dev/ttyUSB20, but nothing happend.

    Would be nice, if I could get this smart thing working. Else I would need to go back to the ESP Wifi gateway.

    Domoticz log:
    2016-12-30 00:31:01.610 Domoticz V3.5877 (c)2012-2016 GizMoCuz
    2016-12-30 00:31:01.611 Build Hash: 15b013c, Date: 2016-11-10 16:44:33
    2016-12-30 00:31:01.611 System: Raspberry Pi
    2016-12-30 00:31:01.611 Startup Path: /home/pi/domoticz/
    2016-12-30 00:31:02.327 Sunrise: 08:18:00 SunSet:15:59:00
    2016-12-30 00:31:02.327 EventSystem: reset all events...
    2016-12-30 00:31:02.411 Active notification subsystems: (0/12)
    2016-12-30 00:31:02.448 WebServer(HTTP) started on address: :: with port 8080
    2016-12-30 00:31:02.479 WebServer(SSL) started on address: :: with port 443
    2016-12-30 00:31:02.481 Proxymanager started.
    2016-12-30 00:31:02.516 Starting shared server on: :::6144
    2016-12-30 00:31:02.516 TCPServer: shared server started...
    2016-12-30 00:31:02.517 RxQueue: queue worker started...
    2016-12-30 00:31:04.520 EventSystem: reset all events...
    2016-12-30 00:31:04.520 EventSystem: reset all device statuses...
    2016-12-30 00:31:04.521 EventSystem: Started
    2016-12-30 00:31:05.519 MySensors: Using serial port: /dev/ttyUSB20
    2016-12-30 00:33:06.145 Incoming connection from: 127.0.0.1


    pi@raspberrypi:~ $ 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 = 0xa8a8e1fc02 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
    read: 2-2-0 s=255,c=3,t=24,pt=1,l=1:1
    read: 2-2-255 s=255,c=3,t=7,pt=0,l=0:
    send: 0-0-2-2 s=255,c=3,t=8,pt=1,l=1,st=ok:0
    read: 2-2-255 s=255,c=3,t=7,pt=0,l=0:
    send: 0-0-2-2 s=255,c=3,t=8,pt=1,l=1,st=ok:0
    read: 2-2-255 s=255,c=3,t=7,pt=0,l=0:
    send: 0-0-2-2 s=255,c=3,t=8,pt=1,l=1,st=ok:0
    read: 2-2-0 s=255,c=3,t=24,pt=1,l=1:1
    read: 2-2-255 s=255,c=3,t=7,pt=0,l=0:
    send: 0-0-2-2 s=255,c=3,t=8,pt=1,l=1,st=ok:0
    read: 2-2-0 s=255,c=3,t=24,pt=1,l=1:1
    ...


    pi@raspberrypi:~ $ sudo cat /dev/ttyMySensorsGateway
    0;0;3;0;14;Gateway startup complete.
    2;255;3;0;24;1
    2;255;3;0;24;1
    2;255;3;0;24;1
    2;255;3;0;24;1
    2;255;3;0;24;1
    1;255;3;0;24;1
    2;255;3;0;24;1
    1;255;3;0;24;1
    2;255;3;0;24;1
    1;255;3;0;24;1
    2;255;3;0;24;1
    1;255;3;0;24;1
    2;255;3;0;24;1
    2;255;3;0;24;1
    2;255;3;0;24;1
    ...


    Traces from sensor node:
    Starting sensor (RNNNA-, 2.0.0)
    TSM:INIT
    TSM:RADIO:OK
    TSP:ASSIGNID:OK (ID=2)
    TSM:FPAR
    TSP:MSG:SEND 2-2-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSP:MSG:READ 0-0-2 s=255,c=3,t=8,pt=1,l=1,sg=0:0
    TSP:MSG:FPAR RES (ID=0, dist=0)
    TSP:MSG:PAR OK (ID=0, dist=1)
    TSM:FPAR:OK
    TSM:ID
    TSM:CHKID:OK (ID=2)
    TSM:UPL
    TSP:PING:SEND (dest=0)
    TSP:MSG:SEND 2-2-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1
    TSP:CHKUPL:FAIL (hops=255)
    !TSM:UPL:FAIL
    TSM:FPAR
    TSP:MSG:SEND 2-2-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSM:FPAR
    TSP:MSG:SEND 2-2-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSP:MSG:READ 0-0-2 s=255,c=3,t=8,pt=1,l=1,sg=0:0
    TSP:MSG:FPAR RES (ID=0, dist=0)
    TSP:MSG:PAR OK (ID=0, dist=1)
    TSM:FPAR:OK
    TSM:ID
    TSM:CHKID:OK (ID=2)
    TSM:UPL
    TSP:PING:SEND (dest=0)
    TSP:MSG:SEND 2-2-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1
    TSP:CHKUPL:FAIL (hops=255)
    !TSM:UPL:FAIL
    TSM:FPAR
    TSP:MSG:SEND 2-2-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSP:MSG:READ 0-0-2 s=255,c=3,t=8,pt=1,l=1,sg=0:0
    TSP:MSG:FPAR RES (ID=0, dist=0)
    TSP:MSG:PAR OK (ID=0, dist=1)
    TSM:FPAR:OK
    TSM:ID
    TSM:CHKID:OK (ID=2)
    TSM:UPL
    TSP:PING:SEND (dest=0)
    TSP:MSG:SEND 2-2-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1
    TSP:CHKUPL:FAIL (hops=255)
    !TSM:UPL:FAIL
    TSM:FPAR
    TSP:MSG:SEND 2-2-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSP:MSG:READ 0-0-2 s=255,c=3,t=8,pt=1,l=1,sg=0:0
    TSP:MSG:FPAR RES (ID=0, dist=0)
    TSP:MSG:PAR OK (ID=0, dist=1)
    TSM:FPAR:OK
    TSM:ID
    TSM:CHKID:OK (ID=2)
    TSM:UPL
    TSP:PING:SEND (dest=0)
    TSP:MSG:SEND 2-2-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1
    TSP:CHKUPL:FAIL (hops=255)
    !TSM:UPL:FAIL
    ....


  • Mod

    @_Rooky_ congratulations on your first post in the forum, welcome!

    The gateway uses MySensors 1.4 and the node uses version 2. These versions are not compatible.

    You probably want to use version 2 for the gateway as well. https://www.mysensors.org/build/raspberry describes how to create a gateway for version 2 (the gateway was completely rewritten for version 2)



  • @mfalkvidd many thanks for the very quick and polite reply.
    It is working now and this solution is much better way, than using an additional ESP as gateway.
    Even though I got on the wrong lane, I learned more details from your excellent guide, than from the "make", "make install" from the MySensors page ... and still got a lot to learn



  • Thanks for this thorough guide, it works perfect 🙂



  • @Scala I have the same error as you. Worked perfectly first time, and after reboot the "/dev/ttyMySensorsGateway: No such file or directory" error message appear. Did you solve this?



  • @MrRikkie Did you solve this issue? I got the same error as you..



  • hi
    when that run this code
    :

    sudo /etc/init.d/PiGatewaySerial start
    

    error:

    [....] Starting PiGatewaySerial (via systemctl): PiGatewaySerial.serviceFailed to start PiGatewaySerial.service: Unit PiGatewaySerial.service failed to load: No such file or directory.
    

    can you help me??


  • Hardware Contributor

    TROUBLESHOOTING
    If you get this error

    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!
    

    or this error

    pi@raspberrypi ~ $ sudo /usr/local/sbin/PiGatewaySerial
    sudo: /usr/local/sbin/PiGatewaySerial: command not found
    

    you have probably forgotten to run sudo make install. Read the instructions again, and follow them this time 🙂

    In my case I did need simply to restart. I did "make install" but I did need to restart 😉 😉



  • I know this thread is ancient, but why it was needed to add

    sudo ln -s /dev/ttyMySensorsGateway /dev/ttyUSB20
    

    into rc.local if you could just change a line in makefile from

    TTY_NAME := /dev/ttyMySensorsGateway
    

    to

    TTY_NAME := /dev/ttyUSB20
    

    and create "proper" name from the start



  • Hi,
    I plan using a gateway with Mydomoticz and this solution seems great. However, I might want to use later signing or the high Amplifier NRF24 or even the version 2 which seem not suitable for this project.
    How easy is it to start with this gateway, then migrate to an external ethernet gateway ?
    I saw this gateway can be uninstalled, but should I then modify anything on sensors to move them to new gateway ? will I lose log datas in Domoticz ?

    br,
    Ricorico94


  • Mod

    @ricorico94 welcome to the MySensors commu ity! All you need to do when switching from raspberry pi gateway to ethernet gateway is change the "hardware" configuration in Domoticz.

    However, if you are just starting out, don't use this gateway. It works for MySensors 1.x only. Use the new raspberry pi gateway instead.



Suggested Topics

13
Online

11.4k
Users

11.1k
Topics

112.7k
Posts