6 MOSFET (3-phase) H-bridge control

Started by pyrochk247 March 18, 2008
Hello,

I am trying to create my own 3-phase H-bridge to commutate a brushless
DC motor. I know that I need to open/close 3 MOSFETS at a time. Can
anyone help me develop a code to activate my commutation patterns? I
have the binary code patterns already but I am a cruddy programmer and
I am new to the whole micro-controller thing. I need the patterns to
be switched every 2ms (about a 60Hz, 12% duty cycle for this motor).
Any advice? I can give more information if anyone needs it. Thanks
for any help!!

~pyrochk247
> ... trying to create my own 3-phase H-bridge to commutate a
brushless DC motor...

Maybe this will help:

http://tech.groups.yahoo.com/group/basicx/message/21898
Tom
I took a look over the link (thank you btw.) and I don't quite think
that is what I am looking for. I am simply trying to open and close 3
of 6 MOSFETS at a time to simulate a squarewave. i.e.:

100100 will open the high side P-mosfets 1,2 and n-mosfet 6
110110 will open 1, 5 and 6...etc.

I just want to open and close each mosfet individually at a certain
rate. I know this isn't the best way to commutate the motor but I
will also have to somehow add in Hall sensor feedback to see if I can
get it to move more efficiently.

So, I guess..for now...I just need to know how to send a 5V pulse to
whatever transistor I want to open or close its gate. Thanks for your
help!

-pyro

--- In b..., "Tom Becker" wrote:
>
> > ... trying to create my own 3-phase H-bridge to commutate a
> brushless DC motor...
>
> Maybe this will help:
>
> http://tech.groups.yahoo.com/group/basicx/message/21898
> Tom
>

Hi,
Did you try call pulseout instruction?

call pulseout(pin number, how long on value, high =1 0=low output)

rosarite

**************Create a Home Theater Like the Pros. Watch the video on AOL
Home.
(http://home.aol.com/diy/home-improvement-eric-stromer?video?ncid=aolhom00030000000001)

> ... I am simply trying to open and close 3 of 6 MOSFETS at a time to
simulate a squarewave. i.e.:
> ... 100100 will open the high side P-mosfets 1,2 and n-mosfet 6
> ... 110110 will open 1, 5 and 6... etc.

One way to approach this is to assign your three pairs of H-bridge
control lines to adjacent pins on a single byte port (PortA is BX-24
pins 13-20, PortC is pins 5-12), say pins 5 through 10. Configure the
six pins as outputs (you can use register.DDRn (A or C), then
successively put the byte sequence you've defined to the pins using
register.Portn at the rate you want.

Suppose you've put a 12-byte repeating pin sequence in bXYZ(1 to 12).
Try:

sub DriveLoop()
register.DDRC = bx1111_1100 '6 pins as outputs
do
for b = 1 to 12
register.PortC = bXYZ(b) 'put byte to pins
call Sleep(1) 'pause a tick (~1.95mS)
' call PulseOut(0, 0.002, 0) 'this is another delay method
next
loop
end sub

You might need to dynamically change the delay time to ramp up from
stopped and ramp down from speed, since the rotor mass won't usually
instantly accelerate to the speed of the code.

Driving a BLDD motor this way is very similar to conventional stepper
motor drive, but with more coils and consequently different sequences,
so you might investigate stepper motor code, too.
Tom

> Call PulseOut(0,0.002,0) --p-MOSFET 1 open
> Call PulseOut(1,0.002,1) --p-MOSFET 2 closed
> Call PulseOut(2,0.002,1) --p-MOSFET 3 closed
> ... etc.

Although BX-24 pins aren't numbered from zero (a BS2 Pin0 is actually
pin 5), this method will only activate a single pin at a time. I
suspect that is not what you want. You likely need to overlap these
pulses to rotate the shaft. You'll find it's 's easier, therefore, to
write to multiple pins simultaneously with the appropriate switching
sequence for an appropriate time.

Study stepper motors for some insight, perhaps.
Tom