Stc-1000+

Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Help Support Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
Good News Everyone!

The buttons on the haunted STC work perfectly now.

I'm not sure about the cooling delay though. Did you make any changes to it or were you going for the buttons first?

I configured all the settings and power cycled the STC. I am about 8 degrees above my set point (with a 0.5*F hysteresis), it has been 10 minutes, and the cool led is still blinking.

Also, I assume that only the fixed startup delay should pass (300 seconds) before it allows the relay to close... the cool delay shouldn't come into effect until after that first closing of the cool relay, correct?

The fix for the buttons is great.

Effing awesome! This was driving me insane.
No I havn't fixed cooling delay yet. I just had a few minutes. I'll get to it soon. It least, with your stc fixed, I think it verifies that was the issue.

That's what I've played with - the free version. SDCC looks interesting though...

Yeah, I think it is OK. This was a bit of a let down though, but they (like me) make no promises :) but it is free (as in freedom).
I miss avr-gcc though :)
 
So was the 300 second delay in there from the code? In other words, alpha, did you insert that delay in?

If so, can it be removed or drastically reduced? I understand that it's a safety measure, but that's the idea behind the cd setting in the first place. Oftentimes, I don't want to have to wait a long time to get the compressor on, because there's times when it'll delay but didn't need to. Like for example, you just plug it in, and it immediately delays per the cd setting (and apparently 300 secs which I didnt know -- probably a LOT of my probs last night due to that).

Well, what if I hadn't been running the compressor before I plugged it in? I of course want to get the thing going, and waiting a bunch of minutes doesn't seem very sensible. Therefore, under the stock firmware, I would set the delay down to 1 miin, so that it would always come on quickly within a minute.

I guess what I'm getting at -- 99% people know their own hardware, and know what's appropriate for the cooling delay. If they're worried about a power outage recycling the controller, then they should set the "cd" setting to 15 mins or so, as that's the entire purpose. Having a second layer of protection for 300secs seems like an unnecessary step, especially given that the heating mode has no such protection.
 
I'm pretty sure the factory firmware has a 600 second initial delay and then it starts using the user setting on the next cycle. I can't find anything on-line documenting that, so I'll have to check when I get home.

But anyway, I wonder if there is anything prohibiting making the initial delay equal to the user configurable compressor delay?

You probably want a bare minimum in there, like 60 seconds. Otherwise, if your power starts flickering it could damage your compressor.

I'm guessing they probably can't be separated into two configurable settings due to memory constraints, Alpha will have to answer that.

The heat side doesn't have the same protection because cycling most heating devices on and off rapidly won't hurt them like it will a refrigerant compressor.

Slightly related to this is that you absolutely do not want your heat delay and cool delay both set to zero. Depending on your hysteresis setting and probe placement, you could end up with some really nasty heat/cool rapid cycling.
 
So was the 300 second delay in there from the code? In other words, alpha, did you insert that delay in?

If so, can it be removed or drastically reduced? I understand that it's a safety measure, but that's the idea behind the cd setting in the first place. Oftentimes, I don't want to have to wait a long time to get the compressor on, because there's times when it'll delay but didn't need to. Like for example, you just plug it in, and it immediately delays per the cd setting (and apparently 300 secs which I didnt know -- probably a LOT of my probs last night due to that).

Well, what if I hadn't been running the compressor before I plugged it in? I of course want to get the thing going, and waiting a bunch of minutes doesn't seem very sensible. Therefore, under the stock firmware, I would set the delay down to 1 miin, so that it would always come on quickly within a minute.

I guess what I'm getting at -- 99% people know their own hardware, and know what's appropriate for the cooling delay. If they're worried about a power outage recycling the controller, then they should set the "cd" setting to 15 mins or so, as that's the entire purpose. Having a second layer of protection for 300secs seems like an unnecessary step, especially given that the heating mode has no such protection.

