Search code examples
linuxhardwareusbmicrocontrolleratmel

Control a USB light via software


I have a little USB-powered light. I'd like to be able to turn it on and off with software. I'll be attaching it to a Linux computer. I have an Atmel ATtiny2313 from a previous project, but I'd rather do this with a simple hack than repurpose my microcontroller.

Is this possible? I suspect this can't be done as the computer won't talk to a device without some kind of USB-compliant firmware?

I found this question, which has a comment suggesting that the OP use an LM317 voltage regulator to change the voltage of the USB out. I don't think this is applicable to me, but thought I'd mention it.

Update:

Looks like I could maybe put USBtiny on my microcontroller, then I could wire it up to the light, then I could write an app to control the controller. Sounds like a lot of work, though. I'd rather do a simple hack, but I lack experience with USB.


Solution

  • I'm going to use my PL-2303-based USB/serial bridge and an ATtiny2313 microcontroller running a USB stack--possibly USBtiny. It'll work like this:

    • The USB light is attached directly to the microcontroller--not the computer
    • An app/driver controls the microcontroller via USB
    • The microcontroller sets the voltage for the USB light

    I'll look into wiring it so there are some resistors on some outputs so I can set the light to different brightnesses, and if I want to do patterns or anything, I'll do them in software.