Thursday, May 28, 2020

Vactrol Envelope Follower--From the Lab of Otto Wahh

I'm going back through my old designs from 2004-2005, laying out new PCBs, and rebuilding stuff.

Why = Whynot?

So let's build a Vactrol envelope follower I initially drew up when dinosaurs still roamed the earth:

Another crappy Lazertran decal job--don't know what I was thinking with the bun-n-weiner logo thing on the left, it's really stoopid, so, the front panel will have to redone.  Oh well.





What the VAC: In 2004 I had even less idea what I was doing then I do now, but I think the module came out OK, you can hear a sound clip of the module here. Pretty much everything you hear is processed in some way through this module, to create auto-wah, side chain effects, amplitude creating  modulation on a VST via Expert Sleepers interfaces, etc.

USING THE VAC-Envelope Follower:

The VAC-EF uses amplitude seen at input to generate a corresponding DC voltage at its output. If you've ever messed with an auto-wah device such as a Mutron III or any sort of optically based compressor/limiter you've messed with amplitude to voltage sub circuits, a small bit like this one, before.

Fun begins fast; an easy application: change a bandpass filter's center frequency in response to the amplitude of an audio signal. Sounds like Jerry, right? Also fun: side chain effects: so a drum track gets louder when another track is soft, for instance. Or: change phase when there is a loud passage for phase shifty sounds, crank up a distortion effect when the instrument you want to mangle is really loud, but not so much when it's soft, or for any of this, do the visa versa.

Hours of fun.  

BUILDING the VAC-EF: 

Here's the schematic:


Board is designed to fit behind a 1u Frac panel:





Temp Front Panel!!! Does it surpass the weiner?

Overall the vactrol action gives the module a slow, drunken, sloppy feel, which to my ears is sometimes a good thing.

But Why, Scotty, Why: I am not sure if the current source for the Vactrol is a smart design choice, but for me it works, I used a voltage regulator to feed current to the opto because I have about a million (a bit fewer maybe?) of those in my junk box. How about putting the 2222 transistor in the feedback loop of the op amp? Is this a good idea? Not sure--I am not even sure it's necessary, but regardless, I've used this module  for the past 15 years and have been happy with its performance.

The TL084 gets a bit hot sometimes depending on the module's settings which means the design could be improved, but I'm too lazy to bother fixing it.

If you do build one of these, mess with R5 value to set the overall performance of the circuit. You might even consider putting a trimmer in series with R5.   

Here are some bench photos:






My initial test PCB used normal 9mm PCB pots and small knobs but as you can see the ergonomics sucked.  Hence I replaced them with tall trimmers which you can buy from Thonk:





FIXES: I had to add 2 kludge wires to make this work since I screwed up the wiring for V+ and V- for the quad op amp. Nice, but omitting is better than wiring it up backwards and blowing up the op amp right? it's like plumbing--if the water squirts out, hey, get a mop. The Eagle files, PDFs including the fixes, etc. etc. are on my website, here.
  
OK still need to test it more and redo the damn front panel. May do a dual VAC-EF in a 2u Frac?  Who knows. Until then, have fun VAC-uuming, always suck when you can, and above all (especially now right?) don't breathe the fumes!

Sunday, May 17, 2020

Noise! Lunetta Circuit Part IV: adding dual VCAs for Audio Gran-Turing-smos

Back again. I'm stuck at home with damn covid Shelter in Place and it's raining. Fortunately the PCB fab shop I use in China is still cranking and I got another set of boards for my Noise! Lunetta stack last week.

Built 'em up rawhide. Worked first time.  Here's all 6 PCBs to date.  The little switch on the left chooses the overall frequency range.

The project so far.....

About Noise!: It's an ongoing project I've been building for many months. I've tried to keep things organic: I think some damn thing, crank it out in Eagle, send it off, get it back, solder it up and see if and how it works. Like the Winchester Mystery House this project may never be completely finished.

It started when Martijn Verhallen from reverselandfill.org and I did a board swap. I really got into his Noise! tone generator and started adding to it, my goal being a full Lunetta type synth for oddball sound generation (I refuse to call this "Sound Design").

Part I--where I build up the base VCO and logic board is here.  Part II: resized and revised, here.  Part III: Adding a quad mux, here.  I created a quad digital pot board and added it to the stack, here.

AD5254 based quad digital pot board, Arduino controlled.  Post is here.

As I was messing with the interconnected PCBs: patching the stack to a bench VCA frequently came up as strange repeating patterns of audio bleeps and blurps. In the mod synth world this is not quite referred to as a "Turing machine"; as Turing modules I've messed with (a popular one has a demo vid here) produce CV, not audio, and on my bench it's the audio patterns that tend to repeat over and over. But whatever. Is a frequency to CV board coming next? Perhaps.

So why not add a couple of VCAs to the stack?  OK, easy, I already have built up a 2164 based dual VCA board (here), I just needed to lay it out again to fit the 3750x2000 mil footprint I am using for the project.

Got em back, built 'em up. No dumb mistakes--yeh baby. You can get eagle files, PDFs of schematics, Eagle files etc. here.

OK now the bench photos--sorry--some folks take photos of their dogs and cats, but I don't have dogs nor cats, so you get circuit boards.

The 3750x2000 dual VCA board.  

Ready to test....

The front facing board is a jacks PCB for the 3750x2000 dual VCA. While I was at it I added buffered CV inputs for the MUX board using the usual opamp/zener thing.




I used the usual super-low-parts-count zener clamp/buffer to keep the Arduino CV inputs from frying:



However I am curious about this clever fragment I lifted from a Mutable Instruments design--looks to me like it allows more stages with only one zener reference; didn't use it this time, will use it down the road.


After that, it became a matter of wiring it all up and testing.

