08M to MosFet circuit for square wave

Haroen

Member
Hi guys, when I want to amplify a PICAXE 08M signal(5V) with a MosFet circuit(to 12V) I get no pulse anymore when I increase the mosfet voltage to 8,8V.
I use a setting like this picture with a LED and resistor instead of the relais and no diode.
http://www.electronics-tutorials.ws/articles/switch8.gif

I just use this simple code
"High 2: Pause 10: Low 2: Pause 10".

Why can't I increase the voltage above 8,8V with pulses?
 

premelec

Senior Member
The circuit you show is for a Pchannel MOSFET - is that what you have and what Vgsth is it specified to? Is it indeed an IRF9540? Do you have source and drain correctly located? Note that the voltage being switched is above the 5 volts you have.... You might do better with an Nchannel MOSFET wich then only has to switch the gate voltage... Or switch a BJT that will take the higher voltage... or try different gate resistor setup noting that your PICAXE signal is only 0 to 5 volts and can't switch the full 12volts -
 

eggdweather

Senior Member
Turn the 10K and 1K resistors around - swap them...
Assuming your PICAXE is running at 5volts and you want 12volts Vdd (currently you can't get beyond 8.8 volts), then the voltage at the MOSFET gate at logic HIGH PICAXE out = (12-5)*(1/10+1) + 5 = 5.6volts giving you a Vgs of 6.4volts meaning the MOSFET is ON.
When the PICAXE is logic LOW then Vgs = 11volts and the MOSFET is a saturated on, which is OK.

Now reverse the values, and you get:

Assuming your PICAXE is running at 5volts and you want 12volts Vdd (currently you can't get beyond 8.8 volts), then the voltage at the MOSFET gate at logic HIGH PICAXE out = (12-5)*(10/10+1) + 5 = 11.4volts giving you a Vgs of 0.6volts meaning the MOSFET is OFF.
When the PICAXE is logic LOW then Vgs = 1volt and the MOSFET is a on, which should be OK.
 
Last edited:

AllyCat

Senior Member
Hi,

Yes, as premelec implies, that is not the correct circuit to use (reliably).

If the difference in voltage between the "++" rail (your Vdd, 12v) and the PICaxe "+" rail (say 5v) is more than the FET's threshold voltage, then the FET will always be On. Thus you would need a FET with a threshold voltage above about 9 volts and then should see that the Load would be switched On when the PICaxe output is Low.

You need either a low-side switch, e.g. a logic-level N-channel FET (or NPN / Darlington) in the Cathode side of the LED/load; or a level-shifting transistor (NPN / N-channel) between the PICaxe output pin and the P-channel FET.

Cheers, Alan.
 

inglewoodpete

Senior Member
Hi guys, when I want to amplify a PICAXE 08M signal(5V) with a MosFet circuit(to 12V) I get no pulse anymore when I increase the mosfet voltage to 8,8V.
I use a setting like this picture with a LED and resistor instead of the relais and no diode.
http://www.electronics-tutorials.ws/articles/switch8.gif

I just use this simple code
"High 2: Pause 10: Low 2: Pause 10".

Why can't I increase the voltage above 8,8V with pulses?
I had a look at the circuit diagram you referenced (switch8.gif) and thought to myself: what other diagrams are in this series? So I altered the URL to http://www.electronics-tutorials.ws/articles/switch7.gif and bingo!....that's the circuit you want when the drive is coming from a microcontroller. If I could find the actual article, then all would be probably be explained.

As mentioned by neiltechspec, an N-channel MOSFET starting with the IRL prefix is best suited to being driven by a 5v source.
 

Haroen

Member
When I tested the Pulse_in pin of the circuit manually on the rail power +14V and Gnd, the LED pulses correctly, so I assummed that the PICAXE chip output was the trouble.
But now with all your answers I see that the circuit is to blame therefore I tried the Pulse_in pin of the circuit manually on the +5V and the LED stays on incorrectly when Vin is above 8,8V!

I use the exact setup as the picture including IRF9540N with (Vgsth=2-4V) and datasheet: 'http://pdf.datasheetcatalog.com/datasheet/irf/irf9540n.pdf
The IRL520 (Vgsth=1-2V) datasheet, as shown in manual 3: http://pdf.datasheetcatalog.com/datasheet/irf/irl520.pdf

@eggdweather
Turning the 10K and 1K resistors around - swapping them doesn't work.

@AllyCat
The difference in voltage between the "++" rail and the "+" rail reaches Vgsth=4Vmax around the 8,8volts so that explains it!
Now I see that after a PICAXE pin the PICAXE manual always uses components with positive charge at he base or gate (BC548B, BCX38C, IRL520).

I have tried the Nchannel MOSFET IRF530 setup in my CNC board few years back with unipolar steppers that works great.
Should it have been a "logic level" like the IRL520?
Why is the IRL prefix so important?

The P-channel MosFet doesn't make sense anymore. It is rated to switch up to 100V and with Vgsth=4Vmax. So what should I put at the gate to fully switch the max voltage?
 
Last edited:

premelec

Senior Member
"...100V and with Vgsth=4Vmax..." it's P channel so that should be MINUS 4v... review your polarities...
 

lbenson

Senior Member
The IRL prefix is important because the "L" indicates that it is controlled with "logic level" voltages, 0-5V.

Is there a reason you can't use the low-side mosfet switch in the circuit linked to by inglewoodpete, with, say, an IRL520 N-Channel mosfet? That could be controlled directly by the picaxe output. As long as you're not using pwm at a high rate, the IRL520 should be fine.
 

Haroen

Member
The IRL prefix is important because the "L" indicates that it is controlled with "logic level" voltages, 0-5V..
Are there also IRL P-channel fet's available?

Is there a reason you can't use the low-side mosfet switch in the circuit linked to by inglewoodpete, with, say, an IRL520 N-Channel mosfet? That could be controlled directly by the picaxe output.
Yes, there are situations where the load being switched should not be at any voltage when off.

As long as you're not using pwm at a high rate, the IRL520 should be fine.
That's just the case for my CNC-machine operating at highest possible PWM spindle speed rates.

The CNC had stall problems when performing 3Dprinting moves that has fast accelerations at some times.
I thought it was the stepper driver logic or even low power adapter.
But now I have to understand and figure this out for driving unipolar steppers correctly too.
 

lbenson

Senior Member
For fastest pwm rates you would need a driver for your low-side mosfet switch, or else you risk serious overheating and possible malfunctioning because of slow response.

I have used the IRF9540N, but with a 2n7000 signal mosfet low-side driving it, with negative logic (picaxe 0V means ON).
 

Attachments

Haroen

Member
For the unipolar stepper I used 0-5V on the optocouplers 4N35 or CNY17-3 to drive the gate of a IRF530 switching 12-18V.
I didn't get overheating though but malfunctioning because of slow response and stall, YES IT DID!
I will test the combination on my breedboard and oscilloscope to be certain...
 

Haroen

Member
Even if Logic Level P-channel MOSFET's would exist I thought that the Gate PullUp resistor will also put Vdd(100V) on the PICAXE chip pin!
Is that permitted or will that destroy the chip?
 
Top