V_TEMP / V_STATUS update without ack

8 years 5 months ago #2534 by mihai.aldea
Hello,

I am trying to build a battery powered thermostat. It's comprised of an ATmega328P IC, one NRF24L01+, DS18B20 sensors and one 433.92MHz transmitter used to turn an RC outlet ON/OFF, all of them powered by a 9V battery through an MCP1702 3.3V regulator.
The sensor presents two temperature sensors and one binary sensor.
1, S_TEMP - send the DS18B20 readings to EasyIoT for graphing purposes
2, S_TEMP - is actually used set the thermostat reference temperature by defining it as Temperature Output in EasyIoT
3, S_BINARY - defined as a Digital Output in EasyIoT used to enable/disable the thermostat

My idea was to have the loop run every 5 sec, in this scenario:
1. The node pulls the (2, V_TEMP) value from the gateway to determine if the desired room temperature changed.
2. Also queries for (3, V_STATUS) to see if it should continue to act as a thermostat or disable its function after sending the ON command to the outlet.
3. It pools the DS18B20 temperature sensor
4. Determines whether the current room temperature is within +/- 0.5 degrees deviation from the reference temperature and depending on that, sends an ON or OFF command to the RC outlet controlling the heat pump.


The problem is that since it's running in a loop with a certain gw.sleep() value, I can't get the desired temperature to change, nor I can disable/enable the thermostat. I belive that EasyIoT is trying to send the RF24 command instantly, waits for an acknoledgement from the node and if it doesn't receive it withing a short amount of time, aborts the command and doesn't update the value in EasyIoT.

If I rule out the gw.sleep() and let it process the incoming messages constantly while using a blink-without-delay way of having the DS18B20 poll the room temperature once every 15 sec, it works great. But I can't have a battery powered sensor that doesn't go to sleep.

It would be great that EasyIoT would allow me to set the temperature output gauge without waiting for the node to acknowledge the new setting and echo the acknowledge value on the temperature gauge. If EasyIoT would allow that, the node would simply wake up every 15 sec, check if there's a new (2, V_TEMP) value and use it to determine if it needs to send any command to the heatpump.

Right now, the project is working, but on an USB powered Arduino Uno while I have a nice tiny box with all the components inside that would make a great freely moving thermostat.

So, is there any way of tricking EasyIoT to accept a Temperature Output change request without requiring the node's receiving confirmation?

Please Log in or Create an account to join the conversation.

8 years 5 months ago #2540 by EasyIoT

mihai.aldea wrote: Hello,

I am trying to build a battery powered thermostat. It's comprised of an ATmega328P IC, one NRF24L01+, DS18B20 sensors and one 433.92MHz transmitter used to turn an RC outlet ON/OFF, all of them powered by a 9V battery through an MCP1702 3.3V regulator.
The sensor presents two temperature sensors and one binary sensor.
1, S_TEMP - send the DS18B20 readings to EasyIoT for graphing purposes
2, S_TEMP - is actually used set the thermostat reference temperature by defining it as Temperature Output in EasyIoT
3, S_BINARY - defined as a Digital Output in EasyIoT used to enable/disable the thermostat

My idea was to have the loop run every 5 sec, in this scenario:
1. The node pulls the (2, V_TEMP) value from the gateway to determine if the desired room temperature changed.
2. Also queries for (3, V_STATUS) to see if it should continue to act as a thermostat or disable its function after sending the ON command to the outlet.
3. It pools the DS18B20 temperature sensor
4. Determines whether the current room temperature is within +/- 0.5 degrees deviation from the reference temperature and depending on that, sends an ON or OFF command to the RC outlet controlling the heat pump.


The problem is that since it's running in a loop with a certain gw.sleep() value, I can't get the desired temperature to change, nor I can disable/enable the thermostat. I belive that EasyIoT is trying to send the RF24 command instantly, waits for an acknoledgement from the node and if it doesn't receive it withing a short amount of time, aborts the command and doesn't update the value in EasyIoT.

If I rule out the gw.sleep() and let it process the incoming messages constantly while using a blink-without-delay way of having the DS18B20 poll the room temperature once every 15 sec, it works great. But I can't have a battery powered sensor that doesn't go to sleep.

