Gwyscope documentation

open hardware SPM controller with advanced sampling support

User Tools

Site Tools


simple_scan_by_lua_lines

Lua Line scan

This simple client scans topography in contact mode, using Lua script, measuring a collection of individual profiles.

It connects to the server and sets the operation regime to proportional feedback (typically used in contact mode, difference between value of signal on input and some setpoint value makes piezo to extend or shrink, depending on settings). Then it sets some basic parameters of feedback loop and sets feedback on. It sets the scanning velocity and then it scans 1×1 micrometer in 50×50 pixels using a Lua script using measurement of individual profiles (lines), which are higher level functions than only individual movements and data storage as shown in Lua scan example. Finally, it stops the feedback, shrinks the z-piezo and exits.

Used commands and their parameters:

state: mode: proportional to set the mode, which connects inputs, outputs and sets many other parameters as defined in hwserver.ini file on the server

set: pid_p: 0, pid_i: 0.1, pid_d: 0, pid_setpoint: 0.2 to set the feedback loop parameters

set_feedback: feedback: true to start the feedback loop, which should make z-piezo to extend and probe to reach the surface if the sample is in reachable distance, setpoint is correct and settings in hwserver.ini match the experimental configuration.

set_scan: speed: 1e-6 to set the scanning speed to 1 micrometer per second

run_scan_script: n: 2500, script:

local scan = {}

function scan.runit()
   gws_clear(p)
   gws_move_to(p, 0, 0, 0)

   for iy = 1,50 do
      local xfrom = 0
      local xto = 50*200e-9
      local y = iy * 200e-09
      gws_scan_and_store(p, xto, y, 50, 0)
      gws_move_to(p, xfrom, y, 0)
      end
end
return scan

get_scan_ndata: n to get how many points were already measured (repeated until all 50 values are measured)

get_scan_data: from: 0, to: 2500 to get all the data at once (data could be red also sequentially as they are measured altering the “from” and “to” value).

set_feedback: feedback: false to stop the feedback

move_to: zreq: 0.0 to move the z-piezo to zero after the feedback is stopped.

To explore it further, see the simple client implementations in C and in Python.

simple_scan_by_lua_lines.txt · Last modified: 2026/06/01 15:06 by pklapetek