Saturday, June 21, 2025

"LFO MINI": Small and Simple CA3080 modulation source

Readers: If you'd like to build the project featured in today's post, please go to PCBWAY's Community pages--gerber file; KiCAD 9 project/pcb/schematic/library files, a couple of B.O.M.'s, and more, are here.  

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

============

Carrying on with the latest "keep it simple" and "just say no to AI" posts: this time I designed, laid out and populated a small CA3080 based LFO PCB. Works!


 The basic OTA > op amp core was stolen from EFM's LFO2; see the previous post here; an online simulation of the current source for the 3080's "Iabc" pin 5 is here.


Laying this out was easy, but I had to make a few decisions that seem a bit arbitrary:

  • I used Through Hole Technology not SMD. I don't do a lot of through hole work any longer, but have so many THT parts lying around, I felt like I had to use them?
  • I had a tube of NOS CA3080's so I used a few. If you build this LFO you'll need to find this IC. The DIP version of this IC is no longer made, but, as I am writing this post I see plenty for sale on Ebay, Amazon and elsewhere--it's not unobtanium.
  • Inputs rails were +/- 12V, but the circuit should work fine with anything from maybe +/- 15V to +/- 9V.
  • Inputs and outputs were put on 3 pin 100mil headers.

One modulation input was current limited by R5 and brought out to the "CV I/O" pin, but additional modulation sources could be easily added--wire up 100K resistor(s) between your CVs and the "Q1BASE" wirepad:

Be careful! If you leave off the 100K resistors and plug your additional CV directly into the "Q1base" wirepad you risk blowing up transistor Q1. Make sure to current limit the additional CV with a series resistor as shown.

From here this was an easy build:

I got 10 LFO minis from this blog's loyal Sponsor, PCBWAY, for $5USB (excluding tariff and import fees).  You can greatly help this blog by checking 'em out here.





Testing....

The LFO worked first time--almost.

I had a short between two of the bypass cap pins (C1) initially and the CA3080 got hot; once I cleaned up the sloppy solder everything was fine. Fortunately I didn't smoke the CA3080.

Using only the 10K trimmer board for modulation the LFO goes from < 1hz well into audio range. With +/- 12V CV added, I got a wide range of frequencies, from reeallly slllowww to well up into the audio range--this is a the hallmark EFM design: cool and simple.


 

Output for triangle is about 6V P/P, for the square it's close to the rails. Since I designed the LFO-MINI to be a daughterboard, I figure whatever I plugged it into could gain up or down these output amplitudes, so for now this was good enough.

What's next? It would be easy to make this a dual super-small LFO using SMD parts and an LM13700. 

Overall, this will find its way into some "quad mod" type modules swirling around in my head, that combine random voltage sources, audio inputs, a couple of these LFO's, and who know what else. 

Until then, don't breathe the fumes.

Saturday, June 7, 2025

BNC to 3.5mm Adapter Board--Sans AI

Readers: If you'd like to build the project featured in today's post, please go to PCBWAY's Community pages--gerber file; KiCAD 9 project/pcb/schematic/library files, a B.O.M., and more are here.  

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

============

At my day job I'm up to my knees in Artificial Intelligence. Thank goodness I can do something simple and stupid for AudioDiWHY and get away from AI for a bit.

How about a 3x BNC to mono 3.5" adapter PCB? BNC's can be found on most of my bench test gear, and 3.5" jacks are common on anything DiWHY.  

Sure, I could buy or make BNC to 3.5mm mono adapters/adapter cables, but what fun is that?

THE BOARD

In addition to the 3x breakout the PCB has signal and ground brought to wirepads.

For the audio jacks I used my favorite horizontal 3.5" switching mono jack, the Switchcraft 35RAPCVAV

KICAD 9 doesn't provide a footprint for this connector, so I made my own. Get it from Github, here (a library with all my custom KICAD footprints is here).

For the BNC's I had a lot of choices, but, in the spirit of this blog, I chose cheap Chinese BNC's sourced from Amazon: "Superbat":




I had to make a custom a Kicad footprint for this component as well, get it here.....and, assuming the link still works--you can buy the connectors here.  

THIS BLOG'S SPONSOR


