dilwong / nanonis_control

Software for controlling SPECS Nanonis
MIT License
7 stars 5 forks source link

Standard Nanonis Command Chart Wanted #1

Closed CoccaGuo closed 2 years ago

CoccaGuo commented 2 years ago

Thank you for this work. I want to make some automatic scripts with this interface. How can I check all the common commands? For example, Control the motor to raise 100 steps in Z and move to next area in XY? Or to start a scanning process and monitor the current signal?

By the way, does the nanonis software still work when this python program takes the control that I could supervising all the automatic process?

dilwong commented 2 years ago

Thanks for the interest in this project!

Yes, Nanonis will still work even when Python is issuing commands. But for this library to work, you must have a version of Nanonis that is compatible (i.e. a newer version and you are licensed for it). You can check this in Nanonis by seeing if "TCP Programming Interface" exists under System > Options.

Unfortunately, I stopped working on this library because our team had to downgrade our version of Nanonis to an incompatible version. So I only implemented a few commands:

        BiasSet(bias)
        BiasGet()
        TipXYSet(X, Y, wait = 1)
        TipXYGet(wait = 1)
        TipZSet(Z)
        TipZGet()
        FeedbackOnOffSet(feedbackStatus)
        FeedbackOnOffGet()
        Withdraw(wait = 1, timeout = -1)
        Home()
        SetpointSet(setpoint)
        SetpointGet()
        CurrentGet()

But it's very easy to fork the project and implement your own! Simply write a function or add a method to the nanonis_programming_interface class that calls

nanonis.send(NAME_OF_COMMAND, DATA_TYPE_OF_ARG1, ARG1, DATA_TYPE_OF_ARG2, ARG2, ...)

For example, to walk the coarse piezo motor NUMBER_OF_STEPS steps in DIRECTION (e.g. DIRECTION = 4 for +Z):

nanonis.send('Motor.StartMove', 'uint32', DIRECTION, 'uint16', NUMBER_OF_STEPS, 'uint32', GROUP, 'uint32', WAIT_UNTIL_FINISHED)

All of the available commands are documented in the Nanonis TCP Protocol manual from SPECS: https://www.dropbox.com/s/episfukl38fra0f/TCPProtocol_SPM.pdf?dl=0

CoccaGuo commented 2 years ago

Thank you for your fast and detailed answer!

I've tried this package just now by using a withdraw function in the nanonis STM simulator, but received an error in the connection. The version of my copy of the simulator is something like RC4. It's too low to use a TCP server. The nanonis we are using now is version 5e, so maybe I should upgrade my simulator and try again.

I used to write some Labview programs with the official interface, but the structure of program gets too complicated when working with big projects. I prefer the approach of Python.

I hope I could manage to upgrade the simulator to a newer version, or else maybe I should get a Labview interface to wrap the official interfaces, like the method used in the work of deepSPM. (https://www.nature.com/articles/s42005-020-0317-3)

Thank you again for providing a new method to use Python in this way. I didn't know it before.

dilwong commented 2 years ago

Haha, I completely understand why you would want to avoid LabView for anything complex, like exploring samples or fixing the tip with machine learning.

Yes, RC4 is too old for the TCP interface. Our team uses Nanonis V5 7821, which also doesn't have the TCP Programming Interface. We tried Nanonis V5 R10811, which does have the TCP interface, but that version of Nanonis was not so stable on our computer. But maybe newer versions of Nanonis are good.