CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

BLDC driver code for PIC

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
mesut69
Guest







BLDC driver code for PIC
PostPosted: Sun Dec 12, 2004 1:38 pm     Reply with quote

I am working on a product to control a BLDC motor via PIC. I need any little program to inpire. I already inspected the AN 857.

Thanks to everybody concerns.
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Sun Dec 12, 2004 2:58 pm     Reply with quote

Motorola (Freescale) has always had some good application notes on brushless DC motors (I assume that is what you ment by BLDC motor).

A quick hit with Google shows this link
http://www.freescale.com/webapp/sps/site/overview.jsp?nodeId=02nQXGzm8L8528
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Sun Dec 12, 2004 6:08 pm     Reply with quote

And you didn't like, understand or what with AN857? Are you just trying to find more examples?
Arclite



Joined: 02 Jul 2004
Posts: 16
Location: UK

View user's profile Send private message Send e-mail

Check these tutorials out.
PostPosted: Sun Dec 12, 2004 8:07 pm     Reply with quote

Hiya,

Check these tutorials for motor control:

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1959

Then start piecing it together with the app note mentioned.

It is where my reference designs for all motor control came from, failing that, try the Atmel (or any other MCU vendor) website appnotes and port the code you might find.

You just need to know the basic modules involved, ie power switching, control, signal conditioning, protection etc... One of those tuts has a very detailed explanation of various motor types, and sensing methods. I don't remember which tho'.

Re-invent the wheel if you wish, or rip a design its up to you.


(Is it legal for me to use 'Atmel' here?)
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

Re: Check these tutorials out.
PostPosted: Mon Dec 13, 2004 8:28 am     Reply with quote

Arclite wrote:

(Is it legal for me to use 'Atmel' here?)


You must put a penny in the "cuss-jar"... Cool
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
mesut69
Guest







BLDC driver code for PIC
PostPosted: Thu Dec 16, 2004 2:31 pm     Reply with quote

Thanks to everybody. In my project I have two different brushless DC motor. First one has 3 hall effect sensor to position sensor. Second BLDC has no sensor and has to be controlled in sensorless mode. The (possible) weak point is , I must use a PIC x877 or 18F452 to control both motors. Speed reference , direction signals and error feedback will be supplied through an RS 232 interface.

Could someone tell me about the best configuration to do above things.
Guest








PostPosted: Thu Dec 16, 2004 5:26 pm     Reply with quote

Check these out:

[url]
http://ww1.microchip.com/downloads/en/AppNotes/00899a.pdf

http://ww1.microchip.com/downloads/en/AppNotes/00885a.pdf

http://ww1.microchip.com/downloads/en/DeviceDoc/41233A.pdf

[/url]

You will first off need a power supply rated for your motors, 2 or 3 phase, it doesn't matter. it gets rectified into + and - Vmotor supply. Industial servos often use 300 VAC. The supply is passed through a 3 phase to 2 phase rectifier and has a smoothing capacitor of a large value placed on the output. You'll see that in the above PDF's.


Now your PIC will need to control that voltage to the motor windings. So you will need a big power switch to handle the high current surge on the motor (dependent on the size of the motor). It would be wise to use a surge protector across the supply.
The convetional method is to use a combined High-side/Low-side driver with an IGBT or MOSFET package. (i'll stick with IGBT for now)

Through the driver you will control the power applied to motor via the IGBT. For a 3 winding motor, you will need a total of 6 IGBTs (3 N type and 3 P type). You will need a total of 6 logic pins from your PIC to control them.

With the supply, driver, IGBTs, motor, PIC, all set up, you can fire the IGBTs like flashing an LED on a demo program. Depending on your sequence of O/Ps, will determine the coarse position of the motor shaft.

To get finer control, you will need to pulse these O/Ps, and that's up to you how you code that. You may have a couple of on-board PWMs to do the work for you, but you will need 3, and some means of implementing Dead Band control.

I'll leave you to read the pdf's to understand in more detail on their control.


Sensing will require 3 analog inputs either way.

If you have the Hall Effect Devices (HED's), you can query the position at any time of the motos' operation.

If you have sensorless fb, you are powering 2 phases of the motor, whilst measuring the back-emf on the third. So you know the general position of the motor is determined buy the fact two windings are powered. It could be in sectors 0-120,121-240,or 241-360 degrees. The cross coupling of fields in the two windings overlay onto the temporarily unpowered winding, and from that voltage you can estimate postion/speed.

I hope that keeps you entertained for a while. ;-)
Arclite



Joined: 02 Jul 2004
Posts: 16
Location: UK

View user's profile Send private message Send e-mail

PostPosted: Thu Dec 16, 2004 5:33 pm     Reply with quote

Just to finish off my last post above (i was logged out),

The PID loop should be place in a Timer interrupt, so that you have a regular system heartbeat, that check the position, checks command, calculates error, applies PID algorithm. Over and over again.

UART interface code should live in a seperate interrupt, and general operation and house keeping in the main loop.

Hope it works out for you.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group