Go Down

Topic: Help on (non-working) LM317 constant current circuit (Read 16956 times) previous topic - next topic

westfw

One of the things I noticed in researching this is that 1W SMT resistors are annoyingly expensive ($0.35), compared to 1W TH resistors ($0.09), though the difference gets less dramatic in moderate quantities.

SirNickity

Hey -- glad it's working now.  :-)  BTW, because I like optimizing:

Code: [Select]
if(commonAnode){
     digitalWrite(currentFireColor, HIGH);
}else{             
     digitalWrite(currentFireColor, LOW);
}


... could be...

Code: [Select]
// Turn on LED
digitalWrite(currentFireColor, commonAnode);

// Turn off LED
digitalWrite(currentFireColor, !commonAnode);


Basically, if commonAnode == true, it's the same numerical value as HIGH.  Same for commonAnode == false and LOW.  To turn off the LED, you just invert the value (!commonAnode).

The constants are defined in arduino.h:

Code: [Select]
#define HIGH 0x1
#define LOW  0x0

#define true 0x1
#define false 0x0

xl97

#32
Oct 16, 2013, 09:09 pm Last Edit: Oct 16, 2013, 09:46 pm by xl97 Reason: 1
nice....
I wasnt even thinking of use that shortcut/the var like that.. (still really new to Arduino/electronics/C+ in general).. but makes perfect sense.

I have more of a web/web programming background..  where I am/was spoiled about resources/memory..etc..
and even now.. sometimes a shortcut that like would make total sense.. (when Im in here I panic and sometimes forget a lot of the same practices apply in some fashion..logic/theory at least)

so Im taking it one step at a time. :)  haha

I find that if I have a project or goal in mind.. I can break it up into steps/parts.. and work on them individually and then combine them,.,(instead of random learning...I work through an obstacle to get real world experiences on how to handle it in the future I guess?)

if interested.... this was my last project/goal.. an electronics kit for some guys who like StarWars (cosplay I think?)..
(which you guya have helped me finalize/work through!)  so thanks!  lol

these pcb's I designed/order/assembled (yeah $17 wal-mart toaster oven! woot!)  LOL.. with the help of my Silhouette Cameo Vinyl cutter..I make my own solder paste stencils at home all day long! Cant recommend it enough! (love it!)




*the 3rd board with microSD socket is the 'main' board.. a custom Arduino/Waveshield hybrid

and the last pcb to make up the 'kit' is the constant current board:


and a quick mock-up of it:
http://www.youtube.com/watch?v=ZWI2AyHt38k

however.. based on the feedback.. I have updated things. :)

hope this ones better/correct..
*220 resistors
*3.6 Ohm resisotr value (to give full 350mA)
*3.6 Ohm resistors above is a 1-Watt 2512 footprint resistor now
*removed DIODE (pad, wasnt being used anyways)

Here is the resistor I plan on ordering/using in the future..
http://www.digikey.com/product-detail/en/CRCW25123R60JNEG/541-3.6XCT-ND/1178522








thanks guys!

dc42


One of the things I noticed in researching this is that 1W SMT resistors are annoyingly expensive ($0.35), compared to 1W TH resistors ($0.09), though the difference gets less dramatic in moderate quantities.


Needing to use a 1W resistor is a warning sign that the design may not be very good. In this case the issues are that a linear regulator is being used instead of a switching regulator, and a chip intended for regulating voltage is being used to regulate current. I just checked the Farnell site and it shows 22 chips designed for driving LEDs @ 350mA - 12 buck converters, 8 boost converters, and 2 linear current regulators.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

xl97

I think the LM317 was suggested to me when trying to use a voltage regulator was pointed out to be the wrong apporach.. and I needed to regulate the current

Looking at the LM317 datasheet.. I mirrored the current regulating schematic.

as far as the other stuff.. (if it even fits the current project size..etc.. I dont believe a buck puck even applies here?) is not something I intentionally snubbed..  I just didnt/dont know any better yet.

as mentioned it was my first attempt at a constant current anything.. LOL

dc42

As a first attempt, it's not at all bad, and I congratulate you for putting it all together using SMD components.

The LM317 is a very old voltage regulator, and in those days there were few if any constant-current regulator chips made. Circuit boards were larger (no SMD components!) and people were much more willing to waste power. So I guess it was natural for them to show how it could be used as a constant current regulator on the datasheet. I guess the lesson is that not everything shown on datasheets for older devices is now considered good practice.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

xl97

haha..

fair enough. :)

I just dont have a clue if some schematic is outdated or not.. LOL..

I am sorta feeling my way through..  based on the project/goal at hand.. it leads me to learn new things..both in code (like how to use PROGMEM and more so how to retrieve from PROGMEM..lol).. and in hardware. :)

thanks!

SirNickity

