This is part 4 of my reflow controller series.
Data is coming in over the serial USB connection. Quick, let’s visualize it!
There are two ways to do this: with some external tool such as Excel, or with the GUI facilities built into JeeMon.
Let’s do Excel first, because it requires less coding. Change yesterday’s “application.tcl” example to this:
proc start {} {
set conn [Serial connect usb-A900adav 57600]
oo::objdefine $conn forward onReceive [namespace which GotData]
variable fd [open logfile.csv w]
chan configure $fd -buffering line
puts $fd "time,temperature"
vwait forever
}
proc GotData {msg} {
variable fd
if {[Serial cmdParser $msg OK -node id -int1 temp]} {
puts $fd "[Log now],$temp"
}
}
The cmdParser function in Serial helps with decoding the “OK …” lines. It takes type arguments and variable names. In this case the node id header and an integer, to be stored in a variable called temp. The “-int1” notation means: treat the int as having one decimal, i.e. convert 123 to 12.3, etc.
Run JeeMon and it will create a “logfile.csv” file with readings (in “Comma Separated Values” format). You may have to stop JeeMon before you can open the logfile with another application.
Using “Numbers”, a Mac OS X application similar to Excel, this is what I get:
You can see the sensor at room temperature, heating up as I touched the thermocouple, and then cooling off again gradually.
The other approach is to create the plot with Tk, the GUI toolkit which is built into JeeMon, as I did with the OOK Scope. This is more work, but you get a plot which updates in real time.
So now let’s make a graph. I turned the grill on until it reached about 175°C, then let it overshoot and cool back down to 175°C again, and then I opened the lid. This is the result over a period of some 8 minutes:
Looks like this little grill will overshoot by some 40°C, and that it can heat up about 2.5°C per second. It’s only 700 Watt, which probably explains it. Should be fine for reflow, though.
This is the code I used, i.e. “application.tcl” (source here):
All this is standard Tcl/Tk code, as documented here if you want to explore how it works. With some elbow grease, I hope to add such basic plotting facilities to JeeMon as utility code, hiding most of the distracting details.
Tomorrow, I’m going to add remote switching to control the oven.
package require Plotchart http://docs.activestate.com/activetcl/8.5/tklib/plotchart/plotchart.html