Augmenting existing lighting circuits with high-side PMOS switch and OR logic

Thread Starter

ironhalo

Joined May 15, 2021
9
I am working on some custom lighting designs for vintage autos where high-side switching is required (chassis is grounded). The current project requires augmenting six existing 12V lighting circuits so that the lights turn on either via their existing physical switches, or a microcontroller output.

I have some experience using p-channel MOSFETs with for high-side switching, but always on new circuits. This will be the first time I am augmenting an existing circuit in this way, and I'd love some input to know if I'm on the right track. My current thought is to splice into the wiring harnesses and interrupt each circuit with a diode and a single lead back to my control box, where I will have my Arduino driving an array of six BJTs, and those driving six PMOS (with an additional diode between the PMOS and the existing circuit). I don't have any experience using diodes to create OR logic, so that is where I am most in the dark on this one.

I'm sure there are other ways to go about this, but one of the goals here is to be as non-destructive as possible with these vintage vehicles, and not make it too difficult for the owner to reverse/remove the augmentation down the road if they choose. Which is why I'm attempting to make a single splice only, leaving the rest of the wiring loom intact (as opposed to rerouting/rewiring any existing circuits).

Here is a rough schematic of where I'm at so far...

SK_lighting_1.jpg

Some questions:
-If diodes make sense in this application, which type of diode is recommended and how do I size them properly for each circuit? (current varies between circuits)
-If diodes are not recommended, what is preferred here?
-Is there anything additional I need to include to make sure the Arduino is protected?

Assumptions:
-Lighting system power: 12V regulated power supply from a Lithium power source (not connected to alternator and car battery)
-Switching current: varies from 0.2A to 2.5A
-Arduino REF Voltage: 5V (Arduino Mega)
-Arduino power supply: same regulated 12V source (via barrel jack)

Thanks in advance for any insight.
 

djsfantasi

Joined Apr 11, 2010
7,689
What’s the switching current required of one GPIO pin on the Arduino?

A GPIO pin can only supply up to 40mA. But, that’s the maximum and your circuit should demand no more than 20mA from a pin.

And that’s not all. There is a maximum of 200mA in total from an Arduino.

Your specs call for a switching current of 0.2 to 2.5 A. That’s obviously not going to be switched directly from an Arduino, so what total current will be expected of the Arduino.
 

MisterBill2

Joined Jan 23, 2018
8,745
I do not see any benefit from diodes D1 and D2,unless the 12 volt battery gets connected in reverse. I DO suggest fuse protection between the circuit and that 12 volt battery, it is probably there, just not shown.
 

Thread Starter

ironhalo

Joined May 15, 2021
9
I do not see any benefit from diodes D1 and D2,unless the 12 volt battery gets connected in reverse. I DO suggest fuse protection between the circuit and that 12 volt battery, it is probably there, just not shown.
I guess I was under the impression that we needed to prevent 'back flow' of the current from one branch of the circuit to another. Is this not a concern? No issues will occur if the PMOS and physical switch are closed at the same time? Or if the switch is closed and the PMOS is not? Just trying to be super careful about causing any damage to the clients' equipment.

And yes, we have multiple fuses throughout that I failed to put on the diagram. Thanks.
 

MisterBill2

Joined Jan 23, 2018
8,745
I do not see any path for back flow to happen, and if both switches are on at the same time there will be no problem except for having to switch 2 things off to get the load to switch off. Not a big deal.
 

Thread Starter

ironhalo

Joined May 15, 2021
9
What’s the switching current required of one GPIO pin on the Arduino?

A GPIO pin can only supply up to 40mA. But, that’s the maximum and your circuit should demand no more than 20mA from a pin.

And that’s not all. There is a maximum of 200mA in total from an Arduino.

Your specs call for a switching current of 0.2 to 2.5 A. That’s obviously not going to be switched directly from an Arduino, so what total current will be expected of the Arduino.
I haven't actually sized the PMOS, BJT, or R1 yet, but on my last project I used 2N3904 NPNs on the Arduino GPIOs with success. If I recall the current draw on each IO pin was around 10mA.
 

Thread Starter

ironhalo

Joined May 15, 2021
9
I do not see any path for back flow to happen, and if both switches are on at the same time there will be no problem except for having to switch 2 things off to get the load to switch off. Not a big deal.
Thanks for confirming that, great to know the diodes are unnecessary. Much appreciated.
 

LowQCab

