Simple SMPS using 8 pin PIC microcontroller. - Page 2 - diyAudio
Go Back   Home > Forums > Amplifiers > Power Supplies

Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 26th October 2010, 05:33 PM   #11
sahu is offline sahu  India
diyAudio Member
 
Join Date: Oct 2010
Quote:
Originally Posted by nigelwright7557 View Post
Just started on a design for a simple PIC micro SMPS.
This one converts 30 to 55 volts to 12 volts.
PIC SMPS

PIC SMPS no clear image.pl post hear & post also asm file
pl
  Reply With Quote
Old 26th October 2010, 06:51 PM   #12
tomchr is offline tomchr  United States
diyAudio Member
 
tomchr's Avatar
 
Join Date: Feb 2009
Location: Greater Seattle Area
Quote:
Originally Posted by wakibaki View Post
It's a bit hard to read the schematic. I've redrawn it to make it a bit more comprehensible. Is this what you've got?

Attachment 193762

w
THANK YOU!!! Now that the resistors are drawn as resistors and not transmission lines, the inductors as inductors and not resistors, I do recognize that it is indeed a buck regulator. Fantastic.

Quote:
Originally Posted by nigelwright7557 View Post
The main problem seems to be the amount of extra components needed.
What extra components? A UC184x-series controller would require 3~4 $0.03 passive components in addition to what you have. In return, you get a power supply with load regulation, line regulation, and low temperature coefficient. You don't have to use the current mode control. Just ground the current sense input and you have regular voltage mode control.

There are less expensive options out there. SG3524 comes to mind.

Quote:
Originally Posted by nigelwright7557 View Post
The circuit relies on a PIC input threshold of 2 volts, so all I have to do is scale the feedback voltage for the PIC.
So your reference voltage is purely the threshold voltage of a logic gate?! First of all, that voltage is not guaranteed by the manufacturer. Sure, they may have min/max limits, but they're typically fairly loose. Secondly, the threshold voltage will vary with process (i.e. lot-to-lot variation), temperature, power supply voltage, loading, and a whole slew of other things. In addition, operating a logic gate at the threshold voltage will cause the gate to chatter and draw high supply current. Think of an inverter where both the NMOS and PMOS are on at the same time. That's what you have going on.

You may be able to get it to work on one prototype. But try building two of them and measure the difference. I'm also curious to see your Vout vs Iload and Vout vs Vin plots... Especially over temperature...

If you insist on using the PIC, I strongly strongly suggest that you use one with an A/D converter. Write the code to drive the switch with a pulse width modulator (remember to use double-buffering). Make a real control system where the PWM pulse width is inversely proportional to the ADC value. This could lead to some learnings about how control systems work. Mess with the gain - i.e. the constant of proportionality between the PWM pulse width and ADC code.

Just remember to limit the PWM pulse width to something less than 100 %.

Yes, I learned about the double buffering and pulse width limit the hard way doing a project much similar to yours. Except mine used a 555 to generate a ramp and a dual opamp as comparator and error amplifier. It worked well. That was back in the day when uC's with built-in ADCs were $15 and came in 64-pin PLCC packages...

~Tom
  Reply With Quote
Old 13th November 2010, 10:24 PM   #13
diyAudio Member
 
nigelwright7557's Avatar
 
Join Date: Apr 2008
Location: Carlisle, England
Quote:
Originally Posted by benb View Post

But yeah, two loops to make a fixed width rectangular wave is awfully basic - the PIC might as well be a 555 timer chip.
The PIC does a bit more than supply a 10KHz pulse.
It only supplies the pulse if the output is less than 12 volts.

A PIC input threshold is 2 volts and this is used for a comparator to measure the output volts.
__________________
PCBCAD50 software. http://www.murtonpikesystems.co.uk
  Reply With Quote
Old 14th November 2010, 10:07 PM   #14
diyAudio Member
 
nigelwright7557's Avatar
 
Join Date: Apr 2008
Location: Carlisle, England
Finally got around to building the PIC SMPS.

There is a problem with the PIC input pins as they have hysteresis on them.
This causes a step in the output voltage.

I have ordered a PIC12F510 which has an A2D on board, this should fix the problem.
__________________
PCBCAD50 software. http://www.murtonpikesystems.co.uk
  Reply With Quote
Old 14th November 2010, 10:36 PM   #15
Banned
 
Join Date: Jan 2008
Blog Entries: 2
I wondered if you got this going.

