Having trouble getting 2.0.1-beta running on Raspberry Pi2 as gateway and controller
-
I think I've read every topic on this so far and I must have tried every combination.... and I'm stuck, so I'm hoping someone can see my mistake and help me get this sorted
Here is how I setup MySensors on my Raspberry Pi 2 - I followed the guide to install the NRF24L01+ PA/LNA radio with 4.7µ decoupling (and it previously worked on version 1.4 of mysensors)
Here is the contents of my mysGateway.cpp
#include <iostream> #include <cstdio> #include <unistd.h> #define MY_LINUX_CONFIG_FILE "/etc/mysensors.dat" #define MY_GATEWAY_MAX_CLIENTS 20 #define MY_IS_SERIAL_PTY #define MY_LINUX_SERIAL_PTY "/dev/ttyMySensorsGateway" #define MY_LINUX_SERIAL_GROUPNAME "tty" #include <MySensors.h> void setup() {} void presentation() {} void loop() {}Here is how I make and then monitor it
./configure --my-gateway=serial --my-rf24-pa-level=RF24_PA_LOW sudo make all sudo make install sudo ./examples_linux/mysGateway -dHere is my Arduino Node code - It's a simple Uno with a DHT sensor and an NRF24L01+ radio with 4.7µ decoupling
#define MY_DEBUG #define MY_RADIO_NRF24 #define MY_NODE_ID 5 #define MY_PARENT_NODE_ID 0 #include <SPI.h> #include <MySensors.h> #include <DHT.h> #define CHILD_ID_HUM 0 #define CHILD_ID_TEMP 1 #define HUMIDITY_SENSOR_DIGITAL_PIN 5 DHT dht; float lastTemp; float lastHum; boolean metric = true; MyMessage msgHum(CHILD_ID_HUM, V_HUM); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); unsigned long pMillis_DHT = 0; long sCheck_DHT = 10000; bool requestACK = false; void setup(){ dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); metric = getConfig().isMetric; } void presentation(){ // Send the Sketch Version Information to the Gateway sendSketchInfo("Just Temperature and Humidity", "0.1"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID_HUM, S_HUM, "DHT22 Humidity", requestACK); present(CHILD_ID_TEMP, S_TEMP, "DHT22 Temperature", requestACK); } void loop(){ unsigned long currentMillis = millis(); // Check Temp and Humidity if (currentMillis - pMillis_DHT >= sCheck_DHT){ pMillis_DHT = currentMillis; float temperature = dht.getTemperature(); if (isnan(temperature)) { Serial.println("Failed reading temperature from DHT"); } else if (temperature != lastTemp) { lastTemp = temperature; if (!metric) { temperature = dht.toFahrenheit(temperature); } send(msgTemp.set(temperature, 1)); #ifdef MY_DEBUG Serial.print("T: "); Serial.println(temperature); #endif } // Fetch humidity from DHT sensor float humidity = dht.getHumidity(); if (isnan(humidity)) { Serial.println("Failed reading humidity from DHT"); } else if (humidity != lastHum) { lastHum = humidity; send(msgHum.set(humidity, 1)); #ifdef MY_DEBUG Serial.print("H: "); Serial.println(humidity); #endif } } }So far I thought I was doing everything correctly.... but here is my debug output
On Gateway (Rp2) -The last 6 lines continue to repeat
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,5-5-255,s=255,c=3,t=7,pt=0,l=0,sg=0: mysGateway: TSF:MSG:BC mysGateway: TSF:MSG:FPAR REQ,ID=5 mysGateway: TSF:CKU:OK,FCTRL mysGateway: TSF:MSG:GWL OK mysGateway: TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0 mysGateway: TSF:MSG:READ,5-5-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 mysGateway: TSF:MSG:PINGED,ID=5,HP=1 mysGateway: !TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=NACK:1 mysGateway: TSF:MSG:READ,5-5-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 mysGateway: TSF:MSG:PINGED,ID=5,HP=1 mysGateway: !TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=NACK:1 mysGateway: TSF:MSG:READ,5-5-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 mysGateway: TSF:MSG:PINGED,ID=5,HP=1 mysGateway: !TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=NACK:1 mysGateway: TSF:MSG:READ,5-5-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 mysGateway: TSF:MSG:PINGED,ID=5,HP=1 mysGateway: !TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=NACK:1 mysGateway: TSF:MSG:READ,5-5-255,s=255,c=3,t=7,pt=0,l=0,sg=0: mysGateway: TSF:MSG:BC mysGateway: TSF:MSG:FPAR REQ,ID=5 mysGateway: TSF:CKU:OK,FCTRL mysGateway: TSF:MSG:GWL OK mysGateway: !TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 mysGateway: TSF:MSG:READ,5-5-255,s=255,c=3,t=7,pt=0,l=0,sg=0: mysGateway: TSF:MSG:BC mysGateway: TSF:MSG:FPAR REQ,ID=5 mysGateway: TSF:CKU:OK,FCTRL mysGateway: TSF:MSG:GWL OK mysGateway: !TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 mysGateway: TSF:MSG:READ,5-5-255,s=255,c=3,t=7,pt=0,l=0,sg=0: mysGateway: TSF:MSG:BC mysGateway: TSF:MSG:FPAR REQ,ID=5 mysGateway: TSF:CKU:OK,FCTRL mysGateway: TSF:MSG:GWL OK mysGateway: !TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 mysGateway: TSF:MSG:READ,5-5-255,s=255,c=3,t=7,pt=0,l=0,sg=0: mysGateway: TSF:MSG:BC mysGateway: TSF:MSG:FPAR REQ,ID=5 mysGateway: TSF:CKU:OK,FCTRL mysGateway: TSF:MSG:GWL OKOn Arduino Node
0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.0.1-beta 4 TSM:INIT 10 TSM:INIT:TSP OK 12 TSM:INIT:STATID=5 14 TSF:SID:OK,ID=5 15 TSM:FPAR 51 TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 504 TSF:MSG:READ,0-0-5,s=255,c=3,t=8,pt=1,l=1,sg=0:0 508 TSF:MSG:FPAR PREF 510 TSF:MSG:FPAR OK,ID=0,D=1 514 TSM:FPAR:OK 515 TSM:ID 516 TSM:ID:OK 518 TSM:UPL 553 !TSF:MSG:SEND,5-5-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=NACK:1 2562 TSM:UPL 2567 TSF:MSG:SEND,5-5-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=1,st=OK:1 4574 TSM:UPL 4576 TSF:MSG:SEND,5-5-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1 6584 TSM:UPL 6620 !TSF:MSG:SEND,5-5-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=NACK:1 8628 !TSM:UPL:FAIL 8629 TSM:FPAR 8666 TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=1,st=OK: 10673 !TSM:FPAR:NO REPLY 10675 TSM:FPAR 10711 TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 12719 !TSM:FPAR:NO REPLY 12721 TSM:FPAR 12756 TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 14765 !TSM:FPAR:NO REPLY 14767 TSM:FPAR 14802 TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:So I'm totally confused by these messages... it seems like they are hearing each other but are having trouble communicating properly.
HELP!!!
-
I think I've read every topic on this so far and I must have tried every combination.... and I'm stuck, so I'm hoping someone can see my mistake and help me get this sorted
Here is how I setup MySensors on my Raspberry Pi 2 - I followed the guide to install the NRF24L01+ PA/LNA radio with 4.7µ decoupling (and it previously worked on version 1.4 of mysensors)
Here is the contents of my mysGateway.cpp
#include <iostream> #include <cstdio> #include <unistd.h> #define MY_LINUX_CONFIG_FILE "/etc/mysensors.dat" #define MY_GATEWAY_MAX_CLIENTS 20 #define MY_IS_SERIAL_PTY #define MY_LINUX_SERIAL_PTY "/dev/ttyMySensorsGateway" #define MY_LINUX_SERIAL_GROUPNAME "tty" #include <MySensors.h> void setup() {} void presentation() {} void loop() {}Here is how I make and then monitor it
./configure --my-gateway=serial --my-rf24-pa-level=RF24_PA_LOW sudo make all sudo make install sudo ./examples_linux/mysGateway -dHere is my Arduino Node code - It's a simple Uno with a DHT sensor and an NRF24L01+ radio with 4.7µ decoupling
#define MY_DEBUG #define MY_RADIO_NRF24 #define MY_NODE_ID 5 #define MY_PARENT_NODE_ID 0 #include <SPI.h> #include <MySensors.h> #include <DHT.h> #define CHILD_ID_HUM 0 #define CHILD_ID_TEMP 1 #define HUMIDITY_SENSOR_DIGITAL_PIN 5 DHT dht; float lastTemp; float lastHum; boolean metric = true; MyMessage msgHum(CHILD_ID_HUM, V_HUM); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); unsigned long pMillis_DHT = 0; long sCheck_DHT = 10000; bool requestACK = false; void setup(){ dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); metric = getConfig().isMetric; } void presentation(){ // Send the Sketch Version Information to the Gateway sendSketchInfo("Just Temperature and Humidity", "0.1"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID_HUM, S_HUM, "DHT22 Humidity", requestACK); present(CHILD_ID_TEMP, S_TEMP, "DHT22 Temperature", requestACK); } void loop(){ unsigned long currentMillis = millis(); // Check Temp and Humidity if (currentMillis - pMillis_DHT >= sCheck_DHT){ pMillis_DHT = currentMillis; float temperature = dht.getTemperature(); if (isnan(temperature)) { Serial.println("Failed reading temperature from DHT"); } else if (temperature != lastTemp) { lastTemp = temperature; if (!metric) { temperature = dht.toFahrenheit(temperature); } send(msgTemp.set(temperature, 1)); #ifdef MY_DEBUG Serial.print("T: "); Serial.println(temperature); #endif } // Fetch humidity from DHT sensor float humidity = dht.getHumidity(); if (isnan(humidity)) { Serial.println("Failed reading humidity from DHT"); } else if (humidity != lastHum) { lastHum = humidity; send(msgHum.set(humidity, 1)); #ifdef MY_DEBUG Serial.print("H: "); Serial.println(humidity); #endif } } }So far I thought I was doing everything correctly.... but here is my debug output
On Gateway (Rp2) -The last 6 lines continue to repeat
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,5-5-255,s=255,c=3,t=7,pt=0,l=0,sg=0: mysGateway: TSF:MSG:BC mysGateway: TSF:MSG:FPAR REQ,ID=5 mysGateway: TSF:CKU:OK,FCTRL mysGateway: TSF:MSG:GWL OK mysGateway: TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0 mysGateway: TSF:MSG:READ,5-5-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 mysGateway: TSF:MSG:PINGED,ID=5,HP=1 mysGateway: !TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=NACK:1 mysGateway: TSF:MSG:READ,5-5-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 mysGateway: TSF:MSG:PINGED,ID=5,HP=1 mysGateway: !TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=NACK:1 mysGateway: TSF:MSG:READ,5-5-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 mysGateway: TSF:MSG:PINGED,ID=5,HP=1 mysGateway: !TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=NACK:1 mysGateway: TSF:MSG:READ,5-5-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1 mysGateway: TSF:MSG:PINGED,ID=5,HP=1 mysGateway: !TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=NACK:1 mysGateway: TSF:MSG:READ,5-5-255,s=255,c=3,t=7,pt=0,l=0,sg=0: mysGateway: TSF:MSG:BC mysGateway: TSF:MSG:FPAR REQ,ID=5 mysGateway: TSF:CKU:OK,FCTRL mysGateway: TSF:MSG:GWL OK mysGateway: !TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 mysGateway: TSF:MSG:READ,5-5-255,s=255,c=3,t=7,pt=0,l=0,sg=0: mysGateway: TSF:MSG:BC mysGateway: TSF:MSG:FPAR REQ,ID=5 mysGateway: TSF:CKU:OK,FCTRL mysGateway: TSF:MSG:GWL OK mysGateway: !TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 mysGateway: TSF:MSG:READ,5-5-255,s=255,c=3,t=7,pt=0,l=0,sg=0: mysGateway: TSF:MSG:BC mysGateway: TSF:MSG:FPAR REQ,ID=5 mysGateway: TSF:CKU:OK,FCTRL mysGateway: TSF:MSG:GWL OK mysGateway: !TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 mysGateway: TSF:MSG:READ,5-5-255,s=255,c=3,t=7,pt=0,l=0,sg=0: mysGateway: TSF:MSG:BC mysGateway: TSF:MSG:FPAR REQ,ID=5 mysGateway: TSF:CKU:OK,FCTRL mysGateway: TSF:MSG:GWL OKOn Arduino Node
0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.0.1-beta 4 TSM:INIT 10 TSM:INIT:TSP OK 12 TSM:INIT:STATID=5 14 TSF:SID:OK,ID=5 15 TSM:FPAR 51 TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 504 TSF:MSG:READ,0-0-5,s=255,c=3,t=8,pt=1,l=1,sg=0:0 508 TSF:MSG:FPAR PREF 510 TSF:MSG:FPAR OK,ID=0,D=1 514 TSM:FPAR:OK 515 TSM:ID 516 TSM:ID:OK 518 TSM:UPL 553 !TSF:MSG:SEND,5-5-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=NACK:1 2562 TSM:UPL 2567 TSF:MSG:SEND,5-5-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=1,st=OK:1 4574 TSM:UPL 4576 TSF:MSG:SEND,5-5-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1 6584 TSM:UPL 6620 !TSF:MSG:SEND,5-5-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=NACK:1 8628 !TSM:UPL:FAIL 8629 TSM:FPAR 8666 TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=1,st=OK: 10673 !TSM:FPAR:NO REPLY 10675 TSM:FPAR 10711 TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 12719 !TSM:FPAR:NO REPLY 12721 TSM:FPAR 12756 TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 14765 !TSM:FPAR:NO REPLY 14767 TSM:FPAR 14802 TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:So I'm totally confused by these messages... it seems like they are hearing each other but are having trouble communicating properly.
HELP!!!
Other things I've tried....
- make sure the connections are good --- CHECK
- make sure there is enough distance --- CHECK (about 15 feet)
- cleareepron on node and reload code --- CHECK
- test with two arduinos -- CHECK (I setup another arduino with a radio as a gateway and it communicated properly with the node described above)
Also, I'm using a fresh download of the mysensor libraries... from yesterday on both the Rp2 and my arduino
-
Other things I've tried....
- make sure the connections are good --- CHECK
- make sure there is enough distance --- CHECK (about 15 feet)
- cleareepron on node and reload code --- CHECK
- test with two arduinos -- CHECK (I setup another arduino with a radio as a gateway and it communicated properly with the node described above)
Also, I'm using a fresh download of the mysensor libraries... from yesterday on both the Rp2 and my arduino
Just tried a few more things...
- added irq pin 15 to Rp2, then rebuild with the following --- CHECK
./configure --my-gateway=serial --my-rf24-pa-level=RF24_PA_LOW --my-rf24-irq-pin=15- soldered decoupling capacitor to both radios (previously they were jammed into the wires) --- CHECK
- rechecked all wires --- CHECK
-
Just tried a few more things...
- added irq pin 15 to Rp2, then rebuild with the following --- CHECK
./configure --my-gateway=serial --my-rf24-pa-level=RF24_PA_LOW --my-rf24-irq-pin=15- soldered decoupling capacitor to both radios (previously they were jammed into the wires) --- CHECK
- rechecked all wires --- CHECK
UPDATE
I think it's a problem with the arduino board itself.
So since my previous posts I've tried multiple radios and I've got a 4 working nodes now:
- Mega + NRF24
- UNO R3 + NRF24
- DCcEle (clone) + NRF24
- Nano DCCduino (clone) + NRF24
Plus the Raspberry Pi 2 as gateway with NRF24L01+ PA/LNA is working.
So... it seems like it's a problem with that Uno board.... weird.
I've tried multiple radios (specifically ones that worked on the other boards) and none of them work. Like I said before, the board and the Rp2 seem to be communication but not properly.
Has anyone ran into a similar problem before?
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login