Inconsistent Power Scaling with Arduino Control - Page 2

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

#11: Post by ira »

Sorry, I originally said 10 or 20, and then changed it as I missed the loop. I still think you want the loop length longer than 100 cycles which means the Delay() should be set to at least 16.

Ira

uwe

#12: Post by uwe »

I am using a very similar setup an I am expiriencing the same problem, the power is non-linear when I go above 98%.
The best solution to this problem I found so far was: limiting output to 98% in Artisan, insulating the roaster and increasing the heater power. Not very elegant, but it solves the problem. And insulating the roaster in order to minimize ET is anyway good for your roast...
Another option is to increase the delay from 5 to 8 or 9 ms. If the delay is too high, MODBUS connection fails. You need to experiment here. This mitigates the problem only.
Would be interested how other users solved this non-linearity issue.
Best wishes
Uwe

Baratza: skilled in the art of grinding
Sponsored by Baratza
marcism (original poster)

#13: Post by marcism (original poster) » replying to uwe »

Ah interesting to see it isn't limited to my system. This seems to suggest to me that the issue must be software related.

What did you to to increase the heater power? Regarding insulation: I was thinking of wrapping a fire blanket around the inner roast chamber to keep it snug. What does yours look like?

ira
Supporter ♡

#14: Post by ira »

Remember, you're switching at some rate 60hz AC power and it's likely that the SSR stays on till the end of the cycle after you turn it off. So if the on/off cycle does not extend over more than 100 cycles, you will suddenly get 100% power when you don't expect it. It's probably better if it extends over 200, but you should have at least 100 which is one and 2/3 seconds, 2 seconds if you're on 50hz power.

Ira

marcism (original poster)

#15: Post by marcism (original poster) » replying to ira »

Ok now you've lost me a bit. Are you saying that instead of having 0-100 in artisan, that it should be 0-200?

Definitely excuse my ignorance on this, but I gotta admit I've learned a hell of a lot in these two pages!

ira
Supporter ♡

#16: Post by ira »

You're turning the power on and off in 1/100 increments. The AC power cycles 60 times per second. If 1/100 of the total loop time is less than 100 cycles of AC power you will likely get a weird non linear power increases. If each 1/100 time interval encompasses 2 or more AC power cycles you're much more likely to get linear changes in power for each increment of 1/100 time.

In the code posted at the top, the loop time is about 1/2 second or 30 power cycles so conceptually it might take three 1/100 increments to make any noticeable power change. There is no need to cycle the heater in a coffee roaster twice a second. In the similar code I used in FrankenBehmor I made the cycle time 10 seconds and there was no noticeable pulsing of the heating elements. On an air roaster the elements will respond faster so you'll probably want to use a shorter loop time, but I believe 1/2 second is to short and something like 4 seconds would be much better.

Ira

btreichel

#17: Post by btreichel »

i was trying to remember the control impacts that Ira brought up; listen to his advice. Also, so what if you only change your setpoint once a second. The thermal mass of the system is a lot slower than a once per second control cycle.

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

#18: Post by marcism (original poster) »

ira wrote:You're turning the power on and off in 1/100 increments. The AC power cycles 60 times per second. If 1/100 of the total loop time is less than 100 cycles of AC power you will likely get a weird non linear power increases. If each 1/100 time interval encompasses 2 or more AC power cycles you're much more likely to get linear changes in power for each increment of 1/100 time.

In the code posted at the top, the loop time is about 1/2 second or 30 power cycles so conceptually it might take three 1/100 increments to make any noticeable power change. There is no need to cycle the heater in a coffee roaster twice a second. In the similar code I used in FrankenBehmor I made the cycle time 10 seconds and there was no noticeable pulsing of the heating elements. On an air roaster the elements will respond faster so you'll probably want to use a shorter loop time, but I believe 1/2 second is to short and something like 4 seconds would be much better.

Ira
You know when you get that feeling that despite knowing some things about the world, you still don't know jack s**t about most of it? Thanks for this really valuable insight. Will try put it into practice today.

marcism (original poster)

#19: Post by marcism (original poster) »

Qporzk wrote: I'd assume that most of your actual control range is in the last 10% of your power, so small changes like 98 to 99 are leading to much bigger relative changes. You should be able to massage this loop to have more granular control in this last range, but you would probably have to sacrifice the lower range of control. Maybe something like this:

for(int i=1; i<=99; i++) {
int n=(((100-au16data[4])/2)+au16data[4]);
if(i<=n)
digitalWrite(led, HIGH);
else
digitalWrite(led, LOW);

delay(5);
}

Keep in mind that I haven't used C++ in a while, so you'll probably need to be careful with the types in that calculation.
So this change in code only made the big temperature shift happen at 98 instead of 99 :lol:

Also seems to be quite a bit stronger now!


I also tried to increase the delay a bit but it failed at anything beyond 8-9 (was fairly unstable at 9 so had to move it back down).

@ira - can you please share any more direct instructions on how to go about this, or are we limited here by the MODBUS instability? Thanks again for your insights!

ira
Supporter ♡

#20: Post by ira »

I don't see how the loop time is affected by Modbus or vice-versa. Oh, I guess you need to call slave.poll( au16data, 16 ); more often than the loop allows.

Then inside the loop, add the lines:
if ( (i % 20) == 0) {
    slave.poll( au16data, 16 );
}
And adjust the 20 to a large number that makes the code stable. Calling it more times than necessary only means you throw some data away, but that doesn't really matter.

If the call to slave.poll( au16data, 16 ); takes long enough to mess up your delay than you can use something like this for the delay:
unsigned long timeOut = millis() + 10;
if ( (i % 20) == 0) {
    slave.poll( au16data, 16 );
}

while (timeOut > milis()){;}
Ira