Thursday, December 8, 2011

LTSpice simulation of Chua's circuit

[EDIT 2012-03-25: fixed a stupid error on the sample rate]


From time to time I get spam from Farnell (a component distributor), and on their newsletter they're promoting a free webinar by Elektor magazine, titled "Let's Build a Chaos Generator!". The event is due 15th of December at 6:00 PM EET, so if you have nothing better to do, that's one good way to waste your time.

I had been reading on chaos generators in the past, and this e-mail got me interested again. Their design is somewhat complicated, with a total of 13 stages of 7 different circuit blocks. You can read all about it in the PDF they published.

Elektor's Chaos Generator won't fit in your pocket.

A much simpler chaos generator that can be built with a lot less components is called Chua's circuit. The downside with this simple circuit is that you need an inductor which you might have to wind up yourself. Also there should be much less variety than in the waveforms of the Elektor circuit. It has so many stages that can saturate to give different waveforms.

Still, Chua's circuit is very interesting to fiddle with. I haven't built the circuit yet, but I did some simulations with LTSpice IV and here's what I found out.

First, I googled for schematics. The first result was this great page giving me a nice schematic and details on the circuit. Another page I found had a quite similar circuit but with a little bit different component values. I built a circuit with LTSpice based those two pages.

My LTSpice version of Chua's circuit.

If you want to try simulating the circuit yourself, click here to download the .asc file.

The circuit is powered by two 9V sources, one positive and one negative. Would be nice to see a single-supply version by the way! There are two outputs, nodes V1 and V2. I chose the LT1351 op amp, since it should be quite near the common TL071 series op amps, and the model comes ready with the LTSpice installation.

The circuit can be tweaked by varying R6 from 0 to 2k. Somewhere in between lies chaos. I found 1.6kohms a good value.

A transient simulation to 1/10th of a second gives the following waveforms for V1 and V2:


From up here, voltage V2 (blue) seems to be bouncing around two different DC levels at the same time!

A closer zoom on the waveforms shows some detail:


And if we change the x-axis to be V2 and the y-axis to V1, we get the beautiful double scroll plot:


I also ran an FFT for the signals, to see what kind of frequencies are involved:


Hmm, seems like it's audible... and so I couldn't stop there. I wanted to hear what it sounds like, so I made a simulation which outputs .WAV files.

Since LTSpice IV clips WAV outputs with an amplitude over 1V, I had to attenuate the two signals with voltage dividers. Here's the LTSpice circuit I used:

LTSpice simulation with WAV output!

If you want to simulate this one yourself, download the LTSpice project here.

The simulation for 10 seconds of audio took some time with my settings, and generated 500MB of raw data. Looking at it now, the time step (0.1ms) is lower than the sampling time... You might want to simulate with approximately 1/44100 time step, but that will produce even more data.

After all this, I could finally listen to the horrible screeching noise of chaos.

And so can you: The signal V1 (.wav) is more high-pitched, while the V2 (.wav) has lower frequencies in it's spectrum (like you can see from the FFT).

What it sounds like is noise, and a very annoying kind of noise.

I don't know yet how changing the value of R6 realtime will affect the sound. For that I would need to build the circuit and try it. With low values of R6, the circuit oscillates with a constant frequency. It would be neat to hear the moments at the edge of chaos. So I'll be probably building this one sometime. If someone has already built it, go ahead and post a comment!

11 comments:

  1. How you got a double scroll?? Please tell that me in detail

    ReplyDelete
  2. Take the two voltages: V1 to ground and V2 to ground.
    Then plot one versus another, so that one is X axis and one is Y axis.

    You can do that after running the transient analysis, by plotting V1 and then changing the X axis to v(V2).

    ReplyDelete
    Replies
    1. where to add this two voltages v1 v2 in order to obtain the double scroll

      Delete
    2. This site has detailed information on how do get the double scroll: http://www.chuacircuits.com/howtobuild3.php

      Delete
  3. do a transient analysis and plot V1 first. then change the x axis to V2. it's called an XY plot.

    ReplyDelete
  4. nice concept circuit for hobbiest
    adrian liauw

    ReplyDelete
  5. Hello,

    Any insight how to deal with .wave files paths and names on a Mac computer? I can't go beyond a "Trouble creating .wav output file: ..." error message, even when creating the files directly on the root of the HDD and ensuring there's no space in the pathname.

    ReplyDelete
  6. No idea about Mac LTSpice, other than Mac uses "/path/to/file.wav", where Windows uses "c:\path\to\file.wav" format for paths...?

    ReplyDelete
  7. Hi, I really like your work. is there a way to get a double scroll without using a inductor? I have to use a Antoniou indutance- simulation, but I can't get results. Is it possible using LTSpice?

    ReplyDelete
  8. have you tried to implement it in breadboard?
    I've tried it but the result is not double scroll

    ReplyDelete
  9. can I use other simulator please like Matlab, Simplorer?

    ReplyDelete