Electronic switch for electromagnet

Alec_t

Joined Sep 17, 2013
15,119
The post #40 circuit will work if the power MOSFET is a logic-level type. If it's not, connect the top 10k resistor to +12V instead of to +5V.
(BTW, when drawing circuits, get into the habit of labelling each component, e.g. R1, R2 etc. It makes it much easier to discuss the circuit.)
 
Last edited:

djsfantasi

Joined Apr 11, 2010
9,237
Its the same circuit as I posted earlier (post #22)
Not exactly the same. Your second MOSFET isn’t a logic level MOSFET and hence your pull up resistor is to the solenoid power supply. All MOSFETs in this circuit are logic level and need a lower voltage on the pull up.
 

Thread Starter

EduardoBat

Joined Jul 16, 2019
29
The post #41 circuit will work if the power MOSFET is a logic-level type. If it's not, connect the top 10k resistor to +12V instead of to +5V.
(BTW, when drawing circuits, get into the habit of labelling each component, e.g. R1, R2 etc. It makes it much easier to discuss the circuit.)
Ok, gonna see which mosfet I can buy and set the circuit accordingly.
thank you for the help and the hint about labelling.
 

AnalogKid

Joined Aug 1, 2013
12,130
Or use a 2N7000 logic level n-channel MOSFET to invert the logic
My point was that it is easier to invert the signal polarity in software (since it is custom software already) than adding external parts, no matter how few.
Place 100Ω resistor between the APM output and the 2N7000 gate, with a 10kΩ resistor from the 2N7000 gate to ground.
Why? I see no reason for the resistors.

ak
 

Thread Starter

EduardoBat

Joined Jul 16, 2019
29
The post #41 circuit will work if the power MOSFET is a logic-level type. If it's not, connect the top 10k resistor to +12V instead of to +5V.
(BTW, when drawing circuits, get into the habit of labelling each component, e.g. R1, R2 etc. It makes it much easier to discuss the circuit.)
If I need to use a PNP or a NPN, how would it be?
 

Thread Starter

EduardoBat

Joined Jul 16, 2019
29
UPDATE: You have many ideas presented to you. I’ll try to summarize them.
  • A solution using MOSFETs is a preferred solution, as using BJT transistors requires more complex calculations.
  • You can switch either the positive voltage (high side) or the ground connection.
  • Switching the high side is done with p-channel MOSFETs; n-channel MODFETs switch the low side.
  • You can use a daisy-chained MOSFET to invert the logic.
What calculations would be needed for a BJT?
 

djsfantasi

Joined Apr 11, 2010
9,237
My point was that it is easier to invert the signal polarity in software (since it is custom software already) than adding external parts, no matter how few.

Why? I see no reason for the resistors.

ak
We don’t know enough about the device providing the signal. Hence, a 100Ω resistor protects the APM.

It is a fairly common practice to use pull-up or pull-down resistors on MOSFET gates. Do you believe they are unnecessary?

Also, the software may not be accessible on the APM. I suggested a software solution earlier in this thread. But it appeared to not be a viable solution and hence I concentrated on solving the issue in hardware.
 

djsfantasi

Joined Apr 11, 2010
9,237
What calculations would be needed for a BJT?
To use BJT transistors, you’d still need two in series. And they’d require base resistors. You’d need the maximum current draw of the solenoid as well as the voltage into the base. Divide the current by 10 or 20. Then, given the base voltage and the calculated current, use Ohm’s law to calculate the base resistor. Repeat for the first transistor, using the calculated current (/10) and divide it by 10 or 20 again. Repeat applying Ohm’s law to get the second base resistor value.

Then, there is the whole issue of picking a standard resistance value for each of the calculated resistances.

The MOSFETs simply can use 10kΩ pull-up or pull-down resistors.

And depending on what’s driving the MOSFETs, you may not need that 100Ω resistor. It’s just there to protect your circuitry. And anything from 100Ω to 1kΩ will probably work.

While these resistor values work for many MOSFET circuits, with BJTs the resistance values are fairly critical and must be calculated for each circuit.
 

AnalogKid

Joined Aug 1, 2013
12,130
We don’t know enough about the device providing the signal. Hence, a 100Ω resistor protects the APM.
Post #1 looks pretty clear to me. The driving signal is a +5 V source, which is way below most power MOSFETs max. Vgs rating of 20 V. Also, as this is not a switching power supply or motor controller that must meet european or MIL EMI rules, I don't think the occasional few microseconds of gate voltage ringing is going to hurt anything so a damping resistor is not necessary.
It is a fairly common practice to use pull-up or pull-down resistors on MOSFET gates. Do you believe they are unnecessary?
In this application, yes. I think the odds are virtually zero that the uC output is an open collector PNP that would require an external pull-down resistor to GND. A pulldown resistor provides no additional functionality, and are a (very) small but unnecessary additional drain on the battery.

ak
 

Thread Starter

EduardoBat

Joined Jul 16, 2019
29
Actually, if you connect the left side of the 10 K resistor to the +12 V, you no longer need a logic-level FET.

Please add reference designators to your schematics. It makes component discussion much easier and more clear.

ak
How would the circuit look, please?
 

Thread Starter

EduardoBat

Joined Jul 16, 2019
29
To use BJT transistors, you’d still need two in series. And they’d require base resistors. You’d need the maximum current draw of the solenoid as well as the voltage into the base. Divide the current by 10 or 20. Then, given the base voltage and the calculated current, use Ohm’s law to calculate the base resistor. Repeat for the first transistor, using the calculated current (/10) and divide it by 10 or 20 again. Repeat applying Ohm’s law to get the second base resistor value.

Then, there is the whole issue of picking a standard resistance value for each of the calculated resistances.

The MOSFETs simply can use 10kΩ pull-up or pull-down resistors.

And depending on what’s driving the MOSFETs, you may not need that 100Ω resistor. It’s just there to protect your circuitry. And anything from 100Ω to 1kΩ will probably work.

While these resistor values work for many MOSFET circuits, with BJTs the resistance values are fairly critical and must be calculated for each circuit.
I'll go with MOSFET, thanks.
 
Top