Learning about LTspice

(An aside. I have had terrible trouble getting this Blog post to you. WordPress has fought me all the way. I still don’t know why so much user hostility has been programmed into it, but work-arounds have been found and here we are. I would like to acknowledge the help of the people from my site provider, Zuver. Thanks, Guys!)

On Tuesday the 23rd of July, I attended a seminar on LTspice. This was put on by the Arrow people. The speaker was Mike Engelhardt, the author/creator of LTspice. Mike is a proficient and entertaining speaker. We could tell that he was enjoying himself. Well he might, as it seems that he has a lot to crow about. He listed the respects in which he can claim that LTspice is superior to any other spice simulation package that is available to the public. The claims really are big. In taking in the Engelhardt story, we face a stark choice. We have to make one interpretation or the other – seems to me that there is no middle ground. The choice is this: Either we have to conclude that Mike really is laying it on a bit thick, or that LTspice is pretty special, and really is superior to other spice invocations – in spite of the fact that it is free. My bullshit detector did not go off, and I am inclined to the second view.

Mike Engelhardt in funny hat
(The hat wasn’t worn at the seminar)

I think that Mike finds an Australian audience a bit strange. He lists his achievements with this package, and these are achievements that anyone would be proud of, and the audience just sits there like stunned mullets. I get the impression that audiences in other places might be a little more demonstrative about being impressed. At one time, Mike said “Now I am going to step out of ‘Humble Mode’ ”. He then described some feature of the software that he is quite proud of. This was the second time that I had heard Mike speak, and I remembered that the first time ’round, I noted the way the Australian audience did not show appreciation. Thus when Mike made his brief statement whilst out of ‘Humble Mode’, I started the clapping off. Once it was started, the whole audience joined in. It was as if Australian audience members are a little embarrassed about showing that they are impressed, but once given permission, they let loose.

I remember the day, it would have been in 1989, that my colleague Tino Vescovi explained the significance of current mode control in a switched mode power supply to me. He explained that the supplies (topologies that we were looking at) had an inductor in series and a capacitor in shunt at the output. This is two poles in the control loop for voltage control. On the other hand, if we had current mode control, then the inductor was effectively being fed with a current. A current source in series with an inductor is just a current source. In other words the inductor disappears as far as the (outer) voltage control loop is concerned. This means that the loop has one less pole. There was more to it than that, in the Vescovi story, of course, but that was “Point Number One”. This is pretty fundamental in the world of switched mode supply design, and if you gathered a bunch of people who claimed to be switched mode power supply designers, then I would expect them all to know this: either that, or they had delusions of grandeur in claiming to be in the group.

On the first occasion that I heard Mike (2011), mates of mine who, like me, are switched mode power supply designers, Bob Sheehy and Nigel Machin were in the audience. When Mike asked what phase shift was caused by the inductor, one of us (I can’t remember which one), called out “None”. At the time, Mike said that he was impressed to find someone who knew that. Mike is a good speaker, and finding an excuse to flatter an audience member, is a ploy in his tool box of presentation tricks. On that ground, we can forgive him for making a fuss, but strictly, we should expect all of the audience to know this.

This time around, Mike again asked how much phase shift the inductor caused, and Bob and Nigel were not there, so it fell to me to call out “None”. Mike repeated his speil about how impressed he was to find someone who knew that. He obviously didn’t remember his first visit as well as I did. That didn’t matter. I went up a couple of hat sizes and enjoyed the rest of the seminar even more.

During the talk, Mike explained how we should draw conclusions about stability by identifying poles and zeros in the circuitry surrounding a switched mode controller chip. One pin on the chip was the output of a transconductance error amplifier. Attached to this was a capacitor and resistor in series to ground. His talk proceeded on the assumptions that the audience knew what the error amplifier was and its role in the scheme of things. These assumptions seems strangely incongruous with the assumption that the audience member did not realise that a current source in series with an inductor is just a current source.

I didn’t make notes to cover the whole substance of the talk, wanting only to record the information that was either new to me and I wanted to use, or, if not exactly new, then nice to be reminded of.

