Microprocessor based Boost supply

Jarhead

Banned
Joined
Sep 29, 2002
Messages
321
Location
Molalla, OR USA
Here go, here is one of the application notes for turning an microcontroller into a buck supply for high current LEDs

Includes Programming GUI, source code, and schematics.

The system described in this application note shows a
minimal part count control for a LumiLED™ high-power
LED driver based upon a simple buck regulator
topology.

http://www.microchip.com/1010/suppdoc/appnote/all/an874/index.htm

Source code is downloadable off the website.

Increment Intensity Command
Power Off Command
Change Mode Command
BATTERY MONITORING CIRCUIT
Automated Flash Sequences

etc

Constant Current based schematics, source code, modulation techiques for sending information over the beam:
http://www.microchip.com/1010/suppdoc/appnote/all/tb062/index.htm

More of the same:

http://www.microchip.com/1010/suppdoc/appnote/all/tb060/index.htm

And more:

http://www.microchip.com/download/appnote/pic16/91053a.pdf

Enjoy!
 
Mmmmmmm Pics.

Now that's something I've tried in the past. Never got past my few-off applications using a stamp though. Understand basic/pbasic but could never justify the cost of the pbasic compiler for the few projects I needed and given a few-off applications, never justified going further with assembly for pic or C (etc). I stopped with the Z80 assembly way back - takes too much time to keep up to date.

Now it's getting interesting again given my recent flashlight addiction......

Good link jarhead, but looks like you'll now be responsible for my future lack of sleep!

Chris
 
How expensive are these particular microcontrollers?

And Burnt, are you saying that they take Z80 assembly language, or were you just musing about the venerable Z80? I know Z80 assembly from WAY back and would be perfectly happy to program flashlight firmware in it. /ubbthreads/images/graemlins/grin.gif
 
They are free as samples, but you'll have to pick a different part:
http://sample.microchip.com/

You can also buy them at digikey's gouging price of 2.33.
http://www.digikey.com/scripts/DkSearch/dksus.dll?Criteria?Ref=60858&Site=US&Cat=31589233

Or about a 1.48 ea at 1ea quantities, Microchip Technology PIC12F675-E/SN PICXX FLASH Order Online $1.48 from Arrow
http://www.arrow.com/www_engineers/find_buy/index.html

PIC12F675-I/P MICROCHIP 8-BIT, FLASH, 20 MHz, RISC MICROCONTROLLER, PDIP8 60 RAIL In Stock 1.26
www.future.ca

And they quickly drop below 1 dollar in small volume.
 
You might want to change the title of the thread -- the first app note listed is for a buck switcher. This type of circuit needs a battery voltage higher than the output voltage, or put another way - produces an output voltage lower than the supply voltage. They can be current regulated.

This app note circuit is current regulated which is perfect for driving LEDs. Looks well done, and uses cheap parts. It might be possible to come up with a boost circuit based on this app note with some circuit and code changes.

In fact, one could approximate a poor man's ARC 4 if one were willing to put in some time and find a suitable body to stuff it into. PIC assembler on this small microcontroller is OK, but the larger parts have banking snares waiting for you. (I program PICs in "C" and let the compiler deal with it). This PIC can sleep and consume almost no current, and has onboard EEPROM to remember customizations (like preferred brightness levels, etc).

As far as PIC assembler language - it's not Z80. There may still be on the 'net a third party assembler that accepted Z80 mneumonics and produced assembled PIC binaries, but you'd be better off just learning PIC assembler. All the development tools are free (and very good). Code can be debugged on the free simulator (fully integrated in the tool set). You can purchase a PICkit programmer for cheap and it comes with some sample PICs. When you get the code working on the simulator - you check a box and generate code to program, click another button to program the part, then try it out on the real thing.
 
php_44, thank you sir! /ubbthreads/images/graemlins/grin.gif Ever since "back in the day," I've had a soft spot in my heart for the good ol' Z80. Used to hack my TRS-80 computer to do all sorts of cool things. /ubbthreads/images/graemlins/grinser2.gif

But yes, learning the new assembly shouldn't be that big a deal. Those tools sound nice, and the price is certainly right! /ubbthreads/images/graemlins/smile.gif

Gonna have to look into this, heh heh. /ubbthreads/images/graemlins/naughty.gif
 
The develpment tool set is called "MPLAB". It's huge. If you have access to high speed internet that is not a problem, but if you don't Microchip is pretty good about sending free CDROMs. Even without any PICs in your hands, you can completely learn and write useful application code with MPLAB. If you end up liking it - you can spend a few $$ for a PICkit to play with the real chips.
 
