Diode Dimming Circuit

gootee

Joined Apr 24, 2007
447
Hi Darrin,

I don't think there will be ANY problem with noticing the LEDs dimming. As the pot is changed from one extreme to the other, the _AVERAGE_ voltage at the NE555's output changes from close to 0v (about 179 mV for 10/9990 Ohms) to almost 12v. And because of persistence-of-vision, the average is what you will see.

The NE555 output voltage will always have approx 12v peaks. But when the duty cycle is very low, the output is almost all at 0v with extremely narrow 12v pulses. And when the duty cycle is high, the output is almost all 12v with extremely narrow drops to 0v.

- Tom Gootee

http://www.fullnet.com/~tomg/index.html
 

Thread Starter

dhosinski

Joined Dec 6, 2007
40
I am using the output of the PWM 555 timer circuit as an input to a dimming circuit for the LED's... There is an opto-isolator that will monitor the PWM duty-cycle% and the NCP1216 Current Mode controller will increase or decrease the current accordingly.
 

SgtWookie

Joined Jul 17, 2007
22,230
You can attach pictures by using the "Advanced" mode. Below the "Quick Reply" there's a "Go Advanced" button. On the next screen there's a "Manage Attachments" on the bottom. Follow the instructions from there.

Try to keep your attachments small. .jpg and .png files work quite well.
 

gootee

Joined Apr 24, 2007
447
Wow. How many diodes are you planning on driving??!

I guess I don't understand why you need to use the circuit you attached. The NE555 can source up to 200 mA. If you connect LEDs with suitable series resistances to the NE555's output, you will already have a variable LED dimmer. And if you need to provide more current than the NE555 can deliver, you could probably use a simple high-current buffer amplifier, between the NE555 and the LEDs.

- Tom Gootee

http://www.fullnet.com/~tomg/index.html
 

SgtWookie

Joined Jul 17, 2007
22,230
What Tom said ;)

A simple high-current buffer might be something like a ULN2004 or ULN2804; they are Seven or Eight Darlington Pairs, respectively. Each of the Darlington pairs can sink up to 500 mA. The outputs of the Darlington pairs are open-collector; they are not capable of putting out any voltage or current, but they can act as a switch for grounding. You could connect the output of the 555 timer to 1 of the inputs of a ULN2x04, some of them, or ALL of them if you'd like.

When the output from the NE555 goes high, the ULN2x04 Darlington is biased ON, which causes the open-collector output to conduct through the emitter to ground. Since it is a silicon NPN, you'll see a voltage drop across it from about 0.8V to 1.6V max (1.1 typically) depending upon how much current is going through it. You'll need to get the numbers from the spec sheet and calculate that in for your LED current limiting resistors.
 

gootee

Joined Apr 24, 2007
447
Hi Darrin,

Since you mentioned that your transformer can only source about 300 mA, it sounds like you weren't planning on needing a lot more than 200 mA of drive current, anyway, unless you are using a separate transformer for the actual drive circuit. (Although, if you did need more current, you could also consider using a "power opamp" or chipamp of some kind, if it could run on only a 12V supply; maybe something like the L165 from ST, or maybe National's LM675 (4 Amps) OR LM1877 (1 Amp). With a higher-voltage supply, there would be many more possibilities. You could probably also easily make a single-power-transistor follower or something.)

So I still don't understand why you might need the complex circuit that you posted, unless it's a requirement, for academic purposes.

By the way: Do you have a URL for the document that contains the schematic in the pdf that you posted?

I did download the NCP1216's datasheet, and one of the five related application notes for that device (and the pspice model for the NCP1216). But everything I saw in the docs I downloaded looked like it was related to AC-to-DC converter design.

- Tom Gootee

http://www.fullnet.com/~tomg/index.html
 

Thread Starter

dhosinski

Joined Dec 6, 2007
40
Hey guys. I have a problem.

I'm not familiar with LT SPICE so I'm having a problem with selecting values for capcitors. I am looking for a 0.1 micro farad cap. Not in the database?

Can somebody offer some assistance.

Thanks
 

Thread Starter

dhosinski

Joined Dec 6, 2007
40
Hi Darrin,

Since you mentioned that your transformer can only source about 300 mA, it sounds like you weren't planning on needing a lot more than 200 mA of drive current, anyway, unless you are using a separate transformer for the actual drive circuit. (Although, if you did need more current, you could also consider using a "power opamp" or chipamp of some kind, if it could run on only a 12V supply; maybe something like the L165 from ST, or maybe National's LM675 (4 Amps) OR LM1877 (1 Amp). With a higher-voltage supply, there would be many more possibilities. You could probably also easily make a single-power-transistor follower or something.)

So I still don't understand why you might need the complex circuit that you posted, unless it's a requirement, for academic purposes.

By the way: Do you have a URL for the document that contains the schematic in the pdf that you posted?

I did download the NCP1216's datasheet, and one of the five related application notes for that device (and the pspice model for the NCP1216). But everything I saw in the docs I downloaded looked like it was related to AC-to-DC converter design.

- Tom Gootee

http://www.fullnet.com/~tomg/index.html
I am kind of bound to using this circuit because I am too far along to change it. I ended up taking an incomplete because my laptop got a virus the last 2 weeks of class.

I do believe it will be a good circuit to use, just have to get everything pulled together. Starting with the schematic. That's why I need to get more fluent in using the software.
 

gootee

Joined Apr 24, 2007
447
Hey guys. I have a problem.

I'm not familiar with LT SPICE so I'm having a problem with selecting values for capcitors. I am looking for a 0.1 micro farad cap. Not in the database?

Can somebody offer some assistance.

Thanks
Hi Darrin,

Welcome back!

In LTspice, I basically don't ever use the database of capacitors. I just click on the capacitor symbol in the toolbar (Actually, I just strike the C key. I don't know if that's standard or if I set it up in the "keyboard shortcuts".) and plop the cap symbol onto my schematic.

Then I right-click on the cap symbol and enter, for example, 0.1u, for the value, and also enter something for the ESR (equivalent series resistance), and, sometimes, an ESL value and a parallel resistance value, especially if it's a large electrolytic cap.

You will want to enter at least SOME non-zero ESR value, just for the sake of the internal solver in Spice, and probably to make your simulation run faster, and be slightly more realistic.

For small ceramic and film capacitors, I usually initially enter an ESR in the range of .05 to .005 Ohms. If it later turns out to be critical, you might have to find out what the ESR might actually be, AT the frequency of interest.

If you really get into it, modeling capacitor ESR as a function of frequency and temperature can be done. But it's a bit messy. Cornell Dubilier has a great new on-line cap-modeling applet, for some of their electrolytic caps, that actually produces a spice model that works over frequency and temperature, that actually functions well in both transient and AC analysis, in LTspice (and other Spices). It's at http://www.cde.com/applets/CDEspiceApplet/aframe.htm . For better information on actually using the generated models with LTspice, look at my post # 136, in this thread: http://www.diyaudio.com/forums/showthread.php?s=&threadid=106648&perpage=25&pagenumber=6 . And Kemet has some helpful downloadable capacitor-modeling software, for smaller types of caps.

If you're using electrolytic caps, be aware that their ESR usually rises dramatically, at lower frequencies (and also goes almost crazy versus temperature). So if the ESR spec you have is for 100 kHz, it probably won't even be close (i.e. way too low) for 120 Hz, which could be important when modeling a power supply, since it will help determine the ripple amplitude and the cap's ripple current, et al.

If you need a quick reference to get ballpark ESR numbers for electros at 120 Hz, mouser.com's catalog has some Cornell Dubilier and United Chemi-Con aluminum electrolytics for which they list the ESR ratings at 120 Hz. Your cap's manufacturers' websites should be consulted, eventually, though. (OR, maybe you could measure the ESR of the actual caps you are using, at the frequencies of interest. If you don't have a ready-made way to do that, see http://www.fullnet.com/~tomg/esrscope.htm .)

If you only have the tan(delta) spec for a cap, you can estimate the ESR at a particular frequency with ESR = tan(delta)/(2 * Pi * f * C). Note that "Dissipation Factor" specs are just tan(delta) as a percent, IIRC.

For the parallel (leakage) resistance, for electrolytics' models, you can probably just use 1/(0.01 * C).

For ESL (equivalent series inductance), I think you can probably assume that for most modern electros, at least, it's about the same as a pcb trace with a length equal to the lead-spacing. For that, you can probably be safe-enough, for your current purposes, in assuming 25 nH per inch, assuming ESL even matters at all, in your application.

- Tom Gootee

http://www.fullnet.com/~tomg/index.html
 

gootee

Joined Apr 24, 2007
447
Hi Darrin,

My latest LTspice schematic and plot-settings files, for your PSU and NE555 circuit model, are downloadable below. Just right-click on the link for the zip file and select "Save Target As".

http://www.fullnet.com/~tomg/dhosinski.zip

You should be able to put the files in your LTspice (SWCADIII) working directory and then open the .ASC file with LTspice, and run it.

The LT1086-12 regulator came from the "PowerProducts" component database, included with LTspice.

- Tom Gootee

http://www.fullnet.com/~tomg/index.html
 

SgtWookie

Joined Jul 17, 2007
22,230
LTSpice does take a bit of time to get used to, but it's actually quite easy to use.

Once you select a component from the menu bar, rotate (if necessary) and place it, you can right-click on the component to change it's values. Initially, capacitors have a value of "C" - if you overtype the C with 0.1uF then LTSpice will use that value. You don't have to fill in the rest of the data if you don't wish to - just the capacitance value will be sufficient.

