Stc-1000+

HomeBrewTalk.com - Beer, Wine, Mead, & Cider Brewing Discussion Community.

Help Support Homebrew Talk:

alphaomega

Well-Known Member
Joined
Jul 10, 2013
Messages
1,041
Reaction score
461
Hi!

I'm very pleased to announce the inital release of my project for the last few weeks, STC-1000+.

I have reverse engineered the STC-1000 and reprogrammed it with new firmware that is specifically made for beer fermentation. What that means is that I have added possibility to run temperature profiles (i.e. change setpoints at given times). And yes, I have also made it possible to use Fahrenheit scale (why anybody would want that beats me, but as I understand that is a pet peave for you guys).
Moreover, as I realize most of you (including myself) dont have the programmer needed to perform the upgrade, I have designed a sketch targeted for the Arduino UNO, to do the actual flashing of the firmware. All you need (in addition to the UNO) are a few pieces of wire (and maybe some soldering skills, I guess you could use hot glue or tape or something in a pinch).

It is all released as open source, so feel free to modify, but please contribute if you can.

Now, here's the downside, I've been working my ass off on this project for a week or two now and finally have something to present, but it is not 'done' yet. It is not production ready so to speak.
I would like all the help I could get, please try it if you can and report bugs. Don't try it on beer though, if you do and fail, don't blame me.
Also, the code running on the STC-1000 is protected, that means, once you reprogram, you cant go back. They are pretty cheap though...

If you are experienced in PIC programming, please have a look at the code. I would consider myself experienced in embedded programming, but not so much towards the Microchip line of MCU's.

With the source I provide, it is also possible to repurpose the the STC-1000 pretty much any way you'd want if you are cool with some coding. It could be a PID for example if you exchange the relays for SSRs. The PIC fairly puny though, so you will need to be careful when coding, especially RAM is very tight.

The firmware I provide, features 6 programmable profiles, 10 setpoints each with 1-999 hours between setpoints. You can also set hysteresis, temperature correction offset, cooling delay, you can change current step and duration in the running profile and you can set current setpoint, finally you can choose and run profile or simply thermostat mode.

Right now programming is made by sending the HEX file through the Arduino usiing a serial terminal emulator that supports sending files (I use CuteCom in GNU/Linux). But once I reach something that I feel is good enough I'll provide the option to embed the HEX in the sketch and you'll just need the Arduino IDE to (user friendlier to the non-developer).

The programming header ont the STC-1000 is a bit difficult to reach from the top, you might have better luck on the bottom of the board. I have provided a picture of my dev board, but in it I have already soldered in a pin header.

So, again, if you can, please contribute and maybe soon enough everyone can run a slightly better STC-1000.

Lastly, documentation is suffering right now, I'd like to improve it as well, but I feel like I want to get this project 'out there' as soon as possible.

Find the source here.

Cheers!
//Mats

Edit: Update 04-04-2014, v1.00 now released. This is the first version that should be good enough for actual use :)

Edit2: Update 06-22-2015, there has been a lot of progress to this project.
Most notably Will Conrad has tracked down the manufacturer of the STC-1000's with the correct hardware version. They are manufactured an sold by HongKong U-control electric CO Ltd. They have a store through AliExpress where you can buy individual units.
Check out the github project page for more info on the project.
 
OP
A

alphaomega

Well-Known Member
Joined
Jul 10, 2013
Messages
1,041
Reaction score
461
Thanks a lot!
Well no, not the schematics as such. I've reverse engineered the function of buttons, leds, relays and how they are used by the MCU.
 

Brumateur

Supporting Member
HBT Supporter
Joined
Jan 13, 2014
Messages
563
Reaction score
91
Could you explain how that ADC to temperature conversion works? I don't quite understand meaning of number in ADC look up table and how exactly you do an interpolation. And what does exactly represent an ADC reading? Is it proportional to probe resistance?
 
OP
A

alphaomega

