H-Bridge timing

Discussion in 'The Projects Forum' started by camerart, Sep 9, 2014.

  1. camerart

    Thread Starter Active Member

    Feb 25, 2013
    517
    30
    Hi,

    Some time ago I built H-bridge circuits for motor control on Camera buggies. I've attached the schematic. The Mosfets are 'N' IRF7413ZPBF and 'P' IRF7424PBF (The 'Ps' at the top).

    I remember the many times that I 'popped' the mosfets, I assume by switching forwards and reverse at the same time (Which they don't like much). I added a dedicated PIC for adding pauses each time I switched direction.

    Would someone have a look and see if this looks ok please, as I intend to use it in another project.

    Cheers, Camerart.
     
  2. ericgibbs

    Senior Member

    Jan 29, 2010
    2,499
    380
    hi,
    A quick look shows.

    Ref your PIC to Bridge circuit, I dont see a 0V/Common from the bridge to the PIC Common.??
    How can the 5V powered PIC switch the NMOS FET's.?

    LED1 shows -12V to the Anode, if its a Red LED, when RA0 is low, its sinking 20mA. Whats is its purpose.?

    E

    EDIT:
    D1 zener is not current limited, whats its type.?
    Why not use the internal 4MHz osc.?
     
  3. camerart

    Thread Starter Active Member

    Feb 25, 2013
    517
    30
    Hi Eric,

    Re: the 0V common, I had zoomed in a bit too much, here it is again:

    Here is the Zener type:

    I'll have to think about how the 'N's are being switched? I think it might be the resistors pulling them up combined with zener voltage control.See edit.

    I used to always use XTLs after I didn't get good results without them, and I used LEDs on circuits, to show me the PIC was working.

    I'll let you know when I remember more.

    EDIT: The SCH shows -12Vmotors it should read 0V.

    C.
     
    Last edited: Sep 9, 2014
  4. ericgibbs

    Senior Member

    Jan 29, 2010
    2,499
    380
    hi,
    Look at this LTS sim of your basic circuit. [showing only one Hbridge]

    I dont see what the 15V zener is supposed to do.? What will be power source a 12V battery.?

    E
     
  5. camerart

    Thread Starter Active Member

    Feb 25, 2013
    517
    30
    Hi E,

    If I read it correctly, it is working ok in your LTS?? sim. Let me know if I'm wrong.

    There are two 12v batteries, a small one for the circuit 0v-12V and a power one for the motors also 0v-12v (No -12v) Both 0V are connected together.

    I have used these circuits on wheelchair motors, and they were cool to the touch. I want to make sure about the switch over delays in the 16F819 so the mosfets don't 'pop'.

    I must have been advised or saw the zener on a circuit, and copied it, I think it might be for smoothing spikes, but I'm not sure.

    C
     
  6. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    When I drive h-bridges from a PIC, I use four port pins. That way, I can guarantee that I can turn off first the NFET, then turn off the PFET, then turn on the other PFET, and then finally turn on the opposite NFET. I can also go dynamic braking at will. Let the software generate the non-overlapping drive signals...
     
  7. camerart

    Thread Starter Active Member

    Feb 25, 2013
    517
    30
    Hi Mike,
    I made these circuits about 4 years ago, and they worked ok, but do you think that switching the 'N' which in turn switches the 'P' is unsafe, or could the timing be wrong? If you can see that it is prone to 'popping' the mosfets, then if I have to re-design them, I'll do as you say.

    With your method, how do you time them so they switch over as quickly (and safely) as possible?

    Will your method switch as in PWM? I've never used it, just simply forward/reverse switching.

    How do you get them to dynamic brake?

    C
     
    Last edited: Sep 10, 2014
  8. ericgibbs

    Senior Member

    Jan 29, 2010
    2,499
    380
    hi C,
    Ref to our PM's, I would recommend that you build one of the H bridges and write a simple test program for the HB using a 18F2431 [ which you are already planning to use for the QEI feature for the encoder disk]. This will allow you to debug the system.

    For your application the scanner head will have to be driven over a wide range of rotational speeds when tracking a moving remote target.
    A basic On/Off drive to the motors will not give the head slew control required, so PWM would be my recommendation.

    I believe what Mike uses for dynamic braking is the method, switch On BOTH NMOS FETs at the same time [ the PMOS being both Off] this effectively shorts the motor so that it will brake quickly. As he points out 4 PIC pins per HB are required to achieve this braking.

    PWM and dynamic braking can be realised within the same program, but you will need level shifters from the PIC to the PMOS FET's, perhaps a transistor etc.

    The initial PWM only test program could be then modified to add dynamic braking. [ leave space on your HB PCB for the level shifters]
    I see that your motor is 12V at approx 1A running current, so beef up the FET's to give say 5Amps for start up.

    Eric
     
    Last edited: Sep 10, 2014
  9. camerart

    Thread Starter Active Member

    Feb 25, 2013
    517
    30
    Hi Eric,

    It looks like I am going to need to make a completely new circuit, using 18F2431 for QEI Quadrature encoder input and PWM output to an H-Bridge, with separate inputs for all mosfets.

    Thanks, C.
     
  10. camerart

    Thread Starter Active Member

    Feb 25, 2013
    517
    30
    Hi,

    Can someone suggest a H-bridge circuit, with individual inputs from TTL to each mosfet please.

    The above circuit will be driven from an 18F2431 PIC using QEI quadrature inputs and output PWM to the H-bridge circuit.

    I can only program (limited) in basic and have been using Oshonsoft to program PICs

    NOTE: The Oshonsoft simulator does not work with QEI yet!!!


    Hi Eric,

    Here is a section from one of the 'N' mosfets:

    Do you still think they need to be bigger?

    C
     
  11. ericgibbs

    Senior Member

    Jan 29, 2010
    2,499
    380
    hi.
    The IRF7413 is suitable for 5V Gate control.
    E
     
  12. camerart

    Thread Starter Active Member

    Feb 25, 2013
    517
    30
    Ok, thanks.
     
  13. ericgibbs

    Senior Member

    Jan 29, 2010
    2,499
    380
    hi C,
    Attached is a Basic Oshonsoft program for Forward & Reverse for one motor drive, using a 18F4520 PIC.
    CCP1 [PWM] and CCP2 [PWM] on PORTC [ I have retained the LCD display as per the logger]
    Internal 8MHz clock with 4*PLL , so 32 mMHz as the Logger setup.

    Its for your bench testing, it uses ADC0 and ADC1 to control the motor speed by varying the PWM period.[ use a 10K trim pot for each ADC +5V to 0V to set each PWM ].

    Use PORTC.0 for motor direction control, there is a software interlock so you cannot select Fwd and Rev direction at the same time.! having said that it would be wise while testing to fuse your HB 12V supply with say a 5Amp fast blow fuse until you have finished debugging your wiring.:eek:

    The PWM is set for Mode 7, which at 4MHz is 997Hz, so with the PLL*4 thats 32MHz =7913Hz PWM base frequency.

    Note: there is no dynamic braking software, we can add that later if required.

    Eric
     
  14. camerart

    Thread Starter Active Member

    Feb 25, 2013
    517
    30
    Hi
    Hi Eric,

    Just to clarify: 1/ I make a new H-bridge circuit board for 2x 18F2431 (The mosfets are surface mount, so no breadboard tests) then 2/ I adapt one of the 18F2431 sockets for this test 18F4520.

    If I add a protection fuse, does it need to be removed? (Changing mosfets is a pain)

    I will post the schematics etc for checking as I go along.

    Thanks.

    C.
     
  15. ericgibbs

    Senior Member

    Jan 29, 2010
    2,499
    380
    hi,
    If you have already built the HB using a 18F2431, you can just change that 18F4520 program to suit the 18F2431.
    Remove the LCD part
    E

    EDIT:
    I see that Oshonsoft does not support the ADC feature in the 18F2431, so editing the 18F4520 program to run in the IDE is not possible....
     
    Last edited: Sep 11, 2014
  16. camerart

    Thread Starter Active Member

    Feb 25, 2013
    517
    30
    Hi Eric,

    I haven't started the HB yet, first I have to find out how to switch 4x mosfets, then draw the schematic, route it, then etch it. This is quite a long process, and only needs to be done once if possible:eek:

    The HB will have 2x sockets for 18F2431 (assuming this is the final PIC chosen) the 18F4520 is wider, so an adaptor must be made.

    I'm not sure what we do about: I see that Oshonsoft does not support the ADC feature in the 18F2431, so editing the 18F4520 program to run in the IDE is not possible.

    I have sent a bug report to Oshonsoft RE: ADC.

    C
     
  17. ericgibbs

    Senior Member

    Jan 29, 2010
    2,499
    380
    The PWMdemo1 program I post today, using a 18F4520 will enable you to test and debug your HB circuit, both in the IDE and a PIC .
    If the HB works OK using a 18F4520 it will also work with a 18F2431.

    You should always prove your design by building a prototype board BEFORE laying down PCB artwork.

    Also I have already posted a LTSpice sim of a HB circuit showing the component values, use the N MOSFET
    type you posted today.
     
  18. camerart

    Thread Starter Active Member

    Feb 25, 2013
    517
    30
    Hi Eric,

    Thanks for your postings.

    I only have the original HB which has only 2 inputs/motor (Posted earlier). I'm under the impression that I need to make a new Hb with 4 inputs/motor.

    I don't know how to make a prototype board with these little Mosfets, other than etch a circuit for them to sit on, because of their tiny legs. Is there better way?

    EDIT: If the HB needs 4 inputs for possible braking in the future, how do I connect the two PIC PWM outputs in the test program, or have I missed something?

    C.
     
    Last edited: Sep 12, 2014
  19. camerart

    Thread Starter Active Member

    Feb 25, 2013
    517
    30
    Hi,

    I've moved some components round from my early SCH and added transistor switches, hopefully making the HB a 4 Channel one enabling braking later.

    Does it look ok>

    EDIT: Pots etc added

    C.
     
    Last edited: Sep 15, 2014
Loading...