# 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? Commented Feb 27, 2017 at 15:30
• What means "mosfet (741)" Commented Feb 27, 2017 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. Commented Feb 27, 2017 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.
– user16324
Commented Feb 27, 2017 at 15:35
• I'm guessing it means IRF741, which is an N-channel, albeit an obsolete one. Commented Feb 27, 2017 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? Commented Feb 27, 2017 at 16:26
• You need to be driving the gate with at least 5 volts to get reasonable conduction. Commented Feb 27, 2017 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? Commented Sep 22, 2018 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. Commented Sep 22, 2018 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 Commented Feb 27, 2017 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. Commented Feb 28, 2017 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. Commented Feb 27, 2017 at 16:42
• Has something been hacked? I'm seeing a weird quote about human rights, migrants, and restricting movement. Commented Mar 2, 2017 at 2:32
• I just noticed the same thing. I don't know what that means. Commented Jan 29 at 14:29

I am creating a circuit that is very similar and am having the same issues. The reason why the output isn't a square wave anymore and why there are round shoulders that doesn't reach to the full 12 V peak to peak is likely due to:

1. In power mosfets, the gate is insulated by a thin silicone oxide. This gives the mosfets a capacitance characteristic in the output and input. Check the datasheet of your mosfet, it contains these capacitance values.

2. Leakage current can also be an issue if the leakage current rating is comparable to the current you are trying to switch.

3. Mosfets also have fall/rise times, (the time it takes for the mosfets to switch on/off). If the fall and rise times are comparable to the period of your input waveform, then this will also be an issue.

• Thank you. That capacitance build up is a good tip. I was not aware of that. And now I'm certain that was rounding the pulse shoulders. As glen Geek added, the internal diode could be causing the slight voltage drop. I'm curious to what you are working on? I was attempting to switch (syncronously) 50 or so mofsets to create a continuous moving conductive wire along a long magnet to see if voltage could be induced in the moving portion. I'd appreciate someone to collaborate with if you're interested. Commented Jan 29 at 14:44