Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
register persistance
04-06-2017, 05:39 AM
Post: #1
register persistance
Hi,

Is there some (easy, supported) way of achieving persistance of a node's register?

Details: In an application where a node is powered up and down regularly I'd like to implement a register which (in it's simplest) is a counter.
The device powers up (together with the system being monitored), counts something, powers down. Next time that power is up the device pulls the counter from lagarto, counts further, powers down, etc. Any idea if that could be (easily) implemented? I'm using node-red and emoncms on the data side if that helps in any way.

Regards,
Kuba
Find all posts by this user
Quote this message in a reply
04-06-2017, 05:30 PM
Post: #2
RE: register persistance
Hi Kuba,

You can keep persistence from either node-red or your end device. However lagarto-swap will simply show the value received from your end-device. If you decide to keep your register value into the end-device's flash then bear in mind how often this value is being refreshed and stored. Otherwise you could create a "saving" routine to be called before powering the device off.

Daniel Berenguer
http://www.panstamp.com
Visit this user's website Find all posts by this user
Quote this message in a reply
04-06-2017, 06:01 PM
Post: #3
RE: register persistance
Thanks for reply Daniel.

Keeping the value in flash is the 'obvious' option, but indeed - flash wear might be a problem. It should still work for my application where there would be ~1 cycle per day.

Any idea how the persistance via node-red could work? I can imagine keeping the counter value in node-red (or emoncms) and incrementing it on message from end-device, but how can you get a value (at startup) from node-red to end-device via lagarto?
Something like this perhaps?
- end device notifies lagarto (and nodered) that it's started by writing to a register
- nodered writes to a register of end-device with counter value
- on receive of the message with counter value end-device is ready to go

Kuba
Find all posts by this user
Quote this message in a reply
04-07-2017, 05:27 PM
Post: #4
RE: register persistance
Hi Kuba,

Your approach seems correct but have you considered producing a partial count on your end-device and do the conversion (to total count) from node-red?

Daniel Berenguer
http://www.panstamp.com
Visit this user's website Find all posts by this user
Quote this message in a reply
04-07-2017, 05:31 PM
Post: #5
RE: register persistance
Yes indeed.
What I need, however, is a display of the "total counter value" on the node as well.
But I think it's going to be easiest done such that node-red pushes this accumulated value to the node via standard SWAP register update.
So whenever an incremental count is done on the node and pushed to the server an accumulated value is pushed back to the node for display.
As the device will be net powered (or actually power stolen from the device-under-monitoring) there's no issue with more communication.

Thanks for all the help!

Kuba
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)