[Current Regulator] Do you need some Spice in your Design (en)

Yes ! You need it.

LTSpice Introduction and schematic

A little feedback about Spice simulation, at first I was a little skeptical. My first spice schematics was not that good because of « bad » models (understand Ideal models), but more recently at my work I had to use it before prototyping some « complex » analog board (Fet, Transformer, High Voltage, HF) and after many research I manage to have a better overview of the Spice Engine capabilities (LTSpice to be precise). In fact, if you want to have a mV precise simulation you MUST fetch your components models from the manufacturer  (or do it with the help of datasheet but it’s a lot difficult). It’s particulary true if you want to simulate things like HF oscillators, amplifiers and other thing in this domain.

In the case of my Current Regulator, I’m lazy and I’ll go for the first simulation with simple model, because constraints are not so importants and I’m not borred by the idea of doing the prototype many times ;) In fact, I just want to see If my « concept » with these values has a chance to work.

The first problem in this case (and the only one in fact) is « how to do a PWM without modelling the µC ». The solution is really simple, just use a Voltage Component in pulse mode.

As you guess modify it for your need (Remember F = 1/T ;)) For the test I’ll take Ton = 3.5u because 5*65% = 3.25V, so if the simulation goes well it should be good. I made a little change before launching the simulation, the Schotkky Diode will be a MBRS340 and the model is already in the default lib of LTSpice so I took it (moreover the diode is one of the most important part in this design). I placed a V+ net flag on the top of the load and a V- net flag between load and sense resistor.

First Results

We should have about 3.25V and 325mA… Suspens « Le jeu commence. »

First check… Seems « Not Bad » ;) If you don’t know you can add « computed » traces, just right-click on the graph and select Add Traces. You can type your equation in the textbox. (For easier read you can use Add Plane to add a panel in the graph area). In this example, I added the Power dissipation of the Sense Resistor.

So, we will zoom on interesting part of the curve to see if we have a « good » ripple and to see how long is the initial current overshoot wich worrying me because I don’t know is the LED will appreciate, if you have any clues on this topic leave a message ;)

LED Power Part

As you can see we have about 956mW, a 40mV / 3mA Ripple, we could have better results, but I’ll do the fine tuning on the protype or if I’m not too lazy on a simulation with real and correct models !

As I said, I’m worrying for the transient voltage accross the LED the first 120µS are a little too hard for the device I think, I’ll investigate on the Internet, and if necessary, I’ll add a snubber. Your advices are welcome !

Sense Resistor Part

There should be no problem here, but to be sure just take a look at the voltage drop and the dissipated power in the sense resistor.

Ok, everything seems normal hopefully.


So, what to say in conclusion, first all the results here could have been (hand)calculated but honnestly it tooks me 2 minutes to draw the schematic and launch the simulation, I agree there are some differences with the real board, but it shows me before, maybe, frying my LED that I should take care of this transient, and gave me an idea of how much power will be dissipated. For more complicated board it will save you much time if you did a stupid mistake or design error.

In fact, the hardest part of Spice simulation when the design is already here, is to find the models, but there are many model. The LTSpice choice is in my opinion the best, because the engine is great, really optimised, the GUI is not fancy with eyes-burning colors but efficient, and you can easily adapt Spice model for other (expensive) software. It is a 0$ software and it runs well with Wine under Linux. Maybe it will be the subject of a futur post on this blog. And for the glory I’ll do the schematic of this little board with corresponding models (for the OPA too, if i find one) and do some measure on the real one ;)
Have a good night.



Entrez vos coordonnées ci-dessous ou cliquez sur une icône pour vous connecter:

Logo WordPress.com

Vous commentez à l'aide de votre compte WordPress.com. Déconnexion /  Changer )

Photo Google

Vous commentez à l'aide de votre compte Google. Déconnexion /  Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion /  Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion /  Changer )

Connexion à %s