I started this discussion with @rickwierenga via email, but opening it up here for more input, particularly from @marielle who did the initial contributions with the Agrowtek pumps in PLR.
I have an array of Agrowtek pumps that I’m trying to get working with PLR and not having much luck. I am able to initialize them fine on a windows computer using the default software from Agrowtek.
I’m trying to piece together the initial setup from the docs regarding the master-flex pumps, and trying this:
from pylabrobot.pumps.agrowpumps.agrowdosepump import AgrowPumpArray
pump = AgrowPumpArray(port='/dev/tty.usbserial-D30AKVJF', address="0")
Which executes without error in my notebook. Then when calling setup()
:
await pump.setup()
I get this error and trace:
Failed to connect [Errno 35] Could not exclusively lock port /dev/tty.usbserial-D30AKVJF: [Errno 35] Resource temporarily unavailable
---------------------------------------------------------------------------
ConnectionError Traceback (most recent call last)
Cell In[59], line 1
----> 1 await pump.setup()
File ~/Documents/FutureHouse/Lab/PyLabRobot/pylabrobot/pylabrobot/pumps/agrowpumps/agrowdosepump.py:110, in AgrowPumpArray.setup(self)
106 async def setup(self):
107 """ Sets up the Modbus connection to the AgrowPumpArray and creates the
108 pump mappings needed to issue commands.
109 """
--> 110 await self._setup_modbus()
111 register_return = await self.modbus.read_holding_registers(19, 2, unit=self.address)
112 self._num_channels = \
113 int("".join(chr(r // 256) + chr(r % 256) for r in register_return.registers)[2])
File ~/Documents/FutureHouse/Lab/PyLabRobot/pylabrobot/pylabrobot/pumps/agrowpumps/agrowdosepump.py:122, in AgrowPumpArray._setup_modbus(self)
120 await self.modbus.connect()
121 if not self.modbus.connected:
--> 122 raise ConnectionError("Modbus connection failed during pump setup")
ConnectionError: Modbus connection failed during pump setup
It obviously seems like a connection issue, which makes some sense because I’m not sure I know how to identify the proper port on my Mac and put the above (port='/dev/tty.usbserial-D30AKVJF'
) based on some googling, as that’s the change I see when calling ls
on /dev/
with the USB adapter with the pump plugged in vs. not.
I’m also not sure what to use for address=
, but I put 0
as that is what I put as the address when initializing with the windows program. This may be referring to something else though.
Any help is appreciated.