Saturday, February 22, 2025

Irwin Dual VCA: 20+ Years Later

Readers: If you'd like to build the project featured in today's post, please go to PCBWAY's Community pages--gerber file (main board); KiCAD project/PCB/schematic/library files, and a B.O.M. are here for a socketed SSM2164 version or clone and here for an SOIC IC build.

You can also help out this site immensely by checking out PCBWAY using the link here. Thanks!

=====

One of my first DiWHY projects from 2002 was Mike Irwin's dual VCA I found in an EDN article (copy of Mr. Irwin's original is posted here).  

Around 2004 I fabricated a bespoke PCB around Mr. Irwin's design and sold several dual-VCA's PCB's.

I needed a simple dual linear VCA for a stereo panner project (details in a future post).

Unfortunately the 2002 era PCB's are long gone....but....Easy! Using Kicad and help from my friends at PCBWAY I made more.

 

SSM2164 Quad VCA. I have a few tubes of New Old Stock (NOS) SSM 2164 IC's but you probably don't....fortunately, 20 plus years later you can get 2164 clones, e.g. here.


FABRICATION 

My 2002 design was through-hole, but nowadays, for quick prototyping, I think using SMD, a stencil, solder paste, and a hotplate are the way to go (fabrication in this manner is described in the high pass filter post here). 

 


getting ready to stencil....


I am always a bit surprised that solder paste, in spite of its name, is not very pasty. I carefully lifted the populated board onto the hot plate after hand-placing the SMD components so they wouldn't slide off.

Bake-o-rama....baked to 215 degrees C for a few minutes then let it cool to 150C, worked great.



Quick power test...power tested OK, no shorts.


Testing the completed VCA....


Did it work first time (WFT?)  Nope. Power draw from the board was about 20mA with all IC's installed...about right....but no sound, anywhere, no matter what.  

Instead of spending hours troubleshooting I did something both difficult and unusual for me: I walked away. 

That night I sprang up from a deep sleep--eureka! I knew why it didn't work. 

The board has 2 power terminals, one for large format (right), one for Euro (left top).  On the bench I used the Frac power header, but the latter Euro power connector SV1 had accommodations for ferrite beads, FB2 and FB1.  





On the bench I left the beads out, thinking: if I was not using the Euro header, why use ferrite beads?  

Doh! The power traces went from frac power header through the Euro power header to some of the rest of the circuit so yes, the beads were needed. 

I soldered in jumpers instead of ferrite beads and the board worked.

PCBWAY--This Blog's Sponsor


If you want to build your own dual VCA--I posted the THT and SOIC versions on PCBWAY's community site

Many thanks to PCBWAY for sponsoring this blog and for all the help they've provided over the years.  You can help out this blog immensely by checking out PCBWAY, here.  

A build option: setting the bias offset of the VCA's op amp buffers to something other than ground is possible.  

If you want to do that, leave the 0 ohm resistors off and put present a DC voltage to the OFFSET JST pins. 

OK, getting to the end of this quick post. this VCA will show up in some future designs. The boards I posted on the PCBWAY community site have a few minor improvements to things like silk screened legends, other than that, it's all Irwin, baby.

Monday, February 10, 2025

Kicad, NGSPICE and the MiniMoog EG Simulation Rabbit Hole

This one started when my 50-year old (!) Minimoog bit the big one.

Its Loudness Contour Envelope Generator croaked; it would work on occasion if I tapped on the DECAY TIME knob--so, a faulty potentiometer?

I took it to an expensive vintage electronics repair shop 45+ minutes away. 

Sadly, $600USD later, after "fixing" it, the sustain knobs sent CV to the VCA and VCF, even if a key wasn't depressed. Need to do a soundcheck? Have the roadie crank up "Sustain Level". Done.

Not a feature, a bug?

MiniMoog "Modifiers" section. On my vintage Mini this is transistor/resistor/cap/diode only ADSD Envelope Generator.

In the words of Richard Nixon: I had to erase it myself?  

