@tekka Thanks again, I'll give it a try! I already defined the limited data rate but I was not aware of the fact that the non-P type was not supported.
Posts made by alfredb
-
RE: NRF24L01 can't find parent on gateway
-
RE: NRF24L01 can't find parent on gateway
@alfredb
Hi there, meanwhile I've been testing with another gateway (on a NodeMCU) and this worked right away. So there is an issue here with the NRF24L01 module on the Uno, perhaps it has something to do with using the ICSP connections for the NRF24L01 module or the combination with a W5500?Regards
-
RE: Domoticz - MySensors: Unknown/Invalid sensor type (51)
Ah, check, I'll give that a try, thanks!
-
Domoticz - MySensors: Unknown/Invalid sensor type (51)
Hi there,
I'm using the latest version of mysensors 2.0 with domoticz but when using the recently added WATER_QUALITY (PH meter) and send V_PH domticz logs the following error:
MySensors: Unknown/Invalid sensor type (51).Anyone an idea how to update domoticz to get this to work? Or can I add this manually? Run Domoticz on a Synology.
Thanks.
-
RE: MySensors 2.0.0 Released
@bomber I'm using a W5500 with locally attached sensors, only thing you have to do is use a customized version of the Ethernet library. Like this one https://github.com/embeddist/WIZ_Ethernet_Library-IDE1.6.x.
-
RE: NRF24L01 can't find parent on gateway
Hi Tekka,
Thanks for your reply. I'm using the nRF24L01 (without the +). Hereby the sketches (the gw one is not complete yet as got stuck getting the gw and node talking.
GW sketch:
#define MY_DEBUG // Enable debug prints to serial monitor
#define MY_DEBUG_VERBOSE_RF24#include <SPI.h>
#include <DHT.h>
#include <Time.h>
#include <Ethernet.h>
#include <RemoteTransmitter.h>
#include <RemoteReceiver.h>
#include <NewRemoteReceiver.h>
#include <SensorReceiver.h>
#include <InterruptChain.h>#define GATEWAY_FEATURE
#define MY_GATEWAY_W5100
#define MY_RADIO_NRF24
#define MY_NODE_ID 0
//#define MY_RF24_SANITY_CHECK
#define MY_RF24_PA_LEVEL RF24_PA_LOW
#define MY_RF24_DATARATE RF24_250KBPS#define SS_ETHERNET 10
#define MY_PORT 5003
#define HUMIDITY_SENSOR_DIGITAL_PIN 3
#define CHILD_ID_HUM 0
#define CHILD_ID_TEMP 1
#define CHILD_ID_RECEIVER 2
#define CHILD_ID_ACTION_SWITCH_A 3
#define V_RCODE 0
unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
const char SYSTEMCODE = char(31); // Adjust this to your own SYSTEMCODE see RemoteTransmitter.h#define MY_SOFT_SPI_SCK_PIN 14
#define MY_SOFT_SPI_MISO_PIN 16
#define MY_SOFT_SPI_MOSI_PIN 15// When W5500 is connected we have to move CE/CSN pins for NRF radio
#define MY_RF24_CE_PIN 5
#define MY_RF24_CS_PIN 6// Intantiate a new KaKuTransmitter remote, also use pin 11 (same transmitter!)
KaKuTransmitter kaKuTransmitter(8);DHT dht;
float lastTemp;
float lastHum;
float RFCode = 0;
bool metric = true;
// Protocol handler
bool RFCodeAvailable = false;
int value01 = 0;// Controller ip address. Enables client mode (default is "server" mode).
// Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
//#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254#define MY_IP_GATEWAY_ADDRESS 192,168,2,254
#define MY_IP_ADDRESS 192,168,2,230
#define MY_IP_SUBNET_ADDRESS 255,255,255,0
#define MY_MAC_ADDRESS 0x00, 0x08, 0xDC, 0xF4, 0x6D, 0xC1int sensorValue = 0; // variable to store the value coming from the sensor
#include <MySensors.h>
#include <MyConfig.h>MyMessage msgHum(CHILD_ID_HUM, V_HUM);
MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
MyMessage msgRCode(CHILD_ID_RECEIVER, V_LIGHT);
MyMessage msgDeviceA( CHILD_ID_ACTION_SWITCH_A, V_LIGHT );void setup()
{
Serial.begin(115200);
dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN);
metric = getConfig().isMetric;
Serial.println("Humid sensor setup complete");
//RemoteReceiver::init(-1, 2, showOldCode);
//NewRemoteReceiver::init(-1, 2, showNewCode);
//InterruptChain::addInterruptCallback(0, RemoteReceiver::interruptHandler);
//InterruptChain::addInterruptCallback(0, NewRemoteReceiver::interruptHandler);
//358694,while (!Serial) {
; // wait for serial port to connect.
}}
// shows the received code sent from an old-style remote switch
void showOldCode(unsigned long receivedCode, unsigned int period) {
// Print the received code.
Serial.print("Code: ");
Serial.print(receivedCode);
Serial.print(", period: ");
Serial.print(period);
Serial.println("us.");
float RFCode = (receivedCode);
float RFCodeAvailable = true;
// Serial.println (RFCodeAvailable);
// Send the received code.
if (RFCode=='358694') {
Serial.println ("detected RFCode");
send(msgRCode.set(RFCode, 1));
send(msgDeviceA.set(RFCode, 1));
}}
// Shows the received code sent from an new-style remote switch
void showNewCode(NewRemoteCode receivedCode) {
// Print the received code.
Serial.print("Addr ");
Serial.print(receivedCode.address);if (receivedCode.groupBit) {
Serial.print(" group");
} else {
Serial.print(" unit ");
Serial.print(receivedCode.unit);
}switch (receivedCode.switchType) {
case NewRemoteCode::off:
Serial.print(" off");
break;
case NewRemoteCode:
Serial.print(" on");
break;
case NewRemoteCode::dim:
Serial.print(" dim level ");
Serial.print(receivedCode.dimLevel);
break;
case NewRemoteCode::on_with_dim:
Serial.print(" on with dim level ");
Serial.print(receivedCode.dimLevel);
break;
}Serial.print(", period: ");
Serial.print(receivedCode.period);
Serial.println("us.");
}void presentation() {
// Present locally attached sensors
sendSketchInfo("Temp and Humidity", "1.0");
present(CHILD_ID_HUM, S_HUM);
present(CHILD_ID_TEMP, S_TEMP);
sendSketchInfo("Kaku Receiver", "2.0");
present(CHILD_ID_RECEIVER, S_LIGHT);
present (CHILD_ID_ACTION_SWITCH_A, S_LIGHT);
sendBatteryLevel(100); // It just looks better in Domoticz
Serial.println("presented data...");
}void loop() {
delay(dht.getMinimumSamplingPeriod());//Fetch temperatures from DHT sensor
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
}// Print the received code.
// float RFCode = (receivedCode);
// float RFCodeAvailable = true;sleep(SLEEP_TIME); //sleep a bit
}
// kaKuTransmitter.sendSignal('B',2,true);
void receive(const MyMessage &message) {
if (message.type == V_LIGHT) {
Serial.println ("MSG from sensor:");
Serial.println (message.sensor);
Serial.println ("MSG from sensor:");
Serial.println (mGetCommand(message));
Serial.println (mGetPayloadType(message));
Serial.println ("Message value:");
Serial.println (message.getString(_convBuf));char *hextstring = (message.getString(_convBuf)); Serial.println ("Converted:"); Serial.println (*hextstring); if (*hextstring=='1') { Serial.println("AAN"); kaKuTransmitter.sendSignal('B',2,true); } if (*hextstring=='0') { Serial.println ("UIT"); kaKuTransmitter.sendSignal('B',2,false); }
}
}
Node Sketch:
#include <SPI.h>
#define MY_RADIO_NRF24
#define MY_DEBUG
#define MY_DEBUG_VERBOSE_RF24#define MY_NODE_ID 5
#define MY_PARENT_NODE_ID 0
#define MY_PARENT_NODE_IS_STATIC
// Set RF24L01 channel number
//#define MY_RF24_CHANNEL 125// Define nRF24L01 datarate
#define MY_RF24_DATARATE RF24_250KBPS
#define MY_RF24_PA_LEVEL RF24_PA_LOW#include <MyConfig.h>
#include <MySensors.h>
#define COMPARE_PH 1 // Send PH only if changed? 1 = Yes 0 = Nounsigned long SLEEP_TIME = 60000; // Sleep time between reads (in milliseconds)
float lastPH;boolean receivedConfig = false;
boolean metric = true;//Kraanwater 7,380 28-07-2016
int ph_pin = A5; //This is the pin number connected to Po
void setup() {
Serial.begin(9600);
}// Initialize PH message
MyMessage msg(0, V_PH);float getPH() {
//query your PH sensor here (I2C,Serial,Phidget...)
float measure = analogRead(ph_pin);
Serial.print("Measure: ");
//Serial.print(measure);double voltage = 5 / 1024.0 * measure; //classic digital to voltage conversion
//double voltage = 5 / 1024.0 * measure; //classic digital to voltage conversion
Serial.print("\tVoltage: ");
Serial.print(voltage, 3);
// PH_step = (voltage@PH7 - voltage@PH4) / (PH7 - PH4)
// PH_probe = PH7 - ((voltage@PH7 - voltage@probe) / PH_step)float Po = 7 + ((2.5 - voltage) / 0.18);
Serial.print("\tPH: ");
Serial.print(Po, 3);
//return Po;
}void presentation() {
// Send the sketch version information to the gateway and Controller
sendSketchInfo("PH Sensor", "1.1");
present(0, S_WATER_QUALITY);}
void loop() {
Serial.println("");
delay(2000);
float ph = getPH();
Serial.print(ph);#if COMPARE_PH == 1
if (lastPH != ph) {
#endif// Send in the new PH value send(msg.set(ph, 1)); // Save new PH value for next compare lastPH = ph;
#if COMPARE_PH == 1
}
#endif
//sleep(SLEEP_TIME);
} -
NRF24L01 can't find parent on gateway
Hi there,
I'm using an ethernet gateway on an UNO R3 with some locally attached sensors and an NRF24L01 attached to it. The locally attached sensors work fine (sending to Domoticz).
Now I have another Robotdyn UNO with one sensor attached and an NRF24L01 but I can't get it to find the parent on the gateway.
Tried lowering the power and moving the two closer and further away from each other, but all makes no difference. The node id get's assigned. Below are the logs from both gateway and client:
0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0)
0;255;3;0;9;TSM:INIT
0;255;3;0;9;RF24:write register, reg=0, value=14
0;255;3;0;9;RF24:write register, reg=3, value=3
0;255;3;0;9;RF24:write register, reg=4, value=95
0;255;3;0;9;RF24:write register, reg=5, value=76
0;255;3;0;9;RF24:write register, reg=6, value=35
0;255;3;0;9;RF24:read register, reg=6, value=35
0;255;3;0;9;RF24:read register, reg=5, value=76
0;255;3;0;9;RF24:write register, reg=16, value=115
0;255;3;0;9;RF24:write register, reg=29, value=6
0;255;3;0;9;RF24:write register, reg=2, value=2
0;255;3;0;9;RF24:write register, reg=1, value=0
0;255;3;0;9;RF24:write register, reg=28, value=3
0;255;3;0;9;RF24:flushRX
0;255;3;0;9;RF24:flushTX
0;255;3;0;9;RF24:write register, reg=7, value=112
0;255;3;0;9;TSM:RADIO:OK
0;255;3;0;9;TSM:GW MODE
0;255;3;0;9;RF24:write register, reg=2, value=3
0;255;3;0;9;RF24:write register, reg=1, value=1
0;255;3;0;9;RF24:start listening
0;255;3;0;9;RF24:write register, reg=0, value=15
0;255;3;0;9;RF24:write register, reg=10, value=0
0;255;3;0;9;TSM:READY
IP: 192.168.2.230
Humid sensor setup complete
presented data...
0;255;3;0;9;No registration required
0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1
T: 23.00
H: 51.00
0;255;3;0;9;Eth: connect
presented data...
0;255;3;0;9;Eth: 0;0;3;0;2;
0;255;3;0;9;Eth: 0;0;3;0;2;Get Version
0;255;3;0;9;Eth: 0;0;3;0;18;PING
0;255;3;0;9;Eth: 0;0;3;0;18;PING
0;255;3;0;9;RF24:read register, reg=6, value=35
0;255;3;0;9;RF24:read register, reg=5, value=76
0;255;3;0;9;TSP:SANCHK:OK
0;255;3;0;9;Eth: 0;0;3;0;18;PING
0;255;3;0;9;Eth: 0;0;3;0;18;PING
0;255;3;0;9;Eth: 0;0;3;0;18;PING
0;255;3;0;9;Eth: 0;0;3;0;18;PING
0;255;3;0;9;Eth: 0;0;3;0;18;PING
0;255;3;0;9;Eth: 0;0;3;0;18;PING
0;255;3;0;9;RF24:read register, reg=6, value=35
0;255;3;0;9;RF24:read register, reg=5, value=76
0;255;3;0;9;TSP:SANCHK:OK
0;255;3;0;9;Eth: 0;0;3;0;18;PING
H: 52.00
0;255;3;0;9;Eth: 0;0;3;0;18;PING
0;255;3;0;9;Eth: 0;0;3;0;18;PING
0;255;3;0;9;Eth: 0;0;3;0;18;PING
0;255;3;0;9;Eth: 0;0;3;0;18;PING
0;255;3;0;9;Eth: 0;0;3;0;18;PING
0;255;3;0;9;RF24:read register, reg=6, value=35
0;255;3;0;9;RF24:read register, reg=5, value=76
0;255;3;0;9;TSP:SANCHK:OK
0;255;3;0;9;Eth: 0;0;3;0;18;PING
0;255;3;0;9;Eth: 0;0;3;0;18;PINGClient:
verbose:
Starting sensor (RNNNA-, 2.0.0)
TSM:INIT
RF24:write register, reg=0, value=14
RF24:write register, reg=3, value=3
RF24:write register, reg=4, value=95
RF24:write register, reg=5, value=76
RF24:write register, reg=6, value=35
RF24:read register, reg=6, value=35
RF24:read register, reg=5, value=76
RF24:write register, reg=16, value=115
RF24:write register, reg=29, value=6
RF24:write register, reg=2, value=2
RF24:write register, reg=1, value=0
RF24:write register, reg=28, value=3
RF24:flushRX
RF24:flushTX
RF24:write register, reg=7, value=112
TSM:RADIO:OK
RF24:write register, reg=2, value=3
RF24:write register, reg=1, value=1
RF24:start listening
RF24:write register, reg=0, value=15
RF24:write register, reg=10, value=5
TSP:ASSIGNID:OK (ID=5)
TSM:FPAR
RF24:stop listening
RF24:write register, reg=0, value=14
RF24:open writing pipe, recipient=255
RF24:write register, reg=10, value=255
RF24:write register, reg=16, value=255
RF24:send message to 255, len=7
RF24:flushTX
RF24:write register, reg=7, value=48
RF24:MAX_RT
RF24:flushTX
RF24:start listening
RF24:write register, reg=0, value=15
RF24:write register, reg=10, value=5
TSP:MSG:SEND 5-5-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
TSM:FPAR
RF24:stop listening
RF24:write register, reg=0, value=14
RF24:open writing pipe, recipient=255
RF24:write register, reg=10, value=255
RF24:write register, reg=16, value=255
RF24:send message to 255, len=7
RF24:flushTX
RF24:write register, reg=7, value=48
RF24:MAX_RT
RF24:flushTX
RF24:start listening
RF24:write register, reg=0, value=15
RF24:write register, reg=10, value=5
TSP:MSG:SEND 5-5-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
TSM:FPAR
RF24:stop listening
RF24:write register, reg=0, value=14
RF24:open writing pipe, recipient=255
RF24:write register, reg=10, value=255
RF24:write register, reg=16, value=255
RF24:send message to 255, len=7
RF24:flushTX
RF24:write register, reg=7, value=48
RF24:MAX_RT
RF24:flushTX
RF24:start listening
RF24:write register, reg=0, value=15
RF24:write register, reg=10, value=5
TSP:MSG:SEND 5-5-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
TSM:FPAR
RF24:stop listening
RF24:write register, reg=0, value=14
RF24:open writing pipe, recipient=255
RF24:write register, reg=10, value=255
RF24:write register, reg=16, value=255
RF24:send message to 255, len=7
RF24:flushTX
RF24:write register, reg=7, value=48
RF24:MAX_RT
RF24:flushTX
RF24:start listening
RF24:write register, reg=0, value=15
RF24:write register, reg=10, value=5
TSP:MSG:SEND 5-5-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
RF24:write register, reg=0, value=12
RF24:power down
TSM:INITAnyone an idea?
Thanks!
-
RE: Errors compiling using 2.0 beta
Thanks tekka! I have updated to IDE 1.6.9 (was on 1.6.7) and also found out I was using the wrong location for libraries (the libraries I copied to the program files folder in C:\Program Files(86)\Arduino, seems they belong in the documents folder of the user profile). After this indeed the example Sketch HumiditySensor now compiled without errors.
On my particular sketch (I want to use send locally attached sensors through the ethernet gateway) I stil got the error. Now I started to compare the two and the error disappears when I include the MY_RADIO library (#define MY_RADIO_NRF24) in my sketch.
Very happy that it's solved now. Thanks for your help!
-
RE: Errors compiling using 2.0 beta
Did some more testing, but also with an example sketch like HumiditySensor I get the same error In function `_processInternalMessages()':
MySensorsCore.cpp:276: undefined reference totransportGetHeartbeat()'Anyone an idea?
Thanks.
-
RE: Errors compiling using 2.0 beta
Thanks! That solved most of the errors. The only one left now is;
Arduino: 1.6.7 (Windows 10), Board: "Arduino/Genuino Uno" sketch\MySketch.ino.cpp.o: In function
sendHeartbeat()': C:\Program Files (x86)\Arduino\libraries\MySensors/core/MySensorsCore.cpp:276: undefined reference to
transportGetHeartbeat()'
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling.This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences. -
Errors compiling using 2.0 beta
Hi,
I'm getting errors compiling when using the 2.0 beta, anyone has an idea about the cause? I'm not signing anything in my code or enabled it. Please see the errors below:
Arduino: 1.6.7 (Windows 10), Board: "Arduino/Genuino Uno" libraries\MySensors\utility\sha256.cpp.o: In functionSha256Class::init()': C:\Program Files (x86)\Arduino\libraries\MySensors\utility/sha256.cpp:35: multiple definition of
Sha256Class::init()'
sketch\MySketch.ino.cpp.o:C:\Program Files (x86)\Arduino\libraries\MySensors/drivers/ATSHA204/sha256.cpp:35: first defined here libraries\MySensors\utility\sha256.cpp.o: In functionSha256Class::init()': C:\Program Files (x86)\Arduino\libraries\MySensors\utility/sha256.cpp:35: multiple definition of
Sha256Class::ror32(unsigned long, unsigned char)' sketch\MySketch.ino.cpp.o:C:\Program Files (x86)Arduino\libraries\MySensors/core/MyHwATMega328.cpp:28: first defined here
libraries\MySensors\utility\sha256.cpp.o: In functionSha256Class::init()': C:\Program Files (x86)\Arduino\libraries\MySensors\utility/sha256.cpp:35: multiple definition of
Sha256Class::hashBlock()'
sketch\EthernetGateway-Kaku.ino.cpp.o:C:\Program Files (x86)\Arduino\libraries\MySensors/core/MyHwATMega328.cpp:28: first defined here libraries\MySensors\utility\sha256.cpp.o: In functionSha256Class::init()': C:\Program Files (x86)\Arduino\libraries\MySensors\utility/sha256.cpp:35: multiple definition of
Sha256Class::addUncounted(unsigned char)'
sketch\MySketch.ino.cpp.o:C:\Program Files (x86)\Arduino\libraries\MySensors/core/MyHwATMega328.cpp:28: first defined here libraries\MySensors\utility\sha256.cpp.o: In functionSha256Class::init()': C:\Program Files (x86)\Arduino\libraries\MySensors\utility/sha256.cpp:35: multiple definition of
Sha256Class::write(unsigned char)' sketch\MySketch.ino.cpp.o:C:\Program Files (x86)\Arduino\libraries\MySensors/core/MyHwATMega328.cpp:28: first defined here libraries\MySensors\utility\sha256.cpp.o: In functionSha256Class::init()': C:\Program Files (x86)\Arduino\libraries\MySensors\utility/sha256.cpp:35: multiple definition of
Sha256Class::pad()'
sketch\MySketch.ino.cpp.o:C:\Program Files (x86)\Arduino\libraries\MySensors/core/MyHwATMega328.cpp:28: first defined here libraries\MySensors\utility\sha256.cpp.o: In functionSha256Class::init()': C:\Program Files (x86)\Arduino\libraries\MySensors\utility/sha256.cpp:35: multiple definition of
Sha256Class::result()'
sketch\MySketch.ino.cpp.o:C:\Program Files (x86)\Arduino\libraries\MySensors/core/MyHwATMega328.cpp:28: first defined here libraries\MySensors\utility\sha256.cpp.o: In functionSha256Class::init()': C:\Program Files (x86)\Arduino\libraries\MySensors\utility/sha256.cpp:35: multiple definition of
Sha256Class::initHmac(unsigned char const*, int)' sketch\MySketch.ino.cpp.o:C:\Program Files (x86)\Arduino\libraries\MySensors/core/MyHwATMega328.cpp:28: first defined here
libraries\MySensors\utility\sha256.cpp.o: In functionSha256Class::init()': C:\Program Files (x86)\Arduino\libraries\MySensors\utility/sha256.cpp:35: multiple definition of
Sha256Class::resultHmac()'
sketch\MySketch.ino.cpp.o:C:\Program Files (x86)\Arduino\libraries\MySensors/core/MyHwATMega328.cpp:28: first defined here libraries\MySensors\utility\sha256.cpp.o: In functionSha256Class::init()': C:\Program Files (x86)\Arduino\libraries\MySensors\utility/sha256.cpp:35: multiple definition of
innerHash'
sketch\MySketch.ino.cpp.o:C:\Program Files (x86)\Arduino\libraries\MySensors/core/MyHwATMega328.cpp:28: first defined here libraries\MySensors\utility\sha256.cpp.o: In functionSha256Class::init()': C:\Program Files (x86)\Arduino\libraries\MySensors\utility/sha256.cpp:35: multiple definition of
keyBuffer'
sketch\MySketch.ino.cpp.o:C:\Program Files (x86)\Arduino\libraries\MySensors/core/MyHwATMega328.cpp:28: first defined here sketch\MySketch.ino.cpp.o: In functionsendHeartbeat()': C:\Program Files (x86)\Arduino\libraries\MySensors/core/MySensorsCore.cpp:276: undefined reference to
transportGetHeartbeat()'collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling.
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.