Harold M Hallikainen wrote: > > Hi Harold, does your PIC have a comparator? > > You could set the comparator vref to the low > > setting of 0.2v I think, and use a current sense > > resistor of 0.1 ohms. Then a simple boost > > converter consisting of one mosfet/inductor/diode > > and the PIC controlling duty cycle. > THANKS Roman! I've been reviewing your simple SMPS page. Nice! Are you > suggesting using the comparator (and sense resistor) to make sure we > don't go over a maximum switch current, but regulating the output using > the PIC's PWM output? Yes. The current will not be 100% smooth, it will modulate a tiny percentage (like 5%) around the average desired current. This system is used in chopper stepper motor drives, all you need is a comparator which triggers at your desired current through the sense resistor. You need a boost regulator (not buck) so it is slightly different but still quite do-able. > Relying purely on the PWM could result in the > switch current taking off if something goes wrong, so limiting duty cycle > based on a maximum measured switch current seems appropriate. I still > need to adjust the switch duty cycle based on the LED current. I'm > thinking A/D there, but are you suggesting use of a comparator there? > Perhaps ramp up duty cycle until the comparator trips, then ramp down > until it "untrips"? No. :o) Like in a chopper drive the comparator will trigger on the peak of every output pulse, as the nature of the inductor will cause surges of current to the output. If current is too high the comparator will be on for a LONG pulse, if current is too low the comparator will only trigger for a short pulse or maybe not at all. You can synchronise testing of the comparator pulse with your PWM cycle, at the same frequency. And obviously you have a software "safe maximum" pulse width! If you require the highest reliability, I would change to a variable frequency system. The PIC is configured to make a PULSE when it changes output, via a simple capacitor differentiator. That way even if the PIC locks up the MOSFET can not stay on, as it can only be ON for a standard length pulse when the PIC pin goes hi. The extra cap, resistor and diode may be worth it. Variable freq fixed pulse length system can be good for a boost converter as the per-pulse energy size can be optimised for your magnetics. Again set it to default-oscillate at about 80% of your desired current, and the PIC can then increase the pulsing freq slightly to increase the current up to the desired average. -Roman -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body