💬 Door, Window and Push-button Sensor
-
@gohan the default sketch with debounce library works better, but now i see my primary problem.
Occasionally I have an ACK errors4231 TSF:MSG:SEND,21-21-0-0,s=3,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=OK:0 4239 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255 4245 TSF:TDI:TSL 4247 MCO:SLP:WUP=0 4249 TSF:TRI:TSB 4290 !TSF:MSG:SEND,21-21-0-0,s=3,c=1,t=16,pt=2,l=2,sg=0,ft=0,st=NACK:1 4298 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255 4302 TSF:TDI:TSL 4304 MCO:SLP:WUP=0 4306 TSF:TRI:TSB 4313 TSF:MSG:SEND,21-21-0-0,s=3,c=1,t=16,pt=2,l=2,sg=0,ft=1,st=OK:0 4321 MCO:SLP:MS=0,SMS=0,I1=0,M1=1,I2=255,M2=255I tried to icrease the time ack on my controller - it does not help
Ithink that I need to ckeck ack state on the node and send the message again, but have no idea how to do -
you are at the limit of the radio range I'd say so randomly it looses a message, so you need to either increase power or get a better antenna (I hope you aren't using any buck/boost converter as power supply)
@gohan how you know?
Id 21 from range 0..255. Are you sure that is limit?Same with any different IDs, I tried sending message 3 times, this guarantees delivery of payload, but it using too much power
Now I use power supply with 1117
But my other nodes powered by CR2032 with boost 0.8-3.3V dc/dc with inductor coil on the NRF24 supply pin without any troubles
-
@gohan how you know?
Id 21 from range 0..255. Are you sure that is limit?Same with any different IDs, I tried sending message 3 times, this guarantees delivery of payload, but it using too much power
Now I use power supply with 1117
But my other nodes powered by CR2032 with boost 0.8-3.3V dc/dc with inductor coil on the NRF24 supply pin without any troubles
@pavel-polititsky said in 💬 Door, Window and Push-button Sensor:
@gohan how you know?
Id 21 from range 0..255. Are you sure that is limit?He means radio range (distance) not ID of node ;)
-
@pavel-polititsky said in 💬 Door, Window and Push-button Sensor:
@gohan how you know?
Id 21 from range 0..255. Are you sure that is limit?He means radio range (distance) not ID of node ;)
@nca78 oke, undestood
Problem stiil not resolved. I want to send message again to the gateway if NACK but dont know how to do it.send(msg.set(value == HIGH), true);in this case i have additional ack log in the serial debug, nothing more
-
A quick ACK example:
static boolean tryAgainLater = false; // should we resend? if(send(msgDust.setSensor(CHILD_ID_DUST_PM25).set(sensorValue),1)){ Serial.println(F("Received ACK")); tryAgainLater = false; }else { Serial.println(F("Connection problem, try again")); tryAgainLater = true; } -
@mfalkvidd said in 💬 Door, Window and Push-button Sensor:
Ah, thanks. So ACK basically always happens?
in that case, do you have any better example code on how to check if the ACK is received?
-
@mfalkvidd said in 💬 Door, Window and Push-button Sensor:
Ah, thanks. So ACK basically always happens?
in that case, do you have any better example code on how to check if the ACK is received?
@alowhum on nrf24, "hardware" ack is always on. "Software" ack is controlled by the second parameter in the send() function. Read https://forum.mysensors.org/post/34267 for an attempt to sort out the details. It is still quite confusing for me.
-
What will happen if i cut the power OFF of the radio after each transmission? is it needed to be initialize again before next transmission?
-
Thanks for fast reply, actually 900nA is to big number and i prefer to use xxx_POWER_PIN to cut the power of the NRF module.
I am building switch powered with CR2032 battery and i want to extend battery live as much as possible, for a switch is not needed to keep radio alive, i need it ON only when transmit signal -
Thanks for fast reply, actually 900nA is to big number and i prefer to use xxx_POWER_PIN to cut the power of the NRF module.
I am building switch powered with CR2032 battery and i want to extend battery live as much as possible, for a switch is not needed to keep radio alive, i need it ON only when transmit signal@tiana 900nA on a cr2032 is 27.9 years battery life. The self discharge of a cr2032 is around 250nA.
But yes, use the power pin setting if you want to.Would be interesting to see how long sleep times are needed to make up for the extra time needed to wake up the radio from power off compared to sleep. The mcu and the radio will need to be awake for 100ms longer time when starting from power off than when starting from sleep.
-
Hi I notice that there is not sleep in this sketch. Is it not required for this build
-
Hi I notice that there is not sleep in this sketch. Is it not required for this build
-
Hi
Can i connect two sensor contact to this arduino ? First to pin 3 second to pin 4 ? But how modified this sketch to support two sensor contact ?@pepson If you need the node to sleep or want to use interrupts then only digital pins 2 and 3 will do this for uno/promini.
So otherwise 2 options really.
If you just need to know that one of the sensors triggered (but not which one) then you can add sensors in series (for normally 'closed' sensors) or parallel (for normally 'open' sensors).
To use interrupt and know which sensor triggered you'd have to connect both sensor to interrupt pin with blocking diodes to digital pins as well and then on interrupt you can check which digital pin activated the isr.