ambient LEDs as peripheral for pc

Discussion in 'General Electronics Chat' started by akramer08, Jun 5, 2014.

  1. akramer08

    Thread Starter Member

    Jan 23, 2013
    I recently had an idea for a new project. I want to put ambient LED strips on the back of my monitor. But the twist I want to put on it may be a little complicated. I want to be able to plug in the LEDs into a USB port (like most peripherals) and have the color change depending on the user that is logged into the pc. I have 3 users myself, my wife, and a guest (blue, pink, white). If anyone has any advice or suggestions please let me know.
  2. MrCarlos

    Active Member

    Jan 2, 2010
    Hello akramer08

    Because each user has their own password, the PC somehow detect who is using it.

    So: a program on the PC is required to detect who is the current user and send a signal to the USB to turn on the LED on the right color.

    Therefore: between the PC and the LED’s must have a device that understands what is sending the PC to the USB and act accordingly. Turning the appropriate LED.

    It could be a PIC with a suitable program.

    Knowledge to develop programs for PC's
    Knowledge to develop programs for PIC's.
    Device programmer for PIC.
    Software is needed to develop the program for both the PC and the PIC
    A program to edit the source code. for the PC and the PIC.
    A cross-compiler to generate the HEX file for PIC and the EXE file to your PC.

    Or know who could develop the above.
  3. akramer08

    Thread Starter Member

    Jan 23, 2013
    I do have some knowledge in programming in C# in visual studio and some knowledge with PICAXE. I have a 20M2 on hand if I can use it. Where should I go from there?
  4. #12


    Nov 30, 2010
    First thought is, "It's going to require 3 USB ports", but you could use the data line to tell a local processor which LEDs to send 5 volts to.
  5. BobTPH

    Active Member

    Jun 5, 2013
    You might be better with a USB GPIO board. These plug in to USB and have inputs and outputs that you can read / set from a PC program. This would make the micro unnecessary.

    Here is an example:

  6. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    Any device that can output some sotr of state information could make this work. That runs from the fancy (and expensive) lab devices thru things you can get off EBay by searching for "USB relay."

    The PC needs a program that loads at start-up to detect the user and send the appropiate info out the USB bus.

    Should not be very difficult for a one-off project.
  7. AnalogKid

    AAC Fanatic!

    Aug 1, 2013
    BobTPH is right, an off-the-shelf USB-to-GPIO module will do everything you want outside the computer with only one USB port. But so will one serial port and your PICAXE. Or one parallel printer port if your box is that old. For all of these outputs, you will need a program that makes an operating system call to determine the user. It's burried in Windows somewhere.

    Depending on the external interface device and your LED string current requirement, you might need to whip up some open collector drivers if the interface device can't make the current by itself.

  8. Doktor Jones

    Active Member

    Oct 5, 2011
    In Windows, there is an environment variable %USERNAME% that indicates the current logged-in user.

    There is also a device called the Digispark that is based on the ATTiny85 and has a USB interfacing option, though I'm not familiar with how to communicate with it over USB. I *believe* there are still three output pins available when USB is in use, so you could use software PWM to drive MOSFETs which would in turn control the power to the LEDs.

    I might suggest having the "switchbox" (where the MOSFETs are) be in a separate enclosure, so the Digispark acts as a USB dongle which then has four wires going from its outputs (and ground) to the switchbox. You'd then have an external power supply that goes into the switchbox, feeding the necessary power to drive however many LEDs you intend to use.

    If you keep yourself down to a reasonable number of regular 5mm RGB LEDs (like six or less), you could theoretically power it right off the USB bus; 3(RGB) * 6 * 0.02A = 360mA, and while I don't know the exact power draw of the Digispark, it shouldn't be more than 600mA (keeping you under 1A total). Most desktops are capable of supplying at least 1A even if the spec says otherwise, so that should work.