Saturday, March 19, 2016

Simplified Superlink Interface!

Here is part 4 of the Cryocooler Saga! You can see Part 1 and Part 2 and Part 3 also.

tl;dr - Here's a program for interfacing with a Superconductor Technologies Superlink

There's a lot of data pumped out by the cryocooler while it's operating, including various temperatures, voltages, power consumption, et cetera. Unfortunately, I could only access that data through the manufacturer's software, which won't run on anything beyond Windows XP. I have a 10 year old laptop that will run it, but I mean c'mon, it's a ten year old computer. I'm not sure how much longer ol' Speed Turtle here is going to keep on staying critical-failure-free.

High Technology
Besides, I'd ultimately like a way to replace the cold-side temperature measurement the cryocooler uses with a different device, which would be greatly simplified if the device measuring the temperature can see what it's transmitting to the Superlink.

The System Status Portal software turns out to be a pretty face for the serial back-and-forth between the computer and the Superlink. The link runs at 19200 baud, 8 data bits, zero parity, no flow control. I ran a serial monitor program while the computer had the software open and talking to the Superlink, and it showed that the back and forth looked something like this:

Request: 3/13/2016 9:59:32 PM.57264 (+0.2567 seconds)

 3C 53 59 20 4F 50 3D 22 4F 4B 22 2F 3E 0D 0A      <SY OP="OK"/>.. 

Answer: 3/13/2016 9:59:32 PM.57264 (+0.0000 seconds)

 3C 53 59 20 4F 50 3D 22 4F 4B 22 2F 3E 0A         <SY OP="OK"/>.  

Request: 3/13/2016 9:59:32 PM.60364 (+0.0000 seconds)

 3C 54 4D 20 4F 50 3D 22 47 54 22 20 4C 43 3D 22   <TM OP="GT" LC="
 43 52 22 2F 3E 0D 0A                              CR"/>..         

Answer: 3/13/2016 9:59:32 PM.60364 (+0.0000 seconds)

 0D 3C 54 4D 20 4F 50 3D 22 47 54 22 20 4C 43 3D   .<TM OP="GT" LC=
 22 43 52 22 3E 30 20 30 20 31 38 20 33 35 3C 2F   "CR">0 0 18 35</
 54 4D 3E 0A                                       TM>.            

Request: 3/13/2016 9:59:32 PM.63364 (+0.0000 seconds)

 3C 54 4D 20 4F 50 3D 22 47 54 22 20 4C 43 3D 22   <TM OP="GT" LC="
 41 43 22 2F 3E 0D 0A                              AC"/>..         

Answer: 3/13/2016 9:59:32 PM.63364 (+0.0000 seconds)

 0D 3C 54 4D 20 4F 50 3D 22 47 54 22 20 4C 43 3D   .<TM OP="GT" LC=
 22 41 43 22 3E 41 43 42 20 33 20 41 43 39 20 31   "AC">ACB 3 AC9 1
 30 3C 2F 54 4D 3E 0A 0D                           0</TM>..    

The interaction consists of query strings sent by the computer that are returned with the data requested. Pouring through the decompiled code for the System Status Portal (what can I say, I live a wild life), I managed to figure out which query strings returned the data I was interested in. Turns out, if you want to find the cold side temperature and cooler rejection temperature, you ask:

<TP OP="GT" LC="MS"/>

which is responded to with something like:

<TP OP="GT" LC="MS">F 6D80 3BE8 4D60 3C78</TP>

Each of those five hex numbers in the middle there correspond to five different measurements it's returning. Turns out the cold side wide range temperature is the second one (6D80) and the cooler rejection temperature is the third one (3BE8). That hex number is pretty meaningless, though. Pouring through more of the System Status Portal code, I found the formulas it used to convert those numbers to actual temperatures. The formula is:

Temp = (5 * (hex string converted to decimal)/32768 - Offset)/Gain

where for the cold wide range temperature, the offset is 5.814 and the gain is -0.01559. There's a different offset and gain for the rejection temperature and the other temperatures returned. Convert the two-letter parts of the query string ("TP", "OP", "LC", "MS") to their ASCII equivalent hex codes (TP=5450) and then convert that to a decimal number (hex 5450 = 21584), and search the System Status Portal code for that decimal number to work through the logic to find which data points are revealed by which query strings!

Similarly, the cooler power draw can be elucidated with the proper query string and formula, as can every other measurement that shows up in the System Status Portal. In addition to reading measurement values, the System Status Portal can also change the operating state of the cooler, switching it between manual mode where the cooler can be shut off and automatic mode, where the cooler will automatically ramp up power as the cold side temperature declines, keeping the cooler within its safe operating limits. This is accomplished with another query string,

<TP OP="ST" LC="SM">1 4</TP>

will set the cooler to manual shutdown mode, while

