I plan to have several PicoScope devices all connected to one Raspberry Pi in the lab. Then I can use the computer to analyze the data in the office.
Now in the lab have i only two 3403D devices with the Ubuntu PC available. So i have download the SDK and use a Test Programm to get the serial numbers of the devices. With the serial number can i use the funktion ps3000aOpenUnit to set up the device.
from picosdk.discover import find_all_units
scopes = find_all_units()
for scope in scopes:
print(scope.info)
scope.close()
Unfortunately I get only one serial number at a time. How can i get two serial numbers at a time? Is there any more similar example code in python on Github?
Please check the function ps3000aEnumerateUnits in the Programmer's Guide which will return a string of serial numbers. You can then use these serial numbers with the ps3000aOpenUnit function as required.
We have no python example code for this, but it should be relatively straightforward to implement.
hi,
there is one more problem. How can i open the unit with the serial number in string or types?
serial = GO768/0079
Serial number is string or types. But the function ps3000aOpenUnit need int8_t * serial.
* serial, on entry, a null-terminated string containing the serial number of the scope to be opened. If serial is NULL then the function opens the first scope found; otherwise, it tries to open the scope that matches the string.
import ctypes
from picosdk.ps3000a import ps3000a as ps
import numpy as np
import matplotlib.pyplot as plt
from picosdk.functions import adc2mV, assert_pico_ok, mV2adc, file_read, file_write
# Create chandle and status ready for use
"""Create cserial
这里的要添加创建ctype的serial
cserial = ctypes.c_int8()
"""
serial = b'GO768/0079'
cserial = ctypes.c_char_p(serial)
status = {}
chandle = ctypes.c_int16()
# Opens the device/s
"""这里的None要修改ctypes.byref(cserial)"""
status["openunit"] = ps.ps3000aOpenUnit(ctypes.byref(chandle), cserial)
print(status, chandle) #注释掉
try:
assert_pico_ok(status["openunit"])
except:
# powerstate becomes the status number of openunit
powerstate = status["openunit"]
# If powerstate is the same as 282 then it will run this if statement
if powerstate == 282:
# Changes the power input to "PICO_POWER_SUPPLY_NOT_CONNECTED"
status["ChangePowerSource"] = ps.ps3000aChangePowerSource(chandle, 282)
# If the powerstate is the same as 286 then it will run this if statement
elif powerstate == 286:
# Changes the power input to "PICO_USB3_0_DEVICE_NON_USB3_0_PORT"
status["ChangePowerSource"] = ps.ps3000aChangePowerSource(chandle, 286)
else:
raise
assert_pico_ok(status["ChangePowerSource"])
print(status)
This is error data.
{'openunit': 3} c_short(0)
Traceback (most recent call last):
File "/home/timyin/Desktop/FA/picosdk-python-wrappers-master/ps3000aExamples/ps3000aBlockMultiChannel .py", line 31, in
assert_pico_ok(status["openunit"])
File "/home/timyin/Desktop/FA/picosdk-python-wrappers-master/picosdk/functions.py", line 146, in assert_pico_ok
raise BaseException("Pico_OK not returned")
BaseException: Pico_OK not returned
hello,
I have been having multiple issues with the SDK via python for the ps3000a series. (ps3000aEnumerateUnits and ps3000aOpenUnit)
System: now Ubuntu with the laptop , in the future Debian with the Raspberry Pi
Program: Python 3
I'm trying to use the funktion ps3000aEnumerateUnits to get a list of all available devices connected to my computer. This is my code but it dose not work.