If so, I needed to understand how the Mini's EG worked.

Looking at MiniMoog schematics (here and here), its EG's are discrete; no IC's. 

I had (and still have) almost no experience with circuit design from this era: pre-integrated circuit, but post-vacuum tubes. 

The more I tried to study the schematics and follow signal paths the more my brain hurt.  

I tried to simulate the MiniMoog's Loudness EG using Falstad:

Get a functional (pun intended) MiniMoog Loudness Contour simulation here. I couldn't get this Falstad simulation to work, but Mod Wiggler's "guest"--the same superhero who helped save the triangle to ramp design here--fixed my broken Moog EG sim. Yeh!


Cool...I had a working simulation, but try as I might, I could not duplicate the odd "Sustain to CV" fault on my beloved MiniMoog.

So--I did what any rational person would do--I gave up. 

Of course, I couldn't leave it alone. 

Instead, I went down a "design using only discrete" rabbit hole. 

Four days of joyful misery--at the end of it, I still sucked--I found it impossible to master even a tiny fraction of late 60's/early 70's discrete audio circuit design kung fu...this stuff is really difficult.

Nevertheless, I dug further into Falstad to (try to) whip up discrete simulations for LFO's, preamps, and EG's. 

I quickly learned that, like my brain, the UI for Falstad wasn't up to some of it.

Which led me to--sorry about the long intro, folks--the NGSPICE simulation abilities built into our beloved EDA software--KICAD 8.  


TUTORIALS 


To simulate circuits, Kicad (an open source project) incorporates code from another open source project, NGSPICE; NGSPICE'S beginner's tutorial page is here but the how-to doesn't help much for Kicad.   

To learn Kicad 8's NGSPICE user interface: watch at least some of the 7-part video series starting here. This is essential viewing.  The content creator presents his tutorials slowly; he's thorough, easy to follow, and accurate--worth the time.  

GETTING STARTED--FAKE DC POWER


Something that puzzled me--how could I "turn on" a simulation?" There is no breadboard to wire anything to, no PCB to fry with a bench DC supply.

To provide fake power to a fake circuit: in a Kicad 8 schematic, I placed a component called SPICE > VDC:

Spice VDC component



I added the usual +5V power pin and GND to this VDC spice supply.  

I edited its properties, renamed it V1, and gave it a 5 volt DC voltage; when my simulation power was ready to go it looked like this:

 Once +5VDC was defined somewhere in my schematic, I found I couldn't define a Spice VDC for +5V again or cryptic errors would appear when it came time to simulate the circuit.


 To create a phony bipolar supply I could craft something like this:

Simulated +/- 15V Power supply
 555, the newbie's IC!

With this in place, I could use +5, +15, GND and so on, "powering up" my circuit during simulation. 

Moving on:


555 ASTABLE: FIRST SIMULATION

One of the first working circuit I ever built was an astable using the venerable 555 IC.  As an homage, for my first simulation using Kicad, I started there.

555-the newbie's IC!


But! Putting a 555 symbol, passive components, and my +5VDC power supply into a Kicad schematic, then starting the simulation (steps to start a simulation follow shortly), threw cryptic errors.  

Turned out: the simulation didn't know what to do with a 555 IC, since its behavior needed to be defined or "modeled". 

I found models for just about every component I could think of using Google searches--often they are found on manufactures' websites. I gathered a few model files I thought I'd use frequently and put them on Github--here

Here's a quick summary of how to add a model to a Kicad symbol:

  • Select the 555 symbol in the schematic
  • Tap "e" key to select properties
  • Click on the "Simulation Model" button:


  • Point the component to the 555 simulation file and choose the 555 model:


Click on the PIN assignments tab to make sure the pins from the model map to the pins in the Kicad symbol:

               


With this in place--was I good to go?

The best thing about simulations--you won't blow anything up, ever. Go ahead: try weasel, try squirrel!

I started the simulation using Inspect > Simulator

I created a new simulation using the "plus" icon:


