Maker Pro
Maker Pro

Using mosfet to switch 12V to a load with a hard ground.

Gusisin

Apr 2, 2024
9
Joined
Apr 2, 2024
Messages
9
I currently have the existing circuit to control my car horn via a relay. I am a beginner but trying to figure out how I can replace the relay with a mosfet. I got it working to control the horm via 3.3v to an n channel mosfet to sound the horn by using a mosfet to switch a relay to connect 12V direct to pin 2 of the horn. To get rid of the relay and use onlt a high current mosfet I am not sure how to get around the ground fitted at the horn. SHould I use a p-type instead and control the 12v rather than use an n-type to controll access to ground? If so I am a bit lost at that point.
1712079435719.png
 

danadak

Feb 19, 2021
767
Joined
Feb 19, 2021
Messages
767
If you are stuck with one side horn grounded then you do a high side switch.





Regards, Dana.
 

crutschow

May 7, 2021
848
Joined
May 7, 2021
Messages
848
Here's a high-side P-MOSFET switch to power the grounded horn:
It powers the horn with a 3V to 12V input.
The P-MOSFET can be any with at least a 15A, 30V rating.

1712088596765.png
 

Gusisin

Apr 2, 2024
9
Joined
Apr 2, 2024
Messages
9
Guys thank you so much I have som p-mosis arriving tomorrow I will try it out and get back with my results. Thanks so much for the great help.
 

Bluejets

Oct 5, 2014
6,921
Joined
Oct 5, 2014
Messages
6,921
I doubt your expected circuit is correct.
Auto wiring to the horn (and other equipment) is normally earth return.
i.e. power is applied to the horn (or other equipment) and the ground is taken to the slipring on the steering wheel.
Those that use a relay would be similar.
 

Gusisin

Apr 2, 2024
9
Joined
Apr 2, 2024
Messages
9
I doubt your expected circuit is correct.
Auto wiring to the horn (and other equipment) is normally earth return.
i.e. power is applied to the horn (or other equipment) and the ground is taken to the slipring on the steering wheel.
Those that use a relay would be similar.
This is the actual circuit for the horn, I want to inject 12V where indicated with a shared ground between micro controller and the car. I did consider an optocoupler to do the switching but the horn os on a 40A fuse so decided that because of the current and the shared earth not to try this. I know that optoisolators are to isolate one circuit from another but would it be simpiler to use one here and use one component (a 3.3v switched opto isolator) and just share ground between circuits, if I can find one with enough load capacity?
1712131698733.png
 
Last edited:

Gusisin

Apr 2, 2024
9
Joined
Apr 2, 2024
Messages
9
SSR ?



Regards, Dana.
Great point that would work as would a standard relay but I am sure I can do this in discrete components as a way to also teach myself. Also, the internals of such a relay are what I am trying to duplicate. It is my this for knowledge :)
 

Gusisin

Apr 2, 2024
9
Joined
Apr 2, 2024
Messages
9
So in tinkercad circuit design I tested the following:

This is the circuit suggested by @crutschow (thanks) in picture one the system is at rest.
1712138870238.png

In picture 2, using the slide switch, I connect a logic high to the npn transistor that provides a gate voltage to the mosfet which in turn switched 12V to the load (a motor in this case).
1712138891853.png
The normal horn function works as expected with the logic 3.3 both high ans low so it seems to work just fine, thank you all.

BTW loving tinkercad circuit design as a test, it reduces magic smoke a lot :) Now I will build in real components and repeat the test.
 

Gusisin

Apr 2, 2024
9
Joined
Apr 2, 2024
Messages
9
Here's a high-side P-MOSFET switch to power the grounded horn:
It powers the horn with a 3V to 12V input.
The P-MOSFET can be any with at least a 15A, 30V rating.

View attachment 63267
In your diagram you show the source of the mosfet going to 12V and the drain doing to earth via the diode, is this the right interpretation?
 

crutschow

May 7, 2021
848
Joined
May 7, 2021
Messages
848
In your diagram you show the source of the mosfet going to 12V and the drain doing to earth via the diode, is this the right interpretation?
Yes.
A P-MOSFET's normal operating voltage is positive, source-to-drain (negative drain-to-source).
The diode is to suppress any negative spikes from the inductive horn load that might otherwise damage the MOSFET.
 

Bluejets

Oct 5, 2014
6,921
Joined
Oct 5, 2014
Messages
6,921
I'd be inclined to trace terminals 1 and 2 on the horn switch and place a standard voltage free set of relay contacts across there.
That retains all the original inbuilt wiring and control mechanism without any possibility of feedback or "strange effects" which can happen when you start fooling with auto wiring systems.

The two terminal wire colours are clearly marked and should present no problem tracking them down.
In fact only one would be required (terminal 1) as the other (terminal 2 ) is ground.
 

Gusisin

Apr 2, 2024
9
Joined
Apr 2, 2024
Messages
9
Yes.
A P-MOSFET's normal operating voltage is positive, source-to-drain (negative drain-to-source).
The diode is to suppress any negative spikes from the inductive horn load that might otherwise damage the MOSFET.
So I am a little confused, Instead of the components you suggested I used IRF4905 mosfet and an 2n2222 transistor. I tested it in ciruitlab and got this

1712413731938.png
1712413918354.png
However, when I test it in a built circuit on a breadboard and a Veroboard test I get 6.99 volts on the collector of the transistor which is not enough to switch the MOSFET on I think. In circuit lab I see the full 12v on the collector with 3.3v on the base but in real life I only see half the expected value on the gate of the mosfet, 6.99v any ideas why?
 

Gusisin

Apr 2, 2024
9
Joined
Apr 2, 2024
Messages
9
So I am a little confused, Instead of the components you suggested I used IRF4905 mosfet and an 2n2222 transistor. I tested it in ciruitlab and got this

View attachment 63294
View attachment 63295
However, when I test it in a built circuit on a breadboard and a Veroboard test I get 6.99 volts on the collector of the transistor which is not enough to switch the MOSFET on I think. In circuit lab I see the full 12v on the collector with 3.3v on the base but in real life I only see half the expected value on the gate of the mosfet, 6.99v any ideas why?
I am an idiot, I had the transistor upside down. duhhh !
 
Top