Jump to content
High Bridge Pottery

Home Made Kiln Controller

Recommended Posts

Well the new chip arrived and I messed it up. Pulled off a contact pad trying to get the old one out and blobbed solder everywhere. Didn't work when I plugged it back in...

 

Ordered some new chips and this time found the circuit diagram to breadboard it instead of soldering. The chip is still a little small to fit in the board so need to work something out for that. Found it along with the PCB design to print so if that fails I could get it printed and try the soldering but that sounds complicated. Easier to buy the plug in bits.

Share this post


Link to post
Share on other sites
Bob Coyle    113

Ah those ten minute fixes that turn into hours of hassle... but hey, think of how much you are learning. Lot's of electronics plus whole new combinations of cuss words!

 

Hang in there Joel, you'll get it yet.

Share this post


Link to post
Share on other sites
MatthewV    258

You are calibrating your thermocouples with an ice bath and boiling water, right?

If the wires are accidentally swapped the reading will go backwards.

It does appear all of your wiring from the sensor to the thermocouple is thermocouple wire. Using a cheaper connecting wire creates additional unwanted thermocouples.

 

I believe these the three most common and easiest to fix mistakes.

Share this post


Link to post
Share on other sites

Ah those ten minute fixes that turn into hours of hassle... but hey, think of how much you are learning. Lot's of electronics plus whole new combinations of cuss words!

 

Hang in there Joel, you'll get it yet.

 

Thank you for the encouragement :D spent the past few days battling with this project, finding any info I could. Looking at lots of circuits, seeing they were all exactly what I was trying. After a few broken chips I took a good look at the surfacemount to breadboard adapter I was using. If you look carefully you can see a 1 in the top left corner. That, is actually the 4th pin so I had been wiring it up backwards the whole time. The first pin has a circle round it. Wired the chip up the right way but I think in wiring it up wrong I broke it. Good thing I have a few spares  ^_^

 

It now seems to be reading the right temperature, excited to test it in my electric kiln to see if it really does read the right temps all the way up.

 

Been looking into PID and think I half have understanding that down, also learning python as I go,

 

gallery_23281_1039_306623.jpg

Share this post


Link to post
Share on other sites

Working a bit more on this. Wrote a basic program in python so I can input the ramps. Not sure if it is the best way to do it but seems ok :D

 

Found a python PID but until I can control something I can't really test it(unless you have ideas). https://github.com/ivmech/ivPID it also came graphing the output so I have borrowed that to test out logging the data. Lost my old program that did this but this one is better anyway.

 

Using the Adafruit thermocouple python library now but I have found another one that I will probably test. 

https://github.com/adafruit/Adafruit_Python_MAX31855

https://github.com/Tuckie/max31855

 

Looks like a loose connection or something as it keeps going to 0.

 

The user setting do nothing right now other than set the total time to log data but I have a list made of the set point for every minute. Not sure if it needs to be better resolution than that.

 