I chose: "OP - DC Operating Point". OP was akin to using a voltmeter, so I figured--easy?


....and to my surprise it showed voltages and current for a sim as a snapshot in time: IT WORKED!!!  

Cool!!!!!


SCOPE A DOPE


Seeing voltages and currents at a point in time was great, but I wanted to take it up a notch: see an X as time and Y as amplitude. 

I put the 555 astable schematic into a hierarchical sheet (a brief how-to covering Kicad hierarchical sheets is here--go to the bottom of the post).  

Using this 555 astable to generate a couple of pulses in 30 seconds I crafted a three transistor attack/release envelope generator:




To edit an existing simulation, I used this icon:

TRAN--something the GOP will outlaw before long? No, blogs like this will go first. 


I chose, as my type of simulation, "TRANS", an abbreviation for "Transient Analysis", the simulation akin to capturing the output of an oscilloscope. 

"Time step" formed the sample rate, "final time" constituted how many seconds of data my fake scope's Y axis showed:

 

I found that making time steps too big or too small could bring the simulation to its knees. For this simple A/R function generator, plotting every 10ms and doing so for 30 seconds did the trick.

With the simulation successfully launched: to choose the voltage I wanted to see plotted over time, on the right column I chose "V(OUT)", indicating the label I added to the AR schematic seen above.


I ran it and it worked! The V(OUT) looked pretty good--attack and release resistance impacted the circuit's peak output voltage but for 3 transistors: good enough.

I also needed to get a 2N7000 simulation model for this as well. I found it here--again, a manufacturer's website is a good place to start your model file journey.



DIGITAL SIMULATION


With my pseudo-analog AR design working I was on a roll--could Kicad be used for digital simulations? 

Specifically: some older ADSR's have SR latches (the "discrete ADSR" here for instance), could I get an 74LS00 simulation to work?

Once again the tutorials here and here  made this pretty easy; I got the models for some of the 74HCxx IC family here--downloaded from the link next to "models for 74xx digital devices, a NGspice subset derived from the MicroCap library."

Setting up the simulation was not too difficult, but I found I couldn't skip a step and have it work--these tips are in the aforementioned videos, but, here they are again:

  • I tied outputs I wanted to see in my simulation to an 1M resistor, which is in turn tied to GND. Otherwise, the simulation wouldn't work.





  • I made sure I added this text to the simulation's .kicad_sch design (this assumed "5V = high" logic):

I have no idea why this is needed....just do it.


  • I didn't need to worry about the power pins on a simulated digital IC, at least for the 74xx series mentioned in the video.

  • Since I was doing a transient analysis of a digital simulation, I unchecked "Save all Currents" and "Save all power dissipations" and selected "PSpice and LTSpice" as my "compatibility mode" (you knew this, right?). Otherwise the simulations throws cryptic error and warning messages and may not run.


With all of that--and it all had to be right for any of it to work--I got a 7400 simulation going:


Notice that no power section "E" is needed.


Output.


OTA's


I simulated those too....took me a day to figure out I needed to use the VSIN (voltage) spice part, not the ISIN (current) part. Doh! That simple mistake tripped me up for hours. 

Again, you can get the model files I have tested working with Kicad/NGSPICE here.

13700...Could only find a model for 1/2 the IC.  The "1/2 LM13700" symbol is available as in the library file found here.

CA3080