>> You can also buy them at digikey's gouging price of 2.33.

Note that digikey PIC prices go down pretty dramatically
with "quantity" purchases of as few as 25 units.

There are also a number of ebay sellers providing PICs
in small quantities and vaguely reasonable prices (once
you include postage&handling.)

There are some very good PIC internet resources, such
as www.piclist.com

BillW
 
Hey! They stole my idea! No but seriously, we (LEDdynamics) have developed many PIC based designs. In fact, of three competing designs submitted for the next generation EverLED, mine was the only one was PIC based, using this same chip in fact. I lost, though. /ubbthreads/images/graemlins/frown.gif

The topology was much different, as it needed to be buck/boost. And their 1ohm sense resistor puts the efficiency in the toilet, but it's less noise sensitive. In the EverLED we have the advantage of nice noise immunity because it's encased in brass. And I used a synchrous rectifier for improved efficiency, but I digresss... Sigh...

My design may still see the light of day in the 3W or 5W EverLED, though these programs are still in their infancy and haven't been proven feasible. But there's still hope. /ubbthreads/images/graemlins/smile.gif

BTW, this is not straightforward to convert to boost. They are doing coil current sense and load sense on the same pin (of course, it's buck), so you would need to use a second analog input on the 675 for load current sense.

--
Lewie
 
For those of you that are not into the idea of learning to code in asm, but don't feel like spending several hundred bucks on a compiler for c, there's another language.

JAL is a pascal based language, pretty easy, fairly well developed. Much better than the free (or somewhat so) basics for pics that are floating around. He's even got a programmer design on his page that you can put together for $30 or so (much less than the microchip offerings).

http://www.voti.nl/jal/index_1.html
 
Must check out this JAL. Not having bothered going past basic, any new one is a learning curve starting from zero. If JAL makes it quicker, then worth a look. Pascal has been around for yonks, but thought at the time - why go the middle road and decided C or nothing. I chose the nothing path.

Milky,

We must be about the same vintage! I think the question of similarity of assembly code is answered, if not, no not the same - it'll differ depending on processor or at least manufacturer to varying degrees. Z80 is too old now and time for this middle aged dog to learn some new tricks I think.

Chris
 
Ahhh... I've come in at the correct time I think. Just got a PIC learning kit from my local electronics hobbyist supplier. Actually got it because I was inspired by the AVR stuff from Willie Hunt (did I remember that correctly?) IIRC, he was using a microcontroller for his lights which are incandescent. I thought it was possible to adapt it to LEDs. Let's see how it goes. But the chips seem to be rather large. 16 pins? I think I saw something called PICAXE that had 8 pins and was really quite small. But, one step at a time... /ubbthreads/images/graemlins/smile.gif
 
Of course a uC switcher can be made - that is how my uFlex driver is implemented.
It takes a lot more bits than what is in that PIC appnote to make a real implementation work efficiently - especially if you want it to work at more than the Vin of the uC. Been there & DONE it. Fun project - but DON'T take the appnote for granted... Atmel has a similar 'simplistic' switcher appnote on their website.

george.
 
[ QUOTE ]
TheFire said:
For those of you that are not into the idea of learning to code in asm, but don't feel like spending several hundred bucks on a compiler for c, there's another language.

JAL is a pascal based language, pretty easy, fairly well developed. Much better than the free (or somewhat so) basics for pics that are floating around. He's even got a programmer design on his page that you can put together for $30 or so (much less than the microchip offerings).

http://www.voti.nl/jal/index_1.html

[/ QUOTE ]

Just to point something out - for only $36 (even from DigiKey) you can get the PICkit. This includes:
<ul type="square">
[*]Full MPLAB development environment with assembler, simulator, debugger, editor, etc.
[*]HiTech PIC "C" lite ansi "C" compiler fully integrated into MPLAB (only limit is <2Kb code which is not really a limit when coding even an elaborate 'light).
[*]Programmer with USB cable - including snap off Prototyping PCB, and socket for programming and testing code (with button, LEDs, small pot, etc).
[*]source code and instructions to learn to use the whole kit via 7 lab exercises.
[*] sample PIC 12C675 (has a/d convertor, comparitor, on board oscillator, works down to 2.5V, etc).
[/list]

PICkit one page flyer with picture (ignore second page)

I'm just a fan of PICs, and this kit in particular is a great bargain considering what you get. You couldn't build this cheaper - and you wouldn't get the reams of source code, labs, and documentation. And who wouldn't prefer a USB based programmer to a clunky serial or parallel port one? /ubbthreads/images/graemlins/cool.gif /ubbthreads/images/graemlins/cool.gif
 
There's a free C compiler for the PIC 14x and 16x series and some other micros. It comes with source code and can probably be targeted to the PIC 17x and 18x. I've never used it and don't know how good it is.

http://sdcc.sourceforge.net/
 
TRS-80... Boy. That's been awhile. I think I was the first computer repair business listed in our local Yellow Pages back in the late 70s. Loved my trash-80s. Ran a BBS for years on one.

Oh, well. Thems was the days..

I like the PICs, and there is the 8pin one to hack on. i'm still a Stamp addict, i'm afraid. Someday, tho, i'll start hacking the pic code. Have a few things running around the airport based on those. Do like the idea of a variable light, and a little micro seems the way to go. User interface is the stinker.. My Shorelites can be annoying, for example..

Gotta bail! Yours, drs the trash80er..
 
[ QUOTE ]
There's a free C compiler for the PIC 14x and 16x series and some other micros. It comes with source code and can probably be targeted to the PIC 17x and 18x. I've never used it and don't know how good it is.

http://sdcc.sourceforge.net/


[/ QUOTE ]

Good spotting to see that tool! There was a large amount of work on that compiler a year or two ago. Things trailed off a little since then. When I last checked - the compiler was at a reasonable "beta" level. It would generate correct code within the limits stated in the release notes. Optimization was not fully there, so the code would not be very compact. There is only support for a limited number of PICs - and it's not clear exactly which ones. The release notes contained instances where the compiler would generate "bad" code - like certain complex statements. If you use a PIC with a good amount of code space and stay within the limitations - you'd be fine. You'd probably need to invest some time into getting comfortable with sdcc's PIC support. SDCC is better with other micros - notably 8051 like micros.

The PICClite free compiler with 1K limit is a better alternative for most use since the HiTech compiler has an awesome optimizer. If you need more than that - you probably need to buy something (Like CCS "C" CCS C ~$125, PICC ~$400 PICC ).
 
If you'd like to get started with learning to program PIC microcontrollers (and, from there, any uC), please take a look at:
http://www.amqrp.org/elmer160/board/index.html

There is a set of lessons that go with it to help get you started and teach you tricks of how things work. It's designed around the windows tools that Microchip gives away, but there are equivalent tools that run under Linux--contact me for further info on the linux tools.

This board is its own programmer, it has several (normal T1-3/4) LEDs, switches, rotary encoder, buttons, speaker, and an LCD display. If you need more, wire it up and hook it to it. You'll have plenty of company learning as the first *500* of these have already sold and that's before the magazine article to go with them has even been published. /ubbthreads/images/graemlins/wink.gif

PICs are fun, heck, any uC is fun. The thought that a little chip can be a whole computer is just stunning. All the more so for those of us who saw really old computers and realize that one little 8 pin uC has more memory and processes faster than a several ton chunk of iron from days of old..... wow....
 
Hello,

This thread makes me want to get a hold of the PIC
kit and try out a few boost circuits myself.
Might even be possible to create a buck/boost
with the PIC chip that comes with the kit.
The only thing i dont like so far is that it looks like
that PIC chip is programmable only one time, then
if you need to change the program you have to start
with a new chip. I wonder if they have anything
that's EEPROM based.
I once designed a Z80 board too 🙂 that was RAM
based, having a ROM that was used mainly to program
the RAM. Since the RAM was reprogrammable, you could
try several different programs using the same board.
Of course it wasnt 8 pins (i agree with "WOW").

Take care,
Al
 
Great minds think alike. /ubbthreads/images/graemlins/wink.gif I've been going over the 12F675 specs and the buck converter app note for the past two weeks.


Or not, as the case may be: I wasn't able to quite figure out how the PWM control of the MOSFET was done in software, until I realised just a few days ago that it isn't. The switching is done using the comparator module... DUH /ubbthreads/images/graemlins/twakfl.gif


That done, I now can't seem to get the same switching frequency they get using the formula for the RC filter they provide...


Hi MrAl,

Actually there are reprogrammable versions of the PICs available - those with a F in the name instead of C are the flash based units, e.g. the 12F675 as used in the Microchip example above, or the basic 16F84 / 16F84A. The C units are one time programmable devices as far as I know.

Seems that the 16F628 is now considered the beginner device, replacing the 16F84 - newer, more features and cheaper too.
 
Back
Top