Jump to content
Tribes

Sensorless BLDC motor control

Recommended Posts

Hi there,

 

my current project is to build a controller for a sensorless BLDC motor using a MSP430G2553. I want to realize trapezoidal control with Back-EMF/zero-crossing detection. I plan to detect zero-crossing with the Comparator(CA2/3/4 vs. CA1) and generate PWM using Timer1. Timer0 will be used for things like 30

BLMC_.zip

post-9129-0-55053500-1375548989_thumb.png

post-9129-0-82022600-1375548994_thumb.png

post-9129-0-30993500-1375548999_thumb.png

post-9129-0-38054700-1375549005_thumb.png

Edited by Tribes

Share this post


Link to post
Share on other sites

 Very cool idea, what amp current are you hoping for?

 

Hopefully I can get at least 20A, but of course the more the merrier. Since I don't have much experience in this area, I have no idea how accurate my assumption is :smile:

 

 

 I assume this is for a quad copter ESC project?

 

Yes, at the end of the day I hope I can build my own quad. But until then I still have a long way to go :grin:

 

 

Lookin forward to seeing more and best of luck!

 

Thanks!

Share this post


Link to post
Share on other sites

Hi there,

 

my current project is to build a controller for a sensorless BLDC motor using a MSP430G2553. I want to realize trapezoidal control with Back-EMF/zero-crossing detection. I plan to detect zero-crossing with the Comparator(CA2/3/4 vs. CA1) and generate PWM using Timer1. Timer0 will be used for things like 30

Share this post


Link to post
Share on other sites

Do you even have enough code space for what you need (not sure how complicated an ESC controller gets but the quadcopter pilot code was fairly big IIRC, though it's done in Arduino which might be less efficient)?  I found the MSP430 code somewhat inefficient.  On my first project, I have almost 1K of code and it's maybe two pages of C code? :-(

Share this post


Link to post
Share on other sites

Cool project, I did something very similar as well!

 

https://github.com/lgbeno/BLDC-Booster

 

There is software on there too that you are free to reference. It works with some exceptions. The method that I used for commutation is bemf integration similar to the ti instaspin approach. The issues that I had was that for very fast motors(>500Kv), I wasn't sampling the ADC fast enough to get the commutation timing right but for slow motors, it works great.

 

A few words of wisdom since I worked on this project for quite some time. I would recommend using the 28pin Tssop or qfn32 versions of g2553. Reason being is that it has 3 pins attached to ta1.1 which you can use for the high side pwm signals and 3 pins attached to ta1.2 to be used for low side pwm signals. This does 3 things, frees up timer 0 for something else, allows you to do dead time insertion (if your gate drivers don't already) and just makes your code easier too!

 

The other thing is that you will see your pwm super imposed on your bemf which will likely cause false trips of the comparator. To solve this, there's a low pass filter but that also introduces a dc offset that throws off your zero cross point.

 

Long story short, I came up with a different network that filters and then ac couples the bemf to the comparator. I was seeing pretty good results with that approach. Then I had to return my borrowed scope and have not been able to work on it. Good news is I'm getting a brand new Rigol DS2072 for keeps on Thursday.

 

Anyway I guess that is my project life story, hope it helps. Tomorrow ill try to dig up schematics with those improvements (not in github yet).

 

Btw the schematics are very inspired by the microkoptor.de schematics, mine are as well... I wonder how they got away with the pwm glitches in their software. Obviously theirs works quite well.

Share this post


Link to post
Share on other sites

One other thing, I don't think that IR2184 is going to work for this application. I tried to load the datasheet but I have a terrible Internet connection at the moment. The single pin pwm input to

Share this post


Link to post
Share on other sites

Sorry, bumped the send button. What I was trying to say was that with the single pin pwm input for the gate drivers, this tells me that they are complementary drivers, ie when the pin is high, high side get is on, when low, low side get is on. This is an issue for bldc because there are 6 different pwm states where you may be driving phase a high side and phase b low side, all other fets need to be off in this state. I don't think that is possible with these gate drivers.

 

You need to get drivers that have seprate inputs for high side and low side drive, or use 6 single channel drivers. Finding a cost effective gate drive is a difficult thing, especially for these huge 6mohm fets!

Share this post


Link to post
Share on other sites

A couple of things to watch out for:

 

1) you should plan for some extenal flyback diodes in case the internal ones don't get the job done

2) I am not sure what the voltage tolerance for the comparator inputs on the MSP is, but you might get some HV spikes from the motor so maybe a zener for protection might be a good idea.

3) you might want to consider an optocoupler between the MSP and the Gate Driver, jus to make sure.

Thanks, I will try to include as much of this as I can in my next revision.

 

 

