You were right ! I changed the sensor radio and it's working now !
But only if I have these lines in my sketch :
#define MY_TRANSPORT_WAIT_READY_MS 1
#define MY_TRANSPORT_SANITY_CHECK
#define MY_TRANSPORT_SANITY_CHECK_INTERVAL_MS (60*1000ul)
You were right ! I changed the sensor radio and it's working now !
But only if I have these lines in my sketch :
#define MY_TRANSPORT_WAIT_READY_MS 1
#define MY_TRANSPORT_SANITY_CHECK
#define MY_TRANSPORT_SANITY_CHECK_INTERVAL_MS (60*1000ul)
I have built an MQTT gateway (Mysensors 2.2.0, openhab 2.2.0,mosquitto RFM69HW radio - running on RPi3)and a wattmeter node(PZEM004t with arduino pro mini), both of them working properly in normal circumstances.
This is the arduino sketch :
/**
*/
#include <SoftwareSerial.h>
#include <PZEM004T.h>
// Enable debug prints to serial monitor
#define MY_DEBUG
// Enable and select radio type attached
#define MY_RADIO_RFM69
#define MY_RFM69_NEW_DRIVER
#define MY_RFM69_FREQUENCY RFM69_433MHZ
#define MY_IS_RFM69HW
#define MY_TRANSPORT_WAIT_READY_MS 1
// Object Node
#define MY_NODE_ID 5
#include <SPI.h>
#include <MySensors.h>
// initialisation du PZEM004T
PZEM004T pzem(4,5); // RX,TX
IPAddress ip(192,168,1,1);
//V_VOLTAGE S_MULTIMETER
//V_CURRENT S_MULTIMETER
//V_WATT S_POWER
//V_KWH S_POWER
#define CHILD_ID_VOLTAGE 1
#define CHILD_ID_CURRENT 2
#define CHILD_ID_WATT 3
#define CHILD_ID_KWH 4
#define SLEEP_NODE true // True to activate Sleep Mode
unsigned long SLEEP_TIME = 30 * 1000; // Sleep time between reads (in milliseconds)
MyMessage msgVolt(CHILD_ID_VOLTAGE, V_VOLTAGE);
MyMessage msgIntensite(CHILD_ID_CURRENT, V_CURRENT);
MyMessage msgWatt(CHILD_ID_WATT, V_WATT);
MyMessage msgKwh(CHILD_ID_KWH, V_KWH);
void presentation() {
// Send the sketch version information to the gateway and Controller
sendSketchInfo("PZEM 004T ", "1.0");
// Déclaration des capteurs attachés au noeud
present(CHILD_ID_VOLTAGE, S_MULTIMETER);
present(CHILD_ID_CURRENT, S_MULTIMETER);
present(CHILD_ID_WATT, S_POWER);
present(CHILD_ID_KWH, S_POWER);
}
void setup() {
pzem.setAddress(ip);
}
void loop()
{
float v = pzem.voltage(ip);
if (v < 0.0) v = 0.0;
Serial.print(v);Serial.print("V; ");
delay(10);
float i = pzem.current(ip);
if(i >= 0.0){ Serial.print(i);Serial.print("A; "); }
delay(10);
float p = pzem.power(ip);
if(p >= 0.0){ Serial.print(p);Serial.print("W; "); }
delay(10);
float e = pzem.energy(ip);
if(e >= 0.0){ Serial.print(e);Serial.print("Wh; "); }
Serial.println();
send(msgVolt.set(v, 1));
send(msgIntensite.set(i, 1));
send(msgWatt.set(p, 1));
send(msgKwh.set(e, 1));
if (SLEEP_NODE) {
Serial.println("Sleep");
sleep(SLEEP_TIME);
} else {
delay (SLEEP_TIME);
}
}
If I power cycle the node, all is OK and the node reconnect to the gateway.
But when I power cycle the gateway, the gateway itself starts up properly but the node freeze.
The serial output of the node looks like this:
__ __ ____
| \/ |_ _/ ___| ___ _ __ ___ ___ _ __ ___
| |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
| | | | |_| |___| | __/ | | \__ \ _ | | \__ \
|_| |_|\__, |____/ \___|_| |_|___/\___/|_| |___/
|___/ 2.2.0
16 MCO:BGN:INIT NODE,CP=RPNNA---,VER=2.2.0
26 TSM:INIT
28 TSF:WUR:MS=1
36 !TSM:INIT:TSP FAIL
38 TSM:FAIL:CNT=1
40 TSM:FAIL:DIS
43 TSF:TDI:TSL
43 MCO:BGN:STP
1054 MCO:BGN:INIT OK,TSP=0
0.00V; 0.00A; 0.00W; 93.00Wh;
3891 !MCO:SND:NODE NOT REG
3895 !MCO:SND:NODE NOT REG
3897 !MCO:SND:NODE NOT REG
3899 !MCO:SND:NODE NOT REG
Sleep
3903 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
3909 !MCO:SLP:TNR
10045 TSM:FAIL:RE-INIT
10047 TSM:INIT
10049 TSM:INIT:TSP OK
10051 TSM:INIT:STATID=5
10055 TSF:SID:OK,ID=5
10057 TSM:FPAR
10061 TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
10491 TSF:MSG:READ,0-0-5,s=255,c=3,t=8,pt=1,l=1,sg=0:0
10496 TSF:MSG:FPAR OK,ID=0,D=1
12072 TSM:FPAR:OK
12075 TSM:ID
12075 TSM:ID:OK
12077 TSM:UPL
12093 TSF:MSG:SEND,5-5-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
12103 TSF:MSG:READ,0-0-5,s=255,c=3,t=25,pt=1,l=1,sg=0:1
12109 TSF:MSG:PONG RECV,HP=1
12111 TSM:UPL:OK
12113 TSM:READY:ID=5,PAR=0,DIS=1
12126 TSF:MSG:SEND,5-5-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
12136 TSF:MSG:READ,0-0-5,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
12161 TSF:MSG:SEND,5-5-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.2.0
12183 TSF:MSG:SEND,5-5-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
14198 TSF:MSG:SEND,5-5-0-0,s=255,c=3,t=11,pt=0,l=10,sg=0,ft=0,st=OK:PZEM 004T
14221 TSF:MSG:SEND,5-5-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0
14243 TSF:MSG:SEND,5-5-0-0,s=1,c=0,t=30,pt=0,l=0,sg=0,ft=0,st=OK:
14268 TSF:MSG:SEND,5-5-0-0,s=2,c=0,t=30,pt=0,l=0,sg=0,ft=0,st=OK:
14290 TSF:MSG:SEND,5-5-0-0,s=3,c=0,t=13,pt=0,l=0,sg=0,ft=0,st=OK:
14313 TSF:MSG:SEND,5-5-0-0,s=4,c=0,t=13,pt=0,l=0,sg=0,ft=0,st=OK:
14319 MCO:REG:REQ
14336 TSF:MSG:SEND,5-5-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
14346 TSF:MSG:READ,0-0-5,s=255,c=3,t=27,pt=1,l=1,sg=0:1
14352 MCO:PIM:NODE REG=1
14354 MCO:SLP:MS=19557
14358 TSF:TDI:TSL
14360 MCO:SLP:WUP=-1
14362 TSF:TRI:TSB
223.20V; 0.11A; 3.00W; 93.00Wh;
16216 TSF:MSG:SEND,5-5-0-0,s=1,c=1,t=38,pt=7,l=5,sg=0,ft=0,st=OK:223.2
16474 TSF:MSG:SEND,5-5-0-0,s=2,c=1,t=39,pt=7,l=5,sg=0,ft=0,st=OK:0.1
16496 TSF:MSG:SEND,5-5-0-0,s=3,c=1,t=17,pt=7,l=5,sg=0,ft=0,st=OK:3.0
16519 TSF:MSG:SEND,5-5-0-0,s=4,c=1,t=18,pt=7,l=5,sg=0,ft=0,st=OK:93.0
Sleep
16527 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
16533 TSF:TDI:TSL
16535 MCO:SLP:WUP=-1
16537 TSF:TRI:TSB
223.70V; 0.11A; 3.00W; 93.00Wh;
18290 TSF:MSG:SEND,5-5-0-0,s=1,c=1,t=38,pt=7,l=5,sg=0,ft=0,st=OK:223.7
18313 TSF:MSG:SEND,5-5-0-0,s=2,c=1,t=39,pt=7,l=5,sg=0,ft=0,st=OK:0.1
18335 TSF:MSG:SEND,5-5-0-0,s=3,c=1,t=17,pt=7,l=5,sg=0,ft=0,st=OK:3.0
18360 TSF:MSG:SEND,5-5-0-0,s=4,c=1,t=18,pt=7,l=5,sg=0,ft=0,st=OK:93.0
Sleep
18366 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
18374 TSF:TDI:TSL
18376 MCO:SLP:WUP=-1
18378 TSF:TRI:TSB
224.00V; 0.11A; 3.00W; 93.00Wh;
20361 TSF:MSG:SEND,5-5-0-0,s=1,c=1,t=38,pt=7,l=5,sg=0,ft=0,st=OK:224.0
20383 TSF:MSG:SEND,5-5-0-0,s=2,c=1,t=39,pt=7,l=5,sg=0,ft=0,st=OK:0.1
20406 TSF:MSG:SEND,5-5-0-0,s=3,c=1,t=17,pt=7,l=5,sg=0,ft=0,st=OK:3.0
20428 TSF:MSG:SEND,5-5-0-0,s=4,c=1,t=18,pt=7,l=5,sg=0,ft=0,st=OK:93.0
Sleep
20436 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
20443 TSF:TDI:TSL
20445 MCO:SLP:WUP=-1
20447 TSF:TRI:TSB
223.30V; 0.11A; 3.00W; 93.00Wh;
22429 TSF:MSG:SEND,5-5-0-0,s=1,c=1,t=38,pt=7,l=5,sg=0,ft=0,st=OK:223.3
22454 TSF:MSG:SEND,5-5-0-0,s=2,c=1,t=39,pt=7,l=5,sg=0,ft=0,st=OK:0.1
22470 TSF:MSG:SEND,5-5-0-0,s=3,c=1,t=17,pt=7,l=5,sg=0,ft=0,st=OK:3.0
22491 TSF:MSG:SEND,5-5-0-0,s=4,c=1,t=18,pt=7,l=5,sg=0,ft=0,st=OK:93.0
Sleep
22499 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
22505 TSF:TDI:TSL
22507 MCO:SLP:WUP=-1
22509 TSF:TRI:TSB
224.90V; 0.11A; 3.00W; 93.00Wh;
24506 TSF:MSG:SEND,5-5-0-0,s=1,c=1,t=38,pt=7,l=5,sg=0,ft=0,st=OK:224.9
24522 TSF:MSG:SEND,5-5-0-0,s=2,c=1,t=39,pt=7,l=5,sg=0,ft=0,st=OK:0.1
24545 TSF:MSG:SEND,5-5-0-0,s=3,c=1,t=17,pt=7,l=5,sg=0,ft=0,st=OK:3.0
24567 TSF:MSG:SEND,5-5-0-0,s=4,c=1,t=18,pt=7,l=5,sg=0,ft=0,st=OK:93.0
Sleep
24573 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
24582 TSF:TDI:TSL
24584 MCO:SLP:WUP=-1
24586 TSF:TRI:TSB
225.40V; 0.11A; 3.00W; 93.00Wh;
26585 TSF:MSG:SEND,5-5-0-0,s=1,c=1,t=38,pt=7,l=5,sg=0,ft=0,st=OK:225.4
26609 TSF:MSG:SEND,5-5-0-0,s=2,c=1,t=39,pt=7,l=5,sg=0,ft=0,st=OK:0.1
26632 TSF:MSG:SEND,5-5-0-0,s=3,c=1,t=17,pt=7,l=5,sg=0,ft=0,st=OK:3.0
26654 TSF:MSG:SEND,5-5-0-0,s=4,c=1,t=18,pt=7,l=5,sg=0,ft=0,st=OK:93.0
Sleep
26662 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
26669 TSF:TDI:TSL
26671 MCO:SLP:WUP=-1
26675 TSF:TRI:TSB
224.40V; 0.11A; 3.00W; 93.00Wh;
28663 TSF:MSG:SEND,5-5-0-0,s=1,c=1,t=38,pt=7,l=5,sg=0,ft=0,st=OK:224.4
28688 TSF:MSG:SEND,5-5-0-0,s=2,c=1,t=39,pt=7,l=5,sg=0,ft=0,st=OK:0.1
28715 TSF:MSG:SEND,5-5-0-0,s=3,c=1,t=17,pt=7,l=5,sg=0,ft=0,st=OK:3.0
28739 TSF:MSG:SEND,5-5-0-0,s=4,c=1,t=18,pt=7,l=5,sg=0,ft=0,st=OK:93.0
Sleep
28745 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
28751 TSF:TDI:TSL
28755 MCO:SLP:WUP=-1
28758 TSF:TRI:TSB
224.90V; 0.11A; 3.00W; 93.00Wh;
30738 TSF:MSG:SEND,5-5-0-0,s=1,c=1,t=38,pt=7,l=5,sg=0,ft=0,st=OK:224.9
30760 TSF:MSG:SEND,5-5-0-0,s=2,c=1,t=39,pt=7,l=5,sg=0,ft=0,st=OK:0.1
30783 TSF:MSG:SEND,5-5-0-0,s=3,c=1,t=17,pt=7,l=5,sg=0,ft=0,st=OK:3.0
30808 TSF:MSG:SEND,5-5-0-0,s=4,c=1,t=18,pt=7,l=5,sg=0,ft=0,st=OK:93.0
Sleep
30816 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
30822 TSF:TDI:TSL
30824 MCO:SLP:WUP=-1
30826 TSF:TRI:TSB
225.70V; 0.11A; 3.00W; 93.00Wh;
34189 !TSF:MSG:SEND,5-5-0-0,s=1,c=1,t=38,pt=7,l=5,sg=0,ft=0,st=NACK:225.7
35549 !TSF:MSG:SEND,5-5-0-0,s=2,c=1,t=39,pt=7,l=5,sg=0,ft=1,st=NACK:0.1
I tried to add the followings lines to the sketch :
#define MY_TRANSPORT_SANITY_CHECK
#define MY_TRANSPORT_SANITY_CHECK_INTERVAL_MS (60*1000ul)
but no luck , the node is not freezing anymore but it doesnn't reconnect.
This is the new output :
__ __ ____
| \/ |_ _/ ___| ___ _ __ ___ ___ _ __ ___
| |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
| | | | |_| |___| | __/ | | \__ \ _ | | \__ \
|_| |_|\__, |____/ \___|_| |_|___/\___/|_| |___/
|___/ 2.2.0
16 MCO:BGN:INIT NODE,CP=RPNNA---,VER=2.2.0
26 TSM:INIT
28 TSF:WUR:MS=1
36 !TSM:INIT:TSP FAIL
38 TSM:FAIL:CNT=1
40 TSM:FAIL:DIS
43 TSF:TDI:TSL
43 MCO:BGN:STP
1054 MCO:BGN:INIT OK,TSP=0
0.00V; 0.00A; 0.00W; 96.00Wh;
3895 !MCO:SND:NODE NOT REG
3897 !MCO:SND:NODE NOT REG
3901 !MCO:SND:NODE NOT REG
3903 !MCO:SND:NODE NOT REG
Sleep
3905 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
3911 !MCO:SLP:TNR
10045 TSM:FAIL:RE-INIT
10047 TSM:INIT
10049 TSM:INIT:TSP OK
10051 TSM:INIT:STATID=5
10055 TSF:SID:OK,ID=5
10057 TSM:FPAR
10061 TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
10637 TSF:MSG:READ,0-0-5,s=255,c=3,t=8,pt=1,l=1,sg=0:0
10643 TSF:MSG:FPAR OK,ID=0,D=1
12072 TSM:FPAR:OK
12075 TSM:ID
12075 TSM:ID:OK
12077 TSM:UPL
12089 TSF:MSG:SEND,5-5-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
12099 TSF:MSG:READ,0-0-5,s=255,c=3,t=25,pt=1,l=1,sg=0:1
12105 TSF:MSG:PONG RECV,HP=1
12109 TSM:UPL:OK
12111 TSM:READY:ID=5,PAR=0,DIS=1
12124 TSF:MSG:SEND,5-5-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
13359 TSF:MSG:READ,0-0-5,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
14454 TSF:MSG:SEND,5-5-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.2.0
14477 TSF:MSG:SEND,5-5-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
16502 TSF:MSG:SEND,5-5-0-0,s=255,c=3,t=11,pt=0,l=10,sg=0,ft=0,st=OK:PZEM 004T
16525 TSF:MSG:SEND,5-5-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0
16547 TSF:MSG:SEND,5-5-0-0,s=1,c=0,t=30,pt=0,l=0,sg=0,ft=0,st=OK:
16570 TSF:MSG:SEND,5-5-0-0,s=2,c=0,t=30,pt=0,l=0,sg=0,ft=0,st=OK:
16592 TSF:MSG:SEND,5-5-0-0,s=3,c=0,t=13,pt=0,l=0,sg=0,ft=0,st=OK:
16615 TSF:MSG:SEND,5-5-0-0,s=4,c=0,t=13,pt=0,l=0,sg=0,ft=0,st=OK:
16623 MCO:REG:REQ
16637 TSF:MSG:SEND,5-5-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
17840 TSF:MSG:READ,0-0-5,s=255,c=3,t=27,pt=1,l=1,sg=0:1
17846 MCO:PIM:NODE REG=1
17850 MCO:SLP:MS=16063
17852 TSF:TDI:TSL
17854 MCO:SLP:WUP=-1
17856 TSF:TRI:TSB
221.20V; 0.11A; 3.00W; 96.00Wh;
19482 TSF:MSG:SEND,5-5-0-0,s=1,c=1,t=38,pt=7,l=5,sg=0,ft=0,st=OK:221.2
19505 TSF:MSG:SEND,5-5-0-0,s=2,c=1,t=39,pt=7,l=5,sg=0,ft=0,st=OK:0.1
19527 TSF:MSG:SEND,5-5-0-0,s=3,c=1,t=17,pt=7,l=5,sg=0,ft=0,st=OK:3.0
19546 TSF:MSG:SEND,5-5-0-0,s=4,c=1,t=18,pt=7,l=5,sg=0,ft=0,st=OK:96.0
Sleep
19554 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
19560 TSF:TDI:TSL
19562 MCO:SLP:WUP=-1
19566 TSF:TRI:TSB
220.70V; 0.11A; 3.00W; 96.00Wh;
21516 TSF:MSG:SEND,5-5-0-0,s=1,c=1,t=38,pt=7,l=5,sg=0,ft=0,st=OK:220.7
21538 TSF:MSG:SEND,5-5-0-0,s=2,c=1,t=39,pt=7,l=5,sg=0,ft=0,st=OK:0.1
21559 TSF:MSG:SEND,5-5-0-0,s=3,c=1,t=17,pt=7,l=5,sg=0,ft=0,st=OK:3.0
21583 TSF:MSG:SEND,5-5-0-0,s=4,c=1,t=18,pt=7,l=5,sg=0,ft=0,st=OK:96.0
Sleep
21592 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
21598 TSF:TDI:TSL
21602 MCO:SLP:WUP=-1
21604 TSF:TRI:TSB
221.00V; 0.11A; 3.00W; 96.00Wh;
23562 TSF:MSG:SEND,5-5-0-0,s=1,c=1,t=38,pt=7,l=5,sg=0,ft=0,st=OK:221.0
23584 TSF:MSG:SEND,5-5-0-0,s=2,c=1,t=39,pt=7,l=5,sg=0,ft=0,st=OK:0.1
23609 TSF:MSG:SEND,5-5-0-0,s=3,c=1,t=17,pt=7,l=5,sg=0,ft=0,st=OK:3.0
23631 TSF:MSG:SEND,5-5-0-0,s=4,c=1,t=18,pt=7,l=5,sg=0,ft=0,st=OK:96.0
Sleep
23638 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
23646 TSF:TDI:TSL
23648 MCO:SLP:WUP=-1
23650 TSF:TRI:TSB
220.60V; 0.11A; 3.00W; 96.00Wh;
25618 TSF:MSG:SEND,5-5-0-0,s=1,c=1,t=38,pt=7,l=5,sg=0,ft=0,st=OK:220.6
25634 TSF:MSG:SEND,5-5-0-0,s=2,c=1,t=39,pt=7,l=5,sg=0,ft=0,st=OK:0.1
25657 TSF:MSG:SEND,5-5-0-0,s=3,c=1,t=17,pt=7,l=5,sg=0,ft=0,st=OK:3.0
25679 TSF:MSG:SEND,5-5-0-0,s=4,c=1,t=18,pt=7,l=5,sg=0,ft=0,st=OK:96.0
Sleep
25688 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
25694 TSF:TDI:TSL
25696 MCO:SLP:WUP=-1
25698 TSF:TRI:TSB
220.20V; 0.11A; 3.00W; 96.00Wh;
29003 !TSF:MSG:SEND,5-5-0-0,s=1,c=1,t=38,pt=7,l=5,sg=0,ft=0,st=NACK:220.2
30363 !TSF:MSG:SEND,5-5-0-0,s=2,c=1,t=39,pt=7,l=5,sg=0,ft=1,st=NACK:0.1
36687 !TSF:MSG:SEND,5-5-0-0,s=3,c=1,t=17,pt=7,l=5,sg=0,ft=2,st=NACK:3.0
43980 !TSF:MSG:SEND,5-5-0-0,s=4,c=1,t=18,pt=7,l=5,sg=0,ft=3,st=NACK:96.0
Sleep
43988 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
43995 TSF:TDI:TSL
43997 MCO:SLP:WUP=-1
43999 TSF:TRI:TSB
219.60V; 0.11A; 4.00W; 96.00Wh;
54110 !TSF:MSG:SEND,5-5-0-0,s=1,c=1,t=38,pt=7,l=5,sg=0,ft=4,st=NACK:219.6
62173 !TSF:MSG:SEND,5-5-0-0,s=2,c=1,t=39,pt=7,l=5,sg=0,ft=5,st=NACK:0.1
70236 !TSF:MSG:SEND,5-5-0-0,s=3,c=1,t=17,pt=7,l=5,sg=0,ft=6,st=NACK:4.0
78301 !TSF:MSG:SEND,5-5-0-0,s=4,c=1,t=18,pt=7,l=5,sg=0,ft=7,st=NACK:96.0
Sleep
78309 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
78315 TSF:TDI:TSL
78317 MCO:SLP:WUP=-1
78319 TSF:TRI:TSB
78372 !TSM:READY:UPL FAIL,SNP
78374 TSM:FPAR
79478 TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=8,st=OK:
79484 !TSF:SAN:FAIL
79489 TSM:FAIL:CNT=1
79491 TSM:FAIL:DIS
79493 TSF:TDI:TSL
220.30V; 0.11A; 4.00W; 96.00Wh;
81475 !TSF:SND:TNR
81477 !TSF:SND:TNR
81479 !TSF:SND:TNR
81481 !TSF:SND:TNR
Sleep
81483 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
81489 !MCO:SLP:TNR
89497 TSM:FAIL:RE-INIT
89499 TSM:INIT
89602 !TSM:INIT:TSP FAIL
89604 TSM:FAIL:CNT=2
89606 TSM:FAIL:DIS
89608 TSF:TDI:TSL
91492 MCO:SLP:MS=19999
91494 TSF:TDI:TSL
91496 MCO:SLP:WUP=-1
91498 TSF:TRI:TSB
220.30V; 0.11A; 4.00W; 96.00Wh;
93249 !TSF:SND:TNR
93251 !TSF:SND:TNR
93253 !TSF:SND:TNR
93255 !TSF:SND:TNR
Sleep
93257 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
93263 !MCO:SLP:TNR
99612 TSM:FAIL:RE-INIT
99614 TSM:INIT
99717 !TSM:INIT:TSP FAIL
99719 TSM:FAIL:CNT=3
99721 TSM:FAIL:DIS
99723 TSF:TDI:TSL
103266 MCO:SLP:MS=19999
103268 TSF:TDI:TSL
103270 MCO:SLP:WUP=-1
103272 TSF:TRI:TSB
219.30V; 0.11A; 4.00W; 96.00Wh;
105019 !TSF:SND:TNR
105021 !TSF:SND:TNR
105023 !TSF:SND:TNR
105027 !TSF:SND:TNR
Sleep
105029 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
105035 !MCO:SLP:TNR
109727 TSM:FAIL:RE-INIT
109729 TSM:INIT
109834 !TSM:INIT:TSP FAIL
109836 TSM:FAIL:CNT=4
109838 TSM:FAIL:DIS
109840 TSF:TDI:TSL
115038 MCO:SLP:MS=19999
115040 TSF:TDI:TSL
115042 MCO:SLP:WUP=-1
115044 TSF:TRI:TSB
219.90V; 0.11A; 4.00W; 96.00Wh;
116787 !TSF:SND:TNR
116789 !TSF:SND:TNR
116793 !TSF:SND:TNR
116795 !TSF:SND:TNR
Sleep
116797 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
116803 !MCO:SLP:TNR
119844 TSM:FAIL:RE-INIT
119846 TSM:INIT
119949 !TSM:INIT:TSP FAIL
119951 TSM:FAIL:CNT=5
119953 TSM:FAIL:DIS
119955 TSF:TDI:TSL
126806 MCO:SLP:MS=19999
126808 TSF:TDI:TSL
126810 MCO:SLP:WUP=-1
126812 TSF:TRI:TSB
220.10V; 0.11A; 4.00W; 96.00Wh;
128550 !TSF:SND:TNR
128555 !TSF:SND:TNR
128557 !TSF:SND:TNR
128559 !TSF:SND:TNR
Sleep
128561 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
128567 !MCO:SLP:TNR
129959 TSM:FAIL:RE-INIT
129961 TSM:INIT
130066 !TSM:INIT:TSP FAIL
130068 TSM:FAIL:CNT=6
130070 TSM:FAIL:DIS
130072 TSF:TDI:TSL
138569 MCO:SLP:MS=20000
138571 TSF:TDI:TSL
138573 MCO:SLP:WUP=-1
138575 TSF:TRI:TSB
219.70V; 0.11A; 4.00W; 96.00Wh;
140316 !TSF:SND:TNR
140318 !TSF:SND:TNR
140320 !TSF:SND:TNR
140322 !TSF:SND:TNR
Sleep
140324 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
140333 !MCO:SLP:TNR
140335 TSM:FAIL:RE-INIT
140337 TSM:INIT
140441 !TSM:INIT:TSP FAIL
140443 TSM:FAIL:CNT=7
140445 TSM:FAIL:DIS
140447 TSF:TDI:TSL
150335 MCO:SLP:MS=20000
150337 TSF:TDI:TSL
150339 MCO:SLP:WUP=-1
150341 TSF:TRI:TSB
220.20V; 0.11A; 4.00W; 96.00Wh;
152078 !TSF:SND:TNR
152082 !TSF:SND:TNR
152084 !TSF:SND:TNR
152086 !TSF:SND:TNR
Sleep
152088 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
152094 !MCO:SLP:TNR
162097 MCO:SLP:MS=19999
162099 TSF:TDI:TSL
162101 MCO:SLP:WUP=-1
162103 TSF:TRI:TSB
220.60V; 0.11A; 4.00W; 96.00Wh;
163840 !TSF:SND:TNR
163842 !TSF:SND:TNR
163844 !TSF:SND:TNR
163846 !TSF:SND:TNR
Sleep
163848 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
163854 !MCO:SLP:TNR
173858 MCO:SLP:MS=20000
173860 TSF:TDI:TSL
173862 MCO:SLP:WUP=-1
173864 TSF:TRI:TSB
219.70V; 0.11A; 4.00W; 96.00Wh;
175599 !TSF:SND:TNR
175601 !TSF:SND:TNR
175603 !TSF:SND:TNR
175605 !TSF:SND:TNR
Sleep
175609 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
175616 !MCO:SLP:TNR
185618 MCO:SLP:MS=20000
185620 TSF:TDI:TSL
185622 MCO:SLP:WUP=-1
185624 TSF:TRI:TSB
219.10V; 0.11A; 3.00W; 96.00Wh;
187357 !TSF:SND:TNR
187359 !TSF:SND:TNR
187363 !TSF:SND:TNR
187365 !TSF:SND:TNR
Sleep
187367 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
187373 !MCO:SLP:TNR
197376 MCO:SLP:MS=19999
197378 TSF:TDI:TSL
Anybody has a solution ?
Is it anything wrong in the sketch ?
Yes I did remove the LDO on the arduino and the power led.
But finally I found the problem ! On my prototype sensor board there was another voltage converter (5 to 3.3V) because I wanted to use the node with an one cell 18650 power bank with 5V output. Even I fed directly the arduino with an external 3.3v power source the output of this LDO remained connected and guess what ? It drained around 4-5ma ! So I desoldered it and now it's ok ! I get around 15-20ua in sleep mode with the dht22.
My gateway is raspberry pi mqtt.
And this is what I get from debug terminal. However 4ma in sleep !
Sleep for 10s !
8540 MCO:SLP:MS=10000,SMS=0,I1=255,M1=255,I2=255,M2=255
8546 TSF:TDI:TSL
8548 MCO:SLP:WUP=-1
8550 TSF:TRI:TSB
8570 TSF:MSG:SEND,1-1-0-0,s=8,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:59.3
H: 59.30
Sleep for 10s !
8579 MCO:SLP:MS=10000,SMS=0,I1=255,M1=255,I2=255,M2=255
8585 TSF:TDI:TSL
8587 MCO:SLP:WUP=-1
8589 TSF:TRI:TSB
8609 TSF:MSG:SEND,1-1-0-0,s=7,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:24.0
T: 24.00
8634 TSF:MSG:SEND,1-1-0-0,s=8,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:59.1
H: 59.10
Sleep for 10s !
8642 MCO:SLP:MS=10000,SMS=0,I1=255,M1=255,I2=255,M2=255
8648 TSF:TDI:TSL
This is my sketch. Can anybody test it please ?
#include <DHT.h>
#define MY_DEBUG
#define MY_RADIO_RFM69
#define MY_RFM69_NEW_DRIVER
#define MY_RFM69_FREQUENCY RFM69_433MHZ
#define MY_IS_RFM69HW
#define MY_NODE_ID 1
#define CHILD_ID_TEMP 7
#define CHILD_ID_HUM 8
#define DHT_DATA_PIN 3
#define SENSOR_TEMP_OFFSET 0
#include <MySensors.h>
/**************************************************/
/****************** CONSTANTS *********************/
/**************************************************/
static const uint64_t UPDATE_INTERVAL = 10000;
static const uint8_t FORCE_UPDATE_N_READS = 10;
/**************************************************/
/****************** VARIABLES *********************/
/**************************************************/
float lastTemp;
float lastHum;
float temperature;
float humidity;
uint8_t nNoUpdatesTemp;
uint8_t nNoUpdatesHum;
/**************************************************/
/****************** MESSAGES **********************/
/**************************************************/
MyMessage msgHum(CHILD_ID_HUM, V_HUM);
MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
DHT dht;
void presentation()
{
present(CHILD_ID_HUM, S_HUM);
present(CHILD_ID_TEMP, S_TEMP);
}
void setup()
{
delay(2000); //Wait 2 seconds before starting sequence
if (UPDATE_INTERVAL <= dht.getMinimumSamplingPeriod())
{
Serial.println("Warning: UPDATE_INTERVAL is smaller than supported by the sensor!");
}
sleep(dht.getMinimumSamplingPeriod());
dht.setup(DHT_DATA_PIN);
}
void loop()
{
sendTemperatureHumiditySensor();
Serial.println("Sleep for 10s !");
sleep(UPDATE_INTERVAL);
}
/**************************************************/
/**************** AUX. FUNCTIONS ******************/
/**************************************************/
void sendTemperatureHumiditySensor()
{
dht.readSensor(true);
temperature = dht.getTemperature();
humidity = dht.getHumidity();
if (isnan(temperature))
{
Serial.println("Failed reading temperature from DHT!");
} else if (temperature != lastTemp || nNoUpdatesTemp == FORCE_UPDATE_N_READS)
{
lastTemp = temperature;
nNoUpdatesTemp = 0;
temperature += SENSOR_TEMP_OFFSET;
send(msgTemp.set(temperature, 1));
#ifdef MY_DEBUG
Serial.print("T: ");
Serial.println(temperature);
#endif
} else
{
nNoUpdatesTemp++;
}
if (isnan(humidity))
{
Serial.println("Failed reading humidity from DHT");
} else if (humidity != lastHum || nNoUpdatesHum == FORCE_UPDATE_N_READS)
{
lastHum = humidity;
nNoUpdatesHum = 0;
send(msgHum.set(humidity, 1));
#ifdef MY_DEBUG
Serial.print("H: ");
Serial.println(humidity);
#endif
} else
{
nNoUpdatesHum++;
}
}```
But datasheet for dht22 says : 1.5ma when measuring and 50ua in standby.
Hi, I need some help. I made a DHT22 node with pro mini and rfm69hw radio.
It works well but it drain too much current when it supposed to sleep, about 4ma !
(and some 17ma spikes when radio is active)
I tested the mini with the old low power library and a blink sketch and I get 4ua in sleep mode !
What could be wrong ?