5

Hey, so I'm just playing around with a usb cable and an LED. I plugged in the usb to my computer and connected ground with the LED ground and the last usb pin (+) to the LED.

It stays lit bright. I moved the wire from the usb power pin to the D+ pin. Is it possible that I could send a bit stream through usb that would in turn light up this LED?

I'm not even a beginner with usb, drivers, etc. I just had the idea that hit me and wanted to see if it was possible as a sort of show off to friends.

flumpb
  • 551
  • 2
  • 5
  • 14
  • You should perhaps ask this on http://electronics.stackexchange.com although they'll no doubt tell you need something more sophisticated than this to work. – JohnB May 26 '12 at 17:00

4 Answers4

6

Not directly, and even if you could, it wouldn't be very useful since the usb protocol constantly sends pings over the wire; the led would probably appear continuously dimly lit.

If you wanted, you could make a low-pass amplifier to get it done. If you go this route, check out USB In A Nutshell to learn more about the USB protocol.

Shawn J. Goff
  • 46,081
2

Another alternative might be a usb-serial or usb-parrallel port dongle.

Note you will need a resistor in series with your LED to limit the current to suitible amount to avoid burning out something (either the LED or the interface).

Another option is, there are off the shelf devices available that do something like what you ask, e.g. at time of writing 'googling' "usb gpio" produced many links.

  • Most USB<->Parallel converters are only designed to work with printers and don't behave the same when you want to simply connect a LED to them and control data lines manually. –  Dec 28 '14 at 09:44
1

If you have an old-style parallel or serial port, this is much easier.

pjc50
  • 3,026
0

Every USB device must implement basic features of the USB protoco, starting with enumeration. If it doesn't, your computer will hold both data lines at a constant 0V via a 15 kOhm resistor.

And even if you connect your LED in parallel with a real device (like a mouse), you won't see anything interesting. USB protocol uses NRZI encoding with bit stuffing, so there is no way to hold the data lines at a constant voltage level long enough for your eyes to detect the change in LED brightness.