Tip: if you're going to have a number of capacitors with the same value that you'd like to be able to easily change, you can use a Spice parameter instead. For example, if you use {C} as the value for some capacitors, and add a Spice directive line:
.params C=0.1uF
then when the simulation is run, all components with {C} as a value will have 0.1uF substituted.
 

Thread Starter

dhosinski

Joined Dec 6, 2007
40
Hello, I started to create the schematic for the second part of my project and there are a couple of components that are not available.

I need an NCP1216 Current Mode controller and a PS2501 Opto-Isolator and neither are in the library. Also, the smallest resistor is 10 ohms and I am suppose to use some 5.1ohm 5% resistors.

Are there any library updates available?

Thanks
 

SgtWookie

Joined Jul 17, 2007
22,230
OK.

On LT Spice's menu bar, there are symbols you can click on for generic resistors, caps, and inductors.

Click on the cap icon to get one, move it to where you want it, and click to place it. You can hit the ESC key to stop placing components.

If you right-click on the now-placed component, you can change it's values. Overtype the "C" with the value you want. For .1 microfarad, put in 0.1uF or .1uF or .1u
The other parameters are optional.

Too bad your laptop got a virus.
I suggest you install AVG Free. Get it here: http://free.grisoft.com/
 

gootee

Joined Apr 24, 2007
447
Hello, I started to create the schematic for the second part of my project and there are a couple of components that are not available.

I need an NCP1216 Current Mode controller and a PS2501 Opto-Isolator and neither are in the library. Also, the smallest resistor is 10 ohms and I am suppose to use some 5.1ohm 5% resistors.

Are there any library updates available?

Thanks
Darrin,

I'm sorry about the delay in getting back to this.

I found all of the devices' spice models and made an LTspice simulation of the entire circuit. It appears to work! (But it is somewhat SLOW, due to all of the high-frequency stuff going on. You might be able to use a longer MAX TIMESTEP, for some runs, to possibly speed it up. I currently have that set at 0.1 us.)

You will need to limit the way-excessive LED current through my little test LED, and/or add more LEDs, or whatever. You might also want to try to get a model for your particular type of LED. What kind will you be using?

I did add a few capacitors to the NCP1216P100 circuit that you posted. The most-important ones are probably the ones that I added from the chip's raised ground to the "real" ground. Without them, the NCP IC's ground bounces like CRAZY! But I didn't play with the circuit too much. So you should definitely also try it without the added caps. Maybe it "needs" to be bouncy. I don't know; no idea. But it doesn't _appear_ to need that (although it's very "interesting" to see how bad it is :).

The added capacitors also speed up the simulations, tremendously, by getting rid of a lot of the high-frequency "junk". One thing: You might want to use better estimates of the ESRs for the smaller caps that I threw in. I think I just used .05 Ohms for the 0.1 uF ceramics, and maybe .005 Ohms for the one 0.1 uF film cap that I had to use for the raised ground. That one's ESR will probably be significant. Maybe polypropylene would be good, there, or, maybe better yet, polystyrene, although I haven't seen those above .01 uF, at places like mouser.com . Then again, polyester or even ceramic would probably be "good enough". At any rate, you will probably also want to try adjusting those caps' values.

I also added a 5.1k resistor between the NCP IC's HV pin and the top of the main power supply filter cap, per the datasheet, to protect the IC from getting fried when the system is powered down. You might need to change the value. The datasheet just says "> 4.7k". They also suggested an alternative diode protection scheme. But I could not get it to run, with that in place. So I used the resistor method, instead.

Here is everything needed to run the simulation, with LTspice:

http://www.fullnet.com/~tomg/Diodedimming.zip

I made the PWM (NE555) section into a subcircuit, with its own symbol, just to make the main schematic smaller. There's a simple way to have parameters passed to a subcircuit, so they can just be edited on the main schematic. But I didn't remember how to do that. So you'll have to right-click on the PWM module's symbol and select "Open Schematic", in order to change the setting of the 10k potentiometer that controls the PWM's duty cycle. (Just right-click on the '.param RPOT=xxx' line and change the value. The other half of the pot is then calculated automatically.) [I also tried to make it so that you could just enter a %-duty-cycle number, from which it would automatically calculate the resistors for the potentiometer. But I couldn't seem to get that to work accurately-enough, within my allotted 60 seconds :) . I did leave the .param statements in there, for that (but "commented out" with semicolons), in case you want to try fixing it.]

[Hmmmm.... That reminded me that, in the meantime, I did a little optical attenuator project in LTspice that used a voltage-controlled potentiometer (just for convenience during simulation, i.e. so I could simulate sweeping the pot throughout its range, for example). If anyone wants that, let me know. (I got it from the LT-SPICE discussion group, at yahoogroups.com.)]