gallery_23281_1039_122856.png

 
#!/usr/bin/python"""Kiln Program 0.1"""import mathimport timefrom ivPID import PIDimport matplotlib.pyplot as pltimport numpy as npfrom scipy.interpolate import splineimport Adafruit_GPIO.SPI as SPIimport Adafruit_MAX31855.MAX31855 as MAX31855CLK = 25CS = 24DO = 18sensor = MAX31855.MAX31855(CLK, CS, DO)kiln_ramp_list = [] # Blank list for user to input programnumber_of_ramps = input('Number of ramps = ') # Variable to store number of ramps user needs"""USER INPUT OF RAMPS"""for i in range(1, (number_of_ramps+1)): # Itterating through number of ramps and appending to list    top_temperature = input('Ramp ' + str(i) + ' top temperature = ') # User input for ramp n    hours = input('Ramp ' + str(i) + ' time (hours) = ') # User input for degrees n    ramp =(i, top_temperature, hours) # Create tuple (ramp number, hours, degrees) for ramp n    kiln_ramp_list.append(ramp) # Add the tuple to the list"""SETPOINT"""temp = sensor.readTempC() # take reading of thermocouple for start setpointkiln_setpoint_list = [temp] # list for setpoints with thermocouple temp set as first valuefor i in range(1, (number_of_ramps+1)): # Itterating through number of ramps to generate a list of setpoints    ramp = kiln_ramp_list[i-1] # Pulling out user input tuples for firing ramps    minutes = int(ramp[2] * 60) # Making minutess from user input ramp n    top_temperature = ramp[1] # Making degrees from user input ramp n    temperature_change = top_temperature - kiln_setpoint_list[-1]    degrees_per_min = temperature_change / float(minutes) # Making degrees per minute needed for each ramp    for i in range(1, (minutes+1)): # Itterating through number of minutes firing will take        setpoint = kiln_setpoint_list[-1] + degrees_per_min # Making setpoint equal to the last value of list plus what you need in degrees per min        kiln_setpoint_list.append(setpoint) # Appending setpoint to the listkiln_setpoint_list = [ round(elem,1) for elem in kiln_setpoint_list ] # Rounding all the crazy float numbers to 1 decimal placesize = len(kiln_setpoint_list) # counting the size of setpoint listprint kiln_setpoint_list"""KILN LOG"""temperature_list = [] # Blank temperature list for loginternal_temperature_list = [] # Blank internal temperature list for logtime_list = [] # Blank temperature list for logtime_variable = 0.01for i in range(1, size): # Itterate through logging temperature and time    temperature = sensor.readTempC() # Reading thermocouple temperature    internal = sensor.readInternalC() # Reading internal temperature    temperature_list.append(temperature) # Appending temperature to list    internal_temperature_list.append(internal) # Appending internal temperature to list    time_list.append(i) # Appending time to list    time.sleep(time_variable)"""PLOT GRAPH"""plt.plot(time_list, temperature_list)#plt.plot(time_list, internal_temperature_list)plt.xlim((0, size))plt.ylim((min(temperature_list)-10, max(temperature_list)+10))plt.xlabel('time (min)')plt.ylabel('Temperature')plt.title('THERMOCOUPLE TEST')plt.grid(True)plt.show()"""def test_pid(P = 1.0,  I = 0.0, D= 0.0, L=size):        pid = PID.PID(P, I, D)    pid.SetPoint= sensor.readTempC()    pid.setSampleTime(0.5)    END = L    feedback = sensor.readTempC()    feedback_list = []    time_list = []    setpoint_list = []    for i in range(1, END):        pid.update(feedback)        output = pid.output        feedback = sensor.readTempC()        pid.SetPoint = kiln_setpoint_list[i]        time.sleep(0.01)                feedback_list.append(feedback)        setpoint_list.append(pid.SetPoint)        time_list.append(i)    time_sm = np.array(time_list)    time_smooth = np.linspace(time_sm.min(), time_sm.max(), 300)    feedback_smooth = spline(time_list, feedback_list, time_smooth)    plt.plot(time_smooth, feedback_smooth)    plt.plot(time_list, setpoint_list)    plt.xlim((0, L))    plt.ylim((min(setpoint_list)-10, max(setpoint_list)+10))    plt.xlabel('time (s)')    plt.ylabel('PID (PV)')    plt.title('TEST PID')    plt.grid(True)    plt.show()if __name__ == "__main__":    test_pid(1.2, 1, 0.001, L=size)#    test_pid(0.8, L=50)"""

Here is a print out of the set-points. Don't think I have the maths set up quite right as the way it is the top temperatures you want will be offset by the initial temperature.

 

EDIT - Did a quick fix on the code and it now ask for top temperature and works out the change that way so you can hit an exact temperature.

 


 

