USB in python

Diez B. Roggisch deets at
Fri Jan 23 07:58:48 CET 2009

Astan Chee schrieb:
> Diez B. Roggisch wrote:
>> Astan Chee wrote:
>>> Hi,
>>> Im trying to write a program for my USB device and I'm thinking of using
>>> python to do this. The USB device is of my own making and it is
>>> activated when one of the two data pins of the USB is given about 5V (or
>>> similar to whatever the power pin is getting). Now I'm confused to if
>>> the software to activate this can actually be written and how do I do
>>> it? Any examples? I've seen pyUSB but it doesn't give me control over
>>> the hardware and how much power is going through the data pins.
>> Unless I'm not getting something here.
> Hi,
> Thanks for all the responses but I forgot to mention that I have very 
> little hardware understanding (at least in english) and the device 
> itself it very simple and only needs about 5V power to be active. The 
> problem here is that I want to control when the device is active using a 
> computer so I thought USB might be a good choice since its simple (but 
> didn't turn out to be). I'm open to any other suggestions on how I might 
> achieve this hardware and software-wise (as in what interface should I 
> use, etc). Also I'm trying to stay away from (complex) micro controllers.
> Any ideas?

Others suggested the parallel port. It is the natural choice for such 
things, with two caveats:

  - it is legacy, and thus often not available on modern hardware, 
especially on mobile ones. So if you want it be prepared to additionally 
buy a usb2parallel-adapter.

  - it's electrical specs aren't as robust I fear. USB allos up to 500mA 
to be drawn, and shouldn't break if you try more & fail (albeit, that 
might be something that isn't true all the time). So you can draw quite 
a bit of current from it (the stupid USB-cup-warmers are an example of 
that). I have often had broken parallel-ports, and I think the reason is 
that they *ARE NOT* specified to drive anything - they only provide 
low-current control-lines. So whatever you design, you need a second 
power-source then.

All in all, using a USB-controller is IMHO the best solution. The 
AT90USBKey is a low-cost evaluation-board. ATMEL provides quite a bit of 
example-code, and there is other FOSS available.

I have to admit though that the whole USB-topic isn't the easiest thing.


More information about the Python-list mailing list