I am going to connect a rainfall sensor to one of my imp’s, but I need some ideas to how to log rainfall.
One of the things I would like to do is to be able to do rainfall the last 1 minute, 5 minutes, 10 minutes, 30 minutes, and so on without being limited to some predefined timespan. One way to do that would be to have a table with 1440 entries in, one for each minute in a day. That way I could insert the pulses from the rainfall sensor into the entry for the corresponding minute for a day. If I wanted to get the rainfall over the last 30 minutes, it would just be to calculate current minute, and add the pulses 30 minutes back…
But I am not sure this is the best/a good way to store that data. Any other suggestions?
Use xively? log it there and all the pain of logging/storing wil be taken away.
The graph’s are scale-able so u can pan in on a curtain period.
Bearded made a script to set this up.
https://github.com/electricimp/reference/tree/master/webservices/xively
That git repo also comes with a ton of examples on eg. sensors, check it out here:
If the links aint working paste and copy ! 
@patcher I am also going to use xively, but I need all data in json, with one call to the agent url where I also get some other things I can’t log on xively.
@DolfTraanberg not sure what that does, or how to use that.
well, you where speaking of an array (table) of 1440 entries for your data storage
This can do that, but more. this creates an array of a length you specify. When the array is full it removes the first entry by overwriting it with the last. When you calculate the sum of all entries and divide this with the number of entries, you will have an average which is always accurate. But the biggest advantage is, that the array never gets full
I wrote this for the imp, based on this video:
https://www.youtube.com/watch?v=okr-XE8yTO8&list=PL2_aWCzGMAwI3W_JlcBbtYTwiQSsOTa6P&src_vid=A5_XdiK4J8A&feature=iv&annotation_id=annotation_3236325531
@DolfTraanberg okay, so it seems to do what I already though about doing. I was more interested in if there was a better way to do it, instead of having all these entries.