<TP OP="ST" LC="SM">0 4</TP>

will turn it back to automatic mode.

I needed an excuse to brush off my infantile Python skills, so I wrote a user interface that will allow you to see the cold side wide range temperature, cooler rejection temperature, cooler power, and status. You can also toggle between Manual Shutdown mode and Automatic mode, so you can shut down the cryocooler safely without the System Status Portal program. I've loaded the Python code to github - you'll need Python installed (I used version 3.5), along with the Tkinter and pySerial libraries to run it. I've only tested it on my Windows 10 computer, but it appears to work pretty well. Here it is on Github. There's a lot of room for improvement and expansion, so if you want to add functionality, go for it!




I next plan to replace the cold side temperature measurement with an external thermocouple, using an Arduino to simulate a resistance to send the temperature measurement to the Superlink. I'll then use the serial handshake to allow the Arduino to talk to the Superlink to read the temperature it's trying to simulate, allowing it to precisely control its output to make sure the Superlink is seeing the same temperature it is.

33 comments:

  1. How did you get the software and its source code from STI? Also, which version of Python do I need to compile your code? Thansk for amazing posts!

    ReplyDelete
    Replies
    1. Python 3.5 is what I used. See below for the program.

      Delete
  2. Wow, just received my Superlink today, and I have the same question. :)

    @Sal: I got Peter's software running on Python 3.6, but I had to set some environment variables, and had to install pyserial.

    pip install pyserial
    set TCL_LIBRARY=c:\Python36-32\tcl\tcl8.5
    set TK_LIBRARY=c:\Python36-32\tcl\tk8.6

    ReplyDelete
    Replies
    1. Yep, I used 3.5. See below for the SSP program.

      Delete
  3. Yep, I used Python 3.5 when I originally wrote the program. I got the original manufacturer software with the Superlink (the seller still has the link up here - https://www.dropbox.com/sh/c0vs33qkuakpb62/AAAoau8K4EqELlRsffjJ5vi0a?dl=0 )

    ReplyDelete
    Replies
    1. Thank you! Thank you! Thank you! Manuals too!

      Got it running on Win7, but have not tried to actually connect to my unit.

      Delete
    2. Dang you're awesome, thanks! I just got my Superfilter today, and powered it up for the first time

      Delete
  4. I'm really struggling to get serial connection to my unit. I have the serial pins connected properly to 5,3,2 but I can't get the software to find the unit. Any hints?

    ReplyDelete
  5. The wiring should be straight through, 2-2, 3-3, 5-5.

    ReplyDelete
    Replies
    1. Ya I got that taken care of. Even the STI portal software can't communicate to it, it's weird. I've opened the box and everything is working. It cools down, etc. It seems serial is the only thing that doesn't not work, weird.

      Delete
  6. My green and red LEDs stayed solid even after a few hours of the thing going at full power. How long did it take for yours to reach it's REGULATE state?

    ReplyDelete
  7. I assume it is one of the newer narrow units with DB9 connector? The older wide units, with DB25 connector, had a simple terminal interface and will not talk to this software.

    ReplyDelete
  8. I did not time it, but it was +-4 hours. Manual says there is something wrong if it takes more than 6 hours. There is a large copper block in the dewar that takes ages to cool down...

    ReplyDelete
  9. Yep, mine took a couple hours to cool down to the temperature where it goes to the regulate state. Did you ever figure out a way to communicate with the unit to extract the measured cold-side temperature? I just simply hooked up the DB9 connector directly to my computer's serial port. Does your computer recognize it as a COM port? If not, you might try troubleshooting by hooking a multimeter (or oscilloscope if you have one) directly to the serial connection and see if there's any signal making it out. If you're getting a COM port to show up, you might try using a serial terminal program like Putty to try to send some commands and look for responses.

    Even with everything hooked up properly, the software can be temperamental for me - sometimes it simply won't connect and I need to close and re-open the program or disconnect and reconnect the cooler to get the program to connect.

    ReplyDelete
    Replies
    1. I don't have a serial port, so I'm using a USB serial adapter. THe adapeter definitely works because if I loop pin 2 and 3 (Tx and Rx), I can see the same characters coming back at me, using Hyperterminal.

      Delete
    2. Oh my Gosh, I just got it! I had to invert the RS232 signal polarity on my USB Serial adapter FTDI chip! I can't believe it!! Also, I got it to run on windows 10. I had to run a cmd prompt as administrator, then run java -jar app.jar within the STI app directory. It works!!!!!!

      Delete
    3. Glad to hear it worked! I'll have to try that trick to see if I can get it to run on Windows 10.

      Delete
  10. Do you know how Ben controlled the power manually? Even in manual mode, if I try to inc and dec the power, it still seems to be controlled by something else that's ramping it. What if I just put a 10k fixed resistor on the thermistor pins, and let it ramp from there, will it give too much too fast?

    ReplyDelete
    Replies
    1. Yep - the software doesn't permit you to change the power manually. It just ignores any inputs you try to manually enter.

      I think a 10K resistor is exactly how Ben controlled his - that makes the controller think the cold head is something like 90K, which will cause it to ramp up to nearly its maximum power to the cryocooler. The controller won't immediately start putting out maximum power if you start it up and it thinks it's at 90K, but rather ramps it up slowly to the maximum over a period of half an hour or so (if I recall correctly). The closer the cold head is to 80K or so, the higher the maximum permissible power is, up to the point where it hits its set point and enters the regulate mode, where it backs off the power and modulates it to keep it at the set point temperature.

      The purpose of limiting the maximum power at higher temperatures I believe is to keep the cooler moving parts from colliding with themselves - I believe Ben explained it in one of his videos. If you start it off thinking it's 90K, it might ramp up power too fast, before the cold head has cooled off enough, and could damage itself. In reality, this is probably a pretty remote possibility, and unless you have something that's a huge thermal mass connected to the cold end that takes a really long time to cool down, it'll probably work fine with just using a resistor there.

      Delete
    2. Also on Ben's blog there was a comment about a page from the cooler's manual that shows the max ramp-up rate: http://i.imgur.com/2uu8dE0.png

      Delete
    3. I figured out how to do it manually. If you put a resistor that makes it think the temp is 78K, and make the temperature setpoint 72K (which is the lowest permissible setpoint it seems), then it will continue trying to cool. You can then set the maximum cooler power in manufacturing view. This will then ramp slowly to the max that you specify, so effectively a manual control. I let mine run for two hours but still no liquid at all. I see liquid dripping off the tip, but it doesn't collect in the dewar, strange.

      Delete
    4. Do you have a really big dewar? Or are you using the electronics dewar that is connected to the cryocooler? It might just take a really long time to cool it down before liquid will begin collecting. It takes about an hour just to cool down the tip plus my small thermos before the tip even gets to liquid nitrogen temperatures. You might also look at insulating the cold tip/dewar connection as best as you can, to reduce heat leakage to as little as possible. I placed a thin piece of floor insulation between the cold head flange and the top of my thermos and pressed the thermos up into the flange to seal it (as shown here http://1.bp.blogspot.com/-Puu3AAtw-ns/VoIYAElAqAI/AAAAAAAAF0I/p0i_Di3lIHU/s1600/2015-12-27%2B17.09.00.jpg)

      Even then, condensation and ice would form on the lip of the thermos, and when you only have a few watts of cooling power at cryogenic temperatures, every bit of leakage has a big impact.

      Delete
    5. I have a Pope 1900 dewar, laboratory grade. All I did was take a thin piece of acrylic plate, punched a hole in it, then laid that on top of the dewar. I then just rested the cryocooler on it's vacuum flame onto this plate. Probably not a good setup

      Delete
    6. Actually that should be pretty good, probably better insulated than my setup. My thermos is only about 500 mL though, so it probably cools down faster than a 1900 mL Dewar might.

      Delete
    7. I was even driving at 150 W. Inside got cold, but only a little frost, no liquid. I'm gonna try insulating around the regenerator part of the cold finger next. Normally the whole finger is in a vacuum, so maybe I should try to replicate that, and only have the last 1/2" exposed. I have a cool CPU head sink I modified to fit on the cold tip, that might help as well.

      Delete
  11. Trying to throttle my coolers power now, without a computer attached. Can you tell me how you decompiled the java app?

    ReplyDelete
    Replies
    1. I think I used this Java decompiler - http://www.benf.org/other/cfr/

      There's some online Java decompilers that would probably work too.

      Delete
    2. This comment has been removed by the author.

      Delete
  12. Also, do you know any more about the command set? I'm trying to capture the traffic but there's just too much. I'm trying to pin down which command sets the maximum cooler power

    ReplyDelete
    Replies
    1. Other than the simple commands I use in this program, I didn't dig further into other commands to manually control the cooler power. I'd bet there's probably a way to increase the maximum cooler power but I hadn't found it.

      Delete
  13. I did a bunch more serial traffic monitoring and figured it out. It's black magic but I have the secret codes. These three commands make the maximum cooler power 50 W
    703 FAD 2666 3D71 9A 3C00 FFD9 27
    EE4 7F E5F 12C AC0 C3 9 1253
    FCC8 7AB

    These three commands make it 155 W:
    703 1B9A 2666 3D71 9A 3C00 FFD9 27
    35FB FFC8 E5F 12B 26F8 BF A 1254
    F455 19C8

    The language is so strange with this thing. The first command changes the power limit but also sends a few other parameters off into LALA land. The latter two commands in each case return those to normal. Strange

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. Good to know! I need to get back into messing around with my cooler.

      Delete