How do I setup Raspberry Pi 2 with NRF24L01 as MySensor 2.0 Gateway with MyController as controller
-
Hi,
I'm stuck trying to setup my Raspberry Pi 2 with NRF24L01 to the GPIO pins as a Gateway and as a controller (MyController.org). Im trying to use MySensors 2.0 library. I will gladly pay a bit if someone can help with 1-to-1 via Skype or similar to get this working. As Im close to giving up on my own...
Any help is very much appreciated.
Configuration of the gateway on the Raspberry Pi 2
pi@raspberrypi:~/MySensors $ ./configure --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensorsGateway --my-radio=nrf24 --my-rf24-channel=0 [SECTION] Detecting target machine. [OK] machine detected: SoC=BCM2836, Type=Rpi2, CPU=armv7l, REV=a01041. [OK] init system detected: systemd [SECTION] Saving configuration. [SECTION] Cleaning previous builds. [OK] Finished.
Make command on the Raspberry Pi 2 via Terminal on my Mac.
pi@raspberrypi:~/MySensors $ make cc -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/log.o drivers/Linux/log.c g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=0 -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/noniso.o drivers/Linux/noniso.cpp g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=0 -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/Print.o drivers/Linux/Print.cpp g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=0 -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/EthernetClient.o drivers/Linux/EthernetClient.cpp g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=0 -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/SerialPort.o drivers/Linux/SerialPort.cpp g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=0 -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/Stream.o drivers/Linux/Stream.cpp g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=0 -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/IPAddress.o drivers/Linux/IPAddress.cpp g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=0 -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/compatibility.o drivers/Linux/compatibility.cpp g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=0 -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/SoftEeprom.o drivers/Linux/SoftEeprom.cpp g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=0 -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/EthernetServer.o drivers/Linux/EthernetServer.cpp g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=0 -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o examples_linux/mysGateway.o examples_linux/mysGateway.cpp cc -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/RPi/piHiPri.o drivers/RPi/piHiPri.c cc -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/RPi/bcm2835.o drivers/RPi/bcm2835.c g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=0 -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/RPi/rpi_util.o drivers/RPi/rpi_util.cpp g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=0 -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/RPi/Wire.o drivers/RPi/Wire.cpp g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=0 -DMY_LINUX_SERIAL_PTY=\"/dev/ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/RPi/SPI.o drivers/RPi/SPI.cpp g++ -pthread -o examples_linux/mysGateway drivers/Linux/log.o drivers/Linux/noniso.o drivers/Linux/Print.o drivers/Linux/EthernetClient.o drivers/Linux/SerialPort.o drivers/Linux/Stream.o drivers/Linux/IPAddress.o drivers/Linux/compatibility.o drivers/Linux/SoftEeprom.o drivers/Linux/EthernetServer.o examples_linux/mysGateway.o drivers/RPi/piHiPri.o drivers/RPi/bcm2835.o drivers/RPi/rpi_util.o drivers/RPi/Wire.o drivers/RPi/SPI.o
I then ran the mysGateway
pi@raspberrypi:~/MySensors $ sudo ./examples_linux/mysGateway -d mysGateway: Starting gateway... mysGateway: Protocol version - 2.0.1-beta mysGateway: MCO:BGN:INIT GW,CP=RNNG---,VER=2.0.1-beta mysGateway: TSF:LRT:OK mysGateway: TSM:INIT mysGateway: TSM:INIT:TSP OK mysGateway: TSM:INIT:GW MODE mysGateway: TSM:READY mysGateway: MCO:REG:NOT NEEDED mysGateway: MCO:BGN:STP mysGateway: MCO:BGN:INIT OK,ID=0,PAR=0,DIS=0,REG=1 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,0!=7 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,0!=7 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,0!=7 --Continues with same code a lot longer - just cut it short here
Then over to the Arduino Uno that is also connect with an NRF24L01
The sketch I'm running on the Arduino
/* * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad <henrik.ekblad@mysensors.org> * Copyright (C) 2013-2015 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * 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. * ******************************* */ #include <stdint.h> #include <pins_arduino.h> #define MY_DEBUG #define MY_DEBUG_VERBOSE_SIGNING #define MY_RF24_CHANNEL 0 #define MY_RADIO_NRF24 //#define MY_SIGNING_SOFT #define MY_SIGNING_ATSHA204 #define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01}}} #define MY_SIGNING_REQUEST_SIGNATURES #ifndef MY_SIGNING_SOFT_RANDOMSEED_PIN #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7 #endif #ifndef MY_SIGNING_ATSHA204_PIN #define MY_SIGNING_ATSHA204_PIN 17 #endif #define MY_RF24_ENABLE_ENCRYPTION #include <SPI.h> #include <MySensors.h>
However with this sketch I'm recieving an error that I can read on the Serial Monitor on my Mac (output from the Arduino sensor node)
Starting sensor (RNNNAA, 2.0.0) TSM:INIT TSM:RADIO:OK TSP:ASSIGNID:OK (ID=1) TSM:FPAR TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: !TSM:FPAR:FAIL !TSM:FAILURE
I don't understand what is wrong. I do believe all the wires are correct, so I believe it is related to the Arduino sketch, or more likely the gateway setup on the Raspberry Pi.
I hope someone can help. I'll gladly pay someone to give me some 1-to-1 support over Skype or similar.
-
Great work @Christian-Simonsen, and great information posted.
Is the Arduino sketch you posted complete? It seems to be missing some stuff (the present() function for example).
You could try to remove the signing stuff for now, to lower the amount of stuff that could affect the functionality of the node. Start small, and add more stuff when you know the small stuff worksI am not familiar with the MySensors 2.0 output, nor with the new Raspberry pi gateway, so I can't help much unfortunately.
-
This post is deleted!
-
FPAR: FAIL = Find Parent Fail. The sensor is looking for a parent, but cannot find it. There can be several reasons for this:
- Try to add larger capacitors to both radios on GW and the sensor.
- Please use a default sketch on the sensor, no signing etc.
- Double check if the channel is the same. You are using channel 0 on RPi. What about the sensor? Did you change it from a default 76?
- Did you upload both sketches using MySensors 2.0?
- Please check the power feed on both GW and the sensor.
-
Additionally, you try to run a default sketch with
#define MY_NODE_ID 1
Also you may add the following to the above:
#define MY_PARENT_NODE_ID 0 #define MY_PARENT_NODE_IS_STATIC
Please see this https://forum.mysensors.org/topic/3648/node-will-not-connect-unless-define-my_parent_node_id
-
@alexsh1 said:
FPAR: FAIL = Find Parent Fail. The sensor is looking for a parent, but cannot find it. There can be several reasons for this:
- Try to add larger capacitors to both radios on GW and the sensor.
- Please use a default sketch on the sensor, no signing etc.
- Double check if the channel is the same. You are using channel 0 on RPi. What about the sensor? Did you change it from a default 76?
- Did you upload both sketches using MySensors 2.0?
- Please check the power feed on both GW and the sensor.
Hi thanks for the support. Hope you are able to elaborate a bit on your points.
-
Try to add larger capacitors to both radios on GW and the sensor.
I'm using a 4.7 uF Capacitator on both the NRF24L01 on the Raspberry Pi, and on the NRF24L01 on the Arduino. Do you think I still need a bigger capacitor? -
** Please use a default sketch on the sensor, no signing etc.**
Can you share a default sketch to use?
I have tried the below sketch from this page https://www.mysensors.org/download/sensor_api_20#sensor-nodes
But the sketch do not compile due to non defined NODE_ID. I tried to updated the code by changing NODE_ID to MY_NODE_ID and added a line to #DEFINE MY_NODE_ID 1Is this correct? See the updated code that I've used below
#define MY_RADIO_NRF24 #define MY_DEBUG #include <MySensors.h> #include <SPI.h> #define MY_NODE_ID 1 #define MY_PARENT_NODE_ID 0 #define MY_PARENT_NODE_IS_STATIC MyMessage msg(MY_NODE_ID, V_TRIPPED); void presentation() { present(MY_NODE_ID, S_DOOR); } void loop() { }
With this code I still get an error (this is the Arduino Uno sensor node)
TSM:INIT TSM:RADIO:OK TSP:ASSIGNID:OK (ID=1) TSM:FPAR TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: !TSM:FPAR:FAIL !TSM:FAILURE TSM:PDT
- Did you upload both sketches using MySensors 2.0?
Not sure how you upload the sketch to the RPI 2 using MySenors 2.0. However I have atleast tried to follow this tutorial. https://www.mysensors.org/build/raspberry
The actual steps I did are repeated below.
git clone https://github.com/mysensors/MySensors.git cd MySensors
./configure --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensorsGateway --my-radio=nrf24
sudo make all
sudo make install
sudo systemctl enable mysgateway.service
sudo ./examples_linux/mysGateway -d
- Please check the power feed on both GW and the sensor.
How do you do this?
-
@Christian-Simonsen said:
@alexsh1 said:
FPAR: FAIL = Find Parent Fail. The sensor is looking for a parent, but cannot find it. There can be several reasons for this:
- Try to add larger capacitors to both radios on GW and the sensor.
- Please use a default sketch on the sensor, no signing etc.
- Double check if the channel is the same. You are using channel 0 on RPi. What about the sensor? Did you change it from a default 76?
- Did you upload both sketches using MySensors 2.0?
- Please check the power feed on both GW and the sensor.
Hi thanks for the support. Hope you are able to elaborate a bit on your points.
- Try to add larger capacitors to both radios on GW and the sensor.
I'm using a 4.7 uF Capacitator on both the NRF24L01 on the Raspberry Pi, and on the NRF24L01 on the Arduino. Do you think I still need a bigger capacitor?
Yes, try a larger ones. I added 100uF. You may try different transceivers.
- ** Please use a default sketch on the sensor, no signing etc.**
Can you share a default sketch to use?
**All default sketches are here:
https://github.com/mysensors/MySensors/tree/development/examplesTake any sketch.**
I have tried the below sketch from this page https://www.mysensors.org/download/sensor_api_20#sensor-nodes
But the sketch do not compile due to non defined NODE_ID. I tried to updated the code by changing NODE_ID to MY_NODE_ID and added a line to #DEFINE MY_NODE_ID 1Is this correct? See the updated code that I've used below
#define MY_RADIO_NRF24 #define MY_DEBUG #include <MySensors.h> #include <SPI.h> #define MY_NODE_ID 1 #define MY_PARENT_NODE_ID 0 #define MY_PARENT_NODE_IS_STATIC MyMessage msg(MY_NODE_ID, V_TRIPPED); void presentation() { present(MY_NODE_ID, S_DOOR); } void loop() { }
With this code I still get an error (this is the Arduino Uno sensor node)
TSM:INIT TSM:RADIO:OK TSP:ASSIGNID:OK (ID=1) TSM:FPAR TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: !TSM:FPAR:FAIL !TSM:FAILURE TSM:PDT
- Did you upload both sketches using MySensors 2.0?
Not sure how you upload the sketch to the RPI 2 using MySenors 2.0. However I have atleast tried to follow this tutorial. https://www.mysensors.org/build/raspberry
The actual steps I did are repeated below.
git clone https://github.com/mysensors/MySensors.git cd MySensors
./configure --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensorsGateway --my-radio=nrf24
Can you please make sure you add the following to the above:
--my-rf24-channel=76
when compiling the code
sudo make all
sudo make install
sudo systemctl enable mysgateway.service
sudo ./examples_linux/mysGateway -d
- Please check the power feed on both GW and the sensor.
How do you do this?
With a voltmeter. I am sorry, but this is rather DIY when i comes to troubleshooting.
At least you'd know that the voltage is here. If you are using an amplified transceiver, you have to be extra cautious with power. What radios are you using? Post photos
-
@Christian-Simonsen said:
I have tried the below sketch from this page https://www.mysensors.org/download/sensor_api_20#sensor-nodes
But the sketch do not compile due to non defined NODE_ID. I tried to updated the code by changing NODE_ID to MY_NODE_ID and added a line to #DEFINE MY_NODE_ID 1This is not a default sketch, this is just a template to explain how it works. It won't compile (requires NODE_ID definition etc).
Try this sketch:// Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_NODE_ID 1 #define MY_PARENT_NODE_ID 0 #define MY_PARENT_NODE_IS_STATIC #define MY_RADIO_NRF24 #include <MySensors.h> #define CHILD_ID_LIGHT 0 #define LIGHT_SENSOR_ANALOG_PIN 0 unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds) MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL); int lastLightLevel; void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Light Sensor", "1.0"); // Register all sensors to gateway (they will be created as child devices) present(CHILD_ID_LIGHT, S_LIGHT_LEVEL); } void loop() { int16_t lightLevel = (1023-analogRead(LIGHT_SENSOR_ANALOG_PIN))/10.23; Serial.println(lightLevel); if (lightLevel != lastLightLevel) { send(msg.set(lightLevel)); lastLightLevel = lightLevel; } sleep(SLEEP_TIME); }
-
@Christian-Simonsen Additionally, you may need to use CleerEEPROM sketch (in Arduino, examples - MySensors) on your sensor to make sure it is clean BEFORE proceeding with a new sketch.
-
Thanks for all the tips.
I've now installed a new 100 uF (16V) Capacitor in parallell with the current 4.7 uF (50V) capacitor on both the units, I also double checked the writing just to be sure. It all looks good. See images below.
**After adding the capacitor, I uninstalled and cleaned the setting on the Raspberry Pi. **
Sudo make uninstall
pi@raspberrypi:~/MySensors $ sudo make uninstall Stopping daemon mysgateway (ignore errors) removing files rm /etc/systemd/system/mysgateway.service /usr/local/bin/mysGateway
Sudo make clean
pi@raspberrypi:~/MySensors $ sudo make clean [Cleaning] rm -rf build drivers/Linux/log.o drivers/Linux/noniso.o drivers/Linux/SoftEeprom.o drivers/Linux/EthernetClient.o drivers/Linux/SerialPort.o drivers/Linux/Stream.o drivers/Linux/Print.o drivers/Linux/IPAddress.o drivers/Linux/compatibility.o drivers/Linux/EthernetServer.o examples_linux/mysGateway.o drivers/RPi/piHiPri.o drivers/RPi/bcm2835.o drivers/RPi/rpi_util.o drivers/RPi/Wire.o drivers/RPi/SPI.o examples_linux/mysGateway drivers/Linux/log.d drivers/Linux/noniso.d drivers/Linux/SoftEeprom.d drivers/Linux/EthernetClient.d drivers/Linux/SerialPort.d drivers/Linux/Stream.d drivers/Linux/Print.d drivers/Linux/IPAddress.d drivers/Linux/compatibility.d drivers/Linux/EthernetServer.d examples_linux/mysGateway.d drivers/RPi/piHiPri.d drivers/RPi/bcm2835.d drivers/RPi/rpi_util.d drivers/RPi/Wire.d drivers/RPi/SPI.d
**After uninstalling, reset the configuration, and installed and started the gateway. **
pi@raspberrypi:~/MySensors $ ./configure --my-debug=enable --my-gateway=serial --my-serial-is-pty --my-serial-pty=ttyMySensorsGateway --my-transport=nrf24 --my-rf24-channel=76 [SECTION] Detecting target machine. [OK] machine detected: SoC=BCM2836, Type=Rpi2, CPU=armv7l, REV=a01041. [OK] init system detected: systemd [SECTION] Saving configuration. [SECTION] Cleaning previous builds. [OK] Finished.
Make all
pi@raspberrypi:~/MySensors $ sudo make all cc -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/log.o drivers/Linux/log.c g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_PTY=\"ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/noniso.o drivers/Linux/noniso.cpp g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_PTY=\"ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/Print.o drivers/Linux/Print.cpp g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_PTY=\"ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/EthernetClient.o drivers/Linux/EthernetClient.cpp g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_PTY=\"ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/SerialPort.o drivers/Linux/SerialPort.cpp g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_PTY=\"ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/Stream.o drivers/Linux/Stream.cpp g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_PTY=\"ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/IPAddress.o drivers/Linux/IPAddress.cpp g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_PTY=\"ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/compatibility.o drivers/Linux/compatibility.cpp g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_PTY=\"ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/SoftEeprom.o drivers/Linux/SoftEeprom.cpp g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_PTY=\"ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/Linux/EthernetServer.o drivers/Linux/EthernetServer.cpp g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_PTY=\"ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o examples_linux/mysGateway.o examples_linux/mysGateway.cpp cc -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/RPi/piHiPri.o drivers/RPi/piHiPri.c cc -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/RPi/bcm2835.o drivers/RPi/bcm2835.c g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_PTY=\"ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/RPi/rpi_util.o drivers/RPi/rpi_util.cpp g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_PTY=\"ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/RPi/Wire.o drivers/RPi/Wire.cpp g++ -DMY_RADIO_NRF24 -DMY_GATEWAY_SERIAL -DMY_DEBUG -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -DMY_RF24_CHANNEL=76 -DMY_LINUX_SERIAL_PTY=\"ttyMySensorsGateway\" -DMY_IS_SERIAL_PTY -I. -I./core -I./drivers/Linux -I./drivers/RPi -MMD -c -o drivers/RPi/SPI.o drivers/RPi/SPI.cpp g++ -pthread -o examples_linux/mysGateway drivers/Linux/log.o drivers/Linux/noniso.o drivers/Linux/Print.o drivers/Linux/EthernetClient.o drivers/Linux/SerialPort.o drivers/Linux/Stream.o drivers/Linux/IPAddress.o drivers/Linux/compatibility.o drivers/Linux/SoftEeprom.o drivers/Linux/EthernetServer.o examples_linux/mysGateway.o drivers/RPi/piHiPri.o drivers/RPi/bcm2835.o drivers/RPi/rpi_util.o drivers/RPi/Wire.o drivers/RPi/SPI.o
Sudo make install
pi@raspberrypi:~/MySensors $ sudo make install Installing examples_linux/mysGateway to /usr/local/bin install -m0644 initscripts/mysgateway.systemd /etc/systemd/system/mysgateway.service systemctl daemon-reload MySensors gateway has been installed, to add to the boot run: sudo systemctl enable mysgateway.service To start the gateway run: sudo systemctl start mysgateway.service
start the gateway
pi@raspberrypi:~/MySensors $ sudo systemctl start mysgateway.service
Start the debug on the gateway:
pi@raspberrypi:~/MySensors $ sudo ./examples_linux/mysGateway -d mysGateway: Starting gateway... mysGateway: Protocol version - 2.0.1-beta mysGateway: MCO:BGN:INIT GW,CP=RNNG---,VER=2.0.1-beta mysGateway: TSF:LRT:OK mysGateway: TSM:INIT mysGateway: TSM:INIT:TSP OK mysGateway: TSM:INIT:GW MODE mysGateway: TSM:READY mysGateway: MCO:REG:NOT NEEDED mysGateway: MCO:BGN:STP mysGateway: MCO:BGN:INIT OK,ID=0,PAR=0,DIS=0,REG=1 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,0!=7 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,0!=7 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,0!=7
Now, the gateway on the Raspberry Pi 2 seem ok and up and running. Moving over to the sensor node, the Arduino Uno with NRF24L01+.
Uploaded and ran the Clear_EPROM sketch
/* * * This sketch clears radioId, relayId and routing info in EEPROM * */ #include <SPI.h> #include <EEPROM.h> void setup() { for (int i=0;i<512;i++) { EEPROM.write(i, 0xff); } Serial.println("EEPROM cleared"); } void loop() { // Nothing to do here... }
After this I uploaded your recommended default sketch. However I added "#define MY_RF24_CHANNEL 76"
// Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_NODE_ID 1 #define MY_PARENT_NODE_ID 0 #define MY_PARENT_NODE_IS_STATIC #define MY_RADIO_NRF24 #define MY_RF24_CHANNEL 76 #include <MySensors.h> #define CHILD_ID_LIGHT 0 #define LIGHT_SENSOR_ANALOG_PIN 0 unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds) MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL); int lastLightLevel; void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Light Sensor", "1.0"); // Register all sensors to gateway (they will be created as child devices) present(CHILD_ID_LIGHT, S_LIGHT_LEVEL); } void loop() { int16_t lightLevel = (1023-analogRead(LIGHT_SENSOR_ANALOG_PIN))/10.23; Serial.println(lightLevel); if (lightLevel != lastLightLevel) { send(msg.set(lightLevel)); lastLightLevel = lightLevel; } sleep(SLEEP_TIME); }
The result, enoyingly is the same it seems based on the output from the Serial Monitor from the Arduino Uno.
Starting sensor (RNNNA-, 2.0.0) TSM:INIT TSM:RADIO:OK TSP:ASSIGNID:OK (ID=1) TSM:FPAR TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: !TSM:FPAR:FAIL !TSM:FAILURE TSM:PDT TSM:INIT TSM:RADIO:OK TSP:ASSIGNID:OK (ID=1) TSM:FPAR TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: !TSM:FPAR:FAIL !TSM:FAILURE TSM:PDT
Frustrating... Can it be other modules, libraries than what I've not installed on the Raspberry Pi that is the reason for the error?
-
@Christian-Simonsen ok, you have an amplified version of nrf24l01+. It does require more power and could be a problem. How are feeding it from Raspberry please?
Can you try a normal nrf24l01+ on Raspberry? Just like the one you have on a sensor and report back?
-
Again thanks for all the help, very much appreciated.
I started last evening putting together a few more NRF24L01 sensors such as the one on the Node. I will also setup a new extra Arduino Gateways, so I also can test communication between two Arduinos, before testing the same with the Raspberry Pi. Ill report back later tonight when I know the results.
-
@Christian-Simonsen I bet the problem is with your GW radio
-
You are 100 % correct
I changed the NRF24L01 module with the antenna, with a standard NRF24L01+ module. And it works like a charm.
Here are the Serial Monitor code from the Arduino (Sensor node). I don't currently understand what all the code says, but it seems like they are communicating.
Starting sensor (RNNNA-, 2.0.0) TSM:INIT TSM:RADIO:OK TSP:ASSIGNID:OK (ID=1) TSM:FPAR TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSP:MSG:READ 0-0-1 s=255,c=3,t=8,pt=1,l=1,sg=0:0 TSP:MSG:FPAR RES (ID=0, dist=0) TSP:MSG:FPAR (PPAR FOUND) TSP:MSG:PAR OK (ID=0, dist=1) TSM:FPAR:OK TSM:ID TSM:CHKID:OK (ID=1) TSM:UPL TSP:PING:SEND (dest=0) TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1 TSP:MSG:READ 0-0-1 s=255,c=3,t=25,pt=1,l=1,sg=0:1 TSP:MSG:PONG RECV (hops=1) TSP:CHKUPL:OK TSM:UPL:OK TSM:READY TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=ok:0100 TSP:MSG:SEND 1-1-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=ok:2.0.0 TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=ok:0 TSP:MSG:READ 0-0-1 s=255,c=3,t=15,pt=6,l=2,sg=0:0100 TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=11,pt=0,l=12,sg=0,ft=0,st=ok:Light Sensor TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=ok:1.0 TSP:MSG:SEND 1-1-0-0 s=0,c=0,t=16,pt=0,l=0,sg=0,ft=0,st=ok: Request registration... !TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=fail:2 !TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=1,st=fail:2 !TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=2,st=fail:2 !TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=3,st=fail:2 Init complete, id=1, parent=0, distance=1, registration=1 50 !TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=4,st=fail:50 56 !TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=5,st=fail:56 !TSM:UPL FAIL, STATP 58 !TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=fail:58 58 58
And from the Raspberry Pi
mysGateway: TSM:INIT:TSP OK mysGateway: TSM:INIT:GW MODE mysGateway: TSM:READY mysGateway: MCO:REG:NOT NEEDED mysGateway: MCO:BGN:STP mysGateway: MCO:BGN:INIT OK,ID=0,PAR=0,DIS=0,REG=1 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,8!=7 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,0!=7 mysGateway: TSF:MSG:READ,1-1-255,s=255,c=3,t=7,pt=0,l=0,sg=0: mysGateway: TSF:MSG:BC mysGateway: TSF:MSG:FPAR REQ,ID=1 mysGateway: TSF:PNG:SEND,TO=0 mysGateway: TSF:CKU:OK mysGateway: TSF:MSG:GWL OK mysGateway: TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0 mysGateway: TSF:MSG:READ,1-1-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 mysGateway: TSF:MSG:PINGED,ID=1,HP=1 mysGateway: TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1 mysGateway: TSF:MSG:READ,0-1-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,8!=7
-
I have connection, however the communication seem to fail after a while. Seems to get worse and worse. I'm currently sending a msg every 30 seconds from the node. See code below.
Gateway on the Raspberry Pi:
pi@raspberrypi:~/MySensors $ sudo ./examples_linux/mysGateway -d mysGateway: Starting gateway... mysGateway: Protocol version - 2.0.1-beta mysGateway: MCO:BGN:INIT GW,CP=RNNG---,VER=2.0.1-beta mysGateway: TSF:LRT:OK mysGateway: TSM:INIT mysGateway: TSM:INIT:TSP OK mysGateway: TSM:INIT:GW MODE mysGateway: TSM:READY mysGateway: MCO:REG:NOT NEEDED mysGateway: MCO:BGN:STP mysGateway: MCO:BGN:INIT OK,ID=0,PAR=0,DIS=0,REG=1 mysGateway: TSF:MSG:READ,1-1-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 mysGateway: TSF:MSG:PINGED,ID=1,HP=1 mysGateway: TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1 mysGateway: TSF:MSG:READ,1-1-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100 mysGateway: TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:50 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:57 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:57 mysGateway: !TSF:MSG:LEN,0!=9 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,9!=7 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:56 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,9!=7 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,9!=7 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:57
And the code from the Arduino Uno Node
Starting sensor (RNNNA-, 2.0.0) TSM:INIT TSM:RADIO:OK TSP:ASSIGNID:OK (ID=1) TSM:FPAR TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSP:MSG:READ 0-0-1 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=1) TSM:UPL TSP:PING:SEND (dest=0) TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1 TSP:MSG:READ 0-0-1 s=255,c=3,t=25,pt=1,l=1,sg=0:1 TSP:MSG:PONG RECV (hops=1) TSP:CHKUPL:OK TSM:UPL:OK TSM:READY TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=ok:0100 TSP:MSG:SEND 1-1-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=ok:2.0.0 TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=ok:0 TSP:MSG:READ 0-0-1 s=255,c=3,t=15,pt=6,l=2,sg=0:0100 TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=11,pt=0,l=12,sg=0,ft=0,st=ok:Light Sensor TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=ok:1.0 TSP:MSG:SEND 1-1-0-0 s=0,c=0,t=16,pt=0,l=0,sg=0,ft=0,st=ok: Request registration... TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=ok:2 TSP:MSG:READ 0-0-1 s=255,c=3,t=27,pt=1,l=1,sg=0:1 Node registration=1 Init complete, id=1, parent=0, distance=1, registration=1 50 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:50 55 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:55 57 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:57 57 56 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:56 56 57 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:57 58 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:58 57 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:57 58 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:58 56 !TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=fail:56 55 !TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=1,st=fail:55 55 55 59 !TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=2,st=fail:59 58 !TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=3,st=fail:58 56 !TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=4,st=fail:56 58 !TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=5,st=fail:58 !TSM:UPL FAIL, SNP TSM:FPAR TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: 56 !TSP:SEND:TNR```
-
My sensors are located about 3 meters apart with nothing in between. To mitigate the packet loss I've increased by the Gateway to RF24_PA_HIGH and the Arduino to RF24_PA_MAX. I tested MAX on the Gateway aswell, but it didn't seem to handle this setting.
Note I've changed the code of the Node - it now sends a number per msg, and it increases by 1 for each message. This way I found it easier to track which msg that succeeded and which didn't.
First it looked ok, but the msg started to fail after some time (note: I have 3 seconds between each message now)
When I start the Gateway by using "sudo ./examples_linux/mysGateway -d" it starts fine, and connects with the Arduino which I restart at the same time as I type the code above in terminal to start the Gateway on the Raspberry Pi.
After the setup it seems like most of the first 13 messages go through successfully. Then the next 10 messages fail (atleast looks like it on the GW debug info). Then there is another good period from 23-40, but with a few lost. Then the rest fail, and the sensor also starts reporting the messages as failed. After this I have to restart the Sensor node to be able to regain communication.
Do anyone know what is wrong... ?
The Raspberry Pi Gateway:
pi@raspberrypi:~/MySensors $ sudo ./examples_linux/mysGateway -d mysGateway: Starting gateway... mysGateway: Protocol version - 2.0.1-beta mysGateway: MCO:BGN:INIT GW,CP=RNNG---,VER=2.0.1-beta mysGateway: TSF:LRT:OK mysGateway: TSM:INIT mysGateway: TSM:INIT:TSP OK mysGateway: TSM:INIT:GW MODE mysGateway: TSM:READY mysGateway: MCO:REG:NOT NEEDED mysGateway: MCO:BGN:STP mysGateway: MCO:BGN:INIT OK,ID=0,PAR=0,DIS=0,REG=1 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:1 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:2 mysGateway: TSF:MSG:READ,1-1-0,s=255,c=3,t=12,pt=0,l=3,sg=0:1.0 mysGateway: TSF:MSG:READ,1-1-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2 mysGateway: TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1 mysGateway: TSF:MSG:READ,1-1-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2 mysGateway: !TSF:MSG:LEN,0!=8 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:3 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:4 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:6 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,17!=7 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:8 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:9 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:10 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:11 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:13 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:13 mysGateway: !TSF:MSG:LEN,0!=9 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,9!=7 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,9!=7 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,9!=7 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,9!=7 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,0!=7 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,9!=7 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,9!=7 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:23 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:25 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:25 mysGateway: !TSF:MSG:LEN,0!=9 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,9!=7 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:28 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:30 mysGateway: TSF:MSG:READ,0-0-0,s=0,c=0,t=0,pt=0,l=0,sg=0: mysGateway: !TSF:MSG:LEN,9!=7 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:31 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:33 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:34 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:37 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:40 mysGateway: TSF:MSG:READ,1-1-0,s=0,c=1,t=23,pt=2,l=2,sg=0:40 mysGateway: !TSF:MSG:LEN,0!=9
And the Arduino sensor node:
Starting sensor (RNNNA-, 2.0.0) TSM:INIT TSM:RADIO:OK TSP:ASSIGNID:OK (ID=1) TSM:FPAR TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSP:MSG:READ 0-0-1 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=1) TSM:UPL TSP:PING:SEND (dest=0) TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1 TSP:MSG:READ 0-0-1 s=255,c=3,t=25,pt=1,l=1,sg=0:1 TSP:MSG:PONG RECV (hops=1) TSP:CHKUPL:OK TSM:UPL:OK TSM:READY TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=ok:0100 TSP:MSG:SEND 1-1-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=ok:2.0.0 TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=ok:0 TSP:MSG:READ 0-0-1 s=255,c=3,t=15,pt=6,l=2,sg=0:0100 TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=11,pt=0,l=12,sg=0,ft=0,st=ok:Light Sensor TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=ok:1.0 TSP:MSG:SEND 1-1-0-0 s=0,c=0,t=16,pt=0,l=0,sg=0,ft=0,st=ok: Request registration... TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=ok:2 TSP:MSG:READ 0-0-1 s=255,c=3,t=27,pt=1,l=1,sg=0:1 Node registration=1 Init complete, id=1, parent=0, distance=1, registration=1 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:0 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:1 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:2 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:3 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:4 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:5 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:6 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:7 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:8 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:9 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:10 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:11 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:12 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:13 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:14 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:15 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:16 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:17 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:18 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:19 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:20 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:21 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:22 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:23 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:24 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:25 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:26 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:27 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:28 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:29 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:30 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:31 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:32 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:33 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:34 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:35 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:36 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:37 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:38 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:39 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:40 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:41 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:42 TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=ok:43 !TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=0,st=fail:44 !TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=1,st=fail:45 !TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=2,st=fail:46 !TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=3,st=fail:47 !TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=4,st=fail:48 !TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=23,pt=2,l=2,sg=0,ft=5,st=fail:49 !TSM:UPL FAIL, SNP TSM:FPAR TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: !TSP:SEND:TNR !TSP:SEND:TNR !TSP:SEND:TNR !TSP:SEND:TNR
-
HI,
I've been doing some testing. I have two Gateways
- Raspberry Pi 2 with a NRF24L01+ module connected to the GPIO pins
- Arduino Nano with a NRF24L01+ module connected via a breadboard to my MacBook Pro
The sensor node is an Arduino Uno with a NRF24L01+ module. This sensor is sending out a higher number for each packet (eg. 1, 2, 3, 4)
Between the Raspberry Pi 2 gateway is have a lot of data loss as shown in earlier posts even with just 3 meters a part. However using the Arduino Nano as the gateway I can walk across the apartment with loosing anything (10+ meters away).
I've switched the NRF24L01 modules around and the result is the same.
I have now two possible reasons:
- Something is wrong related to the Raspberry Pi 2 - The code, libraries, power to the NRF24L01 etc.
- The Raspberry Pi is next to my ASUS RT-AC87U wireless router... maybe it is interfering (I don't think it is this, as I didn't have any packet loss with the Arduino Nano when I held it next to the router)
I therefore think it is related to point 1. The Raspberry Pi 2. But don't know what it could be...
Any ideas?
-
@Christian-Simonsen I have been testing RPi 3 with nrf24l01+ for a month or so - it works just fine.
Your problem (TSM:MSG:LEN) is more related to a communication error between the transceiver and RPi/Arduino. Firstly, try adding the following#define MY_RF24_SANITY_CHECK
The way I have it setup on my RPi is that I feed nrf24l01+ via 5V pin through AMS1117 3.3
Remember that 3.3v is limited in terms of current (hence your problem with PA version).
I recommend using one of these boards designed by @GertSandersWhat transceivers do you have nrf24l01 or nrf2401+?
In relation to the data rate use the lower RF24_250KBPS (by default).
Another issue is RF24_PA_LEVEL_GW and RF24_PA_LEVEL
See - https://forum.mysensors.org/topic/4034/my-first-gateway
Remember if you have modules too close and set the PA leave high, the modules will be screaming to each other.Finally, appreciate your GW on Mac works fine as supposed to your RPi GW. There can be a few reasons for this. Just try to eliminate issues one by one. You have to do a lot of readings on this forum and some DIY trial and error.
-
Hi Alex,
I tested the Sanity check on the the Arduino sensor node, and status came back OK. However I could get this to work on the Raspberry Pi, seems like this function is not yet supported. At least I couldn't find any info on it using the "./configuration -h".
I don't have a AMS1117 available so I can test that.
I connected my Arduino Nano and NRF24L01+ to the Raspberry Pi via USB, that would really well. So I might just use this solution instead as I see little benefit of connecting the NRF24L01 directly to the GPIO pins on the Raspberry Pi.
Next step is to start building some battery powered sensors that I can use, and get MyController setup properly.