Using IRL 540 with PICAXE

Andrei IRL

Senior Member
Hi everyone.

I am trying to improve a device by replacing a pair of mechanical relays with IRL540 MOSFETS.

Everything seems to be working at first.

I am reading an input on PIN3. The signal is a 12v stepped down using voltage divider with 1Kohm and 2.2Kohm resistors.

When this signal is received on PIN3 then a routine is ran, which turns on OUTPUT4 and OUTPUT2 for a predetermined length of time.
Once that time is up both OUTPUT4 and OUTPUT2 go LOW.

The problem is, while i was using relays everything worked very well.

I removed the realys and NPN Transistors that were driving them and replaced them with IRL 540 MOSFETS.

It seems that now that the MOSFESTS power LEDS for a random length of time, almost as if the PICAXE gets RESET some times.

I have a delay set as to how often the MOSFETS can be powered, and its every 200ms, but some times i can not re-triger them for up to 1 sec.

Any idea what i might be doing wrong?

Thanks very much.
Code:
low 4
low 2
Pause 1000
setfreq m8 ` Running at 8Mhz, all pause values are x2 times

symbol greenled=0 	`ready LED
symbol RELAY1=4
symbol RELAY2=2


main:       high greenled	
		if pin3=1 then fire 
				
goto main

fire:	     	high relay1
	     	high relay2
		low greenled
		pause 200
		low relay1
		low relay2		
		pause 400		 `pause 200ms anti-bounce
		
goto main
MOSFET.JPG
 

lbenson

Senior Member
It's not entirely clear to me from your diagram, but are you trying to use the IRL540s as high-side switches?

They need to be low-side switches, with drain coming from the load and source to 0V.
 

Technical

Technical Support
Staff member
You appear to have put the FET where the relay would have been.

What you need to do is put the FET when the npn was and the 'coil' where the relay was. So the 3 FET connections are 0V, PICAXE resistors and 'coil', and the other end of the 'coil' goes to V+.

Should also be a back emf diode in there (should have been across the relay originally, now across 'coil')
 

Andrei IRL

Senior Member
I have added a more accurate diagram to show how exactly the IRL 540 FET is connected.
After performing some additional testing evening looks good but unfortunately I think the FET is conducting a little even when not active.
I want to be able to use it to ground the signal from the ECU unit to the Ignition coil. The signal from the ECU is negative.
So by grounding the signal from the ECU I should be able to kill the spark.
I have this system already working for many years using a relay but now want to use FET or a power transistor.

Does the wiring of the FET looks correct?

The reason I say FET is conducting a little is the fact the when is connected as per diagram the bike is hard to start and didn't idle well. As soon as I disconnect it bike runs fine.

Thanks very much.DSC_2369.JPG
 

MartinM57

Moderator
Perhaps you could volunteer the application? .. looks like a hard rev limiter by trying to "earth" the bottom coil connection (through the 4K7)?
..and you are trying to replace the current relay-based circuit with a MOSFET?

Is the 4K7 in the relay-based circuit?

I suspect that the IRL540 is not up to the job, when "off", of withstanding the huge voltages present on the bottom coil/ECU connection during normal rpm operation - effectively leaking the voltage to earth and affecting starting/normal running.

https://wiki.autosportlabs.com/Hard_rev_limiter_1.2.0 shows an alternative (and proven) design for a solid state hard rev limiter - maybe worth taking some of its ideas into consideration?
 

Andrei IRL

Senior Member
Thanks very much,

You are correct, it needs to act as a rev limiter.

The 4K7 is indeed used in the original design with the Relay.

Thanks for the link provided, i had a look at it.

Unfortunately, in my application the spark cut needs to be done very quick, thats why i am looking for something that can just ground the signal from the ECU.

The current design with a Relay work really really well, so i would like to keep the concept as it is right now but replace the mechanical relay with a Transistor or a FET.

On the other note, do you think a NPN Darlington Transistor might work? Something like TIP122/142?

The voltage is 12V constant and the Power would be no more then 3-4 Amp.

Thanks very much for the input.
 
Last edited:

premelec

Senior Member
In your design keep in mind that LARGE transient spikes on your 12v line likely exist at various times so various bypassing and shielding may be required in the actual operating environment. FET or Darlington could work... and it's possible you'll end up needing an isolator to the ECU signal. Have you measured the voltage and source resistance from the ECU? Seems likely to be pretty low current & voltage but you need to know what you are trying to switch. Possibly a PHOTOMOS relay would suit you [and provide isolation].
 
Last edited:

MartinM57

Moderator
Thanks for the link provided, i had a look at it.
Unfortunately, in my application the spark cut needs to be done very quick, thats why i am looking for something that can just ground the signal from the ECU.
The current design with a Relay work really really well...
I highly suspect that the linked design will be plenty quick enough/quicker than your relay solution, and as it says, earthing the coil -ve at some arbitrary time in the spark creation cycle (and it is arbitrary with your relay solution as you probably have no idea how long it is taking your relay to pull in and do the earthing) can result in a premature spark, and at high rpm that might not be considered a good engineering solution.

Also, as it works on the high side of the coil and dampens/stops the spark (by reducing the coil current to a value low enough that the releasing of the earthing of the coil by the ECU doesn't allow a large enough secondary spark voltage to be produced) then you are working at pretty much the 12v supply level (subject to premelec's transients which do occur but are far less than those seen at the coil -ve) and you don't have to worry about selecting components to deal with the unknown size transients on the coil -ve.

If you could 'scope the coil -ve at various rpm then you would at least know the size of the transients you are trying to live with - at the moment, they are unknown, so pseudo-randomly selecting different components after finding that the initial good idea of a hefty MOSFET is not good enough is going to be trial and error.

I'd be looking at a solution that works on the top end of the coil, as per the link - which to be fair, I need to declare an interest in as many years ago I built and supplied 10's of these to users of that ignition system and they worked fine, bearing in mind that (just) such a simple hard rev limiter on a tuned competition engine is a heck of a sledgehammer solution:
a. the revs drop off very quickly
b. the sparks start going again
c. the unburnt fuel just beyond the exhaust valve, that has been injected/sucked in at the high rpm but was never ignited, explodes with spectacular noise and exhaust system shock
d. the revs build up again very quickly
e. go to a. :)
 

Andrei IRL

Senior Member
I highly suspect that the linked design will be plenty quick enough/quicker than your relay solution, and as it says, earthing the coil -ve at some arbitrary time in the spark creation cycle (and it is arbitrary with your relay solution as you probably have no idea how long it is taking your relay to pull in and do the earthing) can result in a premature spark, and at high rpm that might not be considered a good engineering solution.

Also, as it works on the high side of the coil and dampens/stops the spark (by reducing the coil current to a value low enough that the releasing of the earthing of the coil by the ECU doesn't allow a large enough secondary spark voltage to be produced) then you are working at pretty much the 12v supply level (subject to premelec's transients which do occur but are far less than those seen at the coil -ve) and you don't have to worry about selecting components to deal with the unknown size transients on the coil -ve.

If you could 'scope the coil -ve at various rpm then you would at least know the size of the transients you are trying to live with - at the moment, they are unknown, so pseudo-randomly selecting different components after finding that the initial good idea of a hefty MOSFET is not good enough is going to be trial and error.

I'd be looking at a solution that works on the top end of the coil, as per the link - which to be fair, I need to declare an interest in as many years ago I built and supplied 10's of these to users of that ignition system and they worked fine, bearing in mind that (just) such a simple hard rev limiter on a tuned competition engine is a heck of a sledgehammer solution:
a. the revs drop off very quickly
b. the sparks start going again
c. the unburnt fuel just beyond the exhaust valve, that has been injected/sucked in at the high rpm but was never ignited, explodes with spectacular noise and exhaust system shock
d. the revs build up again very quickly
e. go to a. :)
Thanks very much Martin.

Your argument is very strong.

I will build a prototype based on that.

Sounds like a very good solution and tested at that.

Thanks very much again.

A really appreciate all the ideas i receive on this forum.

Makes a big difference to my projects.
 
Top