- Features Summary
- Requirements
- Installation Instructions
- Connecting Pumps to Computer
- Checking Device Manager
- Command Line Usage
- Python Script Usage
- set diameter
- set infuse/withdraw rate
- set target volume
- set syringe volume
- infuse or withdraw indefinitely
- infuse or withdraw to a target volume
- infuse or withdraw to a target volume and wait until volume has been reached
- check if target volume has been reached (poll)
- stop pump
- external python script
- command line
- write to log
- daisy chain mutliple pumps together
- Python
- Pyserial
- Argparse
- Logging
- USB-serial adapter
- For PHD2000
- Serial to RJ-11 adapter
- RJ-11 to RJ-11 cable
- For chaining: multiple RJ-11 cables
- For PHD Ultra
- For chaining: multiple RS-485 cables
- Cables to connect each pump to power
- Install conda
- Download environment.yml and pump_code_pack.py
- Create the environment from the environment.yml file
conda env create -f environment.yml
- Make sure the pump_code_pack.py is in your current directory, where you'll run your script from
- Connect USB-serial adapter to computer
- Connect DB-9 serial to RJ-11 adapter
- Connect RJ-11 cable to adapter and to the RS-232 IN port of the pump with address 00
- If chaining, connect second RJ-11 cable to RS-232 OUT port of the pump with address 00 and the RS-232 IN port of the pump with address 01.
- Continue connecting the RJ-11 cables to the pumps in address order (can only connect max 99 pumps)
- Make sure pumps are set to Model 44 Protocol (Press SET key, press 1, press enter once Model 44 is displayed)
- Check pump chain configurations:
- Press SET key
- Use RS232 key to scroll until "Pump Chain" is displayed
- When "Pump Chain" is displayed press enter
- Type in address and press enter
- Type in baud rate (baud rate of 9600 is used for this code) and press enter
- Press enter one last time to save input
- If chaining, all pumps need to have the same Baud Rate, and the first pump in the chain needs to have address 00
- Connect USB-serial adapter to computer (if needed connect to male-to-male gender changer) and the RS-232 IN port of the pump with address 00
- If chaining, connect IEEE 1394 cable to the RS-485 OUT port of the pump with address 00 and the RS-485 IN port of the pump with address 01.
- Continue connecting the IEEE 1394 cables to the pumps in address order (can only connect max 99 pumps)
- Check Pump Chain configurations:
- Go to Settings menu
- Choose Pump Address button and enter pump address
- Press Accept to save chages
- From Settings menu, choose Pump Baud Rate and enter baud rate (9600 is used for this code)
- If chaining, all pumps need to have the same Baud Rate, and the first pump in the chain needs to have address 00
If the computer port connected to the pumps is unkown, check the name of the port.
- Open Device Manager, on windows 10, by searching for "Device Manager" on the search field in the taskbar.
- Double click on "Ports (COM & LPT)"
- Find the "Prolific USB-to-Serial Comm Port"
- The name of the port is in parenthesis next to "Prolific USB-to-Serial Comm Port"
- If the names don't match exactly, look for another a name that is similar to "USB-to-Serial"
Run python pump_code_pack.py --help
to see command line options.
Run the following, to stop the PHD2000 pump at address 00 using COM4 port
python pump_code_pack.py -p COM4 -a 0 -stop -PHD2000
Set the PHD2000 pump at address 00 using COM4 port to infuse indefinitely with the parameters: syringe diameter (12 mm) and infuse rate (1 ul/min)
python pump_code_pack.py -p COM4 -a 0 -d 12 -i 1 -iu ul/min -infuse -PHD2000
Set the PHD2000 pump at address 00 using COM4 port to withdraw indefinitely with the parameters: syringe diameter (12 mm) and withdraw rate (2 ul/min)
python pump_code_pack.py -p COM4 -a 0 -d 12 -w 2 -wu ul/min -withdraw -PHD2000
Set the PHD2000 pump at address 00 using COM4 port to infuse (and stop once target volume has been reached) with the parameters: syringe diameter (12 mm), infuse rate (1 ul/min), target volume (1 ml)
python pump_code_pack.py -p COM4 -a 0 -d 12 -i 1 -iu ul/min -t 1 -tu ml -infuse -PHD2000
Set the PHD2000 pump at address 00 using COM4 port to withdraw (and stop once target volume has been reached) with the parameters: syringe diameter (12 mm), withdraw rate (2 ul/min), target volume (1 ml)
python pump_code_pack.py -p COM4 -a 0 -d 12 -w 2 -wu ul/min -t 1 -tu ml -withdraw -PHD2000
Set the PHD2000 pump at address 00 using COM4 port to infuse (and wait for target volume to be reached) with the parameters: syringe diameter (12 mm), infuse rate (1 ul/min), target volume (1 ml)
python pump_code_pack.py -p COM4 -a 0 -d 12 -i 1 -iu ul/min -t 1 -tu ml -infuse_wait -PHD2000
Set the PHD2000 pump at address 00 using COM4 port to withdraw (and wait for target volume to be reached) with the parameters: syringe diameter (12 mm), withdraw rate (2 ul/min), target volume (1 ml)
python pump_code_pack.py -p COM4 -a 0 -d 12 -w 2 -wu ul/min -t 1 -tu ml -withdraw_wait -PHD2000
First, pump needs to be running (with -infuse or -withdraw and target volume). Run the following, to poll PHD2000 pump at address 00 using COM4 port
python pump_code_pack.py -p COM4 -a 0 -poll -PHD2000
Import logging and pump_code_pack
import pump_code_pack
import logging
To allow logging functionality, add in the following code. Substitute "example.log" the name of the log file you would like to add to
for handler in logging.root.handlers[:]:
logging.root.removeHandler(handler)
logging.basicConfig(filename='example.log', level=logging.DEBUG,format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p')
Define the serial connection and pumps
sc_com4 = pump_code_pack.Serial_connection('COM4')
address = 0
pump_2000_1 = pump_code_pack.Pump2000(sc_com4,address, name='PHD2000_1')
address = 1
pump_2000_2 = pump_code_pack.Pump2000(sc_com4,address, name='PHD2000_2')
After the pumps have been defined, run the following to stop pumps
pump_2000_1.set_stop()
pump_2000_2.set_stop()
After the pumps have been defined, run the following to infuse indefinitely with a syringe diameter of 9.52 mm, infuse rate of 10 ul/min. The "set_pump_mode()" command is only used for PHD 2000 pumps to run indefinitely.
diameter = 9.52
pump_2000_1.set_dia(diameter)
pump_2000_1.set_pump_mode()
infuse_rate = 10
infuse_rate_units = 'ul/min'
pump_2000_1.set_infuse_rate(infuse_rate, infuse_rate_units)
pump_2000_1.set_irun()
After the pumps have been defined, run the following to withdraw indefinitely with a syringe diameter of 9.52 mm, withdraw rate of 12 ul/min. The "set_pump_mode()" command is only used for PHD 2000 pumps to run indefinitely.
diameter = 9.52
pump_2000_2.set_dia(diameter)
pump_2000_2.set_pump_mode()
withdraw_rate = 12
withdraw_rate_units = 'ul/min'
pump_2000_2.set_withdraw_rate(withdraw_rate, withdraw_rate_units)
pump_2000_2.set_wrun()
After the pumps have been defined, run the following to infuse and stop at target volume with the parameters: syringe diameter (9.52 mm), target volume (1 ml), and infuse rate (10 ul/min).
diameter = 9.52
pump_2000_1.set_dia(diameter)
target_volume = 1
target_volume_units = 'ml'
pump_2000_1.set_target_volume(target_volume, target_volume_units)
infuse_rate = 10
infuse_rate_units = 'ul/min'
pump_2000_1.set_infuse_rate(infuse_rate, infuse_rate_units)
pump_2000_1.set_irun()
After the pumps have been defined, run the following to infuse and stop at target volume with the parameters: syringe diameter (9.52 mm), target volume (1 ml), and withdraw rate (10 ul/min).
diameter = 9.52
pump_2000_2.set_dia(diameter)
target_volume = 1
target_volume_units = 'ml'
pump_2000_2.set_target_volume(target_volume, target_volume_units) # set target volume
withdraw_rate = 12
withdraw_rate_units = 'ul/min'
pump_2000_2.set_withdraw_rate(withdraw_rate, withdraw_rate_units) # set withdraw rate
pump_2000_2.set_wrun() # withdraw and wait for target volume
After the pumps have been defined, run the following to infuse (and wait for target volume to be reached) with the parameters: syringe diameter (9.52 mm), target volume (1 ml), and infuse rate (10 ul/min).
diameter = 9.52
pump_2000_1.set_dia(diameter)
target_volume = 1
target_volume_units = 'ml'
pump_2000_1.set_target_volume(target_volume, target_volume_units) # set target volume
infuse_rate = 10
infuse_rate_units = 'ul/min'
pump_2000_1.set_infuse_rate(infuse_rate, infuse_rate_units) # set infuse rate with infuse rate units
pump_2000_1.wait_for_target(i_or_w="infuse") # infuse and wait for target volume
After the pumps have been defined, run the following to withdraw (and wait for target volume to be reached) with the parameters: syringe diameter (9.52 mm), target volume (1 ml), and withdaw rate (12 ul/min).
diameter = 9.52
pump_2000_2.set_dia(diameter) # set syringe diameter
target_volume = 1
target_volume_units = 'ml'
pump_2000_2.set_target_volume(target_volume, target_volume_units) # set target volume
withdraw_rate = 12
withdraw_rate_units = 'ul/min'
pump_2000_2.set_withdraw_rate(withdraw_rate, withdraw_rate_units) # set withdraw rate
pump_2000_2.wait_for_target(i_or_w="withdraw") # wuthdraw and wait for target volume
After the pumps have been defined and set to run in either infuse or withdraw, run the following to poll pump (check if target volume has been reached)
pump_2000_1.set_poll(i_or_w = "infuse")
pump_2000_2.set_poll(i_or_w = "withdraw")