Yes, I did. The thing is if the variable is local and static (as it should be) then it needs to be initialized to a known value. And I do think it IS a feature, granted it is not a documented one (yet).
The problems you had last night I think in no small part has to do with the fact that static variables to not seem to initialize properly, so the value could have been anything.

I agree that most poeple would now their own setup best, and if they don't it is their own fault if they set the values incorrectly. I do however think that the the initial delay is a good thing. If your setup permits you to have no hysteresis and no delay, that is fine. If the power should flicker, I still don't think you would want your compressor cycled (or relays worn out).

It is the other way around, the controller can't know your compressor hasn't just been running.

But you are right, I think it could stand to be lowered to maybe a minute.

Heating also has a delay, mainly to spare the relay, assuming resistive load.

Edit: Ah well, Disney7 beat me to the punch on most of the above :)
 
I'm pretty sure the factory firmware has a 600 second initial delay and then it starts using the user setting on the next cycle.

I dont think that could be true. Countless times, I've gotten mine to turn on within a minute of powering up the device (on stock firmware).

I would simply turn the delay down to 1min (the minimum), and it would turn on after a minute. Unless I've got special editions, there's no factory delay outside of the user-defined delay.

Slightly related to this is that you absolutely do not want your heat delay and cool delay both set to zero. Depending on your hysteresis setting and probe placement, you could end up with some really nasty heat/cool rapid cycling.

Lots of controllers, including Ranco and Johnson, have the ability to set the delay to zero. I think the idea behind it is that you know your devices better than they do, and if you need to force the device on, you set it to zero momentarily. I've done this countless times to get a cooling cycle started, because most controllers, when powered on, immediately force you through the user-defined delay period before cutting on. This of course makes no sense if you just plugged it in and it hasn't been running. You put it down to zero, then immediately back up once the compressor comes on.
 
But you are right, I think it could stand to be lowered to maybe a minute.

Heating also has a delay, mainly to spare the relay, assuming resistive load.

Edit: Ah well, Disney7 beat me to the punch on most of the above :)

I think 1 minute is a very fair compromise. 1 thing you gotta keep in mind is not only do people know their hardware, but the people using THIS mod, should REEEEALLY know their hardware, and are likely power-users and tinkerers.

Also, I've witnessed no delay in the heat. I can have it cut on instantly when I power up the device. I have the heat delay set to 0. Am I missing something? Granted, I don't have heating wired up to anything, but I don't think the relay cares if something's hooked up --- it just switches regardless. Perhaps I'm cheating your code :D
 
I think 1 minute is a very fair compromise. 1 thing you gotta keep in mind is not only do people know their hardware, but the people using THIS mod, should REEEEALLY know their hardware, and are likely power-users and tinkerers.

Also, I've witnessed no delay in the heat. I can have it cut on instantly when I power up the device. I have the heat delay set to 0. Am I missing something? Granted, I don't have heating wired up to anything, but I don't think the relay cares if something's hooked up --- it just switches regardless. Perhaps I'm cheating your code :D

Good, because I just pushed new code to the work branch with 60 sec delays on both heat and cool.

I would not make that assumption, this mod is not that hard, and even so, if it works out well, there is no stopping people helping each other or reselling of flashed units.

Well, if it was broken before, the initial delay could have been zero, there is just no telling what it was. And if you had it set to zero...
 
Oh yeah, the new push should fix the initial delays. If it seems to work out, I'll probably merge to master tomorrow. Then I'll probably have a second round at cleaning up the code and maybe try to add degree dot (and the 'C' if Celsius), when displaying a temperature.
Edit: I'm off to catch some z's. Let me know how it works out :)
 
I dont think that could be true. Countless times, I've gotten mine to turn on within a minute of powering up the device (on stock firmware).

I was wrong about the factory behavior. The factory units I have here do not have separate initial cooling and cooling delays. They both match whatever the user setting for cooling delay is. The default is 10 minutes, that might be where I got that idea from.