Well-Known Member
Joined
Jul 10, 2013
Messages
1,041
Reaction score
461
Yes, the NTC probe is very nonlinear. Linearization is not feasible by mathematical function on this tiny MCU, so instead a lookup table is used and interpolation between points in the LUT.
Yes, the reading is the voltage on the AD pin. The NTC is connected as a voltage divider. Voltage is proportional to resistance and resistance to temperature.
The numbers in the LUT is the temperature in C or F respectively multiplied by 10 for every 32nd possible AD value.
Edit: Interpolation is done by adding x times the value that matches top 5 bits read by AD in the LUT and 32-x times the next value in the LUT. Then divide by 32. X is the lower 5 bits read from AD.
Edit2: The values are multiplied by ten in the LUT as floating point arithmetics is of course out of the question also. And I want one decimalpoint to be presented to the user. If Fahrenheit is used, then decimalpoint is dropped from display over 99.9 deg.
 

Brumateur

Supporting Member
HBT Supporter
Joined
Jan 13, 2014
Messages
563
Reaction score
91
I see.

Looks like you have a typo at your Celsius table - there is a mismatch between C and F tables. C table value shifted right by adding "0" value to first element of the LUT array.
 

centex99

Well-Known Member
Lifetime Supporter
Joined
Nov 30, 2011
Messages
205
Reaction score
4
Location
Buda
nice job, subscribing and will look over the code later and am willing to help if possible... One thing having his also allows us to do is reprogram the LUT for different sensors...
 
OP
A

alphaomega

Well-Known Member
Joined
Jul 10, 2013
Messages
1,041
Reaction score
461
I see.

Looks like you have a typo at your Celsius table - there is a mismatch between C and F tables. C table value shifted right by adding "0" value to first element of the LUT array.
Great catch! I think it is Fahrenheit table that is missing a value. I'll fix that asap. Thanks!

Regarding different sensors, I think we'll still be limited to 10k NTC sensors (because the voltage divider is designed for that), but it may be possible to use other 10k NTC sensors with different curves.

Edit: Ok, I have checked the LUT, and Fahrenheit table was indeed missing the initial zero. I have fixed that, and pushed the chages. Thanks again Brumateur! Very good catch!
 
OP
A

alphaomega

Well-Known Member
Joined
Jul 10, 2013
Messages
1,041
Reaction score
461
Ok, I have now fixed the sketch so that flashing new firmware is pretty much as easy as it can be.

Just download the sketch, open it in the Arduino IDE and upload to the Arduino.
Make the 5 connections needed from the STC-1000 to the Arduino board AFTER the upload.
Then use the the Arduino IDE serial monitor at 115200 baud to send a 'd' to check that the STC-1000 is detected (checks that it is the MCU that is expected).
If all is ok, send an 'f' to flash the fahrenheit version (or 'a' for celsius version).

Please see GitHub page for latest info STC-1000+
 

nickmv

Well-Known Member
Joined
Mar 1, 2010
Messages
780
Reaction score
70
Location
Memphis
This is some beautiful work here man. Congrats and hats off to you, this is GREAT!

Anyways, do you have a video you could put up on YouTube of it in action, and also, which UNO do I need?

Will this one work?
 

hunter306

Well-Known Member
Joined
Oct 18, 2013
Messages
396
Reaction score
87
Sub'd, very interested in your work... Will likely flash mine as thing progress here.
 

nickmv

Well-Known Member
Joined
Mar 1, 2010
Messages
780
Reaction score
70
Location
Memphis
Sub'd, very interested in your work... Will likely flash mine as thing progress here.
Same here. I have a feeling this is going to turn an already value-packed temp controller into a steal of a deal once the code is stable and an easier flashing solution found.

Regardless, I'm def gonna give it a shot on mine. At $20/pop, it'd be foolish NOT to.
 
OP
A

alphaomega

Well-Known Member
Joined
Jul 10, 2013
Messages
1,041
Reaction score
461
This is some beautiful work here man. Congrats and hats off to you, this is GREAT!

Anyways, do you have a video you could put up on YouTube of it in action, and also, which UNO do I need?

Will this one work?
Thanks!
I would love to put it on YouTube and I just might. However, I'm not very good at that stuff, so in that case dont expect to much.

That starter kit will do just fine, it is more than you need for this though, but can be cool to have for experimenting with. You just need the bare UNO board and a few pieces of scrap wire.
 

rocket4x4

Active Member
Joined
Oct 1, 2013
Messages
26
Reaction score
8
This is some beautiful work here man. Congrats and hats off to you, this is GREAT!

