{"id":69,"date":"2013-01-10T01:47:46","date_gmt":"2013-01-10T09:47:46","guid":{"rendered":"https:\/\/www.falatic.com\/?p=69"},"modified":"2016-08-25T03:27:04","modified_gmt":"2016-08-25T10:27:04","slug":"memristor-simulation-with-ltspice-a-practical-example","status":"publish","type":"post","link":"https:\/\/www.falatic.com\/index.php\/69\/memristor-simulation-with-ltspice-a-practical-example","title":{"rendered":"Memristor simulation with LTspice &#8211; a practical example!"},"content":{"rendered":"<p><strong>Update 2016-08-25: <\/strong>LTSpice XVII is out! It doesn&#8217;t look that different from IV but it&#8217;s definitely improved under the hood. There is a quirk though:\u00a0it installs a set of component libraries in the usual place, but also in\u00a0<em>C:\\Users\\%username%\\Documents\\LTspiceXVII\\lib\u00a0<\/em>&#8230; and it ONLY uses that second set! (As a test, I removed the examples and libs\u00a0in the install dir and it\u00a0worked just as well.) This may be a transient bug or part of the migration to a new directory model &#8211; either way, <strong>if the normal install doesn&#8217;t work for you,\u00a0install the memristor library to the folders in\u00a0<em>C:\\Users\\%username%\\Documents\\LTspiceXVII\\lib<\/em><\/strong><\/p>\n<p><strong>Update 2016-02-08:<\/strong> The examples can be found on <strong><a href=\"https:\/\/github.com\/MartyMacGyver\/memristor-modeling\" target=\"_blank\">my GitHub repo (MartyMacGyver\/memristor-modeling)<\/a><\/strong><\/p>\n<p><strong>Update 2015-03-30:<\/strong> My goal was to create\u00a0a simulation in LTspice using a memristor component&#8230; I did NOT write the SPICE model for the memristor component itself (it&#8217;s\u00a0straight out of <a href=\"http:\/\/www.radioeng.cz\/fulltexts\/2009\/09_02_210_214.pdf\" target=\"_blank\">the paper by Biolek, Biolek, and Biolkova<\/a>\u00a0as noted in the Readme file).\u00a0Due to the limitations of that model, this\u00a0simulation only works in <strong>transient\u00a0analysis<\/strong> mode.\u00a0The parameters are\u00a0&#8220;<em>.tran 0 3s 0 3m uic<\/em>&#8221; (<em>uic<\/em>\u00a0used to be called\u00a0<em>skipbp<\/em>).<\/p>\n<hr \/>\n<p>Lately I&#8217;ve been getting back into the EE groove with some random electronics projects (such as <a href=\"http:\/\/www.youtube.com\/watch?v=bcLGZKe4U_s\" target=\"_blank\">an Arduino-based LED strip driver<\/a>). I&#8217;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&#8230; still, it&#8217;s handy for quick little sims to learn new things, especially in the digital realm).<\/p>\n<p><a href=\"https:\/\/www.falatic.com\/wp-content\/uploads\/2013\/01\/480px-Two-terminal_non-linear_circuit_elements.svg_.png\" rel=\"attachment wp-att-157\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-157\" src=\"https:\/\/www.falatic.com\/wp-content\/uploads\/2013\/01\/480px-Two-terminal_non-linear_circuit_elements.svg_-300x300.png\" alt=\"Memristors in the mix\" width=\"300\" height=\"300\" data-wp-pid=\"157\" srcset=\"https:\/\/www.falatic.com\/wp-content\/uploads\/2013\/01\/480px-Two-terminal_non-linear_circuit_elements.svg_-300x300.png 300w, https:\/\/www.falatic.com\/wp-content\/uploads\/2013\/01\/480px-Two-terminal_non-linear_circuit_elements.svg_-150x150.png 150w, https:\/\/www.falatic.com\/wp-content\/uploads\/2013\/01\/480px-Two-terminal_non-linear_circuit_elements.svg_.png 480w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Today I stumbled on\u00a0<a href=\"http:\/\/www.linear.com\/designtools\/software\/#LTspice\" target=\"_blank\">LTspice from Linear Technology<\/a>, which I found to be surprisingly intuitive (and given that it&#8217;s based on the <a href=\"http:\/\/en.wikipedia.org\/wiki\/SPICE\" target=\"_blank\">venerable and powerful SPICE<\/a> it&#8217;s that much more worth learning). It&#8217;s not as animation-friendly as Micro-Cap but it&#8217;s pretty easy to make custom components (and where else can you simulate the <em>actual inner workings<\/em> of a <a href=\"http:\/\/www.electronics.dit.ie\/staff\/mtully\/555%20folder\/555%20timer.htm\" target=\"_blank\">555 timer<\/a> or a <a href=\"http:\/\/www.electronics.dit.ie\/staff\/mtully\/741%20tutorial\/741%20Op-Amp%20Tutorial.htm\" target=\"_blank\">741 op-amp<\/a>?) (And yes, the 741 is not something you&#8217;d reach for normally nowadays, but they are instructive nonetheless.)<\/p>\n<p>Memristors have intrigued me since they made the news a few years back, when discoveries were made of practical memristive materials. <a href=\"http:\/\/en.wikipedia.org\/wiki\/Memristor\" target=\"_blank\">You can read more about them on Wikipedia<\/a> 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.<\/p>\n<p>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&#8217;s Law and applying Th\u00e9venin&#8217;s theorem, you&#8217;re probably better off in Materials Science Engineering than Electrical Engineering. At least that&#8217;s what happened to me&#8230; that and a very grumpy EE prof who made it clear we&#8217;d all be obsolete, unemployed and grumpy like him soon anyway. And you can always fall back on CS when the semiconductor market tanks&#8230;<\/p>\n<p>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 &#8211; who writes a text tutorial in a video? &#8211; and a broken webpage, but I never found a working sim). So, I made one&#8230; and after a few false starts I got it to work. Not bad for an evening at home!<\/p>\n<p>To try out my demo LTspice-based\u00a0memristor simulation, please visit <a href=\"https:\/\/github.com\/MartyMacGyver\/memristor-modeling\" target=\"_blank\">my GitHub repo (MartyMacGyver\/memristor-modeling)<\/a>\u00a0and follow the instructions there for how to install and use it.<\/p>\n<p>And to reiterate, this is a demo based on the SPICE model of a memristor as described in one paper&#8230; this is for educational purposes only and no, I can&#8217;t help you with your homework. \ud83d\ude00<\/p>\n<p>To test all this, install the latest LTspice, install the files per the Readme,\u00a0load up\u00a0memristor_sim.asc, and run the simulation. This currently works\u00a0with LTspice IV\u00a0and the latest\u00a0LTspice XVII.<\/p>\n<p>&nbsp;<\/p>\n<!-- wpsso rrssb get buttons: buttons on archive option not enabled -->\n","protected":false},"excerpt":{"rendered":"<p>Update 2016-08-25: LTSpice XVII is out! It doesn&#8217;t look that different from IV but it&#8217;s definitely improved under the hood. There is a quirk though:\u00a0it installs a set of component <a href=\"https:\/\/www.falatic.com\/index.php\/69\/memristor-simulation-with-ltspice-a-practical-example\" class=\"more-link\">[&hellip;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":158,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"Layout":"","footnotes":"","_links_to":"","_links_to_target":""},"categories":[85,108,86],"tags":[124,122,121,123],"class_list":["entry","author-marty","post-69","post","type-post","status-publish","format-standard","has-post-thumbnail","category-electronics","category-science","category-software-and-hardware-development","tag-electronics","tag-ltspice","tag-memristor","tag-spice"],"_links":{"self":[{"href":"https:\/\/www.falatic.com\/index.php\/wp-json\/wp\/v2\/posts\/69","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.falatic.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.falatic.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.falatic.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.falatic.com\/index.php\/wp-json\/wp\/v2\/comments?post=69"}],"version-history":[{"count":0,"href":"https:\/\/www.falatic.com\/index.php\/wp-json\/wp\/v2\/posts\/69\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.falatic.com\/index.php\/wp-json\/wp\/v2\/media\/158"}],"wp:attachment":[{"href":"https:\/\/www.falatic.com\/index.php\/wp-json\/wp\/v2\/media?parent=69"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.falatic.com\/index.php\/wp-json\/wp\/v2\/categories?post=69"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.falatic.com\/index.php\/wp-json\/wp\/v2\/tags?post=69"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}