I have The following
1 Arduino Uno
2 A Few dozen N channel Non-Logic Level Mosfets
3 a few dozen 8 Bit Shift registers
4 A few dozen PnP transistors
5 12Volt Power Supply (car & battery)
6 5Volt Vreg for the Arduino and Shift Registers
7 Complete Compliment of Resistors, Diodes, and capacitors
What I'm trying to accomplish is make a programmable lighting controller to update an older vehicle that doesn't have Automatic headlights, courtesy lights or any of that. also add some things like switchback turn signals or maybe a chase pattern turn signal.
I've so far gotten The Arduino and shift register part worked out. I've gotten it to do some basic blinking and what not but those are all logic level components. The Mosfets for controlling the lighting are not logic level. I'm trying to work out how to switch them on and off. My guess is that I can Switch a small pnp transistor with the Shift register, Take the emitter side of that and use it to switch the Mosfet.
I've got it breadboarded out but not getting any love from the mosfet. It turns on but doesn't turn off.
When I take the the gate pin on the mosfet and drop it on to the - and +12v it switches as expected.
I'll post my crude block drawing and see if anyone can help me out with this. It'd be pretty cool to make it work.
almost forgot I've got the little transistor, collecting on the 12v side emitting to the Mosfet, and the base goes to the Shift Register.
I'm sure my diagram is pretty nonstandard it's more of pseudocode .
DoggerDaze:
So a 10k from from gate to ground on that mosfet?
Yes.
what would be recommended for the shift register to transistor base Resistor?
1-10k will do fine here.
As you're using shift registers I assume no PWM or otherwise fast and frequent switching.
Oh, then I just realise, that won't work still, as with the shift register HIGH (5V) you will still be switching on the PNP as its emitter is of course connected to the 12V.
The way to switch a 12V gate is with an NPN transistor and pull-up on the gate. This way of course the MOSFET defaults on, and your lights will flicker as the Arduino takes time to start up and set the shift register outputs low. Or maybe those outputs default to low themselves, then the MOSFET is switched off faster, nonetheless all lights will be on when the Arduino is off.
If you want your MOSFET to be off by default, you have to drive them through an optocoupler instead. So pull-down resistor on the gate, opto output between gate and 12V, shift register with appropriate current limiting resistor (about 1k) on the opto onput.
DoggerDaze:
What I'm trying to accomplish is make a programmable lighting controller to update an older vehicle that doesn't have Automatic headlights, courtesy lights or any of that. also add some things like switchback turn signals or maybe a chase pattern turn signal.
Is this vehicle positive or negative earth? (Negative earth is far more common and requires p-MOSFETs and NPN level shifters for them). You have the right components to switch low-side, which won't work with a negative earth vehicle where the return current comes via the chassis and bodywork and cannot be switched.
For switching you always use a common-emitter or common-source configuration. It pays to learn the symbols for components and learn to draw circuits using them, its the language of electronics.
I put that link in img tags but it doesn't appear to have shown up.
did a little tweaking to the diagram and added some proper circuit design symbols. Does this look more reasonable?
Based on what I've read and seen nfets are preferred because of their low resistance when fully turned on, and the fact that they are more plentiful and cheaper. I intended to get around the negative ground switching situation by using the little pnp transistor as the switch that turns the nfet on and off.
This won't be a high speed pwm switching application. Turn on and keep headlight bulb on at night . switch turn signals on/off with timing of .5 - 1 second. Then maybe get fancy in code to make a chase or switchback for the turn signals.
The headlight assemblies each have 7 different lighting connections.
1 and 2 H/L beam headlight
3 side marker
4 led running light
5 and 6 H/L blinker
7 Led Halo rings.
I plan on using the WiFi Node MCU as my final "arduino" controller. I have several of them and 3.3v vregs for them and the logic level shifters. I'm just trying to proof the cicuits out and get it all honkydory from the shift reg to the load at this point.
I realize the mosfets are extreme overkill for small 200ma led components, but am doing it this way for ease of duplication. I also plan on adding light bars and other accesories that will have higher power demand.
Thanks again everyone for you insights and guidance.
I think I have the collector of pnp transistor connected to +12v and emitter out to the Gate of the n-fet. With the base pulled up to to 12v via the 10k resistor, but also connected to the shift reg. I'd be running the shift reg inverted such that 0v is on for the circuit and 5v is off.
I could add an npn transistor to switch the pnp. And not run "inverted" in the shift reg.
No matter, it won't work this way as 5V < 12V so the transistor is very much on when 5V is applied to the base. The base has to be brought to 12V (the collector potential) to switch off.
I intended to get around the negative ground switching situation by using the little pnp transistor as the switch that turns the nfet on and off.
No, doesn't work, you HAVE to switch high-side with negative earth.
DoggerDaze:
I think I have the collector of pnp transistor connected to +12v and emitter out to the Gate of the n-fet. With the base pulled up to to 12v via the 10k resistor, but also connected to the shift reg. I'd be running the shift reg inverted such that 0v is on for the circuit and 5v is off.
Your circuit is upside down. PNP requires collector more negative than emitter. Emitter to the 12V rail, collector to the n-FET, then if you bring the base upto 12V the thing will switch off. If the base is below 12V it will be
switched on. Thus you have to level shift upto 12V to drive this arrangement, requiring an NPN to drive the
PNP to drive the n-FET.
Clearly overcomplicated.
logic-level n-FET is what you need to low-side switch 12V from logic output.
If you want to high-side switch you need NPN to drive a p-FET switch.
That's how its done. The only other way is to generate a secondary supply at 24V to allow
n-FETs to switch high-side. That's even more complicated.
So would that 10k across collect and base pull up to 12v and shut the pnp transistor off? Then the shift reg acts as a sink to pull down to 0v when the pin state on that output is in the off state?.
If the shift reg won't sink the base I could add one more transistor npn switched by the shift reg->Switching the pnp->Switching the n-fet.
I know the n-fets switch by voltage and the transistors switch with current. I know the outputs on the shift reg can offer enough current to switch the transistors. This is why I'm thinking that this is an appropriate solution.
I have a circuit in my other vehicle that switches via npn transistors. It does the following and it works for over 6 years now.
Two circuits one for left one for right.
Two 12v rbg led strips
Red 50% while driving
Red 100% both sides while brakes applied
Red 100% both sides while brakes applied and approprite side switches red/amber while blinker engaged.
White 100% both sides while in reverse.
This was a low amperage/wattage application so I did it all with tiny transistors some resistors and capacitors. Using a nano since there were only really three channels to control r/g/b . I arranged pnp from the nano to switch npn to give ground to the strips. Since they are common + and switched -.
I don't see how this is different except I'm dealing with higher amperage so tiny transistors wont work forbswitching the final load.
I understand that the nfets I have need +10v at the gate over the source. But the +12v coming from the pnp is greater than 0v at the gound side of the source and thus should fully turn on the nfet. I have validated this by taking the gate pin of the nfet and aternately connecting it to +12 and 0(ground). And the nfet works as expected turning on fully at +12v and off when grounded.
I am not trying to switch high side. I am trying to switch low side with the nfet. I am trying to drive the nfet with the pnp . maybe the solution is the drive the pnp with an npn being driven by the shidt register. Doesn't seem all to over complicated.
I could go and buy a bunch more logic level gated fets , but I already have this pile of non-logic fets and other components.
DoggerDaze:
So would that 10k across collect and base pull up to 12v and shut the pnp transistor off? Then the shift reg acts as a sink to pull down to 0v when the pin state on that output is in the off state?.
Then you'd have a problem of forcing current into the HC output. Too much current can cause electromigration in the metalization or cause latch-up.
If you're determined to do this with the parts you have, do you have any zener diodes?
You should learn how to draw a proper schematic. This is what I transposed from your second connection diagram:
The circuitry around Q3 makes no sense. It'll never turn on. If it did, it would die. You seem to be trying to connect a 10k resistor (I have it mislabeled, but not worth correcting because it's so difficult to attach images on this forum) to a terminal that doesn't exist on the P MOSFET.
I corrected the connection on Q2. You have the emitter and collector terminals reversed.
I didn't bother showing the Arduino connections because you're not giving pin names or numbers.
A nit... You're use of FET is ambiguous. There are dozens of types of Field Effect Transistors; you're using MOSFETs.
Zeners leak, near the rated voltage bug time. That leakage will be more than enough to open the PNP enough to start pulling up the MOSFET gate. Just a few uA leakage is enough for this to happen.
wvmarle:
Zeners leak, near the rated voltage bug time. That leakage will be more than enough to open the PNP enough to start pulling up the MOSFET gate. Just a few uA leakage is enough for this to happen.