Anyways, do you have a video you could put up on YouTube of it in action, and also, which UNO do I need?

Will this one work?
Will work just fine, If you got wires etc you could always just buy the Uno:
http://www.oddwires.com/arduino-uno/

I will have a go and flash my STC-1000 later today, I will take some pictures if/when I get it to work.
 

digitalpeer

Member
Joined
Mar 4, 2012
Messages
12
Reaction score
7
Location
Las Vegas
Very cool.

Unless I'm missing something, couldn't I just use a regular $15 PIC programmer to program the PIC16F1828 through the ICSP header? Maybe do something like this? Otherwise, sounds like a good excuse to me for an arduino.
 
OP
A

alphaomega

Well-Known Member
Joined
Jul 10, 2013
Messages
1,041
Reaction score
461
Will work just fine, If you got wires etc you could always just buy the Uno:
http://www.oddwires.com/arduino-uno/

I will have a go and flash my STC-1000 later today, I will take some pictures if/when I get it to work.
Very cool! Please report bugs and other issues. I want to get the firmware stable.

@digitalpeer: That will probably work great as well. Just use the HEX files instead. I just don't have one myself and for others like me, I can't see it being cheaper or easier.
 
OP
A

alphaomega

Well-Known Member
Joined
Jul 10, 2013
Messages
1,041
Reaction score
461
Thought I'd add a few pictures that might help.

Opening the STC-1000.




Edit: removed the two pictures with wires reversed

A picture of my development setup. Sorry about the quality... I'm a better programmer than photographer though :)
 

nickmv

Well-Known Member
Joined
Mar 1, 2010
Messages
780
Reaction score
70
Location
Memphis
Don't worry, those pictures are just fine!

I'm seriously getting pumped up about this. It's always cool to watch someone turn a $20 item into something that should cost $100+.

Anyways, rocket4x4, let us know how the flash goes.
 

Lumpyyyyy

Well-Known Member
Joined
Jan 12, 2012
Messages
241
Reaction score
6
Location
Windham
I'm following this thread closely as I'm debating between using STC-1000s or go all out with fermtroller for my next fermentation chamber project.
 

sdgenxr

Well-Known Member
Joined
Jun 30, 2006
Messages
89
Reaction score
5
Location
Sandy Eggo
I'm very interested as well. Especially since I just placed an order for a two relay controllers to display in Fahrenheit! I'll probably flash it with this updated firmware when it's ready for prime time.

Thanks for all the hard work alphaomega!
 

dirkomatic

Well-Known Member
Joined
Sep 6, 2011
Messages
224
Reaction score
30
Location
Blacksburg
Subbed for when I finally build my fermentation chamber... I guess I need to save for an Arduino Uno, now...
 

nickmv

Well-Known Member
Joined
Mar 1, 2010
Messages
780
Reaction score
70
Location
Memphis
I'm very interested as well. Especially since I just placed an order for 100 two relay controllers to display in Fahrenheit! I'll probably flash all my new controllers with this updated firmware when it's ready for prime time.

Thanks for all the hard work alphaomega!
Wait, what? You bought 100 2-way relays? What for -- personal business sales?

Just curious. That's a lot of relays. And if you're going to be using his code in order to profit, you might want to discuss that with him before. That might not be something he wants you to do. There's a difference between personal use, and using his code to sell/profit.
 

sdgenxr

Well-Known Member
Joined
Jun 30, 2006
Messages
89
Reaction score
5
Location
Sandy Eggo
And if you're going to be using his code in order to profit, you might want to discuss that with him before. That might not be something he wants you to do. There's a difference between personal use, and using his code to sell/profit.
I started a thread a couple of weeks ago trying to figure out if people wanted a controller that displayed in Fahrenheit and there was a great response.

Currently, alphaomega has provided his code as open source and stated that it is "It is not production ready so to speak. " IF I choose to use this open source software to modify the firmware on controllers, that is a service that I would be providing. With that said, IF this is something that I plan on doing, I would provide some sort of compensation for the hard work provided along with the hopes that the code continues to be developed.

Let's keep this on topic and support the great work that community has done and continues to do for other homebrewers. I'm looking forward to see how this code works with others and contribute to it in the coming weeks.
 

nickmv