Anyway, 60 seconds sounds good to me for initial cooling. I don't see much need for any initial heating delay, but 60 seconds won't hurt anything.
 
Cool, thanks for your hard work. I'll try to remain professional on any future frustrations.

My biggest deal was that it was 1:45am and I never did solve things. That's the point at which you just pull your hair out and "aaahhhH!!!!!! why wont this work? damnit!!!"

I def appreciate all you're doing here, and will be flashing this when I get home. And here's the upside -- I now have TWO modded controllers!
 
With the latest work commit, things look pretty dang good. The delays are working like they should.

The only thing I noticed was that the delays are a little short and get worse as the delay increases.

I'm using an ice pack and warm water to manipulate the timer. I started a stopwatch when the solid cooling led went off, then raised the temperature back above the set point. Stopped the clock when the cooling led came back on solid instead of blinking.

A 60 second delay was pretty close.

A 5 minute delay was more like 4m50s.

A 10 minute delay was about 9m40s.

A 15 minute delay was a little less than 14m30s

I've run those tests a couple of times each and they're as consistent as my reaction time can be with a stopwatch.

This isn't a big deal for the heat/cool delays. If the programs are using the same timing system it might add up on long steps and cause a problem. Though, when we're talking about step times for a fermenting process, even an hour or so either way is probably not going to make any difference.
 
Just ran a test with a 1 hour step on Pr0. It did not short the step by 2 minutes like I expected. It's hard to tell exactly when it changed because you have to keep checking the set point, but it looks like it switched right at 60 minutes. I'll run a longer test and let it cook all night.
 
I was wrong about the factory behavior. The factory units I have here do not have separate initial cooling and cooling delays. They both match whatever the user setting for cooling delay is. The default is 10 minutes, that might be where I got that idea from.

Anyway, 60 seconds sounds good to me for initial cooling. I don't see much need for any initial heating delay, but 60 seconds won't hurt anything.

Yes - that's how mine work. Delay on cooling only - settable in the menus.
 
Every time I get on this board, you bastards post something that makes me spend money.

Monday I'll have a couple more STCs, a new soldering iron, as well as an Arduino.


Sent from my iPad using Home Brew
 
> Every time I get on here...

Same here...

This is supposed to be my year of not buying any brewing equipment.
 
Just wow. This latest work branch version, alpha, is amazing.

So many improvements, and I'm really liking the up & down button quick-views (they work well). It's really handy to see how many hours have elapsed.

I'm going to keep testing, but this is a night-&-day difference versus last night's experience with the previous build. You should def push this to the main public branch for "official" releases, though that's purely a symbolic move anyways.
 
Cool, thanks for your hard work. I'll try to remain professional on any future frustrations.

My biggest deal was that it was 1:45am and I never did solve things. That's the point at which you just pull your hair out and "aaahhhH!!!!!! why wont this work? damnit!!!"

I def appreciate all you're doing here, and will be flashing this when I get home. And here's the upside -- I now have TWO modded controllers!

Come on, now. :p I've spent a large portion of my life developing embedded products: from robotics to avionics to industrial controls. 145am is just barely getting started. If the sun isn't up yet, it is a good night.
 
I'm looking at some of the programming.... Wow... I salute you...

I'm still trying to figure how you figure the temperature out with this... I need more scratch paper...

Code:
	for (i = 0; i < 32; i++) {
if((temperature & 0x1f) <= i){
temp += ad_lookup[((temperature >> 5) & 0x1f)];
} else {
temp += ad_lookup[((temperature >> 5) & 0x1f) + 1];
}
}

I get the for loop..

If the lower five bit of the variable temperature <= i - I get this...

temp = temp + look up the value in the variable ad_lookup at the location held within bits 5-10??

Do this 32 times?

You sir must be a genius... I'm still scratching my head.