Why not just put in a comparator (opamp), which you probably have lying around?

w
  Reply With Quote
Old 14th November 2010, 10:43 PM   #16
tomchr is offline tomchr  United States
diyAudio Member
 
tomchr's Avatar
 
Join Date: Feb 2009
Location: Greater Seattle Area
I strongly suggest using proportional control rather than on/off control for controlling the pulse width of the switch drive. A comparator has way too much gain at the switching transition. This high gain in your control loop will make the system unstable and you'll end up with huge voltage ripple (best case) or complete lack of control of the output voltage (worst case).

~Tom
  Reply With Quote
Old 14th November 2010, 10:44 PM   #17
diyAudio Member
 
nigelwright7557's Avatar
 
Join Date: Apr 2008
Location: Carlisle, England
Quote:
Originally Posted by wakibaki View Post
I wondered if you got this going.

Why not just put in a comparator (opamp), which you probably have lying around?

w
You can buy PIC's with comparators in anyway. I just chose to use an ADC as it doesnt cost any more.
__________________
PCBCAD50 software. http://www.murtonpikesystems.co.uk
  Reply With Quote
Old 14th November 2010, 10:46 PM   #18
diyAudio Member
 
nigelwright7557's Avatar
 
Join Date: Apr 2008
Location: Carlisle, England
Quote:
Originally Posted by tomchr View Post
I strongly suggest using proportional control rather than on/off control for controlling the pulse width of the switch drive. A comparator has way too much gain at the switching transition. This high gain in your control loop will make the system unstable and you'll end up with huge voltage ripple (best case) or complete lack of control of the output voltage (worst case).

~Tom
The PIC only outputs a single pulse if the voltage is below 12 volts.
This is a tiny amount of charge. The gain is very low but it still reacts very quickly to change.
The pulses are very short, 50KHz.

I had considered a PID technique but this involves so many calculations the PIC would never keep up.
__________________
PCBCAD50 software. http://www.murtonpikesystems.co.uk

Last edited by nigelwright7557; 14th November 2010 at 10:50 PM.
  Reply With Quote
Old 14th November 2010, 11:10 PM   #19
Banned
 
Join Date: Jan 2008
Blog Entries: 2
Quote:
Originally Posted by tomchr View Post
I strongly suggest using proportional control rather than on/off control for controlling the pulse width of the switch drive. A comparator has way too much gain at the switching transition. This high gain in your control loop will make the system unstable and you'll end up with huge voltage ripple (best case) or complete lack of control of the output voltage (worst case).

~Tom
Quote:
Originally Posted by nigelwright7557 View Post
You can buy PIC's with comparators in anyway. I just chose to use an ADC as it doesnt cost any more.
I didn't suggest it on the basis of cost, or that it was ideal. I suggested it on the basis of probable availability for for a solution to the hysteresis for a bit of messing around at midnight on a Sunday evening.

Quote:
Originally Posted by tomchr View Post
You may be able to get it to work on one prototype. But try building two of them and measure the difference. I'm also curious to see your Vout vs Iload and Vout vs Vin plots... Especially over temperature...
w
  Reply With Quote
Old 15th November 2010, 12:13 AM   #20
diyAudio Member
 
Sch3mat1c's Avatar
 
Join Date: Jan 2003
Location: Milwaukee, WI
Send a message via ICQ to Sch3mat1c Send a message via AIM to Sch3mat1c
Quote:
Originally Posted by nigelwright7557 View Post
The PIC only outputs a single pulse if the voltage is below 12 volts.
This is a tiny amount of charge. The gain is very low but it still reacts very quickly to change.
The pulses are very short, 50KHz.

I had considered a PID technique but this involves so many calculations the PIC would never keep up.
What are you writing in, QBasic?! PID is the second simplest control method in all of digital design.

Tim
__________________
Seven Transistor Labs
Projects and Resources
  Reply With Quote

Reply


Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Controlling a relay with a PIC microcontroller rtarbell Parts 9 12th October 2006 09:29 PM
PIC Microcontroller starter kit?? Zero Cool Everything Else 15 25th July 2006 01:24 PM
wiring config..of 4 pin multi (pic) jonz Everything Else 0 1st October 2004 10:55 PM


New To Site? Need Help?

All times are GMT. The time now is 09:22 AM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Copyright 1999-2014 diyAudio

Content Relevant URLs by vBSEO 3.3.2