Skip to content

davidjohnson50/levitation-zone-control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Levitation Zone Melter Control

A lean, console-driven Python control program for a containerless levitation zone melting system. The program uses a camera-derived molten-zone diameter, a two-color pyrometer temperature measurement, and LabJack analog I/O to support manual and PI-assisted control of zone diameter, temperature, rotation, and translation velocity.

This repository is intended as an archival, educational, and experimental control-code record for a specific laboratory instrument. It is not a general-purpose process-control package and should not be used on other hardware without careful review, testing, and local safety interlocks.

Overview

The process uses electromagnetic induction to establish and sustain a levitated molten zone between two sample-bar halves. Control actions help maintain zone stability, sample geometry, and thermal conditions during growth of high-purity single crystals or directionally solidified alloys.

The program is deliberately written as a single, self-contained Python script with uppercase global variables. This matches the style of a laboratory control program where clarity, direct inspection, and easy modification are more important than general software abstraction.

The detailed hardware notes, pin layout, calibration assumptions, hotkeys, and control-loop comments are can be found in the source file header.

Main script

levitation_zone_control.py

This is the primary control script. It opens the camera, configures the LabJack U3, initializes the DAC outputs, reads the pyrometer and analog inputs, displays the camera scanline window, handles single-key operator input, updates the control outputs, and writes CSV log data.

Main control functions

The program coordinates four control/output channels:

Function Measurement or setpoint Output
Zone diameter Camera scanline measurement, converted from pixels to mm LJTick-DAC channel for stretch/squeeze actuator
Zone temperature Keller PA 40 two-color pyrometer, converted to °C LJTick-DAC channel for induction power command
Rotation Rotation setpoint and measured rotation voltage U3 DAC0 rotation command
Translation velocity Velocity setpoint and measured velocity voltage U3 DAC1 translation command

The diameter loop runs at the main loop cadence. The temperature/power loop uses a slower cadence: an 8-sample, 2-second average is used for the PI update to reduce sensitivity to short-term pyrometer fluctuations.

Hardware assumed by the script

This code was written for a specific levitation zone melter setup using:

  • LabJack U3 with LJTick-DAC
  • MOKOSE C-mount UVC camera with Fujinon 75 mm lens and spacer
  • Keller PA 40 two-color pyrometer
  • Induction-powered levitation zone melter with analog input/output wiring to the LabJack

The wiring assumptions are part of the source code comments. Check the pin layout carefully before using the program.

Software environment

The intended environment is Ubuntu Linux with Python 3.x. Required packages and system components include:

sudo apt-get update
sudo apt-get install -y python3 python3-pip git build-essential
sudo apt-get install -y libusb-1.0-0-dev python3-numpy
sudo apt-get install -y python3-opencv

The LabJack Exodriver must also be installed. One typical route is:

git clone https://github.com/labjack/exodriver.git
cd exodriver
sudo ./install.sh

LabJackPython is not normally packaged by Ubuntu and may need to be installed with:

sudo -H python3 -m pip install LabJackPython --break-system-packages

Optional packages used for related analysis or plotting may include:

sudo apt-get install -y python3-pandas python3-serial python3-usb python3-matplotlib

Running the program

Run the control program from a terminal on the control computer:

python3 levitation_zone_control.py

At startup, the program displays a warning that it controls laboratory hardware and asks the operator to confirm before continuing. It then asks for a CSV log filename. If the user presses Enter, the default file is out.csv.

The program then:

  1. Opens the camera.
  2. Places the terminal in raw-key mode for hotkey operation.
  3. Opens the LabJack U3.
  4. Initializes DAC outputs to safe values.
  5. Captures the current panel power command for bumpless transfer.
  6. Enters the 4 Hz measurement, display, control, logging, and hotkey loop.

On exit, the program attempts to restore the terminal, release the camera, close files, and close hardware handles.

Keyboard controls

The program is operated by single-key commands while running:

Key(s) Action
- / + or = Decrease / increase temperature setpoint
t Capture current temperature as setpoint
[ / ] Decrease / increase diameter setpoint
d Capture current diameter as setpoint
a / s Decrease / increase rotation setpoint
r Zero rotation setpoint and return to panel convention
z / x Decrease / increase velocity setpoint
v Zero velocity setpoint
j / k Move video scanline down / up
o / p Decrease / increase diameter deadband
, / . Decrease / increase temperature deadband
1 / 2 Decrease / increase diameter proportional gain
3 / 4 Decrease / increase diameter integral time
6 / 7 Decrease / increase power proportional gain
8 / 9 Decrease / increase power integral time
g Toggle logging between every 10 s and every tick
i Show status information
c Show DAQ check values
h Reprint help screen
q or Ctrl-C Quit

Logging

The log file is written as CSV. The header is:

t_s,pow_kW,T_C,Vel_mm_per_h,rot_rpm,stsq_mm_min,dia_mm,v_out1_V

By default, the logging cadence is every 10 seconds. Pressing g toggles logging to every control-loop tick, nominally 4 Hz.

Safety-related behavior in the code

The script includes several software guardrails. These are not a substitute for physical safety interlocks, trained operators, or hardware emergency stops.

Implemented software protections include:

  • A startup confirmation before hardware initialization.
  • Diameter output defaults to a safe zero value if the camera measurement is invalid.
  • Diameter and temperature deadbands suppress unnecessary control action near setpoint.
  • PI anti-windup prevents integrator runaway at output limits.
  • The power loop can hold the last valid DAC voltage when the pyrometer appears obstructed or the temperature is too low.
  • Power output changes are slew-limited.
  • The power loop blocks some suspect increases when measured kW is high or when temperature and measured power trends appear inconsistent.
  • Stretch/squeeze output is zeroed if the computed actuator speed exceeds a software limit.

Citation / related publication

The source comments reference the following related levitation zone melting publication:

K. E. Luitjohan, M. J. M. Krane, V. Ortalan, and D. R. Johnson, “Investigation of the metatectic reaction in iron-boron binary alloys,” Journal of Alloys and Compounds, 732 (2018) 498–505. https://doi.org/10.1016/j.jallcom.2017.10.238

License

Copyright (c) 2025 David R. Johnson.

Licensed under the MIT License. Portions of the software are adapted from LabJack Exodriver and LabJackPython examples, also under the MIT License.

Add a LICENSE file containing the MIT License text before publishing the repository.

Status

Experimental laboratory control code for a specific instrument. Use only after local review, hardware validation, and safety testing.

About

Python control software for a LabJack-based levitation zone melter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages