phidget interface kit not detected

Supporting 2.7 and 3.2+
Post Reply
-Willis-
Fresh meat
Posts: 4
Joined: Wed Nov 06, 2019 2:08 am
Contact:

phidget interface kit not detected

Post 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
User avatar
mparadis
Site Admin
Posts: 959
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: phidget interface kit not detected

Post 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.
-Willis-
Fresh meat
Posts: 4
Joined: Wed Nov 06, 2019 2:08 am
Contact:

Re: phidget interface kit not detected

Post 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).
User avatar
mparadis
Site Admin
Posts: 959
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: phidget interface kit not detected

Post 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?
-Willis-
Fresh meat
Posts: 4
Joined: Wed Nov 06, 2019 2:08 am
Contact:

Re: phidget interface kit not detected

Post 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...
-Willis-
Fresh meat
Posts: 4
Joined: Wed Nov 06, 2019 2:08 am
Contact:

Re: phidget interface kit not detected

Post by -Willis- »

Problem solved !

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

Thanks for your help !
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 19 guests