Memristor simulation with LTspice – a practical example!

Update 2016-08-25: LTSpice XVII is out! It doesn’t look that different from IV but it’s definitely improved under the hood. There is a quirk though: it installs a set of component libraries in the usual place, but also in C:\Users\%username%\Documents\LTspiceXVII\lib … and it ONLY uses that second set! (As a test, I removed the examples and libs in the install dir and it worked just as well.) This may be a transient bug or part of the migration to a new directory model – either way, if the normal install doesn’t work for you, install the memristor library to the folders in C:\Users\%username%\Documents\LTspiceXVII\lib

Update 2016-02-08: The examples can be found on my GitHub repo (MartyMacGyver/memristor-modeling)

Update 2015-03-30: My goal was to create a simulation in LTspice using a memristor component… I did NOT write the SPICE model for the memristor component itself (it’s straight out of the paper by Biolek, Biolek, and Biolkova as noted in the Readme file). Due to the limitations of that model, this simulation only works in transient analysis mode. The parameters are “.tran 0 3s 0 3m uic” (uic used to be called skipbp).


Lately I’ve been getting back into the EE groove with some random electronics projects (such as an Arduino-based LED strip driver). I’ve also been dabbling with different circuit simulators like Micro-Cap (which I used back in college but which is VERY expensive for the regular version… still, it’s handy for quick little sims to learn new things, especially in the digital realm).

Memristors in the mix

Today I stumbled on LTspice from Linear Technology, which I found to be surprisingly intuitive (and given that it’s based on the venerable and powerful SPICE it’s that much more worth learning). It’s not as animation-friendly as Micro-Cap but it’s pretty easy to make custom components (and where else can you simulate the actual inner workings of a 555 timer or a 741 op-amp?) (And yes, the 741 is not something you’d reach for normally nowadays, but they are instructive nonetheless.)

Memristors have intrigued me since they made the news a few years back, when discoveries were made of practical memristive materials. You can read more about them on Wikipedia and so on, and though very subject is not without controversy I personally think they will prove to be a valuable technology going forward. I found them intriguing from both the EE and the MSE perspectives.

Side-note: if you find yourself wondering more about why a device does what it does (in my case, the humble MOSFET) than regurgitating Kirchoff’s Law and applying Thévenin’s theorem, you’re probably better off in Materials Science Engineering than Electrical Engineering. At least that’s what happened to me… that and a very grumpy EE prof who made it clear we’d all be obsolete, unemployed and grumpy like him soon anyway. And you can always fall back on CS when the semiconductor market tanks…

Given all that, today I decided to see if I could simulate a circuit with a memristor in it. Problem is, while some sims have memristors, LTspice does not, and apparently nobody out there has published a simple example that actually works (I found videos – who writes a text tutorial in a video? – and a broken webpage, but I never found a working sim). So, I made one… and after a few false starts I got it to work. Not bad for an evening at home!

To try out my demo LTspice-based memristor simulation, please visit my GitHub repo (MartyMacGyver/memristor-modeling) and follow the instructions there for how to install and use it.

And to reiterate, this is a demo based on the SPICE model of a memristor as described in one paper… this is for educational purposes only and no, I can’t help you with your homework. 😀

To test all this, install the latest LTspice, install the files per the Readme, load up memristor_sim.asc, and run the simulation. This currently works with LTspice IV and the latest LTspice XVII.

 

9 Comments


  1. Its great that u have developed a successful working ltspice version of the memristor. But I found the problem that when the memristor is energized with the pulse wave its resistance should be a triangular wave atleast(actually a curvy triangular one) but the same is not available from your code. If u are free just see that once..

    Reply

    1. What you see is what I have – hopefully others will expand upon and refine this work over time.

      Reply

  2. i need to know how can we get an access to memristor in LTspice IV
    actually i’m working on a project related to memristors.. i need to urgently know how to get it on LTspice

    Reply

  3. LTSpiceXVII (latest at time of writing) complains: “Couldn’t find symbol(s): memristor”. Followed instructions in readme file and verified that both asy and sub files are in what appear to be the right places. Any idea how to rectify this?

    Reply

    1. Hmm! I was unaware of the new LTSpice XVII rewrite… I’ll check it out soon and update this post accordingly. Meanwhile this should still work with the latest LTSpice IV.

      Reply

    2. Ok, I found the quirk with LTSpice XVII and have updated this post and the Github repo readme accordingly – thanks for letting me know!

      Reply

  4. Could you provide LTspice simulation files of memristor crossbar implementation?

    Reply

Leave a Reply

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


*