Multiple PicoScopes on one PC

Post any questions you may have about our current range of oscilloscopes
Post Reply
timyin
Newbie
Posts: 0
Joined: Fri Oct 26, 2018 3:43 pm

Multiple PicoScopes on one PC

Post by timyin »

Hi All,

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.

Code: Select all

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?

UnitInfo(driver=, variant=b'3403D', serial=b'GO768/0079')

UnitInfo(driver=, variant=b'3403D', serial=b'GO768/0025')


Thanks in advance for any support, Yin

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Multiple PicoScopes on one PC

Post by Martyn »

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.
Martyn
Technical Support Manager

timyin
Newbie
Posts: 0
Joined: Fri Oct 26, 2018 3:43 pm

Re: Multiple PicoScopes on one PC

Post by timyin »

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.

This is my code.

Code: Select all

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

Thanks in advance for any support, Yin

timyin
Newbie
Posts: 0
Joined: Fri Oct 26, 2018 3:43 pm

Re: Multiple PicoScopes on one PC

Post by timyin »

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.

Code: Select all

from ctypes import *
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 ccount,cserials,cserialLth, use ps3000aEnumerateUnits to get the serial numbers
    display ccount, 1st serial, cserialLth
"""

ccount = c_int16()
cserials = (c_char * 10)()
cserialLth = c_int16()
ps.ps3000aEnumerateUnits(byref(ccount), byref(cserials), byref(cserialLth))
print(ccount)
print(cserials[0])
print(cserialLth)
Error code, wrong type with the byref(cserials)???

Code: Select all

/usr/bin/python3.6 "/home/timyin/Desktop/FA/picosdk-python-wrappers-master/ps3000aExamples/ps3000aBlockMultiChannel .py"
Traceback (most recent call last):
  File "/home/timyin/Desktop/FA/picosdk-python-wrappers-master/ps3000aExamples/ps3000aBlockMultiChannel .py", line 21, in 
    ps.ps3000aEnumerateUnits(byref(ccount), byref(cserials), byref(cserialLth))
ctypes.ArgumentError: argument 2: : wrong type
In addition it works ok wenn i use ps3000aOpenUnit( chandle, None ).

Post Reply