[20.3, 21.6, 22.9, 24.2, 25.6, 26.9, 28.2, 29.6, 30.9, 32.2, 33.5, 34.9, 36.2, 37.5, 38.9, 40.2, 41.5, 42.8, 44.2, 45.5, 46.8, 48.2, 49.5, 50.8, 52.1, 53.5, 54.8, 56.1, 57.5, 58.8, 60.1, 61.5, 62.8, 64.1, 65.4, 66.8, 68.1, 69.4, 70.8, 72.1, 73.4, 74.7, 76.1, 77.4, 78.7, 80.1, 81.4, 82.7, 84.0, 85.4, 86.7, 88.0, 89.4, 90.7, 92.0, 93.4, 94.7, 96.0, 97.3, 98.7, 100.0, 102.9, 105.9, 108.8, 111.8, 114.7, 117.7, 120.6, 123.6, 126.5, 129.4, 132.4, 135.3, 138.3, 141.2, 144.2, 147.1, 150.1, 153.0, 155.9, 158.9, 161.8, 164.8, 167.7, 170.7, 173.6, 176.6, 179.5, 182.4, 185.4, 188.3, 191.3, 194.2, 197.2, 200.1, 203.1, 206.0, 208.9, 211.9, 214.8, 217.8, 220.7, 223.7, 226.6, 229.6, 232.5, 235.4, 238.4, 241.3, 244.3, 247.2, 250.2, 253.1, 256.1, 259.0, 261.9, 264.9, 267.8, 270.8, 273.7, 276.7, 279.6, 282.6, 285.5, 288.4, 291.4, 294.3, 297.3, 300.2, 303.2, 306.1, 309.1, 312.0, 314.9, 317.9, 320.8, 323.8, 326.7, 329.7, 332.6, 335.6, 338.5, 341.4, 344.4, 347.3, 350.3, 353.2, 356.2, 359.1, 362.1, 365.0, 367.9, 370.9, 373.8, 376.8, 379.7, 382.7, 385.6, 388.6, 391.5, 394.4, 397.4, 400.3, 403.3, 406.2, 409.2, 412.1, 415.1, 418.0, 420.9, 423.9, 426.8, 429.8, 432.7, 435.7, 438.6, 441.6, 444.5, 447.4, 450.4, 453.3, 456.3, 459.2, 462.2, 465.1, 468.1, 471.0, 473.9, 476.9, 479.8, 482.8, 485.7, 488.7, 491.6, 494.6, 497.5, 500.4, 503.4, 506.3, 509.3, 512.2, 515.2, 518.1, 521.1, 524.0, 526.9, 529.9, 532.8, 535.8, 538.7, 541.7, 544.6, 547.6, 550.5, 553.4, 556.4, 559.3, 562.3, 565.2, 568.2, 571.1, 574.1, 577.0, 579.9, 582.9, 585.8, 588.8, 591.7, 594.7, 597.6, 600.6, 603.5, 606.4, 609.4, 612.3, 615.3, 618.2, 621.2, 624.1, 627.1, 630.0, 632.9, 635.9, 638.8, 641.8, 644.7, 647.7, 650.6, 653.6, 656.5, 659.4, 662.4, 665.3, 668.3, 671.2, 674.2, 677.1, 680.1, 683.0, 685.9, 688.9, 691.8, 694.8, 697.7, 700.7, 703.6, 706.6, 709.5, 712.4, 715.4, 718.3, 721.3, 724.2, 727.2, 730.1, 733.1, 736.0, 738.9, 741.9, 744.8, 747.8, 750.7, 753.7, 756.6, 759.6, 762.5, 765.4, 768.4, 771.3, 774.3, 777.2, 780.2, 783.1, 786.1, 789.0, 791.9, 794.9, 797.8, 800.8, 803.7, 806.7, 809.6, 812.6, 815.5, 818.4, 821.4, 824.3, 827.3, 830.2, 833.2, 836.1, 839.1, 842.0, 844.9, 847.9, 850.8, 853.8, 856.7, 859.7, 862.6, 865.6, 868.5, 871.4, 874.4, 877.3, 880.3, 883.2, 886.2, 889.1, 892.1, 895.0, 897.9, 900.9, 903.8, 906.8, 909.7, 912.7, 915.6, 918.6, 921.5, 924.4, 927.4, 930.3, 933.3, 936.2, 939.2, 942.1, 945.1, 948.0, 950.9, 953.9, 956.8, 959.8, 962.7, 965.7, 968.6, 971.6, 974.5, 977.4, 980.4, 983.3, 986.3, 989.2, 992.2, 995.1, 998.1, 1001.0, 1003.9, 1006.9, 1009.8, 1012.8, 1015.7, 1018.7, 1021.6, 1024.6, 1027.5, 1030.4, 1033.4, 1036.3, 1039.3, 1042.2, 1045.2, 1048.1, 1051.1, 1054.0, 1056.9, 1059.9, 1062.8, 1065.8, 1068.7, 1071.7, 1074.6, 1077.6, 1080.5, 1083.4, 1086.4, 1089.3, 1092.3, 1095.2, 1098.2, 1101.1, 1104.1, 1107.0, 1109.9, 1112.9, 1115.8, 1118.8, 1121.7, 1124.7, 1127.6, 1130.6, 1133.5, 1136.4, 1139.4, 1142.3, 1145.3, 1148.2, 1151.2, 1154.1, 1157.1, 1160.0, 1161.7, 1163.3, 1165.0, 1166.7, 1168.3, 1170.0, 1171.7, 1173.3, 1175.0, 1176.7, 1178.3, 1180.0, 1181.7, 1183.3, 1185.0, 1186.7, 1188.3, 1190.0, 1191.7, 1193.3, 1195.0, 1196.7, 1198.3, 1200.0, 1201.7, 1203.3, 1205.0, 1206.7, 1208.3, 1210.0, 1211.7, 1213.3, 1215.0, 1216.7, 1218.3, 1220.0, 1221.7, 1223.3, 1225.0, 1226.7, 1228.3, 1230.0, 1231.7, 1233.3, 1235.0, 1236.7, 1238.3, 1240.0, 1241.7, 1243.3, 1245.0, 1246.7, 1248.3, 1250.0, 1251.7, 1253.3, 1255.0, 1256.7, 1258.3, 1260.0]
 