Well-Known Member
Joined
Mar 1, 2010
Messages
780
Reaction score
70
Location
Memphis
I started a thread a couple of weeks ago trying to figure out if people wanted a controller that displayed in Fahrenheit and there was a great response.

Currently, alphaomega has provided his code as open source and stated that it is "It is not production ready so to speak. " IF I choose to use this open source software to modify the firmware on controllers, that is a service that I would be providing. With that said, IF this is something that I plan on doing, I would provide some sort of compensation for the hard work provided along with the hopes that the code continues to be developed.

Let's keep this on topic and support the great work that community has done and continues to do for other homebrewers. I'm looking forward to see how this code works with others and contribute to it in the coming weeks.
Oh I gotcha, in terms of legality, open source, etc.

I was just saying it would be polite to at least mention it to him, etc. So sounds like you're good to go.

:rockin: I'd love to see what else can be done with the code. I ordered an Arduino UNO kit this afternoon, and plan to flash mine this weekend hopefully. I'm not a programmer, but have experience from school, so I'll be taking a look at the code myself, just out of curiosity. Who knows, maybe I can even add something to it, if I really get into it.
 

nickmv

Well-Known Member
Joined
Mar 1, 2010
Messages
780
Reaction score
70
Location
Memphis
alphaomega, can you elaborate on:
The firmware I provide, features 6 programmable profiles, 10 setpoints each with 1-999 hours between setpoints. You can also set hysteresis, temperature correction offset, cooling delay, you can change current step and duration in the running profile and you can set current setpoint, finally you can choose and run profile or simply thermostat mode.
Does the timed fermentation require that the controller always be on? Reason I ask -- occasionally I'll turn off my controller for a second while I mess with stuff, so that it doesn't cut back on, etc. If turning it off resets the fermentation, that might be an issue, and one that might not be fixable.
 
OP
A

alphaomega

Well-Known Member
Joined
Jul 10, 2013
Messages
1,041
Reaction score
461
Hi!

I'm very happy there's been some action in this thread :)
As stated previously, the firmware is still beta, but to get it ready for 'production', I really need people getting involved.

First, no it does to require to always be on, but it will restart at last known point which may be off by at most 1 hour.
Edit: Just to clarify, ATM my firmware does not implement 'power off' functionality. It's on my TODO list, so I'll get to to it, but really not all that highly prioritized as it is not really all that essential IMHO. It does nothing except turns off LED's and relays and skips regulation loop. It doesn't really save you any power or anything. I can see that it would be nice, but to turn OFF you really need to cut the power (even with stock firmware, it is the way the hardware works).

Secondly, you yanks and all your legal schmegal.... They way I see it is, yes this is open source and GPL:ed. All I require is that any changes are made public (preferably within the STC-1000+ project, but you are free to start your own, with my source as base, as long as you keep licensing and copyright headers) and users are informed where it is located.
I agree that flashing the device and not least handling customer service IS a service. And you can always flash you own device if you want to.

I want to clarify that I am not affiliated with 'sdgenxr', but I sincerely hope his endeavour in the end will help people who otherwise would not have a chance to use STC-1000+, to use it.

If someone would like kick some money back to me eventually, or even hire me for implementing special functionality. I'm cool with that, but realising the STC-1000 is popular 'cause it is cheap, I don't expect anything. What I really want is to get this project off the ground and into peoples fermenters :)

Cheers!
 

balrog

Supporting Member
HBT Supporter
Joined
Nov 26, 2013
Messages
3,889
Reaction score
3,693
Very excited about this; very. I have a question. Pg1 has "...the code running on the STC-1000 is protected, that means, once you reprogram, you cant go back...", as well as "...or simply thermostat mode". Are you saying there was both enough room to add 6-10 step profiles, Farenheit conversion, and still keep the standard STC-1000 heating/cooling/compressor-delay mode? Why *WOULDN'T* someone want to flash? Thanks for the effort; STC ordered; researching Arduino.
 

Ben58

Well-Known Member
Joined
Aug 8, 2011
Messages
414
Reaction score
40
Location
Hamilton
I really like this idea. I have 4 STC's and would really like to set profiles.:rockin:
 
OP
A

alphaomega