*** One was a method for investigating a system with feedback which requires the feedback for stable operation. There are many examples where we cannot just “open the loop”. A switched mode power supply would be an example. Another example is the Photo Diode Amplifier that I looked at in the posting to this blog More Photo Diode Amplifier – Investigating Miller Capacitance.

Mike’s method is to place the voltage generator that will introduce a disturbance in series with the feedback impedance.

*** Mike urged us to not use vendor’s spice models. He painted a word picture of a scenario in which a component manufacturer finds he is forced to provide spice models, and employs an intern to do the job. As presented to us, the story was entertaining. The horrible thing is that it could quite often be true!

*** If a circuit is complex and run-time might be an issue, don’t put capacitor esr in as a separate component, but put it in as an attribute of the capacitor. This reduces the number of nodes.

*** jfet op amps have a noisy tail current source, so need the same impedance on both inputs so that noise via source-gate capacitance will be (all) common mode. This is not a spice trick, but it is worthwhile point to remember.

*** One is usually better off not using initial conditions ( .ic ). Provide a circuit to add charge (to a capacitor, say) at the start of a run. Mike gave an example with a piecewise linear current source.

Placing one volt on a capacitor at the start of a run
without using the .ic statement.

 It is not clear to me why this is a curved line: I had expected a linear ramp.
(On reflection later, I realised that this had been a very clever way of steering us away from using the .ic command. I wonder what problems there are with the .ic command implementation in LTspice.)

A bunch of files relating to the seminar are to be found in this zip file:


In a Readme, Mike has written:
The .zip archive usually doesn’t preserve the executeability of the .exe files contained therein. You will have to make them executable if you want to be able to use the links in the PowerPoint presentation like I did during the seminar.”

Still nothing worked for me, and after placing a query with John Simpson at Arrow, the following message came through:

It depends on the version of PowerPoint.  Often on has to
hardwire the absolute URL into the links.  The easiest way
to find the file is to right click on the link(in edit mode,
not presentation mode), note the name of the file, and then
open that file.  The file will be in the .zip file.”

I can’t really understand this. I can open the Power Point file in Power Point or in Open Office, but cannot work the hyperlinks off the slides. I don’t regard this as an LTspice matter. I have never before taken any interest in Power Point, being content to just use it as a slideshow viewer, and now I suppose I pay the price.

Another Way?
Apart from attending excellent seminars featuring Mike Engelhardt, there appears to be another way to learn more about LTspice. This is by purchasing a heavy hard cover book that is published by Wurth Elektronik who are another Linear Technology dealer. Wurth Elektronik are a German company. They have several factories, and I could not identify a “Head Office” location on their website, so I can’t say where they are from. I bought my copy from the local Wurth Elektronik office, or perhaps I should say I “picked up” my copy from the local office, as the transaction turned out to be an international transaction in US dollars with an office in Singapore.

It is immediately obvious that the book was not originally written in English. Indeed it is obvious that the translator is not familiar with English idiom. Many a turn of phrase makes strange reading until you realise that some probably popular and common expression in German has been translated word for word into English. The writing style reminds me of the writing style that is prevalent in Elektor magazine.

Quite apart from our languages being different, I think such things as conventions about how material should be laid out for a reader’s convenience are very different. I have enjoyed reading the book: it is a bit like reading Finnegans Wake (sic): you read the actual words, and then you think a bit about what the words mean. I found a couple of what seemed to be errors, but then again, perhaps I was not converting the words into my own vernacular correctly! It is easy to understand how these difficulties arise. Just imagine the distinction that we make between the words “valuable” and “invaluable”. If I employed a youngster to translate my words into German and then where I wrote “invaluable” a German reader read the German equivalent of “not valuable”, then she might reckon that I had made an error.

I had two particular questions about LTspice that had arisen when actually working with it. The first was that I wanted to know how to make an assignment statement. I had been using stepping in spice for some time:

.step param R 1 10 3

(that sort of thing)

but when I am exploring a multidimensional concept space, I might want to step through one parameter at a time whilst keeping all the others constant. My idea was that I could step on R (as above) whilst assigning values to R2, R3 and R4 (say), and then later step on R2 and assign a fixed value to R.

After a quick and casual (no written method) attempt to find out how to do this in the Wurth book, I wrote down all the words that I could think of that were synonyms of “assignment statement”. I probably have to admit here that my imagination wasn’t very good. I then searched the index. None of them were there.

My second question was to do with the FFT plot. Could I show this with a linear frequency scale?

The index of the book has four entries for “FFT” (pages 43, 36, 36, and 76). Page 36 has nothing about FFT except that we should look at Chapter 8.
Page 43 has nothing about FFT, but the text string “FFT” does appear in a list of file types that LTspice works with.
Page 76 contains instructions for a parrot to repeat some steps which lead to an FFT to appear on the screen. This is fine as long as the parrot doesn’t want to know what it is all about.
Chapter 8 starts on page 170 (a page not mentioned under “FFT” in the index) and is headed:

At first, one might not worry just what this chapter title means. Notice that the word “editor” is in the plural. I didn’t worry about this when I first encountered it, but later I came to believe that I had been informed that there are three editors:

(i) Measurements Editor
(ii) Virtual Oscilloscope Editor
(iii) FFT Editor

When reading the chapter, I encountered a sub heading:
8.3.1 Virtual oscilloscope and FFT analyser editor”

Does the singular form of the noun here tell us that one editor serves both?

Then again, what does “Editor” mean? This seems pretty unambiguous, but I remember when I first encountered the word “Editor” in a computer context. It would have been about 1978, and I had just purchased my first Editor and Assembler (both came as punched paper tape, and ran on a Motorola 6800 system). I had great difficulty getting these going, not because of any technical problem, but because of a semantic one. In my mind, editing meant changing some written material. This meant that before you could edit something, you had to write it. In the days when the text i/o was by way of a teletype, editing was a tricky business. You had to print out the document and then identify the place for a change by line number, and then type in a replacement or additional line to go in that spot. A cumbersome business. I could understand that as programs that would fit on a punch paper tape went, this was tricky and I would need a program for that. But how the hell do I enter my text document in the first place? Then I discovered that in the world of the computer, editing does not mean editing! No, it means writing AND editing. This would all be so obvious to young people that the story must seem strange. It is just the way the language goes. What was the German author thinking of when he wrote the German word that was later translated as “Editor”? We don’t know. Could it have been ‘Pop-Down Menu”?

The reason for this musing, is that I have read Chapter 8 very carefully, and cannot find any evidence of an FFT Editor apart form the heading quoted above!

On the day of the seminar, whilst school was out for play time, I collared Mike Engelhardt and asked him my two questions. these were answered in less than a minute.

So far the Wurth Elektronik book has cost me more in time than in purchase price, and I haven’t learned anything from it yet. In spite of this, I do not regret owning it. The fact that it exists probably reduces the probability that someone else will write a book on just this topic. Thus it is the ONLY book on this. That probably makes it a bit special, even if nothing else does.

The answers to my questions were:
(i) The assignment statement in spice is “.param” as in “.param R=5k”
(This IS in the Wurth Elektronik book: one just had to know which word to search on.)

(ii) If you move the cursor towards the bottom of the FFT plot, at some point it will turn into a little ruler. Click and a pop up menu will offer you some options. One of these is a box with a tick in it labelled “Logarithmic”. Remove the tick with a click. This is not exclusive to the FFT plot.

There is a third way to obtain information about LTspice. The program is very popular, and there are many tutorials and even videos to help that are only a Google search away.

Then there are the help screen in the program. I gather from my Googling that these have a bad reputation. They were mentioned several times by Mike in the seminar, but always in the context of the one statement:

I would not be so condescending as to suggest that a person look at the Help screens”. If you can figure out what that means, you should have no trouble with the Wurth Elektronik book.

One thought on “Learning about LTspice

  1. Andrew Beal

    Great post Richard!

    The reason for the non linear ramp is that the current itself is actually linearly ramping in that statement. The current starts at 0A at point 0, as the current linearly ramps to 1A at 1us, so does the rate of change in voltage. If the current was constant for the whole 2us (step response), then you would get the linear voltage ramp.


Leave a Reply

Your email address will not be published. Required fields are marked *