
Home  Forums  Rules  Articles  The diyAudio Store  Gallery  Blogs  Register  Donations  FAQ  Calendar  Search  Today's Posts  Mark Forums Read  Search 

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 

Thread Tools  Search this Thread 
15th November 2010, 12:19 AM  #21  
diyAudio Member
Join Date: Apr 2008
Location: Carlisle, England

Quote:
I havent tried the A2D version yet. If the A2D version doesnt work well then its PID or a class D type triangle wave and comparator technique.
__________________
PCBCAD50 software. http://www.murtonpikesystems.co.uk 

15th November 2010, 12:36 AM  #22  
diyAudio Member
Join Date: Feb 2009
Location: Greater Seattle Area

Quote:
Quote:
Recall that the derivative of the error signal, E, is merely E(n)E(n1), where n is the sample number. The integral, I, is I(n) = I(n1)+E(n). You'll have to limit the integral value to something reasonable to prevent the register from rolling over. I'm not suggesting that you implement the full PID control, though, that would probably result in a pretty wellperforming system. All I'm saying is to use proportional control. I.e. PWM_value = ADC_value * P. That's one line of code... In assembly, it might be three instructions. Plus whatever is needed to set up the PWM and ADC. If you limit P to powers of two, you can use a shift instruction to perform the multiplication. Recall X*2^n = X << n. ~Tom 

15th November 2010, 12:46 AM  #23  
diyAudio Member
Join Date: Apr 2008
Location: Carlisle, England

Quote:
It was for a big drill company. It used 49*ERROR170*ERROR2+25*ERROR3 and scaled the result to get the right gain. I did it in 16 bit arithmetic on a PIC. It worked very well, the drill speed was rock steady. It was just a matter of getting the gain right. A colleague of mine got the formula from a PID seminar and it seemed to work with anything we threw at it with a little tweaking. Just finished a discrete class d amplifier so into PWM at the moment.
__________________
PCBCAD50 software. http://www.murtonpikesystems.co.uk 

15th November 2010, 04:37 AM  #24 
diyAudio Member

I don't know about that, I in my tests I had no problems, I even slowed it down

15th November 2010, 08:28 PM  #25 
diyAudio Member
Join Date: Apr 2008
Location: Carlisle, England

__________________
PCBCAD50 software. http://www.murtonpikesystems.co.uk 
15th November 2010, 08:55 PM  #26  
diyAudio Member
Join Date: Feb 2009
Location: Greater Seattle Area

Quote:
~Tom 

15th November 2010, 10:07 PM  #27 
diyAudio Member

Still no big deal  I don't recall which PICs have multipliers, but I think all AVR do. 8 bit hardware multiply makes even 16 bit multiplications speedy. When your loop bandwidth is a few kHz and the clock is over 1MHz, heck, you could still do it without hardware multiply.
Needless to say, you'd be using the analog comparator (an external one if the internal isn't fast / accurate enough) for a currentmode boost / flyback converter, and wrapping the loop around that. Hmm, you need a DAC to do a proper current mode thing. At 1MHz clock, 1kHz bandwidth, you only get 10 bits PWM, and that's assuming a brick wall antialiasing filter. You only get ~7 bits for a factor of 10 frequency margin, and that's still a lot of ripple from a simple RC. Maybe sigma delta modulation would be better? Tim 
17th November 2010, 12:08 AM  #28  
diyAudio Member
Join Date: Apr 2008
Location: Carlisle, England

Quote:
However I decided to go the whole hog and do a PID version. I just put in a read of the A2D to get an error number and put that into a PID I already had. It oscilated to start with because the gain was too high. A slight reduction in gain saw a steady output voltage. Altering the load made no difference to the voltage tracking.
__________________
PCBCAD50 software. http://www.murtonpikesystems.co.uk 

17th November 2010, 03:58 AM  #29 
diyAudio Member

cool!

Thread Tools  Search this Thread 


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? 