Shop OBEX P1 Docs P2 Docs Learn Events
PWM to drive IRL530? — Parallax Forums

PWM to drive IRL530?

Kirk FraserKirk Fraser Posts: 364
edited 2011-04-25 09:04 in BASIC Stamp
I found a circuit under the Propeller topic to drive an IRL530.
http://forums.parallax.com/showthread.php?t=124471&highlight=IRL530
What modifications would enable it to drive from a Stamp using PWM (pulse width modulation) to give a variable voltage out of the IRL530?

Or would it be easier to stick with a serial output to DAC to OpAmp to IRL530 that was posted here 5 years ago? A more direct route without the extra chips would save lots of errors. Thanks!

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2010-11-17 05:35
    You can drive the gate right off the Stamp pin with 220 ohm resistor in series. Always good practice to also put 15k ohm from gate to Source so the gate won't drift on.
    The PWM command produces a rough series of pulses, originally designed to be filtered with a capacitor to provide a variable signal voltage.
    However, I've used the command and IRL-type transistors to drive motors and proportional hydraulic valves quite nicely.
  • Kirk FraserKirk Fraser Posts: 364
    edited 2011-01-19 06:40
    I tried the following circuit with a Stamp program I volt meter tested to get PWM output from 0 to 4.3 volts (more like 1-4.3 since nearer to zero only happens at zero). The problem is there is no proportional output at the load, it's just on-off. How do I get IRL530 output proportional to the PWM signal? Thank you.

    http://forums.parallax.com/attachment.php?attachmentid=43806&d=1161810605
  • stamptrolstamptrol Posts: 1,731
    edited 2011-01-19 06:58
    Please attach your program and the circuit you're using.

    The example you attached is for on-off switching of a relay which is not what PWM is used for.
  • Kirk FraserKirk Fraser Posts: 364
    edited 2011-01-19 09:27
    Your prior post includes: "However, I've used the command and IRL-type transistors to drive motors and proportional hydraulic valves quite nicely." How did you do that?

    Here's my code. Stamp pgm.txt

    Here's a circuit attempt.
    DACirc1.jpg

    And another: PropValveDriver.gif

    My current goal is to make a hydraulic rotary actuator do a simple back and forth swing test without pulling the mounts out of the concrete which was happening with a simple JK-flip flop circuit. My program may not be tweaked perfectly for smooth S-curve reversals yet but it's on the right track judging by LED responses to the 10K pot position sensor.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-01-19 10:00
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-01-19 10:14
    The problem is that the BASIC Stamp's PWMOUT command dos not really produce PWM but a much faster-switching DUTY mode waveform. This switching is too fast to switch the transistors discretely and they end up conducting linearly. Combine this with the gain from the extra transistor stage and you essentially end up with a comparator output that's either on or off.

    What you need is something 20KHz or slower to drive the transistors. This could be simulated on the Stamp with PULSOUT in a loop, perhaps, with SEROUT and some cleverly selected data, or the same but with the data line of SHIFTOUT. None of these work-arounds are especially good, however.

    -Phil
  • stamptrolstamptrol Posts: 1,731
    edited 2011-01-21 05:25
    No mystery why neither of these circuits are giving the expected output as they are operating your mosfet with a variable voltage, not PWM.

    The input to the mosfet has to be a PWM signal such as generated by the PWM command, but without the capacitor shown in the example.

    Come directly out of the Stamp pin, go through some resistance (say 1K) and connect directly to the gate of the mosfet. Do not use the capacitor. Also have about 15K connected from gate to source.
    Now the transistor will switch fully on and off according to the PWM pulse stream and the valve will respond according to its mechanical response time.

    Cheers,
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-01-21 08:52
    stamptrol wrote:
    The input to the mosfet has to be a PWM signal such as generated by the PWM command
    As I stated in my prior post, the PWM command does not generate PWM but a DUTY output that's too fast for PWMing a MOSFET.

    -Phil
  • stamptrolstamptrol Posts: 1,731
    edited 2011-01-21 08:59
    The point being that the PWM command, when connected as I described, has indeed been able to drive a mosfet and proportionally control a hydraulic valve.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-01-21 11:20
    Tom,

    Despite your apparent success in doing as you describe, I'm afraid I still have reservations about your methodology. The PWM output frequency of the BS2 at 50% is 113 KHz. The gate capacitance of the IRL530 is 930pF. Here's what happens when you drive a 1000pF load through a 1K resistor from the BS2's PWM output:

    attachment.php?attachmentid=77472&d=1295636338

    What this trace illustrates is that the MOSFET will be spending a large amount of time in it's linear region -- neither fully on nor fully off -- and possibly overheating as a consequence. The situation will be even worse with other BASIC Stamps, which have faster "PWM" outputs.

    Unfortunately, upon trying them with a BS2, I've not been able to obtain satisfactory results from either SHIFTOUT, SEROUT, or PULSOUT (which I suggested in an earlier post). Perhaps the best way to obtain the desired lower frequency is with the classical triangle-wave generator and comparator, with a lowpass-filtered "PWM" driving one comparator input. ... or just drive the MOSFET using PWM via a MOSFET driver chip that can switch the gate capacitance fast enough.

    -Phil
    640 x 480 - 14K
  • stamptrolstamptrol Posts: 1,731
    edited 2011-01-21 13:13
    I did this back in 1997 and don't have the resistance value right at hand.. What happens with less resistance? Say down to 100 ohms.

    I'd hate to tell the client that his machine hasn't been operating all these years!
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-01-21 14:06
    Tom,

    At 100 ohms, the rise and fall times to 90% and 10% are about 1/10 the pulse period at 50% duty with a BS2. I measured a peak charge current of 30 mA and peak discharge of 40 mA on the BS2 pins, which is a bit high for a BS2 to endure consistently. At 220 ohms, the rise and fall times double and the currents decrease to a more manageable 18 mA and 23mA. Without a heavy load and with proper heatsinking, 220 ohms might be okay. This all changes, of course, with other Stamp versions.

    -Phil
  • Kirk FraserKirk Fraser Posts: 364
    edited 2011-01-22 06:54
    Sounds like a problem - one says IRL530 can do proportional control another says it can't with either PWM or SHIFTOUT, SEROUT, or PULSOUT? I'll be trying everyone's suggestions to get something to work.

    Is there another transistor or product than the IRL520, IRL530 that everyone can agree will do proportional control easily? Thank you.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-01-22 08:59
    Kirk,

    I think your best bet is to use the IRL530 with PWM and a MOSFET driver chip, like the MIC4420. This will permit the Stamp to drive the MOSFET without stretching the Stamp's output current specs to switch the MOSFET gate at full speed.

    -Phil
  • kf4ixmkf4ixm Posts: 529
    edited 2011-01-22 12:03
    @Phil
    Would a uln2803 be a good choice to drive mosfets, like the above mentioned irf530's or irf510's?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-01-22 15:20
    No, the ULN2803 is unsuitable as MOSFET driver for two reasons: 1) it's current-sinking only: a MOSFET driver has to have both sourcing and sinking outputs; and 2) it uses Darlingtons, which switch too slowly: a MOSFET driver must be able to switch capacitive loads very quickly.

    -Phil
  • stamptrolstamptrol Posts: 1,731
    edited 2011-01-23 05:37
    Kirk,
    while I set this up in the shop, what are the specs on the valve you'll be driving? I don't think the current drawn by th eproportional valve will overload the mosfet.
  • Kirk FraserKirk Fraser Posts: 364
    edited 2011-01-23 11:22
    I hope the forum programmer figures out how to leave a person logged in a bit longer or how to accept a login without losing the post that was submitted.before demanding a login.

    Phil,

    The MIC4420 is ordered, thank you!

    stamptrol,

    The valve data sheet is http://www.sterling-hydraulics.com/files/pdf/JP04C31.pdf but the coils are stamped with 24VDC 14W instead of 18W. There is no spike overload for the IRL530 as I drove it by JK flip-flop for an hour at a time. Not sure if there will be a heat overload trying to maintain a proportional position. Thank you!
  • stamptrolstamptrol Posts: 1,731
    edited 2011-02-19 16:56
    Back in late January we were discussing the use of the PWM command without the capacitor filter to drive a mosfet gate.

    I had remembered doing a project years ago but got tied up with other stuff and am only getting back to trying it on the bench.

    Anyway, the circuit works fine with the stamp pin driving the the mosfet gate through a 470 to 1K resistor. A 15K resistor ties gate to source on the mosfet. Diode reverse connected across the motor.The motor runs smoothly and the IRL520 transistor I had available doesn't heat up when running a 12 volt motor. I think the original poster's intent was to drive a proprotional valve at a much lower current.

    Heres the code that I used to test.

    ' {$STAMP BS2sx}
    ' {$PBASIC 2.5}

    main:

    PWM 5,150,50 ' change the 150 to change speed, the 50 can be lowered slightly if desired.
    PAUSE 20 ' depending on the length of the rest of the program, remove this pause
    GOTO main

    Cheers
  • Kirk FraserKirk Fraser Posts: 364
    edited 2011-04-23 23:04
    The use of two IRL530's with gate directly connected to a PWM pin, ground to ground, and the output to valve coils between a 1N4001 to 24+VDC with no extra parts worked well on solderless prototype board.

    Transfer to an apparently obsolete Stamp project board with soldered point to point wiring fails no matter what I've tried. The output is always 24V on both although the program only allows one side to be powered at a time. I cleared the Stamp output pins from being the problem. I had to replace the IRL530's and added 1K resisters plus 0.1 uf capacitors between the pins and gates to get a straight 5V or less out depending on the program. Then I tried 0.1 caps between gate and ground, plus output and ground. I cut out the extra caps and tried the 15K between gate and ground. Somehow the gates seem connected with 5V out of both Stamp pins so 24V comes out of the IRL530's. I can't see a thing wrong with it. With the extra caps the volt meter seemed to slowly discharge the "off" side down to produce an output of about 19V while the "on" side was doing 24V.

    Does this resemble a problem you've encountered? Is my only option to make a custom PCB to minimize possible wiring problems? Thanks.
  • Kirk FraserKirk Fraser Posts: 364
    edited 2011-04-25 09:04
    Getting the success and the problem written down helped. Obviously I should return to the original no-extra parts circuit that worked. Then proceed to a propeller.
Sign In or Register to comment.