Pages: [1] 2   Go Down
Author Topic: Switching 12v lights with 3.3v  (Read 5691 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 112
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm looking to switch a set of LEDs (think vehicle tail lamps) from a 3.3v pin on an XBee or perhaps later an Atmega (also at 3.3v).  Each of the LED lamps should be under an amp @ 12v.  Logic level mosfets seem to be popular, like the IRLZ24, but even these seem to require 5v to get full saturation.

I'm looking to independently switch on and off 4 different sets of lights.  Right now my project already has 3.3v and 12v power available.  Which would make more sense?
  • 3.3v to a mosfet that is fully operated by 3.3v. (exist?)
  • 3.3v to a small transistor to switch 12v to a mosfet to switch the lights. (most parts, but seems most likely)
  • 3.3v to a transistor that can switch the lights directly. (possible?)
  • 3.3v to 5v via single direction level shifter, to logic level mosfet. (would require adding 5v regulator just for the shifter, but could handle all 4 in one chip)
Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 508
Posts: 31432
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

They will all work apart from the first one. I don't know of a 3V3 mosfet.
I would go for:-
Quote
3.3v to a small transistor to switch 12v to a mosfet to switch the lights.
On the grounds:-
a) it is a mosfet so minimum heating on the power switch.
b) if you have to shift the gate signal why not do it so you can user cheaper mosfets.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 112
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So, something like this?



Assume all grounds are connected.
Assume LED assembly already contains resistors, etc.

Which transistor would work? Would a 2N2222 be ok?
Which mosfet would work? Would an IRF510 be ok?

Edit: Doing some more reading, this looks wrong.  Emitter follower and all that.  I'll see if I can figure this out.

Edit 2: After looking through the forums, I found a circuit like this:



This circuit should accomplish what I want, except I'll have to hold the output pins high to have the lights off.  I imagine this is fine, except in my head it "feels" wrong.  Like I'm wasting power or wearing out outputs since these lights will be off 99% of the time.
« Last Edit: May 11, 2010, 03:07:43 pm by neonpolaris » Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 508
Posts: 31432
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes that last circuit is right.

Quote
except I'll have to hold the output pins high to have the lights off.

Yes you do that's the way electronics works.
Logged

0
Offline Offline
Tesla Member
***
Karma: 114
Posts: 8920
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
This circuit should accomplish what I want, except I'll have to hold the output pins high to have the lights off.  I imagine this is fine, except in my head it "feels" wrong.  Like I'm wasting power or wearing out outputs since these lights will be off 99% of the time.
If you only want the LED to be on when the arduino output pin is high, then try a modification on the first circuit. Delete the 100 ohm resistor, and try a 5-10k resistor in the second resistor position. The 2N2222 transistor should be ok. The IRF510 may only be rated low on current depending on how much the LEDs draw. Note, I haven't tried this setup, but I'd give it a shot to see if it works. Also make sure the grounds are common

5.6A, 100V, 0.540 Ohm, N-Channel Power MOSFET
« Last Edit: May 11, 2010, 06:55:17 pm by zoomkat » Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 508
Posts: 31432
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
If you only want the LED to be on when the arduino output pin is high,

Absolutely no point, you are not wasting electricity it is the way it works.

Quote
then try a modification on the first circuit.
No matter what you do with the first circuit you will never be able to switch 12V with it because it is an emitter follower and so the voltage on the emitter can never be greater than 3V3 - 0.7 = 2.6V. This is not enough to turn a FET on.

Quote
The IRF510 may only be rated low on current depending on how much the LEDs draw.
That sentence makes no sense at all.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 112
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the verification, I've set up the circuit today and it works as expected.  I tested with a RBBB running 3.3v instead of my XBee, since I fried one the other day and I don't know why.  I won't be using them when moving/testing/rearranging my circuits until everything else is proven.

Also, I read that mosfets can be ran in parallel.  If I find myself needing to switch a little more than my mosfet can handle, could I connect each gate, drain, and source, or is this bad?  Everything is well under my mosfet's limit, but I was curious.  I've heard people ask about running voltage regulators and such like that, but it usually doesn't work the way you'd expect.
Logged

0
Offline Offline
Tesla Member
***
Karma: 114
Posts: 8920
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Absolutely no point, you are not wasting electricity it is the way it works.
Well, if his arduino loses power or resets, his LEDs may well fail to the "on" condition. Not sure if this would be important to him or not. Not exactly "fail safe".
Edit: Make that xbee or what ever is suplying the 3.3v
Quote
No matter what you do with the first circuit you will never be able to switch 12V with it because it is an emitter follower and so the voltage on the emitter can never be greater than 3V3 - 0.7 = 2.6V. This is not enough to turn a FET on.
When the NPN is turned on, it should provide a flow path for the 12v to the gate, possibly charging it to ~11v. Bottom line, either it will work or not.  smiley-wink

Quote
That sentence makes no sense at all.

It is probably poorly phrased, with the intent to make the point that the MOSFET is only rated at ~5a, which may be marginal for use with automotive lighting setups. As to your not understanding the statement, well you met my expectations on that point.  smiley
« Last Edit: May 12, 2010, 09:54:19 pm by zoomkat » Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 508
Posts: 31432
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
When the NPN is turned on, it should provide a flow path for the 12v to the gate, possibly charging it to ~11v.

No do some research into how things work.

Quote
As to your not understanding the statement, well you met my expectations on that point.
Sure I am well known for not understanding things.  smiley-razz


Quote
could I connect each gate, drain, and source, or is this bad?  
Yes this is fine, FETs will happy share current, transistors will not.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 112
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, I have a new problem.  When I designed this, I was only thinking about using discrete lights.  It looks like I'll need to use some light assemblies that have a couple different lights in them (running lights and brake lights, running lights and blinker) but they are all common cathode.  Since I'm switching the grounds with my mosfet, this won't work.

Can I just replace my N-channel mosfet with a P-channel and move the light assembly to between the drain and ground?
Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 508
Posts: 31432
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Can I just replace my N-channel mosfet with a P-channel and move the light assembly to between the drain and ground

You can but then you need to supply the FET with a gate voltage that is the same as the source to turn it off. As this is up at 12V and the arduino will only give 5V you need a transistor to generate a 0 to 12V output to then feed to the FET.
« Last Edit: May 25, 2010, 08:27:16 am by Grumpy_Mike » Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 112
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I see. So something like this, but replace T2 with my P-Channel mosfet?


(image taken from http://www.winpicprog.co.uk/pic_tutorial_extras.htm)
« Last Edit: May 25, 2010, 09:16:07 am by neonpolaris » Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 508
Posts: 31432
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes that sort of thing. You don't need R3 if the gate / source rating is over the 12V. In fact with this arrangement (without R3) you have no need to use a logic level FET and a normal gate turn on voltage device will work.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 112
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks!  I'll give that a go and see how it works for me.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 112
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Got the parts in and tested, works as expected.  Thanks Grumpy Mike. I wish I could go to the UK just so I could shake your hand (or buy you a beer).
Logged

Pages: [1] 2   Go Up
Jump to: