Switching PIC16F PWM output between each side of a H Bridge


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2009
    Posts
    19

    Default Switching PIC16F PWM output between each side of a H Bridge

    Hi all, I'm a little stuck here. I think it's mainly because i don't know the terminology to search for so i'm asking for some assistance.

    Basically, i am in the design stages of trying to control a High power H bridge to be able to drive a DC motor in forward and reverse directions using the single PWM output from a 16f628A. So basically i need to be able to switch the PWM signal from one side of the H bridge to the other.

    I know the answer is likely simple but - How can this be achieved?

    TIA...

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default Re: Switching PIC16F PWM output between each side of a H Bridge

    Hi,
    You need some external logic like a couple of AND gates. But how to do it depends on if you're doing locked anti-phase PWM or if plan to use one switch in each leg for the PWM and the other as "steering"?

    With that said there are small PICs a lot more suitable for this kind of application, like the 16F684 for example, which has an enhanced PWM module more sutiable for driving a full H-bridge.

    /Henrik.

  3. #3
    Join Date
    Sep 2009
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: Switching PIC16F PWM output between each side of a H Bridge

    Thanks for the reply Henrik. Perhaps i'm in a little over my head already but i have no idea what anti-phase PWM is. I googled it but it was not clear to me what it's advantages are.

    Perhaps i will explain the application and it might help you help me

    What i am designing here is what i would call a dynamic feedback steering wheel for PC racing games. It's not going to be an active force feedback wheel like commercially available ones. This is to complete my scratch built racing simulator already complete with some other MCU goodness....

    Basic descrition of the project:
    A rotary encoder will be attached to a freely rotating (steering) shaft. The pic will read the encoder and will reference a center position. The amount of allowable rotation will be controlled by variable limits (encoder pulses) set at pic power up. While the position is between the center and the limit (CW or CCW from center), a constant force will be applied in the opposite direction via H bridge/PWM/DC motors as a centering spring. When the wheel reaches this limit, the current to the motors will be significantly increased to act as a hard stop. Also in the mix is the pic SHIFTOUTing to a digital pot to replace the real one.

    I have the main circuit and code working i.e all the dpot and encoder work but i am not sure how to control the H bridge with only one PWM output and i also figured it would be a safer way as then it would be impossible to short the bridge by having two outputs active at the same time. I'm not opposed to changing chips if i can still have enough to cover my i/o requirements.

    My electronics knowledge is reasonable but somewhat limited. i.e I'm not an Electronic engineer (obviously) but I have quite a few other complicated pic based projects under my belt that have been built/designed from scratch.

    Andrew

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default Re: Switching PIC16F PWM output between each side of a H Bridge

    Hi Andrew,
    Locked anti-phase PWM is when you, for zero torque ouput, applies a 50% dutycycle to the bridge. Upper left and lower right switch is on half of the time, then upper right and lower left switch is on half of the time. This means that current is passing thru the motor in one direction 50% of the time and in the other direction 50% of the time. The net current thru the motor is 0 so no torque is produced.

    As you change the dutycycle, up or down, current is passing in one direction for a longer time than in the other meaning the net current thru the motor increases which makes it start to produce torque. This alows a single PWM signal to control direction and torque.

    Basically you apply the PWM signal to top right and low left switch. Then you run the same signal thru an inverter and apply THAT signal to upper left and lower right switch. There's no dead-time when doing this which means your bridge has to implement that in hardware. With the 16F690 dead-time is avaliable and controlled thru the PWM-module and it outputs the complementary signals directly so you won't need the external inverters.

    How is your H-bridge designed? Hybrid chip or discrete components? If MOSFETs what type of driver chip are you using?

    /Henrik.
    Last edited by HenrikOlsson; - 6th June 2011 at 14:04.

  5. #5
    Join Date
    Sep 2009
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: Switching PIC16F PWM output between each side of a H Bridge

    Thanks again Henrik for your time and expertise I really appreciate your input.

    I guess the anti-phase should be ok and looking at the datasheet for the 16F690 it looks pretty simple to implement so there is no reason i can not change to that chip. It even has some other cool stuff that might be of use too!

    The h-bridge design I am looking at using is the one here http://www.pocketmagic.net/?p=508 but using TIP35/6 for some extra current allowance in my design.

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts