Desing a AVR based DC Power Supply( coding stage for PWM)

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Everyone,

I am asking this question with reference to my previous posting regarding a switch mode power supply..

https://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=79525

I am now writing code for my Atmega128L running at 8MHz(My development board)

As i was doing my calculations for the Fast Pwm mode, i realised that the max base frequency that i can obtain without loss in resolution is 31250Hz using 8bit pwm and 7812Hz using 10bit pwm. Please correct me if i'm wrong.

I was intially thinking of using 10bit pwm but i feel i will have to go for the 8bit pwm. Is there anyway of obtaining a high frequency pwm (say 40Khz)?

Even if i use the atmega128 at 16Mhz its 10bit pwm is still slow. What are the disadvantages of running a SMPS at 7.8Khz?

Any suggestions?

Rodney Almeida

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Please correct me if i'm wrong.

Nope those numbers sound familiar.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

People might not like the noise it makes!

Leon

Leon Heller G1HSM

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
What are the disadvantages of running a SMPS at 7.8Khz?

Running a standard topology (buck,boost,flyback,...)
at that low frequency will result in relatively large
inductors. And you might hear the SMPS.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Any suggestions?

For a simple app like that, why a Mega128?

Several AVR models have a high-speed PWM derived from a PLL that were essentially made for apps like yours. Unfortunately neither the device selector at www.atmel.com nor the Devices part of this site have a column for the PLL/high-speed PWM. A search of my downloaded datasheets shows the Tiny15 & Tiny26, but those are old. The newer Tiny261/461/861 has the feature. [IIRC Atmel has an app note for your app using one of the older chips--check there too.] If this is the primary app, the 8-pin Tiny25/45/85 family may work. Then there is the AT90PWMn family.

I don't think any Mega models have the feature, but I don't have all the datashets downloaded. The new Xmega does but that is way overkill.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The Mega128 choice was basically because i have access to it. will check the other microprocessors.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Look at the 90PWM family for a single micro solution, or the Tiny as a secondary micro just to run the PWM. (then again, I don't know what else you might be trying to do, so the Tiny could be enough)

IIRC Lee is correct, none of the megas feature a high speed PWM.

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The T26 does well, but if I had to do it again, I'd let an actual SMPS chip do that job, and control it from the AVR.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I was checking the 90PWM and man it looks complicated. Will go trough it again in some time.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Tiny25/45/85 are 8 pin MCUs that have high speed PWM.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

From the 90PWM datasheet fast Pwm frequency is given by:

fOCnxPWM=(fclkI/O)/(N x(1 + TOP))

But thats not using the PLL.

Should i be reading the PSC(power stage controller section)?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Using less than 8bit resolution would give you faster period time. With 7bitPWM (31.25kHz) and 62.5kHz with 6bit PWM.
Again, using low resolution may lead to other problems. Can you make your setup/design public? This power stuff is hot stuff cause everyone's doing controllers for their solar panels and wind generators :D

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have not made schematics. I directly designed the pcbs. But its a pretty simple circuit. the switching for now is done by a power transistor. the trnasitor output is fed to a inductor and than a filter. Output is scaled down and fed back to the microcuntroller. Microcontroller than changes duty cycle accordingly.