Share this post


Link to post
Share on other sites
MatthewV    258

I think most kiln controllers use three inputs: ramp rate (deg/hr), temp (deg) and hold (time).

 

I recall a "sudden drop to zero" problem with other thermocouples as well. We added a filter to ignore readings less than a certain value unless it was sustained. At that point it was flagged as a thermocouple failure and the input was ignored.

Share this post


Link to post
Share on other sites
glazenerd    816

Joel:

 

I would offer some advice, but I got happy when I learned how to turn on my laptop. I still own a dumb phone. Maybe if you move the thing-a-ma-gig closer to the thing-a-ma-bob it will work.  All I got for ya.

 

nerd

Share this post


Link to post
Share on other sites

Thanks Matthew, had completely forgotten about adding in holds. I don't remember it doing this on the actual pcb but they seem to have a few extra components that I can't find/ not sure what they do. Also the thermocouple going into breadboard is a little sketchy at best.

 

Glazenerd, I am hoping to make my own 'plug in' or household electrical supply kilns. Would be great if I could have two or three going and I think once I have worked out most of the issues they wouldn't cost must more than £200/$300 with the thermocouple being a large chunk of that. The technology now is so cheap, the total cost in materials to read a thermocouple, probably max £30.

 

Still I have very little idea what I am doing so a few years to go yet but I feel worth it to learn how to computer control kilns.

Share this post


Link to post
Share on other sites
Bob Coyle    113

I uploaded a zip file of the stuff I have been doing code, jar files, DLL's and stuff. ... It works ok but is itself a work in progress. I will be updating the zip from time to time. You should be able to unzip it and run the jar file and pack up anything that is coming over the USB... read the readme.txt for details

 

http://raventreestudios.com/kiln_wiz.zip

Share this post


Link to post
Share on other sites

Working on getting the pi to switch a relay on and off. You need a very small 5v coil relay to switch a 12v power supply to the big relay. 

 

Followed this circuit except stuck my 12v power supply and relay on the end of the smaller relay setup. http://www.susa.net/wordpress/2012/06/raspberry-pi-relay-using-gpio/

Relay-Sample.png

 

I always seem to be getting the pins of these thing wrong even when triple checking  :rolleyes: bit of an electrical mess on the table. After a few wrong wires I got it working and turning it on and off with my computer :D

 

gallery_23281_1039_140430.jpg

Share this post


Link to post
Share on other sites

Bob  I tried to make your java work but I really have no idea what I am doing. Couldn't work out what the java JRE was or if I had it. Every time I double clicked the java app inside build it just extracted it.

 

Been working on counting so I can have it check should I be on of off every x times a minute and get the new setpoint every minuite. Not exactly sure where the PID is fitting in yet. I have worked out the further away you are from the setpoint the bigger the pid output. Maybe I should be using the pid to check instead of counting and saving that for generating new setpoints.  I have been counting with time.time() which spits out seconds since the epoch. Not sure if it is the best way but seems the easiest.

 

I remember seeing a video a while back that put me off cheap solid state relays when the components inside were probably rated for 1/4 of what they said. Might work for standard supply but I am happy with £8 for a 25A 12v coil relay and the £1 or so for pi 5v coil relay. Are you actually using the solid state to trigger a bigger relay and not deal with the high power? These 5v coils for the pi are cheap, might not last as long.

Share this post


Link to post
Share on other sites
Bob Coyle    113

I am using a 5 volt digital output from the Arduino directly to the on/off switch of the solid state relay. The relays  don't need much current to toggle them. Better safe than sorry, though. Better set it up through a transistor, as in your schematic.

 

The way I code the controller is with an array of temperatures that are calculated from the ramp data that is input. I convert deg/hr to deg/min and make an array of temperature differences. This array is then used to generate the ramp plot on the graph.  I have a timer set to look for a temperature reading from the Arduino every second. This reading is compared to the target temperature for the given minute, and either turns the kiln on or off depending if it is low or high. I find a one second granularity works fine, since the kiln doesn't respond very quickly. So every 60 seconds the ramp array index is incremented to a new temperature, and the kiln tries to get there before the minute is up. I do not use PID so there is some over and under shoot, but 5 or 10 degree fluctuations do not make much difference over a couple of thousand degrees.  If I were you, I would go simple at first and leave your code open enough to switch over to PID if you need it.  Look at my JAVA code, there is some similarity to what you are coding. I have a few error check there also so the kiln doesn't run away is something fails.

 

 

You have to extract the zip the files to a directory before you can use them. If you just extract the build directory, you should be able to run the jar file. Go into the extracted build directory and double click on the kilnwiz2.jar file. If it is working and you do not have an Arduino on a com port, then you will get an error message that it cant find a com port. If you get a message “ a java exception has occurred†then you probably need to re-name the rxtxSerial-32.dll to rxtxSerial.dll and try again.

 

If you get nothing, you may need to load the latest jre. The JRE is the Java runtime environment...You can find it at

 

http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html

 

The 64 bit version is

jre-8u66-windows-x64.exe

 

the 32 bit version is

jre-8u66-windows-i586.exe

 

If you have a newer computer with windows 10 it is probably 64 bit. If you tried to install windows 10 and failed, use the 32 bit version.

 

The software will not do you much good unless you either have an Arduino with the correct programming or some other COM device that is sending out only numeric data at 9600 baud.

 

Look at the readme file. The AD595simple.ino is the script file for the Arduino.

Share this post


Link to post
Share on other sites

Ok, I guess I won't be able to try it out. I will take a look at your error checking, sounds like you are at a similar place. I make a list of each setpoint per min from user input then checking if it is higher or lower than feedback value every min. I did mess a little with integrating the pid into program and got some basic functionality from the output. Right now it is only saying is pid output above or below 0. If it is positive, turn on, negative, turn off.

 

It is funny how I mentioned the video here and then later youtube happened to recommended it to watch again. It is really interesting to watch somebody who knows what they are taking about breaking down electronics. He does say 10amp loads would be ok but I am still not sure about kiln power.

 

Going to stick with the pi for now. I actually had windows 32 bit installed on 64 bit architecture until a few weeks ago when I realised what I had been doing for years. Still using windows 7 but after using linux on the pi I am looking to move that way. I break the linux computers about twice a week  B)

 

Here is the video.

 

 

Share this post


Link to post
Share on other sites
Bob Coyle    113