Well-Known Member
Joined
Jul 10, 2013
Messages
1,041
Reaction score
461
Very excited about this; very. I have a question. Pg1 has "...the code running on the STC-1000 is protected, that means, once you reprogram, you cant go back...", as well as "...or simply thermostat mode". Are you saying there was both enough room to add 6-10 step profiles, Farenheit conversion, and still keep the standard STC-1000 heating/cooling/compressor-delay mode? Why *WOULDN'T* someone want to flash? Thanks for the effort; STC ordered; researching Arduino.
Thank you! That is very much reaction I was hoping for :)
In fairness, there is either Fahrenheit OR Celsius. Same code, different lookup tables and limits. While it would be possible to actually have both and choose, data is stored as actual temperatures, so switching would mess things up. But I think most will be fine with choosing one.
The basic function is pretty much the same I think, and the profiles actually set the setpoint, that the thermostat is working towards. Pretty much exactly like if you were to press the buttons. So the profiles are sortof added on top of the basic functionality.
Why someone wouldn't want to flash?
Well, so far it is largely untested (well, from what I know, I am the only one yet) and between work, my one year old and improving on the firmware and the Arduino upload, I simply dont have much time to test. So, I can understand if people want to want for the rough edges to smooth out.
However, with the price of an STC-1000 being what it is, I'd really like help in testing, if there are any early adopters...
 

nickmv

Well-Known Member
Joined
Mar 1, 2010
Messages
780
Reaction score
70
Location
Memphis
Yeah I'm a little curious about that as well.

Alphaomega, so is the code encrypted or something, to the point where there's no way to rip it and re-flash it back? Not even with a rip of just a raw binary?

That kinda sucks, but let's be honest -- this is a $20 temp controller. I might as well just order another one right now and have it ready. This is turning into the Linksys WRT54G of homebrewing.

Also, any update on a video? I'm going to see about flashing my STC this weekend, so I may try to make a video once I get familiar with it all.
 
OP
A

alphaomega

Well-Known Member
Joined
Jul 10, 2013
Messages
1,041
Reaction score
461
Yeah I'm a little curious about that as well.

Alphaomega, so is the code encrypted or something, to the point where there's no way to rip it and re-flash it back? Not even with a rip of just a raw binary?

That kinda sucks, but let's be honest -- this is a $20 temp controller. I might as well just order another one right now and have it ready. This is turning into the Linksys WRT54G of homebrewing.

Also, any update on a video? I'm going to see about flashing my STC this weekend, so I may try to make a video once I get familiar with it all.
No it's not encrypted, its protected. It's a feature of the controller itself that you can enable to protect proprietary code. It disables reading back the binary. It makes sense, for example to protect encryption keys, or even code. If you could rip the binary out, you could flash it on a new chip. So protecting the code could be a way of not having your product copied.
 
OP
A

alphaomega

Well-Known Member
Joined
Jul 10, 2013
Messages
1,041
Reaction score
461
Good news!
A guy in a swedish forum is the first to successfully flash his!
He had a lot of problems and it was all my fault, I had mistakenly switched the lines in my images... I have updated the images, so smoother sailing ahead :)

Next order of business.
Since EEPROM (that stores all user data) must be wiped during (at least the intial) programming, I'm now researching the possibility of initializing the EEPROM with sensible defaults.
What would sensible defaults be for the profiles?
There are as previously stated 6 profiles with ten steps each, but the last step being switch back to thermostat mode with that temperature.
You could of course set your very own, but it is kind of frustrating entering a lot of numbers by the keypad... So sensible defaults might be good.

Please chime in if you have any ideas. Or maybe this is just to personal of a preference and they should just be set to 'middle of the road' all around? Or maybe I should work on including something in the sketch that allows it to be set easier?
Ideas?
 

IslandLizard

Progressive Brewing
Staff member
Mod
Lifetime Supporter HBT Supporter
Joined
Jan 9, 2013
Messages
17,196
Reaction score
7,315
Location
Pasadena, MD
I've been following this thread in awe and admire your dedication to create customizable firmware for such a nifty little and affordable device. I don't doubt you have quite a few hundred hours in this already.

I looked at UNOs already to be able to do the flashing in the near future.

Aside from the handy Fahrenheit readout, the ability to program several profiles make it very enticing.
Thank you for thinking outside the box and interrogating the controller's workings. I'll stay tuned to this channel. :mug:
 
Top