What's a safe way to switch a DC load?

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

What's a safe way to switch a DC load?

Postby Bren » Thu Feb 02, 2012 10:16 pm

Hi all,
I'm very new to electronics and have been having some fun with a bunch of minor Arduino projects lately. I'm branching out to try some new things and I've got some very basic questions.

I'd like to take a DC light strip (courtesy of Ikea) meant for banned cabinet undermounting and drive it with a PIR motion sensor. Ultimately, I've got some things I'd like to do to drive it more interactively with an Arduino, but for now I'm just trying to understand the best way to switch this light on and off.

The wall wart outputs 12VDC, 5W max and the full strip of lights pulls about 140mA when it's on. I want to switch this without using a noisy relay (don't want the 'click' when it activates).

What would be a good (and logic pin safe) way to deal with switching a load like that?
Bren
 
Posts: 3
Joined: Thu Feb 02, 2012 7:18 pm

Re: What's a safe way to switch a DC load?

Postby EasternStarGeek » Thu Feb 02, 2012 10:50 pm

That would be a piece of cake to do with a single NPN transistor. A 2N2222 can safely switch up to 500mA without a heatsink, but if your lamps are incandescent, you'll need a bigger transistor than that. Your lamps, when cold, can pull up to 1.5A for several milliseconds. You'd do well with Darlington power transistor, like a TIP29.
http://www.mouser.com/ProductDetail/Fai ... 6%2fv5c%3d

Do not ignore the incandescent surge phenomenon. Leave yourself a safety factor of at least 10x (yes, that's right- ten times the hot current) when specifying any kind of switching device for such lamps. Many a newbie (and even a few folks that should know better) have been burned by this!

If you want to support this great site, you can also use a power MOSFET like this one:
http://www.adafruit.com/products/355

It's way overkill for your application, but you can always use it for something else, including switching on lots and lots of lights!

Just wire it up per the usual tutorials. You will need:

A TIP29 transistor (or N-Channel MOSFET)
a 1/4 Watt resistor, 4.7K for a TIP29 (Optional for a MOSFET, but if used, value should be less than 220 ohms)

A. Connect the Positive terminal of the Wall Wart to one side of the lamp
B. Connect the other side of the lamp to the Collector (Drain) terminal of the transistor
C. Connect Base (Gate) terminal of the transistor to one end of the resistor
D. Connect the other end of the resistor to a digital output
E. Connect the emitter (Source) terminal of the transistor, the Negative terminal of the wall-wart and at least one Arduino GND terminal all together.

Done!

(By the way- if you use the analogWrite(pin, n) command on a PWM output, you can dim the lamp any way you want, or ramp the brightness up and down slowly or quickly, etc.) where 0<n<255

Caution- many LV lights use 12V AC. Make absolutely sure you have a DC wall wart! The above circuit won't work on AC

Have fun!
Last edited by EasternStarGeek on Thu Feb 02, 2012 11:03 pm, edited 2 times in total.
EasternStarGeek
 
Posts: 247
Joined: Mon Dec 13, 2010 12:39 pm
Location: Upper Eastern Tennessee

Re: What's a safe way to switch a DC load?

Postby Bren » Thu Feb 02, 2012 11:01 pm

Thanks for the detailed yet simple explanation! I'll give that a try this weekend.

Yep, it's definitely DC. I mostly just don't want to fry one of my Arduino boards as part of my experimentation. :wink:

Nothing quite like a helpful forum! :D
Bren
 
Posts: 3
Joined: Thu Feb 02, 2012 7:18 pm

Re: What's a safe way to switch a DC load?

Postby EasternStarGeek » Thu Feb 02, 2012 11:05 pm

One more thing- you could, in theory, run the Arduino itself from the wall-wart, if the output DC is clean enough. Considering it was designed for lamps, this might not be the case.
EasternStarGeek
 
Posts: 247
Joined: Mon Dec 13, 2010 12:39 pm
Location: Upper Eastern Tennessee

Re: What's a safe way to switch a DC load?

Postby Bren » Fri Feb 03, 2012 8:35 am

Good idea. How could I test this?
Bren
 
Posts: 3
Joined: Thu Feb 02, 2012 7:18 pm

Re: What's a safe way to switch a DC load?

Postby adafruit_support_bill » Fri Feb 03, 2012 8:56 am

How could I test this?

You can connect via the DC barrel connector - or via the GND and VIN pins. The Arduino regulator will handle 12v DC ok. The question is noise. The regulator and filter capacitors on the Arduino will handle what comes out of most unregulated wall-warts. But if there is too much noise, it can cause the processor to behave erratically.

I'd give it a try. I suspect it will be fine. If you start seeing random resets or other strange behavior, you can either add more filtering or go to a separate supply.
User avatar
adafruit_support_bill
 
Posts: 16072
Joined: Sat Feb 07, 2009 9:11 am

Re: What's a safe way to switch a DC load?

Postby philba » Sat Feb 04, 2012 12:11 pm

good advice so far. A few thoughts/comments:

The inrush current (cold filament current) for incandescent lights can actually be as high as 15X steady state. This is mitigated a bit since that's the peak and it declines exponentially from there. In all it lasts for several hundred mS so you could push limits some without concern. Too many variables to be specific, though.

On your wallwart. You definitely can run the arduino off it but several things to be aware of.

The 12V to 5V drop means 7V are being dissipated in the regulator. This isn't a problem if you are just powering the Arduino (<20 mA) but if you're running a lot of other stuff off of 5V, it might get pretty hot. If the wallwart is spec'd for higher amps, it may run well above 12V so the drop (and heat) will be larger. A "12V 1A" wall wart is designed to deliver 12V at the specified draw. Lower draw = higher voltage. It may well deliver 15-17V at 140-150 mA. Bigger isn't always better in this context. I have a 7V 700 mA WW I'm using to power a mini and the voltage at Vin is 10.4V. It's only pulling 18 mA, though. Unloaded, it reads 11.3V

Also, I'd at least add a diode (like a 1N400x) inline between the WW/light strand power feed and the arduino Vin. This is to prevent inrush voltage sag from disturbing the vreg supply. Since the filter cap in the arduino is pretty small, the light strand inrush could suck it dry. It may not be necessary but 5 cents seems like way cheap insurance. Personally, I'd also put a 100-220uF across Vin and Gnd after the diode so nothing would keep the arduino from having clean power. Tracking down power related glitches is pretty maddening.
Image
philba
 
Posts: 387
Joined: Mon Dec 19, 2011 5:59 pm


Return to General Project help

Who is online

Users browsing this forum: No registered users and 2 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [108]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[31]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[34]
LCDs & Displays[48]
Components & Parts[70]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[111]
 
Wireless[14]
Cables[62]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[70]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]