Tuesday, September 25, 2012

COSM and smooting

Been quite busy this weekend.  I worked on the C# application that sends the sensors to  COSM   https://cosm.com/feeds/74950.

I also soldered the parts onto a expansion shield and put it out on the front porch.  

The Arduino code was reworked to separate the local base station sensors from the external sensors.  I implemented that with RF24Network, so I could put a few more sensors/radios around the house.

I had to change the C# code to allow for different nodes and send each separable to COSM.  The base station is node 0, the external sensor(s) will be 1-6 or so.

After looking at everyone's jaggies in the lines on all the graphs - I went looking for a smoothing function on the net - you would be amazed haw hard it was to find one and then wrap my mind around once it did. I took  statistics and don't remember this exact algorithm.  But it boils down to:

avg = x * prev_avg + (1 - x) * sample; 

You maintain the prev_avg for each sensor that you want to smooth - and you monkey around with the value of x which is in the range of 0

It gives really strange values on  COSM like 30.166451344586.3 Gota love double precision numbers for the Barometric pressure - but the graph looks a lot better.

Now on to hooking up the rain gauge and the light sensor.