(I've never been a professional C programmer - but I can kinda read it..)
 
Come on, now. :p I've spent a large portion of my life developing embedded products: from robotics to avionics to industrial controls. 145am is just barely getting started. If the sun isn't up yet, it is a good night.

Haha, true, but I have a job by day (proj mgr and systems analyst). Gotta get sleep or I'll be grumpy and useless at work the next day.
 
Haha, but I have a job by day (proj mgr and systems analyst). Gotta get sleep or I'll be grumpy and useless at work the next day.

Program manager!?! Well that explains everything.

Engineers have day jobs, too... Ya know. Somehow we still manage not to kill ALL the program managers in the morning.
 
With the latest work commit, things look pretty dang good. The delays are working like they should.

The only thing I noticed was that the delays are a little short and get worse as the delay increases.

I'm using an ice pack and warm water to manipulate the timer. I started a stopwatch when the solid cooling led went off, then raised the temperature back above the set point. Stopped the clock when the cooling led came back on solid instead of blinking.

A 60 second delay was pretty close.

A 5 minute delay was more like 4m50s.

A 10 minute delay was about 9m40s.

A 15 minute delay was a little less than 14m30s

I've run those tests a couple of times each and they're as consistent as my reaction time can be with a stopwatch.

This isn't a big deal for the heat/cool delays. If the programs are using the same timing system it might add up on long steps and cause a problem. Though, when we're talking about step times for a fermenting process, even an hour or so either way is probably not going to make any difference.

Well, wow. Unless you've been reading the code... I didn't think anyone would notice.
The delays are short, but the reason is a good one.
In fact one of the things I have been very careful in doing, is selecting counter sizes so they wont overflow.
The frequency of the main timer is also very carefully selected.
I need one hour to fit in a 16 bit counter, that means frequency needs to be below around 18Hz. I also want 1 sec marks to be easy to detect (i.e. freq. should be power of 2). And I also need frequency to be high enough to sample buttons.
This pretty much leaves 16Hz as only option (62,5ms). It is a bit slow for buttons, but will work.
Now unfortunately, 16Hz is not possible to achieve with the timers. Closest possible value is 16,66Hz (60ms). That means that the one second marks (16*60ms) really only is 960ms. So yeah, it is close, but not really accurate.
The one hour mark occurs on the counter being 60000 which should be an hour exactly (of course no timer is totally accurate, but I have no control over that).

Just wow. This latest work branch version, alpha, is amazing.

So many improvements, and I'm really liking the up & down button quick-views (they work well). It's really handy to see how many hours have elapsed.

I'm going to keep testing, but this is a night-&-day difference versus last night's experience with the previous build. You should def push this to the main public branch for "official" releases, though that's purely a symbolic move anyways.

Thanks! There really is not that big a change from yesterday, except that I found the compiler problem (which is really not my fault).
I'll push the changes.

I'm looking at some of the programming.... Wow... I salute you...

I'm still trying to figure how you figure the temperature out with this... I need more scratch paper...

Code:
	for (i = 0; i < 32; i++) {
if((temperature & 0x1f) <= i){
temp += ad_lookup[((temperature >> 5) & 0x1f)];
} else {
temp += ad_lookup[((temperature >> 5) & 0x1f) + 1];
}
}

I get the for loop..

If the lower five bit of the variable temperature <= i - I get this...

temp = temp + look up the value in the variable ad_lookup at the location held within bits 5-10??

Do this 32 times?

You sir must be a genius... I'm still scratching my head.

(I've never been a professional C programmer - but I can kinda read it..)

The loop is for interpolation between the lookup points.
As you said, upper five bits are used to lookup the value in in lookup table. Lower 5 bits are used to interpolate.
((32-x)*lookup[y] + x*lookup[y+1]) / 32 (where x is lower 5 bits and y upper)
Only the MCU doesn't have hardware multiplier, so the multiplication is rolled out to additions.
 
The loop is for interpolation between the lookup points.
As you said, upper five bits are used to lookup the value in in lookup table. Lower 5 bits are used to interpolate.
((32-x)*lookup[y] + x*lookup[y+1]) / 32 (where x is lower 5 bits and y upper)
Only the MCU doesn't have hardware multiplier, so the multiplication is rolled out to additions.

:drunk: WHaaaaaaat? Uhhh.......yeah. Sounds right, totally.

That just flew 1,000,000 ft over my head.
 
Thanks! Multiplication.... Hmm... I understand the bit shift rights for division - and it was in the comments - so in a sense you're adding up a value and taking the mean average?? I'll find some more scratch paper.. I've tried to use a thermistor on an arduino - ended up attempting to use a steinhart-hart equation - had it kinda working without a lookup - tried a DS18B20 instead and never looked back. I understand why you don't want to make a hardware change though, the STC is already a nice package.

I've read a lot of PLC code - and it's always amazing to figure out someone elses code. You really get to know the programmer, even if you've never met.
 
Thanks! Multiplication.... Hmm... I understand the bit shift rights for division - and it was in the comments - so in a sense you're adding up a value and taking the mean average?? I'll find some more scratch paper.. I've tried to use a thermistor on an arduino - ended up attempting to use a steinhart-hart equation - had it kinda working without a lookup - tried a DS18B20 instead and never looked back. I understand why you don't want to make a hardware change though, the STC is already a nice package.

I've read a lot of PLC code - and it's always amazing to figure out someone elses code. You really get to know the programmer, even if you've never met.

No, not mean average, linear interpolation.
The lookup table can not be big enough to hold every possible AD value, but it does not need to be. If looking at a small enough piece of the NTC temperature/resistance curve, it is linear enough.
So, the upper five bits in the AD value tells me the temperature I want is between that point in the lookup table and the next. How far between is the lower five bits.
Instead of multiplying I add x times the value from the second lookup point and 32-x times the value from the first. Divide by 32 and the resulting value is between the two points proptionally to the least significant bits of the AD value.
Maybe my explanation is not that great, wikipedia has a decent article on linear interpolation
 
Ok, latest updates.

I have pushed two more changes to work branch.
I have fixed sensor alarm. If it works as it should then sensor failure should sound the alarm and disengage relays, it will also turn off the display as the functionality is shared with 'power off'. (A temperature reading out of range is considered a sensor failure). Pretty useless feature IMHO, as if you forgot to attach the probe, you would see that you don't get a reading, and if sensor fails later, you might not be around to hear it.

And I have also added the degree dot (+ 'C' if celsius) when displaying a temperature.

And that is it. I don't have any more issues that I plan to fix or features that I plan to add.
So, now main focus is testing and fixing any bugs.
 
It looks like you already found and worked around the compiler bug, and the following suggestion would not have helped, but I've used "lint" on more than one occasion to find bugs before debuggers became available.
 
Alpha, would it be better to leave the display on under sensor alarm and show an indication (such as 'AL') or does it need to use the power off routine due to memory?

Also, I just finished setting a program that I'm going to let run for 72 hours and log the temp changes. Is there any way to have the setting change rate boost after you've held the up/down button for more than X seconds? It took me a while to set 10 set points and 9 duration. No problem if it can't be done, it would just be handy.

Thanks!
 
I just finished an 8 hour step test. It actually took 8 hours and 2 minutes to switch to SP1.

I'm not sure when it actually sets and activates the profile. I assumed it was when you hit set after switching from thermostat mode to Pr0. That's when I started the timer.

Not a problem unless you think it indicates one.
 
I just finished an 8 hour step test. It actually took 8 hours and 2 minutes to switch to SP1.

I'm not sure when it actually sets and activates the profile. I assumed it was when you hit set after switching from thermostat mode to Pr0. That's when I started the timer.

Not a problem unless you think it indicates one.

Sounds pretty damn good/close to me. Wouldn't you say?
 
It looks like you already found and worked around the compiler bug, and the following suggestion would not have helped, but I've used "lint" on more than one occasion to find bugs before debuggers became available.

Yeah, I've tried lint once or twice. It can be a useful tool, but in this case, I could pretty much guarantee that lint would not know that the compiler I intended on using had a bug :)

Alpha, would it be better to leave the display on under sensor alarm and show an indication (such as 'AL') or does it need to use the power off routine due to memory?

Also, I just finished setting a program that I'm going to let run for 72 hours and log the temp changes. Is there any way to have the setting change rate boost after you've held the up/down button for more than X seconds? It took me a while to set 10 set points and 9 duration. No problem if it can't be done, it would just be handy.

Thanks!

I won't lie, it probably wouldn't be that hard to show "AL" on alarm. Dammit. Now I probably have to go fix that, just because you think it is 'the right thing' (tm).

I know programming by hand is frustrating because of this, and while it might not be impossible to speed up or increment by more than 1, it would probably be a kludgy mess, and I'd like to avoid that. But I hear you. I'll think about it. Maybe. If I can do something clever. Like triggering button_menu_fsm from it's own timer and gradually increase frequency of the timer. Dammit....

I just finished an 8 hour step test. It actually took 8 hours and 2 minutes to switch to SP1.

I'm not sure when it actually sets and activates the profile. I assumed it was when you hit set after switching from thermostat mode to Pr0. That's when I started the timer.

Not a problem unless you think it indicates one.

Yes your assumption is correct to within the second. It is not a problem, that would mean an accuracy of 0.4% if my math is correct which is better than to be expected of the internal timer.
 
Oh man!!!!

That timer idea was pretty incredible You gotta try it out!!!
That **** is smoooooth now!

Check it out, I pushed to work branch.
 
Alpha - Are you using the arduino sketch to load the hex file now - specifically is the hex file embedded within the sketch? I'm wondering what the huge hex constants located at the end of the sketch or for? Can I use one of the *.hex files and my pic programmer instead of an arduino? Or am I forced to utilize an arduino?
 
Yes, the hex data is embedded n the sketch, to make uploading as easy as possible.
I see no reason why using a regular PIC programmer wouldn't work. And yes, I also provide the hex files for those who'd rather go that route.
 
Yes, the hex data is embedded n the sketch, to make uploading as easy as possible.
I see no reason why using a regular PIC programmer wouldn't work. And yes, I also provide the hex files for those who'd rather go that route.

Thank You
 
Yes, the hex data is embedded n the sketch, to make uploading as easy as possible.

alphaomega, you mentioned a compiler bug earlier in the thread. If I wanted to set up SDCC and GPUTILS (say to set up different defaults to be flashed rather than using the buttons to enter profiles) what was the bug and what was the cure? And actually, would it be feasible to edit the hex data area of the file to 'pre-load' different profiles to the 'stock' AlphaOmegaSTC file?
 
alphaomega, you mentioned a compiler bug earlier in the thread. If I wanted to set up SDCC and GPUTILS (say to set up different defaults to be flashed rather than using the buttons to enter profiles) what was the bug and what was the cure? And actually, would it be feasible to edit the hex data area of the file to 'pre-load' different profiles to the 'stock' AlphaOmegaSTC file?

Theres no problem using SDCC to compile the code now. You can't rely on static local variables to be initialized. I moved the variables to global scope as a workaround.

I think this area could stand a bit of improvement. I've been cheating a bit in the sketch when uploading the hex. Ideally, I would separate the EEPROM data to it's own HEX file and not erase EEPROM unless that data is uploaded.
There really is no reason to reset EEPROM when uploading a newer version if EEPROM config has not changed.
I'm even considering reserving two bytes of EEPROM for a magic byte and version, so this could be automatic.
A tool to allow the user to set the data would be cool, and could probably be done with macros in the sketch. But that would be prio 2.
 
I haven't had a chance to try the latest commit with the change to the setting acceleration. Looking forward to it.

I'm out of town this weekend, but I did set up a 10 step program to cover a 72 hour period. BrewPi is logging it in a dorm fridge.
 
Back
Top