a starting point to control your hardware through MATLAB GUI
This is a GUI template to get you up and running connecting and controlling hardware immediately (screenshots below).
This code comes with connection code for:
- three C-663 Step controller from Physik Intrumente (for XYZ scan)
- Standard DG535 Pulse Generator from Rohde & Schwarz
- Wave Surfer Oscilloscope from Le Croy
Initial features:
- Dis-/Connection of Stage controllers, Oscilloscope, and Pulse Generator
- Control of absolute and relative movement of the stage controllers.
- Real-time stage position display.
- Emergency stop of stages.
This code does not comes with the driver of each hardware mentioned above.
First thing first. Note what version your MATLAB is and whether you have installed the drivers of the hardwares.
Clone this repository to your desired folder by entering the following command:
cd path/to/your/folder/
git clone https://github.com/wdputro/stage-controller-GUI.git
Afterwards, proceed according to your MATLAB version.
Since this is mainly a GUI template for your distinct system, we need to configure the connection to each hardware.
Open the controllerApp.mlapp
file. Either from MATLAB by clicking the file, or type this directly in your MATLAB command window:
controllerApp.mlapp
This will then open the App Designer
window.
- Change the DG535 swith to the name of your device
- Head over to the top-right of your App window. Choose
Code View
- Now, hit
Ctrl + F
and searchFdgInit
- replace everything under
function FdgInit(app, GPIB_Address)
with your MATLAB code for connecting to your pulse generator - Note that the initial variable to access the stages are
dg
and are defined under the functionFdgInit(app)
. So if you change it with your code, make sure to replace the variables accordingly.
- Still in
Code View
mode - Now, hit
Ctrl + F
and searchFscopeInit
- replace everything under
function FscopeInit(app)
with your MATLAB code for connecting to your Oscilloscope. - Note that the initial variable to access the stages are
DSO
and are defined under the functionFscopeInit(app)
. So if you change it with your code, make sure to replace the variables accordingly.
- Still in
Code View
mode - Now, hit
Ctrl + F
and searchFstageInit
- replace everything under
function FstageInit(app)
with your MATLAB code for connecting to your Stages. - Note that the initial variable to access the stages are
stageX, stageY, stageZ
and are defined under the functionFstageInit(app)
. So if you change it with your code, make sure to replace the variables accordingly.
Now, save
it and run (F5)
. Check whether everything connects and whether the stages move accordingly.
If you are using stages not from Physik Instrumente, chances are you need to modify the code for each button since the MATLAB class are, of course, inherently different.
If everything works well, then on the App Designer
's file ribbon, click 'Package App' and follow the instructions.
Essentially, quite the same with the steps above. But since I built it using MATLAB GUIDE, you have two separate files (*.fig, and *.m). In short, Design view
is equivalent to *.fig file, and Code View
is equivalent to *.m file
Open the GUIDE by right clicking the *.fig file and choose Open in GUIDE
from the file dialog.
- Right click the button besides
Connect Stage & AFG
label, head toView Callbacks
and chooseCallback
. It would then take you to the code. (If you encounter a warning that says _The current value of Callback has been manually modified..., ignore it.) - replace everything under
function stageAFG_Callback(hObject, eventdata, handles)
with your MATLAB code for connecting to your Stages. - Note that the initial variable to access the stages are
C663_X, C663_Y, C663_Z
and are defined under the functionstageConnectG( handles )
. So if you change it with your code, make sure to replace the variables accordingly.
Now, save
it and run (F5)
. Check whether everything connects and whether the stages move accordingly.
If you are using stages not from Physik Instrumente, chances are you need to modify the code for each button since the MATLAB class are, of course, inherently different.
If everything works well, then close the GUIDE
window, and on the main MATLAB window, select Apps file ribbon and click 'Package App' and then follow the instructions.
Be wild. Add other hardwares. Create another page for your own research or need (eg, 3D raster-scan etc)
If you find a bug or want to request a new feature, feel free to open an issue.
Stage Controller GUI is licensed under MIT license. Check the LICENSE file for details.