My two corrections ended up being huge overshoots. The drop off time (100°C) is correct, but the default rate increase that worked in the other cases is not working at all here.
The goal of "v2.X test #3" is to heat the hot plate to 200°C over the course of 20 minutes, and with v2.6, I have effectively succeeded. There will likely be more issues once I try, for example, to heat the hot plate to 300°C over the course of 60 minutes, but for now, I want to stick with lower temps and shorter times while I work out the kinks. Now that I understand the difficulties of PWMing a hot plate, adapting the code to combat future issues should be straightforward.
To summarize my code, I control the heating rate by cycling the hot plate's power on and off for some % of 1000ms. In other words, the hot plate is on 300ms then off 700ms then on 300ms etc., where the relation between target heating rate and hot plate on time is based on previously gathered data. This produces a nice, linear(ish) temperature increase up until a certain temperature, at which point it plateaus. In the previous versions, the way I compensated for this was by increasing the on time by 5ms for every cycle after 150°C. This did not work for slower heating rates, so the newer versions changed this by making the 5ms and 150°C varry depending on the target heating rate. The exact value is a linear extrapoliation from previous data. This is imperfect, but I do not think perfection will ever be possible with the current equipent, and I think I have reached something good enough that now I can finally apply it to my optically contacted samples.
Since I have finished this "stage" of work, for completeness, I am including all of the code, data*, and graphs involved so far.
*the .txt data files are in the cycle_vX_graphs folders; these folders also have the Jupyter notebooks I used for graphing the data
I realized that, after changing so much from v2.3 to 6, I should check that my first two tests produce correct results with the latest version. This was good because all three tests turned out to be innaccurate, as they were all short roughly 10°C. However, they were very precise. For all three, the final temperature was 193.15±1.5°C.
Since I was focusing on the hot plate code and therefore did not need my weights, I decided to leave them on top of my samples for roughly 2 weeks.
It appears that an increased amount of time under pressure does not result in any noticable differences. A slight increase in surface area (SA) in two places, and a slight decrease in SA in another place, but overall no change. Note that "(initally)" in the picture below refers to http://nodus.ligo.caltech.edu:8081/Mariner/89.
Now that I have (relatively) good PWM code, I wanted to do my first real test with actual samples. Since everything went smoothly, I will now work on building the original set up for the project, which included attaching thermocouples to two plates so we could precisely measure the heat between them.
As you can see in the pictures below, I am running an Arduino off of my laptop which controls an AC/DC control replay that turns the AC power to the hot plate on and off.
Firstly, last night's heating did not change the contacted surface area greatly, but there is too many factors to speculate as to why that is the case. I leave that for future testing.
I attached the thermocouples by adhering them to the two aluminum plates. I was careful to make sure that the thermocouple was in the dead center of the aluminum plate. The other end of the thermocouples—exposed positive and negative wires—were screwed into the K Type connector so they can be plugged into the thermometer/multimeter. Taking the average between the top and bottom plate will give a more precise estimate of the temperature of the samples.
I intended to test the new thermocouple set up today, but when I plugged them in, both did not read a temperature. It took me a long time to figure out what went wrong: when installing the K Type thermocouple connector, the wires of the thermocouple need to be pushed in as far in as possible, otherwise the circuit would not be completed. It took a lot of trial and error to figure this out. I first created a test "circuit" with wire and a resistor to make sure that the connector itself was not broken. Then I carefully observed how moving the wires in different places affected the reading.
Once I did carefully reassemble the thermocouples, they worked perfectly, as indicated by the non-zero current. I ran tests with my three thermocouples and two devices to see how precise the temperature reading is. The results are below and pictures of the readings can be found in the zip file. I cannot explain why one of the adhered thermocouples is hotter than the other.
Plate #1 and 2 refers to the two different aluminum plates. T1 and T2 refers to the two ports on the Digital Thermometer 343. It cannot read two thermocouples simultaneously (as far as I can tell); it's so one can be used as a baseline/reference value for the other.
Since the two devices are giving different temperature readings, I would like to find out if this imprecision is linear (e.g. they are always 3°C off, so I just need to add/subtract 3°C after taking the measurements). If not, some sort of calibration is probably required. I decided to figure this out by running the heating tests I did before, but this time with the plates. This also serves as a test to see how the plates heat up.
Or rather, this is what I would have done, had I not realized that the thermometers were going down as the heat was increaing, meaning I had switched the polarity for both thermocouples. It turns out that this mix-up is a common mistake. I thought that I double checked that red was positive for thermocouples, but it is in fact not:
"red is the usual color for positive charges, whereas the red wire in thermocouple cables typically contains the negative signal. This coloration is ANSI standard for thermocouples, but it is not what most people expect."
I performed the same tests I have been doing prior (+180°C in 10 minutes) but now with the (correctly wired) thermocouples attached to the metal plates. The top plate is thermocouple #1 attached to the Fluke and the bottom plate is thermocouple #2 attached to the TPI (the lime green one).
The base heating rate for the new set up will require some tweaking to the code because the plates heat up much slower, but as I have mentioned previously, I do not think this will require a lot of extra work since I now know the tips and tricks to PWMing the hot plate. The only difficulty might come from the increase in hysteresis (i.e. the plates continue to increase in the temperature long after it turns off). For future tests, I need to remember to continue recording the temperature after program finishes its 10 min cycle.
On the positive, I think this test shows that taking the average of the two thermocouples to find the temperature in the center (where the optically contacted samples are) is a worthwhile endevor, considering how much the top plate lags behind the bottom plate in terms of heating speed.
With v3.0, I took a couple steps backwards by getting rid of the feature that increases the heating rate so I can isolate the base heating rate for the two plates. In my experience, the best way to figure out how to modify the program is to try a bunch of different target temperatures and heating times and look for correlations. I started with (attempting) to increase the plates by 280°C in 10 minutes.
For a future release, I am thinking of radically (relatively speaking) changing the function parameters: the user only inputs the target heating rate and how long the plates should be heated at this rate. This is to address the hysteresis in this new set-up, which I will elaborate on if I make the change.
I decided test how fast the plates would heat up if the heat was just on constantly on for 5 minutes. In general, these tests are raising a lot of questions in regards to controlling the temperature given the hysteresis in the system. It is also apparent that the bottom plate heats up signficantly faster than the top one, which means I need to heat the samples much longer than, say 10 minutes, if I want to avoid unevenly heating both parts of the optically contacted piece.
I also have to be conscientious that I am already half way through the quarter and ideally should be devoting time to bond strength testing rather than continuing to fiddle with the hot plate.
To combat the bottom plate heating up much faster than the top plate, I decided to try increasing the cycle period from 1000ms (1s) to 10000ms (10s). In other words, taking the test I today ran as an example, the hot plate will now be on for 1000ms then off for 9000ms then repeat. Hopefully this should give more time for the heat to transfer to the top plate, but even in this short test, it still appears to be a problem.
Due to the slower heating times, this will be a bit more challenging to test as each test could take hours to complete, but this is more in line with the final intended use anyways. Perhaps my cycle of 1000ms on is too much (e.g. I should do 100ms on then 9900ms off, although I think that might be so slow that it will never heat up; this also raising the question as to how I will deal with mantaining this slow heat up at the higher temperatures).
[I'm behind on data processing, but I'm creating an entry on the day I actually run the tests]
[I'm (once again) behind on data processing, but I'm creating an entry on the day I actually run the tests]
The Arduino / AC PWM interface looks good. I recommend that you maintain the code in GitHub and post a link to the repo whenever you update the code. Use detailed commit messages so that it makes sense.
For the plotting, it would be good if you can use grid lines and markers for the data points. Then we can see the difference between the data and the fits, etc.
And to avoid the hysteresis, etc. you can record the temperature in your Arduino and use feedback to make the heater just go to whatever temperature you specify. So you would have a prescribed T(t) and the PID feedback loop would just make the heater take you there. Can your Arduino read the thermocouple?