USB in python

Grant Edwards invalid at invalid
Tue Jan 27 11:05:15 EST 2009


On 2009-01-27, Lie Ryan <lie.1296 at gmail.com> wrote:

> From the little I know on electronics, a simple, single
> transistor would (almost) immediately switch from
> on-to-off-to-on depending on the voltage of the control pin (I
> think it was the middle pin). I was suggesting this 
> simplistic hack because as far as I comprehend the OP's need,
> he only need on-off switch instead of a complex multiple
> output bits.

The audio output jack outputs AC (alternating current).  If you
put AC into a transistor, you get AC out.  Hence the need for a
rectifier/detector to convert the AC signal into a DC level. To
reliably get an on-off state from an analog DC level, you need
something with some hystersis (e.g. a comparitor). Depending on
the requirements it may possible to do impliment a comparitor
with hysteresis using a single transistor.

If you're looking for a digital output signal whose DC level
you can contol, then either the printer port or the serial port
is a better option than using the sound-card's line-out which
is an analog AC output.

>>> I don't know how much power can be pulled from jack out,
>> 
>> Almost none, and what's there is very low voltage.
>
> That's why the power is taken from USB port.
>
>>> but for a home brewn device it is still feasible to draw power
>>> from USB and signal from jack out.
>> 
>> It would probably be easier to buy a USB-parallel port chip.
>> Then he's got power from the USB bus and something like 14
>> parallel I/O pins he can control.  Alternatively A USB-serial
>> chip will provide 2 outputs and 4 inputs.
>
> The idea was made on the basis that a USB microcontroller is
> not used.

I didn't say anything about using a USB microcontroller.  There
are dead-simple and cheap USB-serial and USB-parallel chips
that you can buy that provide the equivalent of a serial port
or parallel printer port via USB.

> Getting power from USB should be much easier than getting data

Using a USB-serial or USB-parallel chip isn't really much
harder than getting power from the USB port, and it's simpler
than building a detector/comparity circuit to connect to the
audio line-out.

> while the jack out can provide simple on-off signal.

With the addition of a rectifier/detector and an appropriate
comparitor circuit, yes.

-- 
Grant Edwards                   grante             Yow! Civilization is fun!
                                  at               Anyway, it keeps me busy!!
                               visi.com            



More information about the Python-list mailing list