The video is interesting. High Bridge, Solid state relays are pretty cheap, so what I usually do is over spec them. I use 25 amp for a 15 amp kiln and 50 amps for a 30 amp 220.  You also have to put a beefy heat sink on the back. Just attaching them to the side of an electrical box is a no-no. I also sometimes use a cooling fan I salvaged from a computer or printer to cool the heat sink if I am pulling a load close to the rated max of the SSR.

 

Just for laughs, you should buy an Ardino UNO. They also are cheap and you could literally be up and running in 10 min, after you downloaded the Arduino IDE.(free). Also there are libraries and scripts that cover just what you wan to do with control and PID. Just make sure you get an authentic one. Some of the clones don't download the scripts from the IDE.

 

Far as I can tell your code does about the same thing as mine. I have an additional check on how far off the temperature is to the target, If it is too far off I do not move to the next target temperature until it catches up. That way any holds or negative ramps get a better chance to be fully implemented. Also, if the temperature goes way out of line I abort.

 

here is a pdf of a shakout run on the new code. It worked ok. I was also trying out a new glaze made from ground schist.(FAIL!!!)  The timer event in java is not rock solid, this is well documented, so over about 8 hours it lost about  90 seconds. I can live with that... NASA couldn't. When I begin designing rocket software, I'll change it. You can see that the temperature curve veered off just before the last ramp. Witness cones gave a perfect cone 5.

 

Let us know how you are doing, as you go along.

Run_Report.pdf

Share this post


Link to post
Share on other sites

Got some more work on the logic side of things, currently looking at my fan heater wondering if I can set up a dummy kiln that varies 5 degrees or so. After seeing your GUI I have been watching some videos about achieving that. I am sure I will buy one soon after I get to grips with this first project.

 

I will have to add in the if too far from setpoint don't move on.

Share this post


Link to post
Share on other sites
neilestrick    1,381

You also have to put a beefy heat sink on the back. Just attaching them to the side of an electrical box is a no-no.

 

I had to replace an SSR on a Nabertherm kiln last month. The relay itself was tiny, but the heat sink was about 3x3x5 inches, at least 10 times the size of the relay. It didn't help that it was all crammed into a shallow, unvented box on the back of the kiln.

Share this post


Link to post
Share on other sites

Bit more work on the kiln program. Found a tutorial where somebody is making a python bitcoin client, not what I need but I have been pillaging the functionality I want from his GUI.

 

Right now I have a live graph plotting the temperature readings and the setpoints. Hacked the cable of a fan heater into the switch and stuck the thermocouple in front. Need to do a lot more reading about pid and how changing values affects the numbers. Right now it outputs the difference in degrees between setpoint and temp with a bit of a jump when the values change.

 

Now I need to learn some more and get the user input through the GUI.

 

Ignore the barmy 10c it start at in my room :D it is cold here.

 

gallery_23281_1039_57138.png

Share this post


Link to post
Share on other sites
Bob Coyle    113

 

didn't help that it was all crammed into a shallow, unvented box on the back of the kiln.

 

Yes Niel, you need to give those heat sinks a space to breath. Seems like a lot of the kilns just try and use a chimney effect. 

 

High Bridge... that doesn't look bad at all...less than 2C ripple will not even be noticed on a 1200 C chart..

Share this post


Link to post
Share on other sites
Tim T    46

High Bridge, if you go down the PID route you need to tune the parameters, or better still use one of the self-tuning PID algorithms. If you get the parameters wrong, the kiln temperature may oscillate, or may end up higher or lower than you want. Alternative control algorithm mays be to use fuzzy logic or neural networks.

Share this post


Link to post
Share on other sites
AndyL    23

Since I'm an "electronics virgin" I really don't understand theory or programing. I guess I'm sort of like a car owner that just want's the car to run and be easily driven after I hit the ignition. Are there any proven schematics and parts lists for a  proofed out circuit (virgin friendly)? I can build from a plan but need one that works from the get go?

Share this post


Link to post
Share on other sites

The hardware side of reading kiln temperatures and switching things on and off is probably the easier side. A lot of information out there on different kinds of projects, same with the software really but none of it comes in a nice package that you would buy from a controller manufacturer.

 

To get to this point I have probably read at least 20 different tutorials and 100's of programming pages. The hardware came together quite easily after I made some basic mistakes.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×