Op Amp Contest: Generate Spirograph Shapes Using Only Op Amps And Math

Front and back views of a square, purple PCB with op amps and BNC outputs

If you’re a child of the ’80s or ’90s, chances are you’ve spent hours tracing out intricate patterns using the pens and gears of a Spirograph kit. Simple as those parts may be, they’re actually a very clever technique for plotting mathematical functions called hypotrochoids and epitrochoids. [Craig] has spent some time analyzing these functions, and realized you can also implement them with analog circuits. He used this knowledge to design a device called Op Art which generates Spirograph shapes on your oscilloscope using just a handful of op amps.

A spirograph shape shown on an oscilloscope screenTo draw either a hypotrochoid or an epitrochoid, you need to generate sine and cosine waves of various frequencies, and then add them with a certain scaling factor. Generating sines and cosines is not so hard to do with op amps, but making an adjustable oscillator that reliably churns out matching sine and cosine waves over a large frequency range turned out to be tricky. After a bit of experimentation, [Craig] discovered that a phase-shift oscillator was the right topology, not only for its adjustability but also because it generates sine, cosine and inverted sine terms that all come in handy when drawing various Spirograph shapes.

The resulting waves are added together in a mixer, consisting of a dual-gang potmeter that implements adjustable scaling factors for both the sine and cosine channels simultaneously. Finally, a pair of non-inverting amplifiers buffer the output signals and drive two coax cables connected to an oscilloscope. All op amps are low-power MCP6004 types that consume just 100 uA per channel, allowing the whole thing to run off a pair of AAA batteries.

The Op Art system is pretty easy to use: just set your ‘scope to XY mode and start playing with the frequency and gain adjustment pots. [Craig] shows some examples of the shapes it can draw, which vary from simple triangles to all kinds of spirals and flower-like patterns. Most automated spirograph machines try to replicate the mechanics of the original toy using contraptions holding a pen or mirrors manipulating a laser, but as [Craig] shows, going down to the basic maths can yield great results, too.

13 thoughts on “Op Amp Contest: Generate Spirograph Shapes Using Only Op Amps And Math

  1. Oof. Amazon basics…not a good look…
    Never ever buy anything from Amazon Basics.

    Why? Let’s take a tour of how these come to exist.

    1. A company sells something on Amazon. It is popular.
    2. Amazon knows what products sell well. It identifies the product from 1.
    3. Amazon finds 1’s suppliers, or finds one that will make a copy.
    4. Amazon strong-arms the suppliers into selling to Amazon instead. (Allegedly)
    5. Amazon undercuts 1.
    6. Amazon starts suggesting it’s own products instead of 1’s.

    Do you save $0.03 now? Sure!

    But 1. cant compete against the giant company that hosts their storefront and the search results at the same time. They die.

    Eventually your only choice is to buy from Amazon.

    Ever been to a small town with 30 shuttered stores and 1 Walmart?

    1. From personal experience with Amazon I’d say that your steps 1 through 6 are dead on. But you are being nice because Amazon is much more sinister!

      Take grain mills for example. I had a working relationship with a small USA based shop manufacturing grain mills. And being relationship based I had no issue with his 6+ unit wholesale pricing. I started buying from him and selling through FBA Amazon with an agreement that he would not go direct to Amazon. This relationship started in September of that year. And then all of the sudden Amazon started direct selling the exact same grain mill for $4.00 less than my selling price, and no matter where I set my price Amazon stayed at $4.00 less. I tried contacting the guy and his first answer was ‘Someone else must be selling them’ but when I pressed him for a name he finally admitted that Amazon approached him with a large order with a healthy discount and he needed the money!

      I told him “You just fuc, I mean screwed yourself” and not too many months later Amazon started selling their own made in China grain mill. He’s been out of business for a while now and his name is on a mill that’s being imported and sold by a Chinese company. This is because the Chinese sellers on Amazon are even worse than Amazon! And if you said ‘That’s patent or copyright infringement” you would be 100% right. But patents and copyrights take some serious dollars to defend, dollars that most of us don’t have.

      I’m in the same position, not with Amazon but with Chinese Amazon sellers. I’ve sold homebrew and still / boil controllers that I designed and we manufacture for over 15 years. And right now you can buy a Chinese made InkBird brand mash controller for less than what I have invested in material in any of my mash controllers. This means that the customers who do buy one of my mash controllers buy one because they want one. This also means that if I had to survive off only my controller revenue I’d be out of business. So, in a way I’ve joined them. Bulk products that I import and repackage from China help keep my business alive.

  2. “If you’re a child of the ’80s or ’90s,”

    I guess us late Boomers and early Gen X folk probably don’t recollect what we did back then. Or maybe we just probably don’t read Hack-A-Day.

    1. I consider myself a child of the 70’s as that’s when a lot of my memories are from. Spirograph seems to me to have always existed so I assumed it predated me. As I learned just now, we’re the same vintage. 1965 was a very good year, apparently.

  3. Wikipedia seems to think “Spirograph” came into being in the late 60;s. Perhaps you had a similar toy under a different name? My younger brother got one (Spirograph brand) around 1970. I bought him (and my sister) the new version last year.

  4. @Robin Kearey said: “…but making an adjustable oscillator that reliably churns out matching sine and cosine waves over a large frequency range turned out to be tricky.”

    Oh yeah, “tricky” that’s today’s big understatement. Take a look at the analog All-Pass Filter from a theoretical point of view.[1] A common application of an all pass filter with a 90 degree phase shift (IQ) is the Hilbert Transform, often realized digitally (DSP) for SSB generation and demodulation.[2]

    1. All-pass filter


    2. Hilbert transform


    1. Neat project! The large vector display and arcade cabinet really bring it to life. I had not seen a color vector display before. Does that display provide a X-Y input directly, or did it need some hacking to do that? I’m hoping to try OpArt on an analog display at some point – maybe an excuse to pick up an analog scope at some point.

      ElectroHarmonograph does indeed work similarly to OpArt. If I’m understanding it right, the main difference aside from damping would be that OpArt’s second pair of X/Y outputs going into the summer are locked to the same frequency and phase, whereas the second X/Y pair in ElectroHarmonograph can vary in phase and amplitude relative to each other.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.