Once again helping with my DiWHY addiction is this blog's humble sponsor, PCBWAY.  They do all sorts of great fabrication, CNC/3D printing, assembly, and much more.

Please help out this blog and check them out--use the link here.   

DESIGN AND BUILD

Designing the PCB was easy. I used Kicad 9 and made the board less than 100x100 mm to lock in PCBWAY's ridiculously low price of $5USD for 10 boards.


 

Happiness is new boards from PCBWAY!


SE HABLA TARIFFS?

For the first time I had to pay a tariff for these PCB's. It was surprisingly tricky to figure out how to do that.

Here is the process (for DHL Express; other shippers will differ):

  • Print DHL's POA form (download it here). As of 6-8-25: You have to complete this form, and have DHL sign off, to get shipments from China to the U.S.A. using DHL.
  • Go to page 2 and figure out who/what you are. 
  • I am an "individual" so I had to fill out the boxes listed in that form on pages 3 and 4. Yes, I had to provide my social security number.
  • Sign the form.
  • Scan the completed form and email it to DHLExpressUSA.POA@dhl.com 
  • They emailed me back quickly--one business day--to acknowledge they got the form and it was OK.
  • After my order shipped from PCBWAY, DHL sent me an email telling me how much additional USD I had to pay them before I could take delivery of the goods.  
  • For me, it was about half the cost of the boards and another $18 USD for handling fees.
  • Yes, this raised the price of the boards, but they were still a lot less expensive than any PCB fabrication houses I could find in the US, even with the tariff in place.

With that out of the way, I got building!

USELESS BUILD PHOTOS

 

The BNC's are pretty chunky; I had to increase my solder temp to about 750 degrees F to get their leads hot enough to fuse with the solder.

It was hard getting the BNC's perfectly aligned but everything works--good enough.

USE CASE?

If I ever get time I will use this adapter board next time I fire up my QuantAsylum Audio QA403 test rig; right now, with all the adapters and jumper cables needed to hook A to B and B to C and C to D my bench quickly becomes covered in  spaghetti. Hopefully this simple BNC to 3.5mm adapter board helps sort this a bit.

I also might build a few of these to make the BNC's behind my test gear--like the trigger input to my Siglent SDG1025--easier to patch.


Beyond that? Who knows. Adapter boards are great fun and soldering connectors on a simple PCB is satisfying. 

Saturday, May 24, 2025

Adventures in AI

                           

Are you fascinated by the idea of building your own audio gadgets but feel intimidated by complex circuit diagrams and tedious calculations? Artificial intelligence (AI) is rapidly changing the landscape of electronics, and now, even hobbyists can leverage its power to design and create custom audio circuits. This blog post will guide you through the exciting world of using AI tools and platforms to simplify the process, from conceptualizing your project to bringing your sonic creations to life.

BARACK OLAMMA

