View Full Version : PWM Frequency
03-22-2007, 07:16 AM
I'm interested in experimenting with dc-dc boost converter via smps (switch mode power system).
Need to have a PWM Frequency around 20khz driving a MOSFET to match the inductor selected.·
Currently, I have a BS2.·· Is it possible to get a PWM frequency of 20Khz·out this controller?· Also the duty has to be variable.
Appreciate your comments and suggestions.
03-22-2007, 07:25 AM
A BS2 could do this, but anything else you might do (like read pushbuttons, etc.) would affect the frequency a bit. Best thing would be to use a PWMPAL to generate the variable duty cycle pulses and the BS2 would control the PWMPAL based on maybe a keypad/display or some such thing.
03-22-2007, 08:26 AM
Thanks for the reply.·· Just looked up the information on PWMPAL.·· To run at a frequency of 20khz·the duty cycle will be limited to 50% (time on 1 and time off 1).· At this frequency the PWMPAL unit is 2.
Going to need to vary the duty cycle between 0 to 50% more than on step.
Any other suggestions?
03-22-2007, 08:40 AM
A week or two ago, I posted a 555 timer based PWM generator where you could use digital pots to set the base frequency and width of the on pulse. Basically, you use a dual 555 timer and a dual digital pot. One half of the dual 555 is set up as an astable multivibrator with a frequency roughly around 20kHz. The other half of the dual 555 is set up as a monostable multivibrator with a pulse width varying from nearly zero to about 50ms and triggered by the leading edge of the astable's output. The combination gives you the PWM. If you choose your RC values well, you could have 64 or 256 steps for a range of 1-5% to 50% duty cycle and even control the base frequence over whatever range you might want.
The Stamp could still manage the calculations so you're seeing a % duty cycle on a display.
Phil Pilgrim (PhiPi)
03-22-2007, 08:50 AM
Take a look at the Parallax MoBoStamp-pe (http://www.parallax.com/detail.asp?product_id=28300). Each of the two AVR coprocessors included onboard supports two PWM outputs at up to 37.5KHz. Each output's duty cycle can range from 0/256 to 255/256 (or from 1/256 to 256/256). These run independently of the BASIC Stamp and are accessible using the preloaded AVR firmware, so all your programming will be in PBASIC.
If you need to read voltage fed back from your SMPS to close the loop, you can do that, too. Each coprocessor has two 10-bit analog inputs that are independent of the PWM outputs. Again, these are accessible directly from PBASIC.
03-23-2007, 06:30 AM
Thanks· Phil and Mike,
Both options·may suit my needs.· Will be able to use less components with the mother board and drop the ADC circuit. The trade off, is dollar cost.·
Phil, the documention·indicates that there are 9 presets frequencies to choose from using the OWOUT command to the Attriny chip.·· Can these preset frequencies·be changed using the Firmware programming?
Phil Pilgrim (PhiPi)
03-23-2007, 07:31 AM
Using the firmware delivered with the motherboard, no. However, I've had some success changing the PWM frequency by trimming the AVR's internal RC clock by way of the clock calibration register. If you really need 20KHz instead of the available 18.8KHz, I might have some alpha firmware that will get you there. But try 18.8 first. It will probably work just fine.