This doesn't sound like an USB-device to me. The USB-standard defines a
serial line protocol, where of course the state of the TX-line is set to
whatever the protocol dictates. And as not all of the things put out on the
line are of the programmer's own doing, it will be on and off all the time.
And no piece of software is going to control that - it's already implemented
in the USB-host-controllers inside your computer.
Even with a considerably more primitive RS233 line you'd not stand a chance
with that design.
Unless I'm not getting something here.
I've created USB-devices based on the AT90USB1287 from Atmel, and there you
can of course use the libusb (and it's wrapping PyUSB) to acccess the
device, and e.g. drive a single port-pin of the uC high - to activate,
whatever you want to activate.
Diez
Your approach doesn't sound right to me. I don't believe you can control
the PINs of the USB host interface directly. You need to configure the
host controller - OS is giving you interfaces and abstration for the
different device types. All you need to do is to implement the end
points as per spec in your hardware and write handler for your
hardware's USB ids.
Regards
Tino
Brian Vanderburg II
> 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).
USB is definitely not simple. USB is exremely complicated (and
rather badly designed, IMO).
> 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? Thanks again Astan
Standard IBM PC parallel printer ports offer a bunch of 5V I/O
lines that are fairly simple to control in software.
--
If you don't have a built-in parallel port then there are those USB to
serial/parallel converters.
Brian A. Vanderburg II
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.
Diez
If all you need is on-off - why can't you just use a switch?
Diez
Sorry, but you have NOT created a USB device, and I sincerely hope you do
not try to plug it in to a real USB port.
Despite the "serial" in the name, USB is much more than just a pair of
wires, like RS-232. USB is a standard protocol-based bus, like Ethernet,
and anything that is plugged into it must follow the protocol. You don't
get a "voltage", you get a 480 MHz differential digital signal train. The
wires are controlled by a USB host controller. You cannot override its
behavior.
You might be able to achieve your goal by using a parallel port, or by
using a USB-to-serial port adapter, or by using one of the many simple and
affordable USB experimenter's kits in the world.
--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.
> Diez B. Roggisch wrote:
>>>
>>>
>> If all you need is on-off - why can't you just use a switch?
>>
>>
>>
> Because I want to control the on-off the device using a computer and
> write software for it (which I am confident I can do if I had references
> to how the wrappers to said interface). Cheers
> Astan.
>
How about (a crazy idea) using the audio jack out? (DISCLAIMER: Little
Hardware Experience). High pitched sound (or anything in sound-ology that
means high voltage) means the device is on and low pitched sound off. The
device will need an additional transistor to separate low voltage from
the high voltage. I don't know how much power can be pulled from jack
out, but for a home brewn device it is still feasible to draw power from
USB and signal from jack out.
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
In which case the Arduino may be a good place to start. The recent
duemilanove boards use USB to communicate with the host, and so the USB
port should be available to the microcontroller. We areg etting some way
away from Python now, of course ...
This is the FT245 chip which is basically USB-to-Parallel.
Chips: http://www.ftdichip.com/Products/FT245R.htm
Kit/Board: http://www.ftdichip.com/Products/EvaluationKits/UM245R.htm
The spec sheet for the board seems quite simple. It's pin out is
similar to that of a parallel port in that you have your data lines
DB0-DB7, etc. It can also be connected in bus-powered configuration
(~100mA) or self-powered configuration. The kit is more expensive than
the chip itself, but probably easier especially if you don't have any
experience with surface mount.
You could build it into your device. You could also create a simple
switch box out of it to control external devices, maybe connecting each
of the data lines to relays to turn on/off eight devices, etc.
Brian Vanderburg II
> How about (a crazy idea) using the audio jack out? (DISCLAIMER: Little
> Hardware Experience). High pitched sound (or anything in sound-ology that
> means high voltage) means the device is on and low pitched sound off.
1) Pitch has nothing to do with voltage. A high-pitch sound
and a low pitch sound can have the exact same voltage.
2) The OP's device requires quite a bit of power. There is
almost no power available from the line-out jack, and the
voltage is limited to about 1V. If his sound card has a
power-amp (none do these days), he might be able to get a
usable amount of power.
> The device will need an additional transistor to separate low
> voltage from the high voltage.
He'll need more than a transistor. He needs a power supply,
some sort of rectifier/detector, and a comparitor. It would be
more interesting to use notch filters to detect different
frequencies so that you could have multiple output "bits".
> I don't know how much power can be pulled from jack out,
Almost none, and what's there is very low voltage.
> 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.
--
Grant Edwards grante Yow! Not SENSUOUS ... only
at "FROLICSOME" ... and in
visi.com need of DENTAL WORK ... in
PAIN!!!
I second that.
Arduino to microcontrolers, is what Linux was to kernels back in the
90ties (now it's mainstream), or maybe what python is/was to Java.
--
дамјан ( http://softver.org.mk/damjan/ )
() ASCII Ribbon Campaign
/\ Keep it simple!
> On 2009-01-26, Lie Ryan <lie....@gmail.com> wrote:
>
>> How about (a crazy idea) using the audio jack out? (DISCLAIMER: Little
>> Hardware Experience). High pitched sound (or anything in sound-ology
>> that means high voltage) means the device is on and low pitched sound
>> off.
>
> 1) Pitch has nothing to do with voltage. A high-pitch sound
> and a low pitch sound can have the exact same voltage.
>
> 2) The OP's device requires quite a bit of power. There is
> almost no power available from the line-out jack, and the voltage is
> limited to about 1V. If his sound card has a power-amp (none do
> these days), he might be able to get a usable amount of power.
>
>> The device will need an additional transistor to separate low voltage
>> from the high voltage.
>
> He'll need more than a transistor. He needs a power supply, some sort
> of rectifier/detector, and a comparitor. It would be more interesting to
> use notch filters to detect different frequencies so that you could have
> multiple output "bits".
>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.
>> 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.
Getting power from USB should be much easier than getting data while the
jack out can provide simple on-off signal.
> 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
Astan Chee wrote:
>
> Diez B. Roggisch wrote:
>>>
>>
>> If all you need is on-off - why can't you just use a switch?
>>
>>
>>
> Because I want to control the on-off the device using a computer and
> write software for it (which I am confident I can do if I had references
> to how the wrappers to said interface).
What I'm using is dallas 1wire stuff to do such things.
The dongle (which is available as USB too) connects
to the host and you have a lib with bindings even to python
for it: http://www.owfs.org/
The other end is just a bus with a telephone wire...
The most interesting part might be temperature sensors but
there are a lot of GPIO chips, electronic resistors, A/D converters
etc. available. Most of the stuff can be even ordered as sample
from dallas/maxim.
Regards
Tino