Joined Nov 6, 2012
517
If your GPIO Pins can source ~20ma this may be the most elegant way to accomplish this ........
CPC1909J Solid-State Relay, ~$10.oo at DigiKey.
15-Amps continuous current when epoxied or physically clamped to an Aluminum Project Box,
~25-Amps Peak-Current.
Requires 15-Amp or smaller Fuse.

Very Small foot-print.
Direct Wiring, no Circuit-Board required.
Only 2 parts required.

Output Flows Current in either Direction, you can't hook up the Output backwards.
The Input is polarized,
it won't work if hooked up backwards, but it will not be damaged.

Can NOT be mounted under-Hood, 100C Temps are too high.

Generates zero electrical switching noise, no relay contact sparks.

Inputs and Outputs are completely Isolated from each other.

Requires only a ~200-Ohm Resistor between your GPIO and the Relay, (~20ma).
The Non-Inductive Control-Inputs will not need to be filtered for Electronics Protection.
The Input is a simple Infa-Red LED,
And, if you have less than a ~10-Amp Output Load, (per-unit),
the Relay will work just fine when driven with a ~10ma Input Current, (~400-Ohm Resistor).

Multiple units in the same box can share the same Control Input Common Ground Wire.

When using multiple units together,
each must have its own ~15-Amp, or smaller, Battery Fuse.
If the Total Load for a group of Units is less than 15-Amps,
one 15-Amp Fuse can supply multiple switches.
 

Attachments

Ian0

Joined Aug 7, 2020
2,192
Leave out the diodes as @MisterBill2 said provided that you have one PMOS for each switch. (The diodes will generate quite a lot of heat - half a watt for a 5W lamp, and 2W for a 21W lamp) If you want to override multiple switches with a single MOSFET, then you will need the diodes, but it would be better to use multiple MOSFETs - one for each switch (you can connect their gates together to R3).
Don't be mean on the size of the MOSFET - the inrush current of a filament lamp is about 10 times the running current, and if the lamps are flashing it will spend a lot of its time dealing with the inrush.
 

eetech00

Joined Jun 8, 2013
2,350
I am working on some custom lighting designs for vintage autos where high-side switching is required (chassis is grounded). The current project requires augmenting six existing 12V lighting circuits so that the lights turn on either via their existing physical switches, or a microcontroller output.

I have some experience using p-channel MOSFETs with for high-side switching, but always on new circuits. This will be the first time I am augmenting an existing circuit in this way, and I'd love some input to know if I'm on the right track. My current thought is to splice into the wiring harnesses and interrupt each circuit with a diode and a single lead back to my control box, where I will have my Arduino driving an array of six BJTs, and those driving six PMOS (with an additional diode between the PMOS and the existing circuit). I don't have any experience using diodes to create OR logic, so that is where I am most in the dark on this one.

I'm sure there are other ways to go about this, but one of the goals here is to be as non-destructive as possible with these vintage vehicles, and not make it too difficult for the owner to reverse/remove the augmentation down the road if they choose. Which is why I'm attempting to make a single splice only, leaving the rest of the wiring loom intact (as opposed to rerouting/rewiring any existing circuits).

Here is a rough schematic of where I'm at so far...

View attachment 238945

Some questions:
-If diodes make sense in this application, which type of diode is recommended and how do I size them properly for each circuit? (current varies between circuits)
-If diodes are not recommended, what is preferred here?
-Is there anything additional I need to include to make sure the Arduino is protected?

Assumptions:
-Lighting system power: 12V regulated power supply from a Lithium power source (not connected to alternator and car battery)
-Switching current: varies from 0.2A to 2.5A
-Arduino REF Voltage: 5V (Arduino Mega)
-Arduino power supply: same regulated 12V source (via barrel jack)

Thanks in advance for any insight.
Hi

If you use a mosfet instead of BJT driver transistor (see below), then you don't need to worry about the GPIO pin current drive capacity. The 2N7002 will work at 3v and above (even a little lower than 3v).

The output mosfet "RDSon" should be 100 milliohms or less to reduce heat. The FQP27P06 works well.

1621732505847.png
 
Last edited by a moderator:

MisterBill2

Joined Jan 23, 2018
8,745
Consider the real-estate that such a driver circuit will require, and that a good deal of fabrication expertise will be needed to fabricate and assemble a product that will last any length of time in a car driven on real roads. So assembling an adequate controls package is not a simple thing.
 
Top