# Amplify Square Wave with Simple Mofset Circuit

I am a hobbyist. I have a square wave being generated by a 5 volt Arduino. (I tried a 555 circuit but I couldn't get it at an exact square wave.)

The Arduino square wave runs from about 2 or 3 volts to 0 volts. I want to amplify that positive pulse to 12 volts with a mosfet (741) to pulse an electromagnet. The electromagnet is a 12vdc and should run at or below 250 ma. I tried the following setup but am getting a weird signal, kind of like a square wave with rounded shoulders at around 1 volt and a peak in the middle that goes up to about 7 volts. I expected to see the exact same square wave that went in, but coming out at 12v+ instead of 3. am I doing something wrong?

Edit: Do you think the above circuit is correct?

• Can you provide the frequency of your square wave? Feb 27 '17 at 15:30
• What means "mosfet (741)" Feb 27 '17 at 15:33
• That circuit will not to what you want, go read this question: electronics.stackexchange.com/questions/141961/… and look at the circuit, that circuit would work if you use an NMOS. Feb 27 '17 at 15:34
• Which MOSFET? N -or P type? Link to its datasheet. If it's an NMOS, it's connected wrong way round and if it's a PMOS, the gate biasing is incorrect. And either way that source resistor isn't helping. Feb 27 '17 at 15:35
• I'm guessing it means IRF741, which is an N-channel, albeit an obsolete one. Feb 27 '17 at 15:57

Strange circuit: -

If it is a P channel MOSFET then that's OK because source connects to +12 volts (via a resistor whose value is unspecified) and the drain connects to the load BUT, to properly drive the gate, the gate levels have to be 12 volts (MOSFET off) or gate at say 6 volts or less to turn the MOSFET on. Clearly this is not achieved with the Arduino output.

If the MOSFET is N channel then the body diode will conduct and the load will be permanently powered by about 11 volts minus the volt drop across the resistor in series with the source.

Neither will do what I think you want.

• I edited the diagram in my original post. Is that more appropriate for what I'm looking for? Feb 27 '17 at 16:26
• You need to be driving the gate with at least 5 volts to get reasonable conduction. Feb 27 '17 at 18:34

The gate voltage drive from your microcontroller (0-to-5v) is perhaps too feeble to properly drive the IRF741 MOSfet's gate fully ON:

Although the spec sheet only specifies +4v on the gate, you may only get a fraction of a milliamp current through the MOSfet, as well as your load. At +5v gate voltage, you'll get more current, but you don't know how much. With +10v on the gate, the MOSfet is guaranteed to be fully ON, and current flow through your electromagnet will be limited by the electromagnet's resistance. You'd be safer using a MOSfet classified as logic-level, instead of this one, since your microcontroller can only supply +5v.

Since you are driving an inductive load, you must also include a diode to catch the huge flyback pulse voltage when you turn the MOSfet off. Your MOSfet can only withstand about 30v, and the flyback pulse will likely be many times that voltage for a short instant....but an instant is all it takes to break down your MOSfet. The diode goes across the electromagnet, with cathode towards the +12v supply.

• must the diode be rated for the current coming from the mosfet? Sep 22 '18 at 7:33
• @johnywhy Yes, that would be safe design, since the diode must accept all the electromagnet current that the MOSfet is handing over to it. However, that current dies quickly away. A power diode like 1N4001 might be rated for one amp continuous current, but might safely pass 30 amps in a short pulse, as in this case. Sep 22 '18 at 12:35

Not sure how your circuit is wired. As the second one is drawn, -12V is on the Drain. If you flip 12V battery around, it should work.

I'd use the circuit from Switching Test Circuit (Figure 9). Switch your arduino output for pulse generator.

Add a $R_{GS}$ to bias it off, while Arduino is being configured.

Edit...

The Duty Cycle of 555 timer is:

$$D = \frac {R_B} {R_A + 2 R_B}$$

so you cannot get a 50% duty cycle. There are ways, but you cannot get there just with a 555.

• Thanks StainlessSteelRat . I think you and @glen_geek are correct about the voltage and the amperage. I started out with a 555 timer on the same board so that everything could run at about the same voltage. But I couldn't get it perfect square with the resistors I have. The arduino provides an absolute perfect square wave. I'll try your advice on the mosfet. If that doesn't work then I'll try to beef up the arduino signal with a transistor. If that doesn't work I'll go back to the 555 and bite the bullet, parallel a bunch of resistors until I get the right value. Thanks for the help Feb 27 '17 at 20:02
• As for the 555 circuit, yes, I know that. One of my resistors called for 39k - which I don't have, don't even know if they make them. As a lazy man I just didn't feel like putting a bunch of resistors in parallel or series to reach that. So I used a 47k and it was about a 60/40 result. I'm one of those guys who will walk a mile to save a step unfortunately. And the arduino does it so nicely. Feb 28 '17 at 14:49

Wouldn't it be against the Human Rights of said migrants if they do restrict free-movement?

Your electromagnet isn't going to care if the square wave has a rise time of 1ns or 1ms. So a 555 will work just fine.

As to a MCU based approach, it will work as well. In your particular case, you will need to make sure that there is sufficient swing from the Arduino output. If the high is 2 or even on a 5v Arduino, there. ISS something seriously wrong. Fix that first.

Then you will need a MOSFET that goes full open on 5v output.

If you don't have one, get a driver then.

• I'll check that Arduino voltage. I had it set at a 250ms t1 time, so I probably wasn't getting an accurate reading. And my oscilloscope is an old timer, doesn't show voltages. Feb 27 '17 at 16:42
• Has something been hacked? I'm seeing a weird quote about human rights, migrants, and restricting movement. Mar 2 '17 at 2:32