Hello all. This is my first post on this forum. I'll get right to it.

I'm working on a hot box for speeding the drying time of wood. I need to calculate the equilibrium moisture content the wood will reach using temperature and humidity data from my sensor(sh7021). I'm using the formula from here, and my code is attached below. I've made some changes to the code to work around the fact that there's only six points of precision available after the decimal.

My problem is that as far as I can tell, I have the formula implemented properly but get a consistent result of around 4.7% during testing regardless of sensor input. In my test environment, the moisture content reading should be 8.2% to 8.5% but I've tested up to 17% and still get the same result of 4.7% I'm not sure if its something I did wrong, or a limitation of the hardware( arduino uno ), but I'd really like to get it sorted out.

I reverted the code to use the unedited emc formula. The reason I changed it in the first place is because I assumed the error was due to float only being precise to 6 or 7 digits after the decimal and some of the constants in the formula have higher precision. That doesn't seem to be the cause since I still get a similar result as I did before.

Here is the serial output after changing it back. And below that is the new code.

The humidity sensor you are using is accurate to at best +/- 3%, which means that 3 decimal digits of arithmetic precision (0.1%) are more than enough for any calculations you need to do.

The zeros after the decimal point don't count in equations like this, so they are all 3 digit constants.

celsiusHundredths (and the humidity variable) is declared as an integer so this will be an integer division which will truncate to degrees.
Force the conversion to be done with floating point:

Thanks for all the help guys, but I figured it out. The formula was expecting the humidity as a decimal like .45 for example. My code was entering as a number of percent like 45. Dividing H by 100 solved the issue.