Connecting to AG-UC2 by Newport in Python
Instrument Card
The AG-UC2 Agilis™ Controller provides USB computer control for two Agilis axes. The AG-UC2 controller features two sets of push buttons for each Agilis axis; one set for step size settings, and the other set for precise low speed adjustments and fast coarse motion. Power is supplied through the USB port and if not available, the USB-CH power supply can independently power the Agilis controller. USB hubs may also be used for power and communication, but must provide the required 5 V supply, e.g. must feature an external power supply.
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 AG-UC2 in Python
Read our guide for turning Python scripts into Flojoy nodes.
PROTOCOLS > SCPI
In this example, we define a custom AGUC2MotorController
class that inherits from SerialInstrument
provided by Instrumentkit. We set the baudrate and timeout properties specific to the AG-UC2 Motor Controller.
We also define three instrument-specific commands: move_forward
, move_backward
, and stop
. These commands send the appropriate commands to the motor controller via the send_command
method.
We then create an instance of the AGUC2MotorController
class, specifying the serial port to which the motor controller is connected. We connect to the motor controller using the connect
method.
We can then use the defined commands to control the motor. In this example, we move the motor forward at speed 50 for 2 seconds, and then stop the motor.
Finally, we disconnect from the motor controller using the disconnect
method.