Designing a Constant Current DC-DC LED Driver - Video Series - Page 1
Forum section: electronics / projects

author: SteveyG
author_rank: Unknown
timestamp: April 12, 2015, 09:28:19 am
content: I've just uploaded a new YouTube video which will form part of a series where a DC-DC converter based around a dsPIC33FJ16GSxxx DSC.The first part is a little dry, so you might want a coffee or red bull before watching...Big thanks if you decide to watch

author: PeterFW
author_rank: Frequent Contributor
timestamp: April 12, 2015, 04:23:21 pm
content: Quote from: SteveyG on April 12, 2015, 09:28:19 amWatched it, liked it!But... how should i say this... uhm...I guess this will sound mean regardless of how i phrase it, but i do not want to be mean...The intro was a bit unsetteling, i much prefer a disembodied voice to a 4th wall death stare. But i am a bit woky in the head and maybe it was just me

author: SteveyG
author_rank: Unknown
timestamp: April 12, 2015, 10:20:21 pm
content: Thanks for watching. Should be getting a new camera soon, so my face doesn't fill up so much of the screen

author: Howardlong
author_rank: Super Contributor
timestamp: April 13, 2015, 02:29:50 pm
content: I'll be interested to see how you get on with these devices. I made a device based on a dsPIC33FJ16GS502 about a year or so ago with a view to making into a combined Li-ion charger and SMPS. The problem I found with it was (a) the PID loop had to be very tight so the core was operating at full speed and (b) the high resolution PWM also drew an awful lot of current, making its use in a small battery powered device unfeasible. For mains powered equipment I guess this is not so much a problem, but for a single LED it would badly affect the efficiency if you need a tight PID loop and high resolution PWM. I can't remember exactly, but the 28 pin package got too hot to touch, so maybe at least 1/2W just for the PIC.

author: SteveyG
author_rank: Unknown
timestamp: April 16, 2015, 02:48:54 pm
content: Quote from: Howardlong on April 13, 2015, 02:29:50 pmRecording has been delayed as this week has been very busy, but I hope to get the next part of the video up shortly. Fortunately for this design you can make the problem much simpler without needing a PID loop just by using the comparator to trigger the PWM module to turn off for the rest of that PWM cycle. It ends up being a very straightforward design.I'll be interested to see the power dissipation of the device as I had not looked too closely at this.Thanks for your thoughts.

author: SteveyG
author_rank: Unknown
timestamp: April 21, 2015, 06:16:01 am
content: Part 2 now up. No issues with heat in the 28 pin device.

author: Howardlong
author_rank: Super Contributor
timestamp: April 21, 2015, 12:13:25 pm
content: Agreed regarding the PWM on that device, it's a b*stard. Is your PIC getting hot yet? ;-)

author: SteveyG
author_rank: Unknown
timestamp: April 21, 2015, 12:18:46 pm
content: Actually it was barely warm. It was drawing about 50mA, so about 150mW.

author: Howardlong
author_rank: Super Contributor
timestamp: April 21, 2015, 12:39:00 pm
content: Quote from: SteveyG on April 21, 2015, 12:18:46 pmWow, mine was well over 100mA as I remember it. Definitely it was hot. And you were running that PLL at full speed too. Hmm, might fire one up again, see if I can make it catch fire.

author: Howardlong
author_rank: Super Contributor
timestamp: April 21, 2015, 01:35:46 pm
content: 60mA just the core in a while loop toggling an IO.92mA with the aux clock too.Haven't switched on a PWM output yet, need to defrost my brain.Code:#include <xc.h>#pragma config FNOSC=FRC#pragma config POSCMD=NONE#pragma config OSCIOFNC=OFF#pragma config FWDTEN=OFF#pragma config IOL1WAY=OFF#pragma config FCKSM=CSECMD#pragma config ICS=PGD1#pragma config JTAGEN=OFFint main(void){// First set FOSC to 79.2275MHz (i.e. FCY = 39.61375MHz)CLKDIVbits.PLLPRE=0b000; // div by 2 PLL prescalerCLKDIVbits.PLLPOST=0b00; // div by 2 PLL postscalerCLKDIVbits.FRCDIV=0b000; // div by 1 FRC postscalerPLLFBDbits.PLLDIV=41; // mul by 43 (PLLDIV = m-2)__builtin_write_OSCCONH(0b00000001); // NOSC=FRCPLL__builtin_write_OSCCONL(0b00000001); // OSWEN=1while(OSCCONbits.COSC!=0b001){Nop();}while(OSCCONbits.LOCK!=1){Nop();}ADPCFG|=0b11111111; // All pins digitalCNPU1=0xFFFF; // Enable pull ups in case of oscillation on GPIOsTRISBbits.TRISB15=0; // Diagnostic pin/* Setup for the Auxiliary clock to use the FRC as the REFCLK *//*((FRC* 16) / APSTSCLR) = (7.37 * 16) / 1 = 117.92 MHz */ACLKCONbits.FRCSEL = 1; /* FRC is input to Auxiliary PLL */ACLKCONbits.SELACLK = 1; /* Auxiliary Oscillator provides the clock source*/ACLKCONbits.APSTSCLR = 7; /* Divide Auxiliary clock by 1 */ACLKCONbits.ENAPLL = 1; /* Enable Auxiliary PLL */while (ACLKCONbits.APLLCK != 1) /* Wait for Auxiliary PLL to Lock */{Nop();}while (1){LATBbits.LATB15=1;LATBbits.LATB15=0;Nop();}return 0;}

author: SteveyG
author_rank: Unknown
timestamp: April 21, 2015, 01:40:56 pm
content: That's odd. I'll double check readings when I get home, but it definitely wasn't 'hot'. I had issues once with excessive current draw when the capacitor in Vddcore wasn't fitted correctly.