Do you even have enough code space for what you need (not sure how complicated an ESC controller gets but the quadcopter pilot code was fairly big IIRC, though it's done in Arduino which might be less efficient)?  I found the MSP430 code somewhat inefficient.  On my first project, I have almost 1K of code and it's maybe two pages of C code? :-(

No, I don't think code space will be a problem. I assume by "quadcopter pilot code" you mean the actual flight control which is of course a whole different story since it's way more complicated than the ESC.

 

 

Cool project, I did something very similar as well!

 

https://github.com/lgbeno/BLDC-Booster

 

There is software on there too that you are free to reference. It works with some exceptions. The method that I used for commutation is bemf integration similar to the ti instaspin approach. The issues that I had was that for very fast motors(>500Kv), I wasn't sampling the ADC fast enough to get the commutation timing right but for slow motors, it works great.

Nice. I ran across a video on youtube about the InstaSPIN-BLDC technology from TI yesterday, too, and I think it is quite interesting. I'm considering using it instead of the zero-crossing technique but I'm not sure yet. (maybe I implement both and compare which performs better)

 

 

A few words of wisdom since I worked on this project for quite some time. I would recommend using the 28pin Tssop or qfn32 versions of g2553. Reason being is that it has 3 pins attached to ta1.1 which you can use for the high side pwm signals and 3 pins attached to ta1.2 to be used for low side pwm signals. This does 3 things, frees up timer 0 for something else, allows you to do dead time insertion (if your gate drivers don't already) and just makes your code easier too!

Yes, I will do that, I was first planing with a 20pin G2553 as my idea was to create a BoosterPack but I later on decided to do a standalone board since it makes more sense regarding my plans.

 

The other thing is that you will see your pwm super imposed on your bemf which will likely cause false trips of the comparator. To solve this, there's a low pass filter but that also introduces a dc offset that throws off your zero cross point.

Long story short, I came up with a different network that filters and then ac couples the bemf to the comparator. I was seeing pretty good results with that approach. Then I had to return my borrowed scope and have not been able to work on it. Good news is I'm getting a brand new Rigol DS2072 for keeps on Thursday.

My design includes low pass filter on the back emf but I would love to see what you have come up with.

 

 

Btw the schematics are very inspired by the microkoptor.de schematics, mine are as well... I wonder how they got away with the pwm glitches in their software. Obviously theirs works quite well.

Yes mikrokopter.de was one source of inspiration, as was mikrocontroller.de since they have a lot of information and quite a few people on the board there have realised BLMCs with atmel MCUs.

 

 

Sorry, bumped the send button. What I was trying to say was that with the single pin pwm input for the gate drivers, this tells me that they are complementary drivers, ie when the pin is high, high side get is on, when low, low side get is on. This is an issue for bldc because there are 6 different pwm states where you may be driving phase a high side and phase b low side, all other fets need to be off in this state. I don't think that is possible with these gate drivers.

 

You need to get drivers that have seprate inputs for high side and low side drive, or use 6 single channel drivers. Finding a cost effective gate drive is a difficult thing, especially for these huge 6mohm fets!

Hm, especially when I want to realize bipolar PWM you're of course right. Fortunately there is the IR2183 which is basically the same as the IR2184(pin-compatible) but with HIN/LIN instead of IN/SD. So I think I am gonna use that.

 

All those changes might take some time since I am not at home this and next week. So I only have internet via mobile phone, but I will see what I can do.

Share this post


Link to post
Share on other sites

Do you even have enough code space for what you need (not sure how complicated an ESC controller gets but the quadcopter pilot code was fairly big IIRC, though it's done in Arduino which might be less efficient)? I found the MSP430 code somewhat inefficient. On my first project, I have almost 1K of code and it's maybe two pages of C code? :-(

G2553 should have enough code space for an esc, like tribes says, probably not enough for the flight control but I think more because of SRAM not flash. 16k is a decent amount.

 

Also if esc code is done right leveraging the hardware resources of the g2553, it's pretty elegant.

Share this post


Link to post
Share on other sites

Btw, I have quite a few of my bldc boosters sitting around, I could send you one to jump start your code dev, send me a pm if you want one.

 

That would be awesome! Will send you a pm right away :)

This board is just awesome :)

Share this post


Link to post
Share on other sites

Very cool project Tribes!!  I was thinking of designing my own BLDC motor controller for an e-bike but I haven't had the time to get around to it. Your project is close enough where one could adapt it to work for an e-bike too with a few potentially minor changes. Thanks for the post!

 

Also, are you heatsinking your MOSFETS? they might run a little warmer than you'd like that close together when running 20A.

Share this post


Link to post
Share on other sites

Very cool project Tribes!!  I was thinking of designing my own BLDC motor controller for an e-bike but I haven't had the time to get around to it. Your project is close enough where one could adapt it to work for an e-bike too with a few potentially minor changes. Thanks for the post!

 

Thanks! And your idea sounds interesting! If anyone has use for my design, feel free to use it :smile: (just don't hold me responsible ;-) )

 

Also, are you heatsinking your MOSFETS? they might run a little warmer than you'd like that close together when running 20A.

 

I don't have any specific plans regarding heatsinking yet but I have e.g. seen 40 x 40 mm heatsinks, which you could glue to the MOSFETs. But as I said I haven't given it much thought yet, will figure it out along the way (as well as quite some other stuff :grin:  )

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...