Saturday, February 25, 2023

X-Ray Source Controller for MOXTEK and AMPTEK Mini X-Ray tubes

 I needed controller for the Magnum series 50kV / 10W MOXTEK X-Ray source. As it turns out the controller, once sold by MOXTEK is no longer available (discontinued due component availability) and the Moxtek salesperson told me - "We expect customers to develop their own controllers". 

This was not a big deal - their FTC-200 controller has very basic functionality anyways, so I went ahead and developed my own design to control the tube.

One of my design goals is to have a stand-alone unit with no PC required. I don't want to fumble with numerous applications while doing XRF and prefer to have a piece of hardware with actual buttons and dialls to adjust X-ray tube parameters and operate it.

I was pleasantly surprised to find out that the AMPTEK Mini-X2 tube uses the same electrical interface as MOXTEK so my controller will work for AMPTEK Mini-X2 just as well.

My design is based on the nRF52840 System-on-a-Chip (SoC) using Cortex M4F processor and employs 6 control channels as required by the x-ray source interface  - 4 Analog and 2 digital channels. Of these 6, there are 2 Analog outputs (driven by 12-bit DACs), used for setting up tube's HV and Emission Current parameters, 1 digital output (5V TTL signal) to turn the source ON / OFF. There are also 2 Analog inputs (sampled with 12-bit ADCs) to monitor the x-ray tube's working parameters as they are returned by the Moxtek HV PS module and a digital input (5V TTL signal) to report when the beam is on and stable (Filament fully heated). 

I had to employ Level shifters as the nRF52840 is a 3.3V chip and the MOXTEK module has 5V TTL levels for the digital signals. Furthermore, the set ranges on the Analog output channels are 0-to-4V so I had to use the 4.096V internal DAC reference voltage which means the DAC must be powered with 5V Vdd. (in reality, the reference is 2.048V and the output op-amp buffer uses 2X gain, but still 5V DAC power is required) 

For the Analog inputs, I used voltage dividers to bring down the Monitor channel voltages in the range of 0-to-3VDC and used the built-in ADC reference of 0.6V with gain of x5.

There is also 5th Analog Input channel, internal to the controller, with its own voltage divider, used to monitor the Low-Voltage Main Input Power and to inhibit controller operation if the controller's and tube's input voltage is not within the allowed range. 

OSH Park service delivered again beautiful, high-quality PCBs. The ordering process is very simple and a pure joy - I almost feel sorry I don't have more PCB projects to order. 
The PCB design was done with Autodesk Eagle but I am not big fan of what Autodesk is doing with Eagle and very likely to switch over to KiCad in the near future.

The assembled and ready X-Ray Source controller - XTC-2000 (a.k.a. "X-Ray Tube Commander 2000" :-) 
(Chat GPT suggestion :-)

Using a rotary encoder with a pushbutton makes the UI really quick and intuitive. The button (knob-press) is used to enter adjustment mode and the user can dial the whole number and the tenths after the decimal point for each parameter separately. After entering Set mode, the encoder's push-button scrolls through different cursor positions and spining the dial changes the value. 
The encoder is equipped with its own microcontroller (Atmel SAM D09) which takes care of all of the quadrature input stuff - counts, phase-detection, timing, etc. and just reports the actual tick count over I2C bus to the MCU. This makes it really fast and easy to use and I can reset the tick counter with a command if needed.

The complete and working controller during bench-testing and DAC/ADC non-linearity compensation and alignment. The white (unpopulated in this picture) 4-pin JST connector near the encoder is AUX I2C expansion connector, used for the remote temperature sensor.

Currently, the code is fairly small (~1800 lines only) yet it is pretty complete and mature and the core functionality is all done and bug-free thus "Version 1.0" designation is warranted. 
In the unlikely event of some commercial interest I might write a menu system for setting up various tube types, internal parameters and calibration values, but even at this stage, XTC-2000 has more features, better functionality and better ergonomics than both, the discontinued Moxtek FTC-200 controller and the entirely software-controlled Amptek controller. 

As part of the safety and tube's health features, I added temperature sensing and monitoring using MCP9809 chip.

While designing the PCB, I foresaw that having an extra I2C bus connector for future expansion might come handy so I added one to the board layout.
The sensor I am using is MCP9808 - a very accurate and precise chip with I2C interface. Resolution is actually much better than 0.25°C but for my purpose 1° Celsius is completely sufficient.
The controller constantly monitors the temperature of the tube and it will shut it off if temperature exceeds +60°C and until cools down below +55°C. The sensor presence is auto-detected on startup - if the cable is not plugged in, the controller will work normally, without any limitations.
The critical part here is the connection cable between the controller and the MCP9808 breakout board - the cable must be fully shielded due to the proximity to the tube's HV cables and must be of very low capacitance as the I2C bus does not allow for high capacitance on the signal lines or the useable bus speed will begin to drop.  At 70cm cable length the sensor works just fine. The cable I used was foil-shielded 4-conductor USB cable.

The last thing currently pending on my development list is a suitable enclosure.

No comments: