pwm 2 amp

toby gross

New Member
Can I run a 2amp coil with the picaxe 8 ?
I've played with transistors and tried to make it work, yes I do have the diode to kill the back emf, and the transistor is getting very hot. Thank You for your responds, Toby
 

Michael 2727

Senior Member
You can run a 100A Coil if you use the correct transistor.
I would use a MOSFET though (my preference), you could
try an IRF530 or IRF540, the 530 is listed as an example in
the picaxe_manual2.pdf.
Are you using PWM or just high/low for switching ?
If the above get too hot you should go for a true Logic Level
switching type MOSFET.
I've had no trouble using a 540 up to 6 or 8A @ 12VDC.

Correction: picaxe_manual3.pdf
look under Standard Interfacing Circuits
 
Last edited:

toby gross

New Member
I am using the pwm command, I am getting it to work with a darlington configuration on a small motor but when I hook up a 2amp coil with the diode for back emf, it gets really hot so you can't touch it. I will definitely get a mosfet transistor and try it, I am assuming it will work like you suggested in your post.
Thank You Toby
 

Michael 2727

Senior Member
If you use a very fast PWM a standard Power Diode
may not cope with the speed. In that case you need
a high speed diode similar to those used in switchmode
supplies e.g. a PC Supply (2 pin TO-220 packages)
Don't rely on the MOSFETs internal diode for Back EMF
protection.

Use the PWM calculator in the Program Editor software,
look in the tools under wizards.
4KHz is the slowest speed available, unless you POKE
the register, SEARCH here will provide more on that subject.
 

gengis

New Member
Heat is frequently a sign that you are not driving the device hard enough. With bipolar transistors, the gain goes down as the collector current goes up. If the base drive isn't turning the transistor on hard - the transistor is operating in the "linear region." That is it has too much voltage across the transistor, since it isn't fully "on." To minimize heat you minimize the voltage drop across the device.

A darlington has very high gain, as a rule, but requires a higher voltage across it as a result of its construction. 2 amps with 1.5 volts across the transistor is 3 watts of waste heat. 3 watts with no heatsink will get hot. Switching speed of the device will serve to drive that up a little since while switching it has to cruise through the linear range to fully "saturate." For PWM applications - switching speed is not a concern if it is to stay on or off for a long time.

You run into the same/similar problem with mosfets but for a different reason(s). A Mosfet requires 4 or more volts to turn on fully unless you get a logic level device (with international rectifier the LL devices - the ones I'm using at least - have an L in the part name to distinguish it from the others). LL devices can turn on with 2 volts or so (look at the data sheet). Give it enough voltage to fully saturate it (minimum on resistance and minimum heat).

Mosfets have another characteristic. While they require practically no current to turn on, they have a lot of capacitance in the gate (because of the construction). It takes current to change the voltage quickly and get the capacitor to charge and discharge rapidly - otherwise you are back to not turning it on fully while the cap takes time to charge up - in a PWM application. That works both ways - current to charge the gate capacitance and a low impedance path to discharge the gate as well.

A scope can tell you a lot about what is happening.
 

toby gross

New Member
So should I buy a mosfet transistor and see if it works or should I research on something else? I know the diode works cause if it's not in the circuit it doesn't work at all. I thought that a darlington circuit drives the transistor very hard, which that's what I had and it still got hot! will the mosfet heat up as well?
Thank You Toby
 

moxhamj

New Member
I think mosfets are better than darlingtons. My favourite is the BUK555 - 5V drive so drives directly off a picaxe pin and at 2 amps it will hardly even get warm.
 

adub

New Member
I know the diode works cause if it's not in the circuit it doesn't work at all.
:confused:Uh-oh.... Now you have me confused. How do you have the diode wired? Can you show us the circuit?
 

jglenn

Senior Member
:D This is easy!

You need an N channel fet, even a TO-92 small plastic one will work, like the ZVN4206A from Digikey (here in the USA). A TO-220 power tab will have more current ability.

The source lead goes to ground, the gate goes to your digital out. You don't need a gate resister unless going very fast, like 50KHZ, for tailoring the gate drive waveform. In that case use a FET gate driver chip, an inductive bead helps too.

The drain lead goes up to one side of the relay coil, the other side of the coil goes to V+. The diode, which should be a fast recovery type if doing PWM, has the band going to V+, the unband going the drain. The diode is across the coil.

Some people do not use the diode, but instead a snubber. This allows faster switching, because there is not the "freewheeling" current being recycled thru the coil. With very sensitive, high resistance relay coils, you will actually see the relay stay on momentarily after shutting it off due to this!

Darlingtons are old hat, they never completely saturate and have too high of an on voltage. I don't use them anymore. Or vacuum tubes. Or spark gaps....

:eek:
 

toby gross

New Member
So will I be able to connect the base or the gate pin directly to the picaxe, and make the 2 amp coil do whatever I want to, Yes I've got the diode across the coil, with the band side on the + and the - at the unmarked side.
Thanks
Toby
 

jglenn

Senior Member
Yes. I did forget one thing. Make sure your fet will work with 5V on the gate.

Only certain ones can do this. The Vgs (gate to source) voltage is in the specs, for proper turnon. Many of the bigger powertab fets need more than 5V to turn on.

The other rating of interest is the Rds on, on resistance. It can be as low as 50 milliOhms! The lower the value, the more expensive the device. For a simple relay driver, you don't need the best variety.
 

BCJKiwi

Senior Member
Ensure you purchase a "Logic level" device - as recommended by the Doctor as it will turn on fully at PICAXE level voltages.
 

toby gross

New Member
I've been Playing with this project for a while, I figured out that I was trying to run it at 10000hz and 50%, what should it be for controling a 12v coil? I have got a proportional coil that controls hydraulic flow, I have discovered that it makes a difference what command to use, I was using pwmout 2, 150, 300 with a IRF540 mosfet. It makes a click click sound at low signal and does not go over pwmout 2, 150, 180 what is the correct thing to do? When I hook up a 40ma 12v motor it does what it should at pwm 2, 150, 300 I go from 30 duty cycle to 600 and the motor slows down and speeds up like it should. But the coil does not go over 180 duty cycle like I mentioned, it seems like it is reseting the chip when it reaches that level.
Thanks Toby
 

inglewoodpete

Senior Member
Any electromagnetic device can adversely affect a microcontroller. Ideally, the PICAXE should have its own power supply and be separated from the coil as much as possible.

There are 2 ways that any electromagnetic device can upset a microcontroller. When the coil is 'switched off' (with PWM this will occur many times a second), the collapsing magnetic field will induce a large voltage accross the coil terminals. Usually, this will be many times its supply voltage. The voltage spike can make its way through the power supply to the microcontroller, affecting its stability. With larger, unshielded coils the changing magnetic field can induce currents in any nearby conductor. If these currents reach the wrong places (eg microcontroller) then thangs can go wrong.

At a minimum, you need a quench diode connected accross the coil. Refer to the PICAXE Interfacing Manual (3) , standard circuits 3 and 4.

Beyond that, the PICAXE needs a very stable power supply. Ensure you have a 100nF capacitor mounted as close as possible to the PICAXE's supply pins. An electrolytic cap mounted close to the PICAXE will help, too.

Edit: Also you can confirm that a PICAXE has rebooted by adding a LED (and 330ohm resistor) to a spare output pin. Add a PulsOut command at the beginning of your code to flash the LED. Then you can confirm whenever the PICAXE has rebooted.
 
Last edited:

toby gross

New Member
Thanks to inglewoodpete, that worked great. I put in the blicking LED when the program starts, to show that when the picaxe is starting up, had that in bind. What really helped is the 3300uf cap which that was the first one in my parts bin so I used it, it seems to work good, I put the coil that controls the hydraulic motors to actual use with the microcontroller controling the coil and it works good, doesn't heat up or do things it's not told to do.
Thanks Toby
 
Top