I recently bought a USB-powered desk light. Is it possible to control (turn on/off) it with the Arduino Uno? The desk light has 3W so needs 600mA.

  1. Should I connect the USB wire with the 5V pin of the Arduino (which can spend up to 800mA) or should I use an external USB power supply ?
  2. How to control the light when using an external USB power supply ?

3 Answers 3


Use a TIP120 Darlington transistor to switch the current. This webpage has a detailed guide. http://bildr.org/2011/03/high-power-control-with-arduino-and-tip120/ Use the example with the light bulb - no diode is needed in your case.

  • What isn't explicitly mentioned here, but far more important, is that the device needs its own power supply. It should not be connected to either the output of the Arduino's regulator, nor (at least not properly) a USB port to which the Arduino is connected. The one exception might be if you have a higher current USB "power supply" which is not a computer. Feb 22, 2016 at 23:29

You have a couple options here. The main idea is that you're going to add a switch to the light's circuit and that switch will be controlled by the arduino. It's important that you keep the electronics for the light and the electronics for your arduino separate, 600mA will damage your arduino which no one wants. You can power the light and arduino from the same power supply, make sure it can handle the power draw though.

To actually switch the circuit you could use an NPN transistor as mentioned above, with the lamp's - terminal flowing into the C pin, an arduino GPIO pin connected to the B pin and the E pin grounded. When you set your arduino's pin HIGH the transistor will allow current to flow and light up the lamp.

Another option that actually physically separates the circuits is to use an opto-coupler. They're little IC's that serve this exact purpose. The have a light and a light sensitive transistor inside them, so when the light illuminates, the transistor allows current to flow. In your case, you would hook up an arduino pin to the + pin on the light side of the coupler and ground the - pin. Then connect your lamp in the same to the other side, +5v into the + pin on the transistor side and the lamp's positive terminal to the output pin. Again, when the arduino pin goes HIGH, the lamp will light up.

  • Put the lamp on the collector side. Aug 27, 2014 at 6:27
  • @geometrikal You're correct, I was thinking that the transistor would come before the lamp but I suppose it should be placed after the lamp.
    – Doowybbob
    Aug 27, 2014 at 13:20
  • yep, cause you need V_BE to be saturated Aug 27, 2014 at 13:47
  • power lamp from 5v source ( not from the arduino 5v port, but could be spliced into the same line powering the arduino or use a hub )
  • use a transistor to switch the usb 5v line
    • connect the base pin (and resistor) of the transistor to any arduino digital out pin
  • Actually, if you are going to do it that way, use an NPN transistor and switch the ground line. But there are more issues. For example, the light should not be powered through the Arduino's regulator. Aug 26, 2014 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.