Have fun!

Later!

- Tom Gootee

http://www.fullnet.com/~tomg/index.html

-
 

gootee

Joined Apr 24, 2007
447
Hello, I started to create the schematic for the second part of my project and there are a couple of components that are not available.

I need an NCP1216 Current Mode controller and a PS2501 Opto-Isolator and neither are in the library. Also, the smallest resistor is 10 ohms and I am suppose to use some 5.1ohm 5% resistors.

Are there any library updates available?

Thanks
Hi Darrin,

As you probably know, by now, LTspice's component libraries don't have many ICs that aren't made by Linear Technology Corp. But, almost all standard Pspice models will work with LTspice, without modification. And there are tens or hundreds of thousands of those available for free, on the web! Here are a few very good links, for spice models:

This one has links to over 20,000 downloadable spice models:
http://homepages.which.net/~paul.hills/Circuits/Spice/ModelIndex.html

This one has tons of hard-to-find models, on site:
http://www.elektronikschule.de/~krausg/Spice_Model_CD/Vendor List/

The 'Files' section of the LT-SPICE discussion group has thousands of models and circuits, and lots of very interesting stuff:
http://tech.groups.yahoo.com/group/LTspice

And this site has vacuum tube spice models:
http://www.duncanamps.com/spice/

On my site, I have a pretty-good model for a transformer, that I developed with the help of a couple of experts from diyaudio.com (and using an excellent PDF paper about transformer modeling, which is also linked-to, there). This transformer model is nice because you can very-easily model your own "unknown" transformer by taking simple measurements with a multimeter (a Variac is also basically required, though), from which the model automatically calculates all of the needed parameters. Instructions for making the measurements are included right on the model's schematic:
http://www.fullnet.com/~tomg/gooteesp.htm

For resistors, capacitors, and inductors, I almost always just use the generic buttons for them, on the LTspice toolbar, and then right-click on the components to directly set their values, and other parameters.

For IC and semiconductor (and other) models that I can't find at places like the links above, I usually just do a google.com search, and often find that the manufacturer's website has a model. For example, Epcos's website has a great library of models for all of their thermistors, which even includes self-heating effects. (That Epcos thermistor spice-models library has been extremely handy, for me, for designing temperature-compensation/compensated circuits. By the way: If anyone wants my very simple/quick/easy method of using LTspice to "measure" the resistance of a thermistor at several temperatures, and then linearize (or shape as desired) its response around any desired temperature point, let me know.)

If anyone else is at the point where they'd like the ESR and ESL of their electrolytic capacitors to vary realistically versus frequency and temperature, in both time-domain and frequency-domain simulations, check out my message about that, in the LT-SPICE group's forum (Message # 20274), at http://tech.groups.yahoo.com/group/LTspice/message/20274 . [Note that you might need to be an LT-SPICE group member, and be logged in, to view the message.] The technique is based on the spice models that can be generated by this Cornell Dubilier Java applet: http://www.cde.com/applets/CDEspiceApplet/aframe.htm . That applet can also be used without spice, to view plots (online) of capacitor parameters and parasitics versus frequency and temperature.

In general, you'll find that the SYMBOLS for SUBCKT-type models, if available, will not work unless they happen to have been made specifically for LTspice. So you'll sometimes/often have to make your own symbol, for a subcircuit-type model. But, that's very easy, after the first time. The main thing to remember is that, when placing the pins in the symbol, their "netlist order" numbers must be in the same sequence as the list of pins in the model's .SUBCKT statement. (The actual numbers might not be the same. The symbol's pins have to be numbered from 1, and only incremented by one. They just need to be in the same ORDER as those in the SUBCKT statement.) Also, after placing the symbol on your schematic, you will need to right-click on it and change the "Prefix" field to X, and enter the SUBCKT name in the SpiceModel field (or in the Value or Value2 field), using exactly the same name that is used in the .SUBCKT statement in the model file. The actual filename of the file containing the subckt is not important. But you will also need to put a spice directive on your schematic, to include the file, such as .include subcktfilename .

For components that have been modeled with .MODEL-type models (typically, diodes and transistors), rather than the .SUBCKT type, it's even easier: You can usually just use one of the standard already-included symbols (diode, pnp, npn, nmos, pmos, njf, pjf, etc), by placing the desired type of component onto your schematic in the usual way, and then CTRL-RIGHT-CLICK on it and change the SpiceModel field to whatever name is used in the .MODEL statement. You will also need to use a .include directive on your schematic, to include the file containing the .MODEL statement. Alternatively, you can simply copy and paste the whole .MODEL statement into a spice directive (text), right on your schematic.

Enjoy!

- Tom Gootee

http://www.fullnet.com/~tomg/index.html

-
 
Top