It would be great that EasyIoT would allow me to set the temperature output gauge without waiting for the node to acknowledge the new setting and echo the acknowledge value on the temperature gauge. If EasyIoT would allow that, the node would simply wake up every 15 sec, check if there's a new (2, V_TEMP) value and use it to determine if it needs to send any command to the heatpump.

Right now, the project is working, but on an USB powered Arduino Uno while I have a nice tiny box with all the components inside that would make a great freely moving thermostat.

So, is there any way of tricking EasyIoT to accept a Temperature Output change request without requiring the node's receiving confirmation?


Maybe you can change approach and request value from EasyIoT server when your node wakes up.

Please Log in or Create an account to join the conversation.

8 years 5 months ago - 8 years 5 months ago #2544 by mihai.aldea
Of course this is how I do it. The node is supposed to pull the update V_TEMP value from the EasyIoT server each time it wakes. However my problem is that while the node is in sleep, the EasyIoT interface doesn't allow me to change the V_TEMP value. I assume that this is how EasyIoT works:
1. The user changes the V_TEMP values from the interface;
2. EasyIoT expects the node to be awake and sends the update;
3. The node receives the new V_TEMP and acknowledges the update by sending value back to EasyIoT;
4. Upon receiving the acknowledgement from the node, EasyIoT updates the user interface with the desired new value I think by echoing what the node sent back to the gateway after receiving the new V_TEMP.

Pt. 3 happens for sure, I noticed that a constantly awaken node outputs the "read" message in the serial console, then immediately outputs a "send" message.

This makes sense, you want EasyIoT to be reliable and that's why you chose to echo the node's acknowledgement rather than the user input, however for my project this isn't OK. I would rather have a not so reliable EasyIoT <-> sensors interaction and rely on the node's value update on the second or third wake if they weren't able to successfully pull the new values upon the first wake cycle after the V_TEMP update. Of course this "don't require acknowledgement" should be a hidden option and only the users who specifically choose battery power over reliability should enable it.

I don't even know if that's possible or if it's something that should be done at the EasyIoT layer or at the RF24 network layer.

Please Log in or Create an account to join the conversation.

8 years 5 months ago #2545 by EasyIoT

mihai.aldea wrote: Of course this is how I do it. The node is supposed to pull the update V_TEMP value from the EasyIoT server each time it wakes. However my problem is that while the node is in sleep, the EasyIoT interface doesn't allow me to change the V_TEMP value. I assume that this is how EasyIoT works:
1. The user changes the V_TEMP values from the interface;
2. EasyIoT expects the node to be awake and sends the update;
3. The node receives the new V_TEMP and acknowledges the update by sending value back to EasyIoT;
4. Upon receiving the acknowledgement from the node, EasyIoT updates the user interface with the desired new value I think by echoing what the node sent back to the gateway after receiving the new V_TEMP.

Pt. 3 happens for sure, I noticed that a constantly awaken node outputs the "read" message in the serial console, then immediately outputs a "send" message.

This makes sense, you want EasyIoT to be reliable and that's why you chose to echo the node's acknowledgement rather than the user input, however for my project this isn't OK. I would rather have a not so reliable EasyIoT <-> sensors interaction and rely on the node's value update on the second or third wake if they weren't able to successfully pull the new values upon the first wake cycle after the V_TEMP update. Of course this "don't require acknowledgement" should be a hidden option and only the users who specifically choose battery power over reliability should enable it.

I don't even know if that's possible or if it's something that should be done at the EasyIoT layer or at the RF24 network layer.


The solution is not out of the box. You can use Virtual modules and automation...

Please Log in or Create an account to join the conversation.

8 years 5 months ago #2546 by mihai.aldea
Tried that already, the virtual sensors accepts the value change, however the "synced" EasyIoT node, doesn't update its value to send it to the node upon the first wake and read request :-(

Please Log in or Create an account to join the conversation.

8 years 5 months ago #2556 by EasyIoT

mihai.aldea wrote: Tried that already, the virtual sensors accepts the value change, however the "synced" EasyIoT node, doesn't update its value to send it to the node upon the first wake and read request :-(


Use virtual node to set value of MySensors node - for this you need automation.
Look at iot-playground.com/2-uncategorised/32-ea...-automation-part-iii

and Driver and Event helper functions.

Then read value from MySensors node when node wakes up.

Please Log in or Create an account to join the conversation.

Time to create page: 0.199 seconds

Forum latest

  • No posts to display.