Conditionally log to feed?

As part of calibrating my optical gas meter I've got it logging the lowest reading seen during each logging period. This gives a very clear indication when the silvered digit passes by, even if the readings as a whole are offset higher or lower due to my blu-tac positioning or other factors. Example:

Instead of hardcoding a threshold value into the sketch to record a 'pulse', it would be more flexible to have the option to log to a subsidiary feed conditionally. In the example above, I could add a step saying 'record a pulse to feed 2 if the value is < 550' (and then changing this threshold is an easy web interface action, instead of requiring me to redo the sketch).

This is useful because each time I stick on the sensing apparatus I get different relative values: in the graph above you can see it's generally lower after I stick the sensor on (after 20:12) than before, regardless of pulses. This has made it a bit tricky to get a solid sketch.

I don't see such an option in emonCMS at present. Has anyone done (or seen this done) who could offer me any pointers?

Alternatively, I was thinking of having the sketch keep track of a long-term average (over the previous 10 minutes, say) and then counting a pulse as a percentage variation. But I figure the idea of conditional logging to feeds might be useful for all sorts of other things?

Paul Reed's picture

Re: Conditionally log to feed?

Could you use the Event module?

IF gaslog is less than 550 set feed gaspulse to 1

Paul

Schism's picture

Re: Conditionally log to feed?

Ah, that does sound like it would do the trick. It doesn't seem to be part of the emoncms.org installation though (I'm not running my own server). Still a few things to learn evidently.

Thanks - that's saved me reinventing the wheel :)

 

TrystanLea's picture

Re: Conditionally log to feed?

The event module isn't yet installed on the emoncms.org server, its at the moment a module for local installations only.

I wonder if using the "calibration +" input process with argument -300 to subtract 300 and the "allow negative" process limit would work. That should just leave the dips? You could also multiply by -1 to show as positive spikes.

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.