Are you eager to explore the possibilities of large language models (LLM's) on your single-board computer (SBC) without relying on cloud services? Look no further! This section will walk you through the straightforward process of installing and utilizing Ollama, featuring the amazingly small and at times hilariously inaccurate Llama 3.21B model directly on your SBC. Get ready to unleash the potential of local AI for various tasks, right at your fingertips!

                       

The simple video here describes steps to install Ollama and LLAMA3.2. Follow it to install the powerful model on your single board computer (SBC) or in the case of the author of this blog, a Linux Mint VM running 4GB RAM and a 20GB fake HD. 

#install OLLAMA (woe woe)

curl -fsSL https://ollama.com/install.sh | sh

#fix ufw to allowing incoming Baracks.

sudo ufw allow 11434/tcp

#test

#open FireFox on your SBC and go to localhost:11434 you should see "Ollama is running"

#install model

ollama pull llama3.2

#RUN MODEL

ollama run llama3.2

#enter stupid stuff

>>>How do I make potato salad?

Here's a simple recipe for classic potato salad:

Ingredients:

* 4 large potatoes, peeled and diced

* 1/2 cup of mayonnaise

* 1 tablespoon Dijon mustard

* 1 teaspoon chopped fresh dill

(blah blah ginger blah blah)

Once running, you can discover exciting and productive facts that will assist in your quest to create basic do-it-yourself projects. "Why Scotty, why?" It's a line that resonates with anyone who's ever pushed technology to its absolute limit, only to have it fail at the most dramatically inconvenient moment. More than just a frustrated outburst, this iconic Star Trek quote speaks volumes about the complex relationship between engineers and their machines, the inherent unpredictability of even the most advanced technology, and the often-unseen sacrifices made to keep things running. Let's delve into some thoughts on why this simple question, posed by Captain Kirk, has become such a memorable and relatable part of the Star Trek lexicon.


Excellent, always so happy to help! Here are a few more prompts that the author of this blog posed to OLLAMA/LLAMA 3.2.  You too can discover the impressive state-of-the-art inaccuracies. We hope you find LLAMA3.2 useful!

 >>> what are notes in a C major 7 chord

In a C major 7 (Cmaj7) chord, the root note is C, and the other three notes are:

 

1. Major third: E

2. Perfect fifth: G

3. Minor seventh: A

So, the notes of a C major 7 chord are: C-E-G-A 

>>> what are the notes of C minor pentatonic scale?

The C minor pentatonic scale consists of five notes:

C, Eb, F, Gb, Bb.


                          



If you’re rich and just want to lie on the beach, go ahead and soak it all in! Let the sun be your spotlight, the sea your soundtrack. Order a fresh coconut or a fancy cocktail, lean back in a plush lounge chair, and let the breeze do the rest. Don’t even bother with your phone—just let your mind wander as the waves lap at your feet and seagulls play above. 

                        



This is your time to simply exist, with no rush, no deadlines—just warm sand, blue skies, and the gentle hum of relaxation. So go ahead, live that beachfront dream, because after all, isn’t that what the riches are for?


Creative sponsors don’t just offer money—they become partners who help elevate a blog’s content, reach, and professional profile. With their support, a blog can evolve from a passion project into a thriving, sustainable platform.


 


PCBWAY is an outstanding sponsor for this blog, bringing top-tier expertise in PCB manufacturing and assembly to our readers. Known for their high-quality production standards, affordable prices, and quick turnaround times, PCBWAY empowers electronics enthusiasts, engineers, and hobbyists to bring their innovative ideas to life. 



With a dedication to precision and customer service, they’re more than just a manufacturing service—they’re a trusted partner who shares our commitment to creativity and quality. We’re proud to have them as a sponsor, supporting our mission to provide informative, inspiring content for all our readers!


WHY LEARN TO CODE? SIT ON THE BEACH AND LET AI DO THE LIFTING!

OK, most of this post is silly, but the next part, to me, changes everything.

See the videos here, here and here. You can create working, useful software applications without knowing doodley squat about creating software--"Vibe Coding". 

Yes, this really frigging works. 

Terrifying!

Let's create an application to transpose piano chords up half steps, coded in HTML and CSS (which I have a little experience with) as well as javascript (about which I know almost zilch).  

This is useful when trying to learn dense jazz chords in all 12 keys.

I got a Gemini AI studio license, chose the latest model (which seems to change and improve often), and prompted the AI thing what I wanted app-wise over and over until it worked. 

Get the keyboard transposer 1.4 zip from Github here.

You can run it locally on W11, for that install node.js (get installer here) runtime. 

You will also need a Gemini AI studio API key--video about how to get the code is here.

To run it follow the steps in readme.md, yes this worked (amazing!) 

1. Install dependencies:

   `npm install`

2. Set the `GEMINI_API_KEY` in [.env.local](.env.local) to your Gemini API key (this key is not contained in the github repo, you will need to get yer own)

3. Run the app:

   `npm run dev`

For me it said to go to this URL with my browser: http://localhost:5173/

I can see my app!  I didn't write a single line! I created tech but I have very little idea how it works.

To visualize a major 7 in 12 keys:



(10 more were displayed--etc).

Assuming I was decent at CSS, HTML, and Javascript (I am not) this would have taken me a day to code? Two days? A week? But with zero elbow grease or knowledge I created this app in about an hour and a half. 

BACK TO IT

Oh boy, so you’re thinking about inhaling… toxic fumes? wink Let’s be super serious (but in a silly way) about why you probably, definitely, absolutely shouldn’t be doing that. 🌈








Saturday, April 19, 2025

Arduino Againino....R4, ATTINY and UPDI

 After years of staying away from the Arduino--too many abstractions getting in the way of knowing how things really worked--I was drawn back by the Uno R4 Minima.


UNO ARRRR 4 MINNIMEE, MATE!  

Shiver me Timbres! 

Feature-wise, the R4 looked a bit like the cool and popular Teensy. It features a 32-bit Renesas RA4M1 ARM Cortex M4 processor, 14-bit ADC's and a built-in 12-bit DAC. 

It's a performance improvement from the Uno R3's 8-bit processor and 10-bit ADC's. 

I bought two R4 Minimas and updated my Arduino IDE to the current version. 

I also purchased a few R4 workalikes from SEEED: the XIAO-RA4M1:

Seeed XIAO RA4M1 is a truly dinky Uno Minima R4--the connector seen here is USB-C, giving you an idea of its small size.


The R4 can be easily programmed from the Arduino IDE; for me, plug it in and go. 

After making sure a blink sketch worked, the next thing I tried was the analogWave.h library. 

The library let me whip up audio frequency waveforms fast, fast, FAST, with only a few lines of code:  

////////////////////

#include "analogWave.h" // Include the library for analog waveform //generation

analogWave wave(DAC);   // Create an instance of the analogWave //class, using the DAC pin

int freq = 10;  // in hertz, change accordingly

void setup() {

 

int pin = 0;

 analogWriteResolution(12);

 wave.saw(freq);

 //limit of freq seems to be about 30hz to 10k for this library

 

}

void loop() {

  // Read an analog value from pin A5 and map it to a frequency range

  freq = map(analogRead(A5), 0, 1024, 0, 10000);

  wave.freq(freq); 

}

//////////////////////


When I connected the R4's DAC to my scope I was pretty disappointed--the output looked "stair-step": 

 

I found TriodeGirl's sketch that produced a better sounding ramp wave from the same hardware--but  relied on banging the stuffing out of the MCU's registers; if I was going to do that, I might as well stick with the RP2040 and 2350, which I felt were better documented.  

TriodeGirl's Audio output--looks much better--saw @ about 366hz.



OK, how about creating an audio frequency sawtooth waveform using analogWrite()?  

I wrote a single value to the DAC, and on the next run through loop(),increased the output amplitude by one; when the output amplitude got to 255, returned it to zero.

That didn't work perfectly either; the output looked "hairy":


Read more about this error here.  

I decided I'd pass on the R4's DAC for all but the most "DC" applications. 

Beyond that the SEEED and Arduino R4 Minima seemed affordable and tightly integrated into the world of Arduino; they will likely find their way into future projects.

ATTINY412 and UPDI


Microchip's ATTINY's had come a long way since I last used a "series 0" ATTINY85 (previous post here).  

Newer series 1 and 2 ATTINY's use a proprietary one-wire programming protocol called UPDI; they could be reprogrammed without having to remove the chip from its PCB or breadboard. 

Cool! 

I got a few of these tiny spuds (all SMD)--for the rest of this post I will concentrate on the ATTINY412 and ATTINY1624.

Attiny412--8 Pin SOIC SMD

PROGRAMMING UPDI 

The ATTINY 412 needed a toolchain; Bitluni's YouTube video got me started (here). 

Using the "megaTinyCore" library I got a boring blink sketch to work using my Atmel ICE programmer.



 Atmel's ICE documentation (here, go to page 40) was a bit crap about ICE > UPDI wiring, but I figured it out:


The code:

/*
pins for digital on ATTINY412 
IC's PIN2 is 0
PIN3 is 1
PIN4 is 2
PIN5 is 3
PIN6 is 5
PiIN7 is 4

*/

int GPIOOUT = 4;

void setup() {

  pinMode(GPIOOUT, OUTPUT);  // pin 7 of ATTINY412
}

 
void loop() {
  digitalWrite(GPIOOUT, HIGH);  // turn the LED on (HIGH is the voltage level)
  delay(250);                  // wait for a second
  digitalWrite(GPIOOUT, LOW);    // turn the LED off by making the voltage LOW
  delay(250);                  // wait for a second
}


Next I tried to get an Arduino Nano going as a programmer, that meant getting a CH340 driver working, tricky on my Windows 11 Pro system; I followed the instructions from Sparkfun (here). 

After a few reboots combined with unplugging and reconnecting the NANO, the CH340 was visible in Window's device manager; the Nano came to life with its preprogrammed blink.

Next I created an INO file and folder to upload UPDI code into an Arduino Nano clone.  

I got the code from GitHub here; here's how I got the data onto the Nano.:

  • Create new folder "jtag2updi" for the sketch << new directory must be named exactly this
  • Put all the files from the repo:  ino, cpp .h, blah blah, into this directory
  • Open up the Arduino IDE
  • Open the seemingly empty .ino file in the jtag2updi directory using Arduino sketch IDE
  • Compile
  • Upload to Nano
  • Worked!

I DREAMT OF WIRES

Evening 1 the Nano UPDI toolchain worked but it stopped working soon after. 

Try as I might to get firmware to upload--any firmware, to any UPDI ATTINY, using different NANO's--nope. 

I even went back to the Atmel ICE--double nope.

That anxious night I dreamt of fixing the problem: soldering MCU's to the roof of a fast moving train, using my scope to look at logic levels while in a warm swimming in a pool, and best of all, talking tech with Cornelius from "Planet of the Apes."  


No eureka moment!

I ended up finding an excellent ATTINY video from IMSAI guy (here) who laid out the 4 steps in the Arduino IDE that must be done right for any ATTINY UPDI upload to work:

  • I had to choose the right board family ("414/412/212/402", something like that?)
  • I had to choose the right serial port (for me, the CH340 on the Nano programmer, found on Port 6 of my Windows 11 system)
  • I had to choose the right programmer  ("JTAG2UPDI")
  • I had to choose the right processor (in my case, ATTINY412)
I missed the step where I needed to choose the right processor; I had the rest right; sorry, Cornelius. 

With that sorted I had no more issues with the Nano > ATTINY412 toolchain.   

BTW, the "series 1" ATTINY MCU's--412 is part of this series--has an 8-bit DAC. I did some quick experiments and, unlike the R4, the built-in DAC worked great.

DAC output from ATTINY412--nice!



I concluded that the ATTINY 412 would be a great processor for anything that has to be done super small (SOIC 8 pin, no external crystal needed) and super cheap (the 412 at the time of writing this was about 70c USD for Quantity 1).  

Overall, a win. Great chip--1001+ uses.

An aside: PCBWAY 


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


As soon as I get my first ATTINY series 1+2 project going, it's off to PCBWAY to get the PCB's made along with any other fabrication, including 3D printing and assembly. Please consider using PCBWAY for your next audio project. 


ATTINY 1624: Amazing ADC value!


With the jtag2updi Nano toolchain working reliably I turned my attention to an ATTINY 1624.  

At the time of writing this post this was a USD $1.19 part--quite affordable.

Get its pinout here.  

I read here that its "mux'd" built-in Analog to Digital converter ("ADC") can simultaneously bring in 15 (!!!) 16-bit resolution or better analog inputs. 

Really? On a $1.19c part?

I had to see!!!  

Not so fast....I screwed up and ordered TSSOP SMD ATTINY1624's--instead of the larger SOIC version--TSSOP presenting a truly tiny ATTINY.  

Could I make these miniscule spuds work?


To solder the TSSOP 1624's I dabbed some solder paste on 14-pin TSSOP to DIP adapters, dropped on the chips, and put them on a hotplate. After cleaning up the connections with solder wick, they worked! 

Go A's!

I got the mandatory blink sketch working then turned my attention to seeing if the ADC's really produced 16 bit output.  

Breadboard wiring for the 1624 ADC proof of concept





The code:


unsigned long adc0,adc1,adc2 = 0;
unsigned long millis0=0;//initial ms reading
unsigned long millis1 = 0; // ms reading to compare
int x = 2;

unsigned long int next_millis = 0;

#define UART_TX_PIN 7

void setup() {
 //start begin statement here.
  pinMode(7, OUTPUT); //UART transmit (TX)
  pinMode(PIN_PA3, OUTPUT); // LED
  pinMode(PIN_PA4, INPUT); // use chip pin 2 as ADC
  pinMode(PIN_PA5, INPUT); // use chip pin 3 as ADC
  pinMode(PIN_PA6, INPUT); // use chip pin 3 as ADC
  Serial.begin(9600);
  millis0 = millis();  
}

void loop() {

millis1 = millis();

    //toggle LED without using delay() stupidity
  if ((millis1 - millis0) > 250) {
      
      int state = digitalRead(PIN_PA3);       // Read current state
      digitalWrite(PIN_PA3, !state);  // toggle LED
      millis0 = millis(); 
      //print progress bar
      Serial.print("#");
      x++;
      if (x > 3)
      {
      adc0 = analogReadEnh(PIN_PA4,16);
      adc1 = analogReadEnh(PIN_PA5,16);
      adc2 = analogReadEnh(PIN_PA6,16);
      Serial.print(adc0);
      Serial.print("; ");
      Serial.print(adc1);
      Serial.print("; ");
      Serial.print(adc2);
      Serial.print("; ");
      Serial.println();
      x = 0;}

           
  } 
    
}  // end main loop

It worked! The programmed 1624 sent 3x ADC reads to serial out while flashing an LED.  

Holy ADC, Batman!


In my mind, this means I could get high quality Analog to Digital conversion, 10+ channels worth, for less than $1.20USD per IC.

You're kidding right?

And I got all the extra functionality of the MCU to boot. I could use serial, I2C, or SPI to send this data downstream to other elements--maybe another ATTINY MCU.  

The ATTINY series 1 and 2 had some other cool features. I really liked Configurable Custom Logic or "CCL."  This allowed me to create any small and reasonably simple logic part I could imagine using only an ATTINY--a really good introductory video for CCL is here--I may dedicate another post to CCL.

OK enough for this one, I am typing way too much and still waiting for the AI to kick in.  

Not yet? See ya next time.

Friday, March 28, 2025

Crimping JST-XH connectors--a Quick How-To

 It's a beautiful Spring day, instead of going out and enjoying it, I am teaching myself how to crimp and create JST-XH connectors.



I based this post on the video here; also instructions on the back of the crimping tool...I am writing all of this down because in 3 or so days I will forget all of this.

WHAT TO BUY

I got generic made-in-China JST-XH female pins from Amazon, they came in a pretty big reel.  


I also needed the "shells" (not sure what to call them) into which you shove the pins--I got these from Tayda.


...the crimping tool:


I couldn't get the exact tool in this video, but these Engineer Precision Connector Crimping Pliers were Amazon's choice, looked just like what is in the vid, and worked great. Hope the link here still works....


And of course, hook up wire (I used 24 gauge but I imagine 20 to maybe 26 will work) as well as some decent wire strippers.


PREPARING AND MEASURING THE PINS

The pin (this is a female version, the video shows males and females) have metal at the back that needed to be cut away:


Using diagonal pliers I cut away the extra metal on the right, behind the pin.



Next I pushed the rear fan on the pins until the were parallel and then measured their distance:

Came to 1.85mm, that meant I had to use the 1.9mm slot in the tool.


BTW: the female pins themselves are really small, I didn't wear magnification to do this work, but probably should have.


CRIM-PIN


Next I stripped the hookup wire, exposing about 1.5mm. This has to be done with a fair degree of accuracy. This was described well in the video at about :20.

Then I used needle nose pliers to gently affix the cable into the pin, otherwise the damn thing kept falling out of the tool before I could crimp.  I found I didn't want to overdo things here, just a bit of pressure, to keep the pin in place, was most effective:


Then I oriented the pin with the tool--the orientation needed was not self-evident!  It goes with the open end of the tabs into the larger slot of the tool:


Then inserted the pin and wire and crimped.  Sorry, no photo....

When i was done, I could not pull the crimped end off the wire--it was really on there--all good.


Finally I shoved the pin into the shell.  When it worked, I got a nice little click.


Repeated ad nauseum for the entire project. 

The world is a happy place! 


 See you next time.

"LFO MINI": Small and Simple CA3080 modulation source

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