node var request issue
-
Hello,
My water meter has several issues since going 1.4 :
-
transmission/reception issues
-
reception of a variable value
With the same hardware/software in 1.3 it was perfectly functional, not it isn't... do you have an idea how to improve the node to request the var at a frequent pace till it gets the answer or is able to read the answer ?
thanks,
-
-
@hek here is what the console shows me:
sensor started, id 2
send: 2-2-0-0 s=255,c=0,t=17,pt=0,l=3,st=ok:1.4
send: 2-2-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0
send: 2-2-0-0 s=255,c=3,t=11,pt=0,l=11,st=ok:Water Meter
send: 2-2-0-0 s=255,c=3,t=12,pt=0,l=8,st=ok:1.0 reed
send: 2-2-0-0 s=5,c=0,t=21,pt=0,l=3,st=ok:1.4
send: 2-2-0-0 s=5,c=2,t=24,pt=0,l=3,st=ok:1.4
read: 0-0-2 s=5,c=3,t=24,pt=0,l=5:50623I don't see the println from incomming message.
Afterward the node keeps asking the VAR_1 value to the node although answers are given:
send: 2-2-0-0 s=5,c=2,t=24,pt=0,l=5,st=ok:50623 read: 0-0-2 s=5,c=3,t=24,pt=0,l=5:50623 send: 2-2-0-0 s=5,c=2,t=24,pt=0,l=5,st=ok:50623 read: 0-0-2 s=5,c=3,t=24,pt=0,l=5:50623 send: 2-2-0-0 s=5,c=2,t=24,pt=0,l=5,st=ok:50623 read: 0-0-2 s=5,c=3,t=24,pt=0,l=5:50623
and so on ...
I'm not so confident this piece of code works:
void incomingMessage(const MyMessage &message) { if (message.type==V_VAR1) { pulseCount = oldPulseCount = message.getLong(); Serial.print("Received last pulse count from gw:"); Serial.println(pulseCount); pcReceived = true; } }
-
@epierre
Looks like you might have mixed up command-types in your gateway when responding to requests. Should be SET (c=1).Right now c=3 == INTERNAL
-
@hek argh... values having changed, it would have been good to have such low level exchanges a bit documented as before(at least explaining you answer a get by a set...)... now that part works,
Next I have to investigate why it is not counting anymore... so bat we can't yet make OTA updates
https://github.com/empierre/arduino/blob/master/WaterMeterPulseSensor2.ino
-
ok this is now fixed, I added a led pulse too.
@hek could wwe provide both methods in the smae sketch to handle both visual pulse and reed ? the default one does not work for reed....
-
Please go ahead and make the addition to support reed senors.
-
@hek What's different from a regular button when using a reed sensor? Both have to be debounced...
-
-
-
I might have misinterpreted @epierre. But I would guess he means that type of reed switch @Yveaux .. But I cannot understand why that would make any difference from any other pulse sensor.. Maybe the pulses are longer?
-
-
@Yveaux @hek in fact it has to be debounced for it vibrates on rising and falling so it is important to see. maybe the bling delay would do it simply but someoone may remove the led...
Also through trial and error here is the way to manage it:
// Setup the reed pinMode(DIGITAL_INPUT_SENSOR,INPUT); // Activate internal pull-up digitalWrite(DIGITAL_INPUT_SENSOR,HIGH); attachInterrupt(INTERRUPT, onPulse, FALLING);
you have to power the pin to get the signal when both sides are connected.