Page 1 of 1

phidget interface kit not detected

Posted: Wed Nov 06, 2019 2:16 am
by -Willis-
Hi,

I am currently doing projet to use a phidget interfacekit 0/0/4 with a raspberry pi 4 (os=raspbian).
I have written a python script to control the phidget which works well on my laptop.
I have installed the proper libraries on my rasp and the C example "HelloWorld" works fine.
However when I try to run my python script, I get the following message:
"PhidgetException 3 (Time Out) : No Phidgets were detected at all. Make sure your device is attached.
I also tried with the supplied Python example "DigitalOutput" and same result.

I am stuck at this point... What should I verify ?

Thanks

Re: phidget interface kit not detected

Posted: Wed Nov 06, 2019 10:06 am
by mparadis
If the Phidget isn't getting enough power over USB, it may not show up. The Raspberry Pi typically has USB power below what is specified for USB standards (5V 500mA), so you will need an externally powered USB hub to ensure the Phidget has enough power.

Re: phidget interface kit not detected

Posted: Wed Nov 06, 2019 11:35 am
by -Willis-
mparadis wrote:If the Phidget isn't getting enough power over USB, it may not show up. The Raspberry Pi typically has USB power below what is specified for USB standards (5V 500mA), so you will need an externally powered USB hub to ensure the Phidget has enough power.
Actually I have tried with a powered hub and the result is the same.

What is weird is the C example is working fine on my rasp (and if I run lsusb the phidget is definitely there).

Re: phidget interface kit not detected

Posted: Wed Nov 06, 2019 3:28 pm
by mparadis
If it works with the C example, there must be something wrong with both python scripts. Can you post them so I can be sure what you're running?

Re: phidget interface kit not detected

Posted: Thu Nov 07, 2019 2:02 am
by -Willis-
mparadis wrote:If it works with the C example, there must be something wrong with both python scripts. Can you post them so I can be sure what you're running?
I've basically started with a supplied example (which works on my PC):

<code>
from Phidget22.Phidget import *
from Phidget22.Devices.DigitalOutput import *
import time

#Declare any event handlers here. These will be called every time the associated event occurs.

def main():
#Create your Phidget channels
digitalOutput0 = DigitalOutput()

#Set addressing parameters to specify which channel to open (if any)
digitalOutput0.setDeviceSerialNumber(502246)

#Assign any event handlers you need before calling open so that no events are missed.

#Open your Phidgets and wait for attachment
digitalOutput0.openWaitForAttachment(5000)

#Do stuff with your Phidgets here or in your event handlers.
digitalOutput0.setDutyCycle(1)

try:
input("Press Enter to Stop\n")
except (Exception, KeyboardInterrupt):
pass

#Close your Phidgets once the program is done.
digitalOutput0.close()

main()
<code>

In the terminal, I run "python example.py", I get the following error:

Traceback (most recent call last):
File "example.py", line 30, in <module>
main()
File "example.py", line 17, in main
digitalOutput0.openWaitForAttachment(5000)
File "/home/pi/.local/lib/python2.7/site-packages/Phidget22/Phidget.py", line 561, in openWaitForAttachment
raise PhidgetException(result)
Phidget22.PhidgetException.PhidgetException: PhidgetException 0x03 (Timed Out)
No Phidgets were detected at all. Make sure your device is attached.

Now if I run the "HelloWorld.c" example, I get the proper result :

Opening...
Phidget Simple Playground (plug and unplug managers)
Press Enter to end anytime...
Hello Device PhidgetInterfaceKit 0/0/4, Serial Number: 502246
Hello Device PhidgetInterfaceKit 0/0/4, Serial Number: 502246
Hello Device PhidgetInterfaceKit 0/0/4, Serial Number: 502246
Hello Device PhidgetInterfaceKit 0/0/4, Serial Number: 502246

Closing...

Re: phidget interface kit not detected

Posted: Thu Nov 07, 2019 2:22 am
by -Willis-
Problem solved !

It works if I use "sudo python example.py".

Thanks for your help !