Nothing wrong with this approach, other than it being inefficient.  Sometimes that matters, sometimes it doesn't.  Choose your battles.  Heck, there are times when a linear reg is not any less wasteful than a switching reg.  (Usually low, low current...)  There's added complexity to a switching reg, which may not be justified if the wasted heat can be excused.  Remember, 1W may not be necessary so much as a design margin.

XL-- you do good work.  Those PCBs look fantastic.

xl97

#38
Oct 16, 2013, 11:39 pm Last Edit: Oct 16, 2013, 11:47 pm by xl97 Reason: 1
thanks!..

I really have a 'low-budget setup'..

Silhouette Cameo Vinyl cutter to cut stencils with:

Vinyl:


Stencils:  (use some python script not the Cameo software.. post on Dangerous Prototypes forum)
Atmega328P-AU (SMD)
no swelling of pads before export


now I cut them all the time from some mylar.. or like the ones in the pics, overhead projector transparencies.

**a few home cut stencils and Ive paid for the machine..if I use Pololu or Ryan at (I forget ful name OSharp? something 'er other!) LOL.... as they are around $25-$35 shipped to the door.

some 4$ solder paste from DealExtreme/Ebay...  every couple months... and my $17 dollar toaster oven (stock, no sensors, no re-flo signatures..etc)

Keeps me happy and able to prototype/hobby stuff up quickly.

like this project.. lead me to learn about making my first +3.3v Arduino running on INTENRAL clock.. (no external).. and direct 'connect' the SD socket..etc.. for very tiny PCB.. (was for a spiderman web shooter kit/run)
*was supposed to fit a 3D replicas of the watch casing form the TASM movie








toaster re-flow!


I only wish it didnt take 3-4 weeks for PCB's..  :)  (I am liking Elecrow because of the free color pcb's and still $10 for 10 pcbs)

thanks to you guys who genuinely like this stuff.. and like to talk and teach and educate others. (appreciate it)

SirNickity

HUH....  OK, now I'm looking at getting a vinyl cutter.  I have occasional access to one at a nearby FabLab, but it isn't terribly expensive.  I picked up a used toaster oven slated to be a reflow oven, as soon as I build the PID for it.  (Yeah, I know, but it's a trial run for when I build a PID for my espresso machine.)   ]:D

More projects than weekends, unfortunately.

xl97

haha.. I hear that..

unfortunately.. (for me)..  more projects than knowledge as well!  :)  lol..

and yes.. I do suggest the Silhouette Cameo.. great little machine..
no proprietary 'cartridges' for fonts/images/clip art..  (which is how most work)

you can import images.. (trace) then cut them.. .. create using their little tool box/GUI (not the best..no photoshop..lol)
if you get the upgraded software... you can import .svg files directly (and save too I think?)  which is kind of a sweet feature!

I made some etching on mugs (negative stencil on glass mug form dollar store..  into the media cabinet for some some sand blasting)..  can also be done for about $20.00 with 'air erasure' from HarborFrieght too..

great for parties and events to have fun with....etc.

plus geek stickers!  lol..  vinyl stuff for windows/cars/stencils..etc..

but I think it use it for PCB stencils the most..  any time.. just pop-one out, smear some paste...populate & bake!

polymorph

I have a very old Graphtec vinyl cutter that I started making PCBs and experimented with cutting solder stencils, then it quit working after we moved. Not had time to fix it.

You results look great! I agree with the sentiment that although this may be inefficient, you have to start somewhere.
Steve Greenfield AE7HD
Drawing Schematics: tinyurl.com/23mo9pf - tinyurl.com/o97ysyx - https://tinyurl.com/Technote8
Multitasking: forum.arduino.cc/index.php?topic=223286.0
gammon.com.au/blink - gammon.com.au/serial - gammon.com.au/interrupts

xl97

thanks for the support!  (I'm trying)  lol..

I think you can use the same Python stuff I am using for yours (Graphtec)...
it uses Gerber files as the source..(which is great cause I use Eagle)
and it cuts some pretty nice stencils.. (saves me $25-$35 a time when I make them myself!)

the 'kit' above is 5 stencils right there. :)

All the steps/guide is on Dangerous Prototypes forum.. (I think I have everything still saved too,.. if you cant find it let me know)

anyways.. I have everything done.. and ave moved things away from the temp button and using a DB-9 (serial) connector for the magazine to gun connection....

and since I have to disconnect one of the MAX chips (its in the magazine) and reconnect it.. Im having an issue on it re-initializing correctly..(or something)?  I made a thread on it...   (the fun never stops!)    LOL


xl97

any of you more experienced guys wanna take a shot at this one for me:

http://forum.arduino.cc/index.php?topic=193834.new;topicseen#new


:)

experience with the MAX7219/MAX7221 chips is needed..  more or less having trouble removing a part/component/pcb from the circuit  (that has a MAX chip on it).. and re-inserting it later to continue 'running/updating'

Go Up