Ready to test!




OK so how does it sound?  I still need to record the damn stack for real but you can see a vid of some of the repeating patterns at work here.

Is it for everyone?  Nope. Time to keep moving. Might do a powersupply and LFO and call it done.  I guess we'll see.  Until next time, don't breathe the fumes.

Monday, May 11, 2020

Transmitting 32 bit longs between Arduinos using I2C

No soldering this time--let's get on the bench and get going!

From a previous post, I've been messing with new old stock NSA1166 bubble displays for an upcoming audio project, the "Part I" post about retro bubble displays is here.


The 70's era stuff is all cool, but who wants a ton of wires running from whatever to the display?  I want to make these bubbles respond to I2C commands, as you might see in an OLED display like the one here.  I2C has 2 wires to transmit, 3 if you include ground so not too much wiring. Like it. 

I won't go over nuts and bolts of I2C in this post; there is a ton of information all over the Internet about I2C already; you can read more about I2C protocol here--or watch this really good vid here--in short, it's a super easy way to move data between digital dookies.

This time I'll focus on one tid-bit:  I2C wants us to send bytes of data (8 bits) down the wire, one at a time, but for this project I need 24 bits on the slave side; since this 6 digit bubble can display 0-999999. How do we do that?

Wait--let's transmit 32 bits, since that will be a common need for other projects. So: my goal is to be able to enter a long value in decimal on the master Arduino and have it show up in decimal on the slave.

I set up a Proof of Concept on the bench to figure this out. An Arduino UNO was used as I2C master and ProMicro cheapo clono as I2C slave--the ProMicro uses D2 for SDA and D3 for SCL. You knew that right? I didn't. Read more about that here. The Arduino IDE gives us the extremely useful wire.h library right out of the box, greatly simplifying I2C programming so let's use that.

Here's how I wired it up:

(Somewhat unbelievably,  I couldn't find an Eagle device for a 20 pin Pro Micro anywhere so I created an eagle device (how-to for that is here)--the 20 pin ProMicro Eagle thingy you see in the schematic above. Comment if you want a copy of the lbr file for this.)



Bench Press: I used 2 old laptops each with the Arduino IDE running. The iPad on the far right is used to look up Interweb things I'm stuck on. The 3 hosts take up a lot of bench space which is hard on my OCD brain but for me I guess it works....whatever.  To get this going the I2Cscanner sketch (here) proved its worth again, I used that to make sure the physical side of everything worked before digging into creating new code.


Very little wiring for any of this.  I am not 100% sure the pull up resistors are needed, but, whatever....



Rope-a-scope: turns out my bang for the buck Siglent 1202X-E scope (8VA teardown dude vid is here) can accurately analyze and show me I2C data, which i didn't know before doing this proof of concept. This feature proved invaluable as I debugged my crap code--for Siglent users, check out the vid on  getting this going here. Wish I knew about this feature before....

A couple of reminders for myself: bytes, ints, and chars are not the same thing.  For the master code I could get sloppy with variable types, but not with the slave code. I'll have to think about that, but overall, for Arduino, bytes and chars are 8 bits; ints are 16 bits, and longs are 32 bits. Doh!

Shut up and show us the code! 

The POC code sends a sample long value to slave 10000 times over I2C then quits, which should be enough to see if the damn thing is working!


///////////////////MASTER/////////////////////////
#include <Wire.h>


// next line, put any decimal # here 0 to 999999



unsigned long int longInt = 333456;  
//on arduino unsigned long goes to 4 billion something

unsigned char byteArray[4];
   
int c = 0;


void setup() {
// put your setup code here, to run once:
Wire.begin();
//Serial.begin(9600);
}


void loop() {


 

Wire.beginTransmission(0x4);

byteArray[0] = (int)((longInt >> 24) & 0xFF) ;
byteArray[1] = (int)((longInt >> 16) & 0xFF) ;
byteArray[2] = (int)((longInt >> 8) & 0XFF);
byteArray[3] = (int)((longInt & 0XFF));


for (c = 0; c < 10000; c++)
    {
    Wire.write(byteArray, 4);
    delay(10 );
//    Serial.println("Sending");
//    Serial.println(c);
Wire.endTransmission();
    }


}


///////////////////////////////////////
//////////////////SLAVE/////////////////////////


#include <Wire.h>

long value = 0;

byte byteArray[4];

byte x = 0;



void setup() {
  // put your setup code here, to run once:
Wire.begin(0x4);
Wire.onReceive(receiveEvent);
Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
delay(100);    

}

void receiveEvent(byte)
{
  Serial.println("received");
  while(1 < Wire.available()) // loop through all but the last
  {
   
    for(int i=0; i<4; i++)
        {
         byteArray[i] = Wire.read();
        
     //    Serial.println(byteArray[i], HEX);
   
        }

  }
/////// convert back to long
delay(100);
for (int q = 0; q < 4; q++)
{
  value = (value << 8 ) + (byteArray[q] & 0xff);
}
Serial.println(value); 
}



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


I am also working on a PCB for the I2C slave arduino, bubble display, shift registers, pull up resistor array, etc., so far it looks like this; I might send it off for fab this week.



Enough! If anyone has questions about the code, bubbles, PCB, and all else, comment away, but for now, on the bench the POC works; putting a long value in the master code will make it show up in serial out on the slave side. Joy!  For the PCB, who knows--more bubble stuff coming up, as well as an audio chaos generator, just in time for the global chaos we are going through right now. Back to soldering soon. See ya.

UPDATE 7-18-20: Aloha! got this all working, see the Part III of this post here.

ProMicro HID Keyboard Emulator

Quick one this time. The Arduino ProMicro (examples here and here ) is based on an Atmel 16u4 MCU and has HID keyboard emulation ready to go...