Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

BLDC Speed Control using PWM from ATmega640

Status
Not open for further replies.

drtvskuthsav

Member level 2
Joined
Apr 7, 2010
Messages
46
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,630
Hi,
I just tried simulating speed control of BLDC motor in proteus. I followed AVR443 application noted and designed the driver circuit and altered the code for atmega640. But when I connect the PWM channels of the micorcontroller to the lower side gate switches the speed is not controlled. But according to the app notes the speed can be controlled by varying the duty cycle of the PWM connected to the lower side gate switches. The simulation file and the code can be found in the rar file attached with this post.
Can someone please find the bug and provide the solution for this problem.
Thanks in advance


Regards
Kuthsav Thattai

attachment replaced with smaller version in zip format [alexan_e]
 

Attachments

Last edited by a moderator:

sky_123

Advanced Member level 4
Joined
Feb 26, 2011
Messages
1,170
Helped
279
Reputation
566
Reaction score
273
Trophy points
1,363
Activity points
9,598
40 MByte attachment? You might want to supply a jpg image of the circuit, and the relevant code snippet.
 

drtvskuthsav

Member level 2
Joined
Apr 7, 2010
Messages
46
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,630
40 MByte attachment? You might want to supply a jpg image of the circuit, and the relevant code snippet.
I thought of it, but then I felt it will be more easy for the gurus here to just run the simulation instead of making it all by themselves from beginning.

- - - Updated - - -

40 MByte attachment? You might want to supply a jpg image of the circuit, and the relevant code snippet.
I thought of it, but then I felt it will be more easy for the gurus here to just run the simulation instead of making it all by themselves from beginning.
 

sky_123

Advanced Member level 4
Joined
Feb 26, 2011
Messages
1,170
Helped
279
Reputation
566
Reaction score
273
Trophy points
1,363
Activity points
9,598
You're assuming the people that can help, own a copy of Proteus (many don't), and that they have .rar extracting software and are willing to download a 40MB file..
 

drtvskuthsav

Member level 2
Joined
Apr 7, 2010
Messages
46
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,630
You're assuming the people that can help, own a copy of Proteus (many don't), and that they have .rar extracting software and are willing to download a 40MB file..
I am sorry. I am attaching the schematic file (PDF) format and the c code I used..
 

Attachments


alexan_e

Administrator
Joined
Mar 16, 2008
Messages
11,895
Helped
2,020
Reputation
4,156
Reaction score
2,031
Trophy points
1,393
Location
Greece
Activity points
64,377
15MB pdf to include a couple of schematics and a few graphs :shock:

The 43MB rar attachment is another strange case, why would you include the "last loaded...DBK" and two backups of it adding 35MB to the compressed file!
 

drtvskuthsav

Member level 2
Joined
Apr 7, 2010
Messages
46
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,630
15MB pdf to include a couple of schematics and a few graphs :shock:

The 43MB rar attachment is another strange case, why would you include the "last loaded...DBK" and two backups of it adding 35MB to the compressed file!
Alex, it is my work folder. I did not check the size of auto generated files. I just compressed it and uploaded it. And the PDF., some one can find bugs by seeing the graphs. I won' repeat it again. Now please find the mistakes in my work and give me a solution.
 

sky_123

Advanced Member level 4
Joined
Feb 26, 2011
Messages
1,170
Helped
279
Reputation
566
Reaction score
273
Trophy points
1,363
Activity points
9,598
For someone writing software code, it's not an excuse not to know how large files are, or do something to reduce the size.

Anyway, are you sure your motor simulation hall sensors are doing the right thing? Not sure why you have a curve on the
hall sensor graph. Maybe it is due to analog anaysis on a digital component (I've no idea, I don't use proteus).

Secondly, you show some graph of M1, M2, M3, are the black bars containing PWM? It's hard to tell. If it is, then can you change
your OCRxxx values in your code and see the width of the PWM within these black bars changing?

If it is changing, and if your overall M1,M2,M3 period is still remaining the same (i.e. the hall sensor output does not change speed)
then the problem is due to the restrictions of the motor component in your proteus software.
 

drtvskuthsav

Member level 2
Joined
Apr 7, 2010
Messages
46
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,630
Anyway, are you sure your motor simulation hall sensors are doing the right thing? Not sure why you have a curve on the
hall sensor graph. Maybe it is due to analog anaysis on a digital component (I've no idea, I don't use proteus).
It is no hall sensor graph. The one that shows the inverter type output is the graph of voltage difference between motor leads, That is M1-M2, M2-M3, M3-M1. The other graph showing M1,M2,M3 is just the votage at M1,M2, M3.

Secondly, you show some graph of M1, M2, M3, are the black bars containing PWM? It's hard to tell. If it is, then can you change
your OCRxxx values in your code and see the width of the PWM within these black bars changing?


If it is changing, and if your overall M1,M2,M3 period is still remaining the same (i.e. the hall sensor output does not change speed)
then the problem is due to the restrictions of the motor component in your proteus software.
When I change the OCRxxx values, I can see PWM on graph showing UL,WL,VL. But the graph showing inverter type(M1,M2,M3) output is getting distorted and the simulation stops with an error. It says "Fatal Simulation Errors".
 

drtvskuthsav

Member level 2
Joined
Apr 7, 2010
Messages
46
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,630
The code is quite fine, i think. The problem must be with the driver circuit...Can anyone post the Drive Circuit for BLDC motor with N-Channel MOSFET on both high side and low side.??

- - - Updated - - -

I tried another driver circuit.View attachment bldc_pwm_tc4469.bmp
and the output was like View attachment 53percent duty cycle.bmp.

But the speed of the BLDC motor increased instead of reducing...Can someone help me fix this?

- - - Updated - - -

I tried another driver circuit.View attachment bldc_pwm_tc4469.bmp
and the output was like View attachment 53percent duty cycle.bmp.

But the speed of the BLDC motor increased instead of reducing...Can someone help me fix this?
 

sky_123

Advanced Member level 4
Joined
Feb 26, 2011
Messages
1,170
Helped
279
Reputation
566
Reaction score
273
Trophy points
1,363
Activity points
9,598
Well, I'm not downloading a 15MB file again to double check the graph that you're referring to, nor the circuit.
If the code is "quite fine" then the point still remains:

"can you change your OCRxxx values in your code and see the width of the PWM within these black bars changing?"
 

drtvskuthsav

Member level 2
Joined
Apr 7, 2010
Messages
46
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,630
Well, I'm not downloading a 15MB file again to double check the graph that you're referring to, nor the circuit.
If the code is "quite fine" then the point still remains:
Mistakes are just mistakes with no intentions...
It is not 15mb file again..Just 341KB and a 3MB file...Please check the files I uploaded in my last post. I can now see the PWM the output of that file.

In the circuit I posted earlier(15MB), when I try PWM the graph is getting distorted. Can you please check the recent files and post a 12V BLDC driver circuit for speed control.
 

sky_123

Advanced Member level 4
Joined
Feb 26, 2011
Messages
1,170
Helped
279
Reputation
566
Reaction score
273
Trophy points
1,363
Activity points
9,598
I'm not downloading a 3MB BMP either. Check out jpg and see how other websites have small (a few 100kbyte) images.
It's really simple:
"can you change your OCRxxx values in your code and see the width of the PWM within these black bars changing?"
 

drtvskuthsav

Member level 2
Joined
Apr 7, 2010
Messages
46
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,630
"can you change your OCRxxx values in your code and see the width of the PWM within these black bars changing?"
bldc_pwm_tc4469.JPG
Yes in the above circuit I change OCRxxx value and I can see the PWM in the output wave form of the Three phase inverter...
For 53% duty cycle the output is shown in following figure.
53percent duty cycle.JPG

Both JPG files.
 

sky_123

Advanced Member level 4
Joined
Feb 26, 2011
Messages
1,170
Helped
279
Reputation
566
Reaction score
273
Trophy points
1,363
Activity points
9,598
If your graph of the PWM output shows the PWM width changing, then the code and circuit is working fine.
The speed of the motor should change, but it could be a simulation problem (the motor simulation should delay the hall switch change, but maybe the
designer of the motor simulation did not implement the simulation to that level of detail).
 

drtvskuthsav

Member level 2
Joined
Apr 7, 2010
Messages
46
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,630
If your graph of the PWM output shows the PWM width changing, then the code and circuit is working fine.
Thank you so much. So Can I start making the hardware with the same driver circuit. Will it work?? Any free suggestions ? :p
The speed of the motor should change, but it could be a simulation problem (the motor simulation should delay the hall switch change, but maybe the
designer of the motor simulation did not implement the simulation to that level of detail).
The pwm waves shown in the image is the input to motor leads. The problem is with decrease in duty cycle of PWM, the RPM of the motor is going above the rated RPM(In simulation). But with decrease in PWM the RPM should come down. Any explanation for any possibility if it is not the problem with simulation model?
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top