Connecting to Agilis by Newport in Python
Instrument Card
Agilis™ Piezo Motion Controllers provide convenient and compact fine positioning control of the Agilis family of piezo motion stages and mounts.
Device Specification: here
Manufacturer card: NEWPORT
Newport provides a wide range of photonics technology and products designed to enhance the capabilities and productivity of our customers’ applications.
- Headquarters: Irvine, California, United States
- Yearly Revenue (millions, USD): 3500
- Vendor Website: here
Demo: Send commands to a Polulu stepper motor driver
Connect to the Agilis in Python
Read our guide for turning Python scripts into Flojoy nodes.
PROTOCOLS > SCPI
To connect to an Agilis Positional Controller using Instrumentkit, you can use the following code:
from instrumentkit import serialfrom instrumentkit import newport
# Connect to the controllerport = serial.SerialPort("COM5", baudrate=921600)controller = newport.AGUC2(port)
# Reset the controllercontroller.reset_controller()
# Print the firmware versionprint(controller.firmware_version)
# Move the X axis relative by 1000 stepscontroller.axis["X"].move_relative(1000)
# Activate jogging in mode 3 for the X axiscontroller.axis["X"].jog = 3
# Stop the X axiscontroller.axis["X"].stop()
# Query the step amplitude for the X axisstep_amplitude = controller.axis["X"].step_amplitudeprint(step_amplitude)
# Set the positive step amplitude to +10 and the negative step amplitude to -20 for the X axiscontroller.axis["X"].step_amplitude = (10, -20)
# Close the connectioncontroller.close()
This code connects to the Agilis Positional Controller on COM5 with a baud rate of 921600. It then performs various operations such as resetting the controller, printing the firmware version, moving the X axis relative by 1000 steps, activating jogging in mode 3 for the X axis, stopping the X axis, querying and setting the step amplitude for the X axis. Finally, it closes the connection to the controller.