EMC Monitoring Part 2 - using stock EmonTH firmware

Last summer we modified the EmonTH firmware to perform EMC calculations onboard before transmitting the values to our EmonCMS server. (EMC is the percentage of moisture content that wood stabilizes at when subjected to a certain environment for a long enough period of time) We later discovered that it will be difficult for other people to use our contribution because it requires flashing custom firmware and editing the config file. Additionally, our new data structure was incompatible with what has already been standardized from an EmonTH node. A better solution is to calculate an EMC value on the fly using a custom virtual feed. This thread will document the process to implement this solution, and will serve as the basis for other related projects.

-Bert Geen
Founder, SolarMill
“we make things with sunshine”

1 Like

Hey my name is Berkeley Fergusson, and I am an intern working with SolarMill for the summer. I will be attempting to implement this virtual feed. I am new to SQL and PHP and appreciate any and all assistance. Does anyone have tips on where I should begin?

Essentially we need to take two source feeds and perform a function to them and output a new virtual feed based on those values.

-Berkeley
SolarMill CS Engineering Intern

1 Like

Hello Berkeley, Can you describe the function you need to perform in detail? Can it be achieved with emoncms input processors: add, subtract, divide, multiply by value or input?

here is the formula that we will be using to process and combine temperature and humidity into a single EMC feed. This is taken from this thread. I do not believe this can be easily (if at all) achieved through input processors, so I was hoping there is a more elegant solution.

-Berkeley

The main options I can think of are:

  • Write a custom application dashboard such as myelectric/mysolar that takes a temperature and humidity feed and applies this calculation on the fly.
  • Create a special purpose visualisation or dashboard widget that would work in much the same way.
  • Write a input processor - the main issue here is that input processors can currently only have one argument.
  • Modify the firmware as you have done so already
  • Have a seperate script that runs in the background that polls the emoncms feeds and writes the result to another feed.
  • Use node red perhaps?

I would usually modify the firmware or write a custom visualisation in this case I think.

We are looking for a solution more deployable than writing custom firmware (which we’ve already done). We would like users to have access to EMC data without having to modify the stock Emon hardware. Since a virtual feed appears unrealistic, I’ve edited this thread topic to reflect our shift in focus.

Based on your suggestion, it seems like Node-RED will be the way to go, as it’s quickly becoming a core part of the Emon ecosystem. It also should be easy for us to share our “flow” with others.

We haven’t done anything with Node-RED before, so this will be a great opportunity to learn more about it. More updates to come.

-Bert

We have decided to use Node-Red to solve this problem using MQTT inputs that subscribe to the emoncms feeds with the values that we are interested in.

Just have a question I hope someone can shed some light on. Because the mqtt nodes are subscribed to different “topics” they don’t output values at the same time, is there a way to combine them into one message payload so they can all be accessed at the same time?

-Berkeley Fergusson

We have successfully implemented a node-RED solution to EMC calculation.

Technical details about how to receive, process, and resend the values using MQTT are detailed in this post here.

And for anyone interested in using our flow, we have it posted here:

EMC V2

This concludes our update to the open source Equilibrium Moisture Content calculation version 2.0, using node-RED with stock EmonTH firmware instead of having to reflash it with custom firmware. This makes EMC a drop in solution for anyone who want’s to know what’s really happening with temperature and humidity. If you’re a wood worker, furniture maker, restoration specialist, sell wood products such as flooring, or simply want a better indicator of what the composite value of temp and humidity are doing, we highly recommend using EMC.

Regards,
Team SolarMill

1 Like