There's been some AVR changes recently but I haven't pushed it into the snapshot because I don't know how I feel about them.
Thermocouple Non-Linearity Compensation
The one hour change that lasted for days. Steve_M "Toronto Steve" contacted me about adding compensation for the nonlinear response of thermocouples. K-Type thermocouples are not exactly 41uV/C across their entire range. In fact, they aren't even linear across the range we use them in (ref google "Seebeck Coefficient of Thermocouple vs. Temperature"). However, the error is minor at just +1C at 140C and -1C at around 260C.
Fixing this using a compensation table to adjust the values is fairly trivial so I added it. However, comparing the numbers from
Analog Devices AN-1087 compensation tables to the NIST standard reference tables or the formulas in the document didn't match up. This spawned hours upon hours of reading other papers, trying other formulas to compare, and finally just giving up and rolling back to the initial implementation. The newest AVR snapshot now includes this compensation for temperatures between 0C and 320C with accuracy down to 0.01C.
Note: This means if your temperature read 212.0F at sea level and boiling, it will now read 210.596F because there's a -0.78C compensation applied there. There is no way to disable this feature without recompiling.
Less Beepy, Still Too Beepy
You know how when the alarm goes off and you have the action set to Silence/Disable there's still like 2 seconds of beeping? This was something I've wanted to fix for a bit and more of a fix is coming, but now it beeps less! 500ms less to be precise. I was hoping that a simple 1-line change could eliminate the beeping entirely but the processing delay of having to go from the HeaterMeter, into linkmeterd, launch the alarm process, figure out what to do, and tell HeaterMeter not to beep takes too long so it still beeps. As part of some of the LCD UI swaparound, there will be a complete silence mode setting on the device itself so you will never peep the beep again.
Secret Mystery Menus
I do a lot of diagnostics and testing and sometimes I want more information right on the display instead of having to use the webui. In the snapshot now there is a secret menu! Go to the manual mode selection menu and hold the left button. The first screen is Probe0's raw info:
Code:
N ADCxxxx NZyy -- Line 1
Probe number, ADC raw value, Noise
Type CurrentVal -- Line2
Where type is the type of probe and the right is the current calculated value
The display does not update on the fly yet, that's where the LCD UI swaparound needs to be finished. It is currently locked to only having one dynamically updatable display, the "Home" screen. A future update will include the ability for any screen to be the one that is updated on the fly so the values will refresh. There's also going to be a bandgap reference and VCC diagnostic screen, the ability to change probe types, buzzer tester, fan feedback diagnostics, and a servo tester mode to center and set endpoints.
Proportional On Measurement mode
Hey Mr. DJ, Pon de Measure-play.
Issue #42 was opened suggesting that HeaterMeter also allow a PonM mode for proportional contribution to PID output. This is the first major change to the PID control structure in several years, and it is HeaterMeter's core feature so I'm always excited to try new things here. The concept is that instead of P being Kp * error, P becomes -Kp * temperature, switching from Proportional-on-Error to Proportional-on-Measurement. There are a couple good blog articles to explain why here:
Introducing Proportional On Measurement
Proportional on Measurement – The Code
As with all things HeaterMeter, the one hour change spawned a week's work as there were a whole lot of problems with the first implementations that even when I hard coded some band-aids into the code would still have somewhat poor control response. What I ended up with is "a linear combination of Proportional-on-Error and Proportional-on-Measurement to proportional contribution" as discussed in Instrument Engineers' Handbook, Fourth Edition, Volume Two: Process Control. The current snapshot interprets a negative Kp (the P constant in the webui) as indicating you want to run with this new experimental feature, but the sign is removed before the calculations are made, so the value is still always positive. Right now the code is hard-coded to use a fixed lambda weight of 0.4*setpoint - temperature, although once I get a chance to update the UI, any weight can be used. 1.0 would be the same as what we have now, PonE, because that works out to 1.0*setpoint - temperature, which is just the error. However, a full PonM calculation can be done with a 0.0 lambda as well as any weight in between. Allowing this is blocked by needing support in the UI and I've currently got the Pi firmware torn apart to move it back to OpenWrt from LEDE since the LEDE Project is now dead.
In the meantime however, I've used the PID constants of P=-0.4, I=0.1, D=12 on my big green egg and it seems to do OK. Note the P value is negative (to enable the feature) and a lot lower than the "4" default. The I constant probably needs to be higher than what you have now, as the P doesn't do much heavy lifting any more so we're relying more on the I acting more quickly. The D is much larger to try to counteract over/undershoot caused by I settling.
For people used to how HeaterMeter instantly responds when you change the setpoint: In this mode the output is more driven by the I accumulation, so when you change setpoints, expect some time for the controller output to ramp. Also note that this somewhat removes the proportional band so expect to see the output cutting out a lot earlier on startup so if you test, please set your "Max Startup Fan Speed" back to 100, otherwise the startup will be double-limited and might take a lifetime. At the very least set it higher or expect a very slow startup.
So there we have it. Like two months of work that came from what I expected to be just a few hours of coding. I've got such a pile on my TODO list and for every thing that's come off it, I feel like it's not quite done or maybe wasn't a good idea to begin with so maybe you guys will feel like these are better features than I do. There's just so much to work on and it is somehow hard to find the time despite not quite being really employed with a real job, but it does feel good to finally have something to put into your hands. Maybe there should be a new thread for the PonMonE discussion? I'd be interested to hear if anyone feels like it is helpful.
EDIT: Forgot to mention how to get this. Just go to LinkMeter -> AVR Firmware in the webui. Select "From Online Repository" and select the most recent snapshot which is 20180810B.