Kaldi Home and Artisan Software PID

Discuss roast levels and profiles for espresso, equipment for roasting coffee.

#1: Post by aabud »

While I've been roasting coffee "blind" in a crude converted BBQ steel drum for years, I am a newbie when it comes to Artisan, temperature observation and curves. I recently acquired a Kaldi "Home" roaster for a temporary home away from home. I did a couple of roasts manually with it to get the feel of it, and they were drinkable, but nothing too exciting. Then I set about getting Artisan working with it. I'm running Artisan on a laptop, and using a Phidgets setup for the ET and BT probes. BT is in the rotating bean mass and ET is in the center of the drum. I've got a 15,000 (claimed) BTU camp stove for heat, with an Arduino driven servo affixed to the burner knob. In Artisan, I set up a "Burner" slider to talk Modbus to the Arduino to control the server. All the electronics seem to be working well, temps look accurate and change, and the servo turns the knob appropriately when I move the Artisan slider around.

First attempt at PID control... was an abort. PID didn't seem to do anything, but if I attempted to manually move the Burner slider, the PID would move it back. I went back in and reviewed, changed a bunch of settings, and hoped for the best on the next round.

Second attempt met with some success. Initially, it seemed like the PID was doing anything again, but then midway through the roast, I noticed it was working. I think I had the SV minimum set too high (or didn't realize the role that played), and also I had the "negative" target enabled on the PID, which I don't think I need (my servo control is positive, from 0 being a low flame, to 100 being full on).

Third attempt worked! Wasn't necessarily too pretty, but I didn't touch the burner knob. I could see the servo spinning it around a bit. For some reason, Artisan does not plot the Burner Slider changes the PID is making. I notice it does plot them if I manually move the slider. I hope there is a way to make that happen and I just haven't figured it out. Anybody have a suggestion on how to turn this on?

I'll attach the scope on the third roast is below. Since I have to remove the ET/BT probes when I charge, I didn't bother to start the scope until after I had done the charge and reinserted the probes. I had preheated the Kaldi to around 200C just prior to doing that. Forgot to shut Artisan off, and it ran on a bit.

I'll also attach some screen shots of settings.

I'm going to chew on this a bit and ponder how to tweak things to improve the PID tracking and get a better ROR. Any suggestions are welcome, specifically on how to get Artisan to log the Burner changes the software PID is making (I can see them happening on the slider and servo, but not on the plot).

Urnex: 100% dedicated focus on coffee and tea cleaning
Sponsored by Urnex
aabud (original poster)

#2: Post by aabud (original poster) »

Figured out how to get the PID dynamics to display by setting them up as an extra device:

Now that I can see what the PID is trying to do, thought I'd try another roast. And to keep things simple, I changed the PID settings, so I only had a KP value - no KI or KD, just to try and understand the basics. I picked a much larger P value (15) than what I had started with (4):

Here's the test roast. I can see that the PID control of the burner was basically all or nothing. Nothing in my case isn't "no heat" - it's the lowest my flame will go reliably without blowing out.

I'll have to digest this - try to make some sense from how ET and BT react to the burner changes, and doing some reading on the role of KP, KI, and KD, to design the next test.

aabud (original poster)

#3: Post by aabud (original poster) »

I decided to do some experiments with no beans, since I could run tests faster. That was very insightful, and I was getting a good amount of burner control and tracking the profile almost exactly in the second half of this "no beans" test run:

I knew that when I loaded the drum with beans, it was going to change things, but I was curious to see how different it would be. Well... it was quite different, and not in a good way:

The black line on the bottom is the burner - it ran 100% for 2:30, then throttled all the way back, then ran 100% again at around 7:15 for 2:00 minutes. Not very fine control.

Tonight I'm pondering if there might be something fundamental here that is at odds with PID control - an incredibly long deceleration. With beans in the drum, I'm seeing maybe 10 to 20 seconds delay before an increase in heat has an impact on the bean temperature. In that 10 to 20 seconds, I can pump enough heat into the steel drum and housing to keep the bean temp rising for a couple of minutes, , even if the burner is throttled all the way back. I may need to restrict the range I let the PID run the burner(say, 0 to 60%). Also maybe I manually get the roast started and tracking with the profile, then activate the PID to finish the roast. I was asking myself also if a PID will really ever work very well with a drum roaster... I may have to back track and see if any of the PID experience posts here are drum roasters. Maybe I'm beating a dead horse.


#4: Post by Doodads »

I like the gas control with a servo, great idea!

I don't have PID experience to add, but I'm also working on automating my gas roaster (Huky) and I'll be watching this thread. My plan for my roaster is to first automate the warmup/soak routine for the roaster, and roast with gas pressure events triggered by Artisan rather than full PID.

aabud (original poster)

#5: Post by aabud (original poster) »

An update on my progress... I've convinced myself that a PID probably isn't gonna work with my drum roaster. It works fine on an empty drum, so would work for automating preheating, but the combined mass of the beans and steel create much thermal momentum and a long control lead time that a generic algorithm just can't handle. Outside the roasting world, it seems like in these situations "model based" controllers are used - a controller that has an internal model of the dynamics of the mass, heat, desired velocity changes, etc. For example, a PID wouldn't know that it should never add heat after a certain point in the roast, but a "model based" controller could be aware of those types of rules. I also dug around and couldn't find anyone roasting successfully with a solid/mostly solid drum using a PID.

So... I've shifted my focus to designing a model based controller.

From a technical standpoint, I created a software "roast controller" that is the sole source of input for Artisan (via modbus). My desired roast profile, temperature and heat control servo are all controlled by my "roast controller", which in turn makes the data available to Artisan. The "roast controller" will use it's "model" of the my roaster, the current and past temperatures, and my desired roast profile to control the heat servo. Artisan doesn't control anything, it's just monitoring and charting what's happening. Kudos to Artisan for being so "open" that this is possible.

To get started, I've got the "roast controller" simply advising me during the roast, and providing buttons for me to manually control the heat. To get the data to build the model, I used this setup to perform a couple of example roasts, where I controlled the roast manually. Here's a picture to show what the setup looks like:

My next step is to crunch through all this data and build the model and rules until I get the "advice" function to be as good a roast controller as I am with my brain, eyes and hands. Don't know if this'll work out, but it'll be a fun little attempt. If I can get this working, I could imagine folding it back into Artisan itself (as a mod just for me). I kinda think it won't be generic enough to be of general interest, but first things first.


#6: Post by marcism »

This is super cool and you actually had a really similar journey to mine on my popper.

I started messing with pid control with BT as the source and it was tough to get it aligned, I got there in the end but 110g in a popper with an element is going to be completely different to your gas control.

I can say that it worked, but I started having greater success with ET as my source, measuring the intake just before the roast chamber. Naturally this lost me a small amount of per roast control, but it worked ok.

Finally, I settled on using buttons/events added to Artisan to control the pid power in +-1, +-5, and +-10 blocks. I've had my best roasts yet with this, and the fine grain control happens at the end of the roast with a manual knob for airflow changes. Works very well.

Moral of the story: pid roasting is seriously hard to dial in, but not impossible. I think if you can get everything as stable as possible first by preheating, then trying to control it, you will have more success. Nevertheless, thanks for teaching me why I never saw the pid power changes on my charts!

Enjoy your coffee!

aabud (original poster)

#7: Post by aabud (original poster) »

I had some success with the model based controller, and, as this thread was about my experience with the software PID... I decided to start another thread to talk about the model based controller :

Non-PID Automated Control