PT-104 Problem

Post your Linux discussions here
Post Reply
gruenst
Newbie
Posts: 0
Joined: Thu Sep 07, 2017 6:51 pm

PT-104 Problem

Post by gruenst » Thu Sep 07, 2017 7:30 pm

Hello,
I am having some weird problems with the PT-104, which reminded me a bit of this older post
topic23701.html

As a setup, I have only tried it in USB mode so far, and I use it for reading 3 different devices with mV and V output differentially, with the mV devices being attached to channel 1 and 4, and V device to channel 3.
When doing this, the logger only reads channel 3 constantly. Both mV channels mostly show 0V. With the Picolog Recorder under Windows, and with a Python code under Raspberry Pi / Raspbian.
The weirdness starts that I sometimes get a reading of one of the mV channels. Sometimes I can trigger this when changing the acquisition setting. In Python, the returned status is always OK.

So my questions are rather:
- Could it be that the PT-104 is not fit for measuring mV and V signals?
- Could it be an issue with usb instead of LAN communication? (I have not tried that yet)
- Should there be default time delays between measurements? (I already tried this, but anyways)
- Could it be that the input channel resistance is too low when the acquisition is triggered, that a current flow interrupts the voltage measurement?
- Could it be a defective component?

For completeness, here is the Python code for the RasPi as I couldn't find it in the archive yet:

Code: Select all

import time, sched
from ctypes import *

s = sched.scheduler(time.time, time.sleep)
handlePointer=c_short()
vv1=c_long()
vv3=c_long()
vv4=c_long()


mydll=cdll.LoadLibrary('/opt/picoscope/lib/libusbpt104.so.2')
status_unit=mydll.UsbPt104OpenUnit(byref(handlePointer),b'EU341/118')
if (status_unit==0):
  print('Picolog PT104 opened successfully')
  #0-115 mV for channel 1 and 4, 0-2.5V for channel 3
  cs=mydll.UsbPt104SetChannel(handlePointer,1,5,2)
  cs=mydll.UsbPt104SetChannel(handlePointer,3,6,2)
  cs=mydll.UsbPt104SetChannel(handlePointer,4,5,2)
else:
 print('>>>> Picolog ERROR opening device <<<<')

def printALL():
  s.enter(5,1,printALL,())  #re-enter into scheduler
  status_channel_1=mydll.UsbPt104GetValue(handlePointer,1,byref(vv1),0)
  status_channel_3=mydll.UsbPt104GetValue(handlePointer,3,byref(vv3),0)
  cs=mydll.UsbPt104SetChannel(handlePointer,4,6,2) #example of changing the mode before reading
  cs=mydll.UsbPt104SetChannel(handlePointer,4,5,2) #example of changing the mode before reading
  status_channel_4=mydll.UsbPt104GetValue(handlePointer,4,byref(vv4),0)
  print("%s: %s %.1f %.1f %.1f %s" % (time.strftime("%Y-%m-%d %H:%M:%S"),irr.unit,float(vv1.value)/1000000,float(vv3.value)/100000,float(vv4.value)/1000000,"mV"))

print("datetime: SMAirr SMAunit Pico1 Pico3 Pico4 PicoUnit\n")
s.enter(5,1,printALL,())
s.run()

Hitesh
Site Admin
Site Admin
Posts: 2829
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: PT-104 Problem

Post by Hitesh » Tue Sep 12, 2017 10:28 am

Hi gruenst,

The USB PT-104 should be suitable for differential voltage measurements up to 2.5 V.

When you refer to using a time delay, have you tried a 720 ms delay (this is the time taken to convert a single reading).

It might be useful to see a diagram/photo of the setup and which connection pins on the input are being used. You can post this here or send it to support@picotech.com

Have you tried a multimeter to measure the voltage as well for reference purposes?

Regards,
Hitesh

Technical Support Engineer

gruenst
Newbie
Posts: 0
Joined: Thu Sep 07, 2017 6:51 pm

Re: PT-104 Problem

Post by gruenst » Tue Sep 12, 2017 5:31 pm

Thank you for your reply.

I use the screw terminal adapters, so pin 4 (the outermost) is connected to ground, and the differential voltage is between pins 2 and 3 (with 4 being positive).
Here's a picture:
pt104.png
Multimeter Readings between 3 and 2 show the correct voltage. Plugging the screw terminal into the PT-104 is a bit cumbersome, but it was executed correctly. It is only the voltage acquisition itself.
720 ms sounds overly long to me, but I will try this.

Should the time delay be between 2 UsbPt104GetValue commands?

Hitesh
Site Admin
Site Admin
Posts: 2829
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: PT-104 Problem

Post by Hitesh » Wed Sep 13, 2017 8:42 am

Hi,

Yes, please ensure that the delay between the two calls to UsbPt104GetValue() is at least 720 ms.

There should be a new driver available as well so please call the sudo apt-get update command.

Please try the above and I can investigate further if there is no change in the behaviour.

Regards,
Hitesh

Technical Support Engineer

gruenst
Newbie
Posts: 0
Joined: Thu Sep 07, 2017 6:51 pm

Re: PT-104 Problem

Post by gruenst » Sat Sep 16, 2017 5:46 pm

750 ms delay did not change anything, unfortunately.

It is pretty difficult to connect the device with the internet now, so I haven't performed the driver update yet. What's the date of the driver, what is its name?
Because I installed the system only about 2 months ago.

Hitesh
Site Admin
Site Admin
Posts: 2829
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: PT-104 Problem

Post by Hitesh » Mon Sep 18, 2017 12:42 pm

Hi gruenst,

The name of the driver is libusbpt104.so. I believe it should date from 21st August.

Regards,
Hitesh

Technical Support Engineer

gruenst
Newbie
Posts: 0
Joined: Thu Sep 07, 2017 6:51 pm

Re: PT-104 Problem

Post by gruenst » Wed Sep 27, 2017 6:44 pm

I still have the same problem with the mV mode. But the voltage mode works without problems.
So: mydll.UsbPt104SetChannel(handlePointer,1,5,2) does not work properly, while mydll.UsbPt104SetChannel(handlePointer,1,6,2) works.

What's the difference between libusbpt104.so and libusbpt104.so.2, by the way?

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

Re: PT-104 Problem

Post by Martyn » Thu Sep 28, 2017 6:31 am

libusbpt104.so is a symbolic link to the shared library libusbpt104.so.2 , which means that code does not need to change if the version of the library changes.

Can you post your code as it is now, we need to see where you have delays, as you will need 720ms between a SetChannel and GetValue call to read sensible data for a single channel.
Martyn
Technical Support Manager

gruenst
Newbie
Posts: 0
Joined: Thu Sep 07, 2017 6:51 pm

Re: PT-104 Problem

Post by gruenst » Thu Sep 28, 2017 7:23 pm

Code: Select all

import time, sched
from ctypes import *

s = sched.scheduler(time.time, time.sleep)
handlePointer=c_short()
vv1=c_long()
vv3=c_long()
vv4=c_long()


mydll=cdll.LoadLibrary('/opt/picoscope/lib/libusbpt104.so.2')
status_unit=mydll.UsbPt104OpenUnit(byref(handlePointer),b'EU341/118')
if (status_unit==0):
  print('Picolog PT104 opened successfully')
  #0-2.5V for all channels
  cs=mydll.UsbPt104SetChannel(handlePointer,1,6,2)
  cs=mydll.UsbPt104SetChannel(handlePointer,3,6,2)
  cs=mydll.UsbPt104SetChannel(handlePointer,4,6,2)
else:
print('>>>> Picolog ERROR opening device <<<<')

def printALL():
  s.enter(5,1,printALL,())  #re-enter into scheduler
  time.sleep(0.75)
  status_channel_1=mydll.UsbPt104GetValue(handlePointer,1,byref(vv1),0)
  time.sleep(0.75)
  status_channel_3=mydll.UsbPt104GetValue(handlePointer,3,byref(vv3),0)
  time.sleep(0.75)
  status_channel_4=mydll.UsbPt104GetValue(handlePointer,4,byref(vv4),0)
  print("%s: %.1f %.1f %.1f %s" % (time.strftime("%Y-%m-%d %H:%M:%S"),float(vv1.value)/100000,float(vv3.value)/100000,float(vv4.value)/100000,"mV"))

print("datetime: Pico1 Pico3 Pico4 PicoUnit\n")
s.enter(5,1,printALL,())
s.run()

gruenst
Newbie
Posts: 0
Joined: Thu Sep 07, 2017 6:51 pm

Re: PT-104 Problem

Post by gruenst » Wed Oct 04, 2017 6:14 pm

Is the code understandable? Did you experience similar problems?

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

Re: PT-104 Problem

Post by Martyn » Fri Oct 06, 2017 10:46 am

I would suggest doing

Code: Select all

time.sleep(3)
after setting all the channels, before looking to read any of them.
Martyn
Technical Support Manager

Post Reply