hardware_interfaces.newport_control module

class NewportControl(port: str, reference_time: float = 60, lower_bound: Optional[float] = None, upper_bound: Optional[float] = None, name: str = 'micrometer screw')[source]

Bases: object

Connect the DC Servo Controller/ Driver Model: CONEX-CC. Reference the connected micrometer-screw LTA-HL.

The newport motor is used to move the sample up and down. This prevents that the measurement is taken of only one position on the sample. Why is that necessary?

This is useful for UV/VIS experiments, where the excitation has enough energy to “burn out” the sample (Even to the point where the sample sticks (“gets glued”) to the sample-container). The movement of the sample makes it possible to distribute the shots over a larger sample area (in this case we move up and down in a line) rather than one single point. With this, it is possible to measure for a longer time until it is necessary to change the sample. The idea is, that while the delay-stage etc. are driving to a new (e.g. delay), the micrometer-screw moves the sample to a new spot.

The size of the laser-spot is around 100 micrometers. Therefore, the stepsize should be chosen a little bit higher (i.e. 120 micrometer). This can be done in combination with the shutter (i.e. shutter closes, micrometer-screw moves) which is part of the main program. After reaching the final position (limit of stage axis), the screw should move back. Ideally with a different stepsize such that the position which are set, are not the same as before. The screw should be moved every acquisition (e.g. 500 shots). The up and down movements should continue until the measurement is done.

Note, that the controller+screw always have to be initialized before they can be used.

Important parameters of controller:

  • Bits per second: 921,600 - baudrate: 921600

  • Data bits (bytesize): 8

  • Parity: None

  • Stop bits: 1

  • Flow control: Xon/Xoff

  • Terminator: CRLF (rn)

Note

This class was specifically build for the Newport micrometer screw with the purpose of moving a sample container up and down within certain limits to avoid burning of the sample. Technically it could be used for other Newport devices. For that, the functions must be reevaluated and checked. We would recommend writing a more general class in that case. I.e. NewClass() containing all functions shown in the CONEX-CC documentation.

Parameters
  • port (str) – COM port to which the controller is connected. Please check in the device manager of your operating system.

  • reference_time (float, optional) – Sets the time to wait while referenceing. Mainly for troubleshooting. Defaults to 60 because that is the time it takes to go from one limit to the other.

  • lower_bound (float, optional) – Sets the minimum position where the motor should travel to. In millimeters. Revelevant for move_sample() method. Defaults to None (physical lower limit of micrometer screw LTA-HL).

  • upper_bound (float, optional) – Sets the maximum position where the motor should travel to. In millimeters. Revelevant for move_sample() method. Defaults to None (physical upper limit of micrometer screw LTA-HL).

  • name (str, optional) – Name / Identifier to give to this controller. This is relevant for log statements, especially when there is more than one motor in the setup. Defaults to “Newport Controller”.

port

COM port to which the controller is connected.

Type

str

position

Current position of Micrometer-screw.

Type

float

velocity

Current velocity of Micrometer-screw.

Type

float

lower_limit

Position of lower limit switch of the Micrometer-screw.

Type

float

upper_limit

Position of upper limit switch of the Micrometer-screw.

Type

float

lower_bound

User defined lower bound. Typically depends on size of sample container.

Type

float

upper_bound

User defined upper bound. Typically depends on size of sample container.

Type

float

direction

Variable which is used as an identifier for the direction in which the Micrometer-screw travels.

Type

int

continuous_move_stop

Event that is used to stop continuous movement of micrometer screw.

Type

threading.Event

continuously_moving

Indicator whether micrometer screw is continuously moving or not.

Type

bool

ser

Pyserial object which initiates the communication with the Counter.

Type

serial.Serial

References

CONEX_CC_Controller_Documentation_Serial.pdf
__str__()[source]

Read out all relevant parameters.

check_if_movement_is_within_limits(position: float, relative: bool = True)[source]

Checks if movement is within lower and upper limit. If not, it returns lower or upper limit position respectively.

Parameters
  • absolute_position (float) – Targeted position

  • relative (bool, optional) – Set True for relative motion. Set False for absolute motion. Defaults to True.

Returns

relative or absolute position that is within limits

Return type

float

end()[source]

Sets the velocity back to 1mm/s for next use. Moves the screw to 0 to reduce referencing time at next initialization. Closes the Serial connection.

get_configuration()[source]

Read out all parameters which were/are preset in configuration mode.

get_position()[source]

Returns current position of the motor.

get_velocity()[source]

Returns current velocity of the motor.

move(position: float, relative: bool = False, wait: bool = True)[source]

Move micrometer-screw to set position. This can be set to an absolute position or a relative position.

The controller needs time to execute and send the command before it can be moved again. Therefore, it is necessary to check wheather the motor is still moving. The function can wait until a confirmation is received that the motor stopped the motion by halting the interpreter.

Parameters
  • position (float) – Absolute or relative target. E.g. move to 10 mm or move 5 mm more in positive direction (-5 for negative movement)

  • relative (bool, optional) – Set True for relative motion. Set False for absolute motion. Defaults to False.

  • wait (bool, optional) – Wait for motor to complete the motion by halting interpreter. Defaults to True.

move_continuosly()[source]

Method that continuously moves the mircometer screw back and forth between lower and upper bound until continuous_move_stop Event is set.

This method is intentended to be run in a separate thread using for example toggle_continuous_movement.

move_sample(stepsize: float)[source]

Moves the sample within defined bounds which depend on the sample holder.

Method moves to user defined lower bound if the position is outside of bounds. If the position is within bounds, the sample is moved with a user defined stepsize relative to its current position. If the move/ step goes beyond the sample holder boundaries, the rest of the step length is moved backwards in the opposite direction.

Note

To avoid hitting the same spots it is necessary to choose the stepsize such that the length of the sample holder is not divisible by the stepsize. Optimally, the remainder should be half of the stepsize. E.g. sample holder length = 10 divmod(10,0.21) = (47.0, 0.13000000000000037) which is not perfect but #!it’s what it’s.

Parameters

stepsize (float) – Length of the relative movement in millimeters.

read(command: str)[source]

Read out the return from controller.

Parameters

ascii_command (str) – Command which is send to card beforehand. In ascii format.

Returns

Returns what controller sends back as a response

Return type

str

send_command(input_command: str)[source]

Creates necessary ascii format of the command which will be send to the controller

Args: input_command (str): Command which should be send to the

controller

Returns: str: Command which is send to card. In ascii format.

set_velocity(velocity: int)[source]

Set the velocity of the micrometer-screw.

Parameters

velocity (int) – Velocity value in units/s. Maximum value is at 1 mm/s

toggle_continuous_movement()[source]

Either sets up or stops continuous back and forth movement running in a different thread.

wait()[source]

Performs a check via while loop for Error “000028” where 28 indicates if motor/ screw is moving.