Seems worked: green is input sine, output is amplified signal (I got the 13700's built-in Darlington buffer to work, and also an op amp based buffer)


PLOTTING FREQUENCY RESPONSE


To wrap it up I drew a simple schematic, in this case an RC filter:


I used a 2 pin connector for the input, not a spice component.  

Clicked on J1, clicked E for properties then chose the Simulation Model button:



 Under settings--I selected "built in SPICE model"'; Device Type: DC and AC magnitude Value 1; DC value 0:



For the simulation I set up "AC small signal analysis" with these values (stop frequency for audio should be anywhere from perhaps 10Hz to 100K)



When I simulated the filter I got a nice roll off plot:



Good for trying what-if's, dropping in different cap and resistor values--seeing what happens--why do math, ever?

Good video that goes over AC Small Signal Analysis in Kicad 8 is here.

THIS BLOG'S SPONSOR!



Before I go, got to shout it out for this blog's sponsor, PCBWAY. Once you have your simulation working, it's not hard to turn it into a real .sch/.pcb and gerber file and send it off to PCBWAY.  They will get it back to you super fast....PCBWAY fabricates at incredibly low prices (5x 2 layer boards for about $5 US.....).  Hats off to them, I am grateful for their sponsorship of this blog.

ABRUPT TAPE SPLICE 


That's it for this time, paraphrasing the great Quintus Arrius: "you have the spirit to watch bad YouTube, but the good sense to control it". Simulate well and live! See ya next time.

 

Sunday, January 19, 2025

FPGA's 2025 Part II: Lattice/iCEcube2

Hello again, continuing on my quasi-annual attempt to get started with low cost Field Programmable Gate Arrays, or FPGA's. 

How will I do in 2025?

Last post I installed a Windows toolchain for Altera/Quartus; I read that offerings from Lattice Semiconductor are a bit more DIY/hobbyist friendly. Let's find out.

Nandland Go Board, sporting a Lattice FPGA chip


WHICH LATTICE-BASED DEVELOPMENT BOARD?

I already owned a couple of Lattice FPGA based boards: "TinyFPGA BX's",  hardware and their open source toolchain are covered in this previous post.

As far as I could tell BX boards were no longer being manufactured, also, I guessed that Lattice's software might be easier to get going vs. open source software I used to program the TinyFPGA's. 

After research: fingers pointed to Nandland Go Board as an affordable way to get started with Lattice FPGA's.....bought one!



TOOLCHAIN

The lower-end (read: less expensive) Lattice FPGA chips are programmed or "designed" using Lattice's iCEcube2 software. 

An Aside: Lattice almost removed itself from the DIY/student/hobbyist FPGA world forever (smart move? How much money do we spend on this stuff compared to these guys?) by raising license fees for IceCube2 from free to more than $470USB. 

Fortunately Lattice changed its mind, and iCEcube2 is available again using the five finger discount; we are back in business.

I followed the webpage here to get the toolchain going. Conclusion: Nandland's one-stop online resources (tutorials, purchasing, videos, more) made things much easier to get going versus Quartus Prime and Altera. Their "getting started" video and webpage (here and here) were invaluable; I went from nothing to blink in about 2 hours.

How I got iCEcube2 for free:

I had to create an account on the Lattice Semi page: here.

Then I emailed the Lattice Licensing dudes (lic_admn@latticesemi.com) with the subject "New iCEcube2 License Request" from my audiodiwhy email. I sent the email on Saturday. 

I was a bit surprised that the following Monday, yes, I got an email from Lattice Semi that had a serial number in it. 

With that, I went back to Lattice's website (the page here) to turn the serial number into a license (*.dat file). Lattice emailed the .dat file to me, I saved that on my Window 11 system's hard drive, then used it complete the installation of iCEcube2.

NOW--A WORD FROM OUR SPONSOR

I haven't crafted any audio projects yet using an FPGA, but when I do, I will run, not walk, to PCBWAY to get the boards--might be 4 layer?  They have been instrumental in helping get my projects working and they will take great care of you as well. 

If you need injection molding, 3D printing, assembly, and a lot more hit 'em up: 

You can also help out this blog by checking them out here

Back to today's topic....

ICECUBES (2 of them) in YER TROUSERS

During the iCEcube2 installation I had to enter the MAC address of my windows system (start > run > cmd > ipconfig); everything else was straightforward.

iCEcube2 did not have a built in programmer. As per the Nandland tutorials, I had to install the Diamond Programmer Standalone (here).  Be sure to download the 50 odd MB Standalone programmer, not the 1GB+ Diamond software zip. You only need the former.

I downloaded and installed the Windows title:

You will need the "Diamond Programmer Standalone" to get your .bin files onto your FPGA board

I also downloaded the FTDI Windows driver for the Go Board, here. I installed the driver for Windows 11 using all defaults, a reboot wasn't necessary.

All in all--pretty easy.  

Next: a few screenshots that might prove helpful in 6 months when I forget all this.


When creating an iCEcube2 based design, the program will save your critical .bin file--the binary file needed to blow into the FPGA--to god-only-knows where. Wait, I know where! [project]\sbt\outputs\bitmap.  

The Diamond Programmer needs the changes in red above to work with the Go Board....



Then: "device properties" need to be set for the Go Board. Note--"Device: M25P10" did not match what is shown the Nandland blink project video, but the M25P10 setting worked.

Thankfully, you can save your programming configuration as an xcf file. That way you don't have to configure the standalone programmer every time you have a new project. 

Cool!


CODE

To test the toolchain I used the .v blink code from the Nanoland site.


module Switches_To_LEDs

(input i_Switch_1,

input i_Switch_2,

input i_Switch_3,

input i_Switch_4,

output o_LED_1,

output o_LED_2,

output o_LED_3,

output o_LED_4);

assign o_LED_1 = i_Switch_1;

assign o_LED_2 = i_Switch_2;

assign o_LED_3 = i_Switch_3;

assign o_LED_4 = i_Switch_4;

endmodule 

I uploaded it using the instructions from the "getting started" tutorial--here.  

It didn't work at first, but I ran through the steps a second time and viola:

BLINKORAMA?

I reached Newbie Nirvana: press SW1 through SW4, the damn thing blinked.

Boy Howdy!

What next? There are low-code/no code options, like Icestorm (here), and, maybe I can use AI so I don't have to learn Verilog. I also found an interesting video about using Logisim Evolution (previous LSE post is here) to generate code from schematics: click here.

But first I have to come up with a project for my nifty FPGA boards. 

Maybe some sort of all-FPGA Lunetta thingy?  

We will see. See ya next time!

Thursday, January 2, 2025

FGPA's 2025 part I: Intel/Altera/Quartus

Hello there, it's a new year, and I am jumping back down the FPGA rabbit hole:

Tesaric DE10-LITE. The URL for the CD, on a sticker glued by the manufacturer to the board, 404's. Sorry.

I last worked with FPGA's a couple of years ago almost to the day (post here)

This time I wanted to see if I could figure out how to use an FPGA for accurate data acquisition (the frequency counter project/multiplier, for instance: here).  

I got out my tinyFPGA BX for this but soon found out it's listed on Digikey as "obsolete" and not currently for sale.... 

Hello? It's only a couple of years old but, whatever.

Digging into alternatives, wow, the FPGA market is figure 8 trailer racing: 

In a nutshell: the FPGA landscape apparently changes more quickly and more often than my chonies.

Older, lower density FPGA's are being phased out:

I bought this Altera Cyclone II development board a few years ago for next to nothing, but recently discovered that the current Quartus programming IDE no longer supports it. Sorry. I might be able to get an older version of Quartus working on an Windows 7 VM and revitalize this dinosaur? 

Regardless, as a birthday gift to myself, or maybe because I love punishment, I bought a few newer FPGA offerings and will try to get their toolchains going in the next few posts.  

This time it's Intel, Altera, and Quartus. But first.....

PCBWAY--THIS BLOG'S HUMBLE SPONSOR

No matter what FGPA I end up using, if I have to fab up a board for it, my stop will of course be my sponsor, PCBWAY.  They manufacture small quantities of PCB's for very affordable prices and work and ship very quickly. They also do injection molding, 3D printing, assembly, and a lot more. You can help out this blog by checking them out here.

A QUARTUS LOW?


Quartus Prime Lite Edition is the free offering from Intel (Wait--Altera? or these guys?) you can use to program supported Intel FPGA's.

As far as I can tell, Quartus Prime Lite is the same software with the same features as the >$2k USD  licensed versions but only supports Altera's current line of lower density FPGA's. 

Good enough for what we do? Probably, yes!

I downloaded and ran the 28MB SFX installer for Windows: here. Some how-to videos such as the one here demonstrated downloading tricks needed to get Quartus Prime Lite to work for free, but nope, the single file linked above pulled in necessary files and the install was simple. 

Best of all--no license was needed! 

Warning: As mentioned above, the FPGA scene is always changing fast, so who knows when the links in this post will break....if you want software so you can program your FPGA, get it soon!

For hardware: after some research, a good bang-for-the-buck option supported by the current version of Quartus Prime Lite is the Tesaric DE10-LITE.  
 
There are less expensive Altera options, but for now, I wanted to make sure I could get the toolchain to work and a lot of documentation pointed to Tesaric.

The video I followed to get the toolchain up and running is Olawale Akinwale's offering here

This was a helpful video, but Olawale showed me how to do something wrong before showing me how to do it right--educational, but, time consuming. You might want to watch the whole video before attempting to get your FPGA board working.

For Verilog code I used the same .v file the content he used:

module lab1_1 (SW,LEDR);
input [9:0] SW; //slide switches
output [9:0] LEDR; // red LEDs
assign LEDR = SW;
endmodule


A few things not mentioned in the video:

  • The USB-Blaster driver did not install correctly on my windows 11 system during the initial Quartus install. 

To get that going I ran the DPINST.exe program that was installed along with Quartus. On my Windows PC I found the app here: C:\intelFPGA_lite\23.1std\quartus\drivers.  




I found other videos and forum posts saying to fix this issue use Windows device manager--but for Windows 11, no, that didn't work.  Running DPinst.exe fixed things; I can now see "USB-Blaster [USB-0] in the "hardware setup" dialog.

  • To blow your verilog code get into the firmware of the dev board--and not have your work wiped out each power cycle--the Programmer UI needs to be set to run the .pof file and "program/configure" needs to be set as you see here:



Beyond that the video was spot-on.

After uploading to the FPGA deb board, and solving the issues above, each slide switch turned on or off its corresponding LED. 

It worked! Cool!!! 

str = 'F' + str.Substring(1);


Say what you will about Intel, Quartus is a super powerful piece of software.

Next, I found out that you can do low code/no code Verilog development using its "schematic" feature. Video is here.  

Using that I drew up a few AND gates and converted the schemo into verilog code:

"File" > "Create/Update" > "Create HDL Design File for Current File" (I had to have the .v overarching project open for this export to work).

I got this:


module lab1_3(
SW0,
SW1,
SW2,
SW3,
LEDR0
);


input wire SW0;
input wire SW1;
input wire SW2;
input wire SW3;
output wire LEDR0;

wire SYNTHESIZED_WIRE_0;
wire SYNTHESIZED_WIRE_1;




assign SYNTHESIZED_WIRE_0 = SW0 & SW1;

assign SYNTHESIZED_WIRE_1 = SW2 & SW3;

assign LEDR0 = SYNTHESIZED_WIRE_0 & SYNTHESIZED_WIRE_1;


endmodule


QUARTOUTTRO?  QUARTUSTRO?  QUARTOJUMBO? 


Between these features and AI maybe I can do useful FPGA coding without having to learn a ton of Verilog.....

Obviously I have a long way to go here, but, figuring out this new toolchain was a lot of fun.

Next up I am going to look into current offerings for Lattice Semiconductor--thankfully, they are still around, haven't been recently acquired by a wig company, and in that they have some lower-end offerings and seem to care about the hobbyist and semi-pro community, might be a better fit for DiWHY.  Update: done, Lattice FPGA hardware and a free toolchain work--post is here.

We will see.
 


Irwin Dual VCA: 20+ Years Later

Readers: If you'd like to build the project featured in today's post, please go to PCBWAY's Community pages --gerber file (main...