Friday, June 22, 2018

Arduino based Random Gate generator--done-works

I have been working on a PCB for my various Arduino projects including the Random Gate Generator...part I is discussed in this post.

I have fab'd up a prototype of a Arduino PCB that tries to be flexible and audio oriented, with accommodations for 6 op amps, and places to jam D/A, jellybean logic and so on. I used it as a home for the random generator.

The idea is to not have to fab up a new board for every Arduino project; most seem to be just Arduinos, DACs, and buffer op amps?  Who

Anyway here's what I came up with:

The breadboard prototype is seen on top with working random gate.

I am starting to copy all the parts to the PCB.  Power supply (PAIA!) (+/- 15V) is in the bottom left.....

An hour or so later: Good news!  It all works!!!!

Arduino code can be downloaded at GitHub.


Finished and working/populated PCB looks like this--last thing to do is create a front panel and wire in 3.5mm jacks but that's really easy:

OK what does it all mean?  

First: it's not time to post the "nanofactory" PCB you see here yet--sorry to say, there are too many mistakes.  I have started to clean it up, and kludged around the issues for the rev1 PCB. I may do another run (this is a more expensive board than what I usually do due to its size). 

I am still not sure if trying to use a "one board fits all" approach is for the best for any of this.  Any thoughts? 

Anyway if I do another run and have time to test it I'll post this "nano motherboard" on my website.  If anyone is interested in what I have now, comment and I will post the Eagle files and gerbers. I have a list of fixes needed.  They aren't that bad but I hate PCB mistakes.

Second: How this works/what it does?  Simple: using pseudo random number generation and software driven comparators inside the Arduino, have a random gate signal hit a buffer and then out it goes. As a bonus, have the random gate fire off a random voltage output that goes out parallel to the gate.

The two pots are used to set the rate of the random gate, which can be set from very fast random bursts (a few ms each) to very slow (a random on or off every few minutes).  

The best thing about this: if I want to change what the pots do, add features, change how slowly it can fire a gate etc. no need to rewire or add new parts--just go in and change the code.  Also, there is plenty of I/O left over on the board, so if I want to add things (no idea what but I always think of something?) down the road that's pretty easy as well.

The most remarkable thing about all of this is how easy Arduino CV projects are to think up and do.  Comparators--envelopes--LFOs--displays--and so on--super super easy.  And inexpensive! I may never use a 555 timer again!

Wednesday, June 20, 2018

9mm POTS--creating an Eagle Library

(Advanced warning: If you don't use Eagle for schematic/PCB/gerber creation, this post will mean zilch....You have been warned....)

 I bought some dual concentric pots from Small Bear and needed it in the PCB for a few projects.  I couldn't believe I couldn't find an existing library (Alps?  Bourns? Adafruit?  Anyone?) that already had this part--this is super simple, just an array of 100 mil traces with proper spacing and some kind of tName silkscreening that works….but I couldn't.  Time to roll my own....

To summarize the very basics:  Eagle libraries have 4 components that all have to be created and linked properly to work in a useful library

Library: a set of devices.
Device: the entire component--a joining of a Package and Symbol
Package: what goes on your PCB.  Traces/drills etc. must be right or your part won't lay onto the PCB correctly after you fab.
Symbol: What goes on your schematic.

There are so many pages about creating Eagle libraries that I won't go into it here. Here is a good webpage link; here is a good vid.  This was my first attempt at creating a library--and if I can, you can.  It really isn't hard at all.

But I figure it might be worthwhile to mention what I got stuck on, maybe it will help you, or maybe it will help me in 4 months when I forget all of this.

Why can't I edit a @$%^ library?  What comes with Eagle is "read only". Assuming you're modifying library content that came with Eagle--it's way easier to modify something vs. starting from scratch--you have to make a copy of the source lbr file and copy it somewhere else. Then point your Eagle prefs to the new library location.  

It's described here and here--yes, you have to do all this. 

I got somewhat confused when I read instructions that you "import" libraries--what web tutorials really seem to mean is just copy the damn library somewhere else--then you can edit it.

Where are the libraries that come with Eagle?   For windows 10 they are here:
C:\Users\[username]\AppData\Roaming\Eagle\lbr. You may have to enable hidden files and folders in Windows to see this at all. Search for the library you want in there and create the copy somewhere else. Now you can edit the latter.

For other OS's?  No idea.  Sorry.  I am pretty good with Linux and Mac as well, but have never gotten round to using Eagle in either. If you have that information (I am too lazy to look it up) please add a comment.

I have created my device, and created my symbol, but how do I get a symbol paired with the package?  This should be easy according to the tutorials online!
Easy?  Well maybe for you guys, but for me, I couldn't figure out how to do this via the GUI.  Tutorials all over talk about pairing a symbol to a  package via a "new" button in the GUI but at least in version 9.0.1 I can't find this freaking button. (Notice the adafruit link above talks above about this button but it can't be seen in the screenshot?)

it drove me crazy trying to find this "new" button.  Much time wasted!

the command line to the rescue:  Bring up your device and then issue this command:  

ADD PACKAGE [packagename] and the package pops into the device, ready to connect.

OK with all of that in hand it was time to do a Proof of concept board.  I did a quick layout for 3 concentric pots spaced 850mils apart.  Also useful for single 9mm pots or duals.

You can find the files for this  PCB on my website. The result--yep it worked. I can see a lot of uses for this going forward.

Now what?

You can get the clone pot library from my GITHUB page.  I will try to keep expanding this library as I need more components. As always if you find mistakes, have problems, etc. please let me know and I'll fix it.

Friday, June 15, 2018

Synth DVM part III--VU blues

This is the third entry about building a so called "Synth DVM".  If you are interested in the last 2 posts about this, here are links to part two and part one.

OK I have a working prototype on my bench, and I am having 5 boards made up for the op amps and Nano, from EasyEDA, they should be here next week.  Assuming that works I'll get a front panel made....

In the meantime I'm trying to finish up the TFT display programming for the project.  I am using the Adafruit GFX library, discussed in part two...

For the most part once I found decent code examples the TFT coding has been pretty easy, so I made it harder on myself--I decided that in addition to a simple voltage readout I want an analog looking "VU style meter" for the DVM, that shows a needle that points to -10V, 0V, 10V and all in between.
I can see reusing this for all sorts of audioDIY since the whole voltmeter thing with Arduino seems super easy--RMS conversion for displaying AC audio levels?  Arduino driven compressors with a VU to display level reduction?  A needle to show current values when paired with an INA219 current sensor?  A thousand and one uses....

That's the problem with software--you're never done!

The code basics for getting an old school looking meter going isn't that hard, the first thing I had to work on was having the meter needle turn itself off before it changed to a new position with a minimum of flickering but I think I solved that.

You can get the prototype code off of my GitHub repos, but the salient code to get this working is this:

void loop()

 //[…. code for numeric readout....not part of VU]

//get vu meter going
   meterx = (sensorValue * .1) + 13;
   if (meterx != lastState)
   lastState = meterx;


meterx is a float that senses what is being read from an analogPin. I am saving the value during each loop, and then comparing it the next iteration.  If meterx changes--blank and redraw, otherwise, leave it alone.

It works--the VU moves in concert with the read voltage, and it appears to be accurate and linear and the flicker isn't too bad (extra credit: lastState is long, not float, which improved flicker--strange, I thought that wouldn't work at all?)

The "13" pixel x offset centers the meter correctly on the x axis (128 Pixels, pixel 64 is center, we read 1023 gradiations divided by 10--do the math....) of the TFT.

Here is the problem:The needle for the meter is not a constant length as it sweeps across the TFT and it should be.

Since Y is a constant in my code above, the needle "gets longer" as it approaches the far left or right side of its trajectory.  That doesn't look analog--at all!

I sat up at 3AM trying to figure out a way around this--at each refresh, put a bitmap of a semi circle over the needle, but wouldn't that flicker (and take up a ton of memory)?

some sort of sine/cosine kungfu?

A lookup table that reduces Y value depending on "meterx" value?

All of these feel like a kludge to me.

I can't figure out an elegant way to do this--there is a "drawFastVLine" function in the GFX library, but it can only draw vertical lines of a consistent length, not one that moves on a central axis.

I have no idea about the best way to solve this. I might post it to some forums and it's time for more research.  I guess it'd be best if I could expand the C++ library for Adafruit GFX to add a method "CreateMovingLine()" or "createVisibleRadius()" or something.

How deep do I want to get into this?

Here is a quick diagram of what I am up against. Any ideas anyone?  

(UPDATE electro music forum user says "use an array".  Doh.  Did this and it worked.  I was not thinking about this issue simply!

I'll post the results one of these days.)

Thursday, June 7, 2018

Arduino based "Synth DVM" Part II

You can see part I of this post, where I try to get the TFT screen going, as well as discuss this DVM synth project in general here:

To review:
  • I am working on a simple DVM so I can easily see control voltages without having to crack out my Fluke DVM or Siglent Scope.  
  • This Arduino based DVM that can read positive and negative voltages relative to ground without having to flip switches or whatever.
  • Works with a +/- 15V linear power supply
  • Input is buffered so nothing "upstream" can detect it's being detected.
  • Able to read from -10V to +10V DC--with as small an error factor as possible--within say 100mV tops--less is preferred.
  • Have the readout be on a TFT display that's mounted on a 2 or 3u FracRack panel so I can put that into a rack.
  • Extra credit: be able to get P/P AC read as RMS voltage.  
  • But for phase I, stick to DC.
Since that last post I've spent time researching this (to paraphrase the immortal Don Lancaster: you can save hours at the bench by spending minutes on line....).

The first takeaway from the research: lots of folks are building various voltmeters out of Arduinos, but right away you start to see that their accuracy of most basic designs isn't going to be that good.

One problem: by default the Arduino uses 5V derived from USB to suss out the voltages present at the analog pins, which can be dodgy; when I used USB,  my internal ADC readings were inaccurate to over 500mV either way--unacceptable.

Another problem: We need to read negative voltages relative to ground, and the Arduino's analog pins will to clamp unwanted current flow through a diode to flush 'em down the electron toilet, but if you put too much current going the wrong way into the diode, you blow up the Arduino.  So we have to protect against that.

Question: there are "shields" and add on board doodads whose sole purpose is to read currents, and can display voltages and power to boot (an aside: how frigging cool is that??? Remember when this stuff was really hard to do?).

Can I just use one of those?

One of the cool little boards is based on TI's INA219, here's a Great Scott Vid about that add-on--I really like Great Scott. love that accent!  But INA219 based ADC's don't seem to deal with negative voltages very well (e.g., Great Scott's vid is positive V read only, right?) and doesn't seem to have any sort of built in clamping circuitry.  So as cool as the INA219 idea is, I didn't think it'd work here.

OK next I was looking at setting a DC offset at input to 7.5V above ground so everything coming in is positive, then use an INA219, and then code around that....but then we start coming up against rail to rail voltage limitations on the op amp and my +/- 15V power supply.....Remember I am trying to get +/- 10V to be read here....and we only have a 15V positive swing, so even if I put the incoming voltages at a 7.5V offset, we are outside the design parameters, and would only be able to read about +/- 7V DC.

So what I think may work is something like this:

The idea: 
  • The input goes through 2 buffers wired in parallel; one inverts; the other doesn't.
  • The incoming gain is divided by 3, so this could theoretically read inputs as high as +/-12V with an accuracy of about +/- 12mV's.  Remember that we are using 4.096 as external ref, and the ADC has an accuracy of 0-1023, so ADC=0 means 0-4mV, ADC=1 means approv 4.1mv-8mV, etc., up to 1023, or close to 4.096V.  That's how I am doing the math anyway....
  • The sketch will look for data > than 0V at 2 analog pins during each 1ms loop.  If it finds this on the -1 op amp, throw a minus sign in front of the output TFT numeral on display. Otherwise, leave the number as is (Easy right? Why wouldn't that work?)
  • How to keep the Arduino from blowing up?  The Arduino analog inputs want to see high impedance sources, but not too high.  So I figure I can just hook the op amp buffer output right to the analog input....but the solution is easy in any event....Each Analog input could have a  resistor in series to current limit the input of the Arduino analog pins.  It might be 22K, or less?  I figure it won't make a difference?

So step one is getting a positive 0-4.096V input signal accurately, well, read.

Turns out that was super easy--took about 10 minutes from going from the setup last time to a very accurate 0-4V or so DVM.  Here's what I did.

On Amazon I bought this cute little Adafruit LM4040 module and wired it up:

5V from Arduino > VIN on LM4040
GND from Arduino > GND on LM4040
AREF input on Arduino > 4.096 pin on LM4040

  • Modified my code in the [setup] function to include analog Reference so I wouldn't blow up the Arduino--Again here is a good link explaining how this all works.


  • Changed my code so that the voltage read at the analog pin was multiplied by .04.

Finally with everything wired up I tested my TFT display of voltages between 0 and 4V by comparing the Arduino voltages read to my trusty Fluke DVM.  It was "dead nuts on", as my EE brother says:

OK onward and upward.  This part turned out to be so much easier than I thought that I almost laughed. The Arduino platform is stupid easy to use! 

To finish this I need to create a PCB for the electronics and 5V power conversion and a 2U front panel for Fracrak, but that's another post.  See ya....

Thursday, May 24, 2018

EAGLE PCB--Getting Rid of NAMES for Board Components

Full disclosure: 

I use Autodesk's Eagle for PCB layout.

So this blog entry will only be useful to you if you use Eagle vs. other means of laying out PCB's.

It will also only be useful if you use Windows; I suspect the Linux and Mac versions of Eagle are set up differently in terms of where the files go.

And-- I am using Version 9.0.1 of Eagle as I write this; Autodesk changes Eagkle all the time, so I can't guarantee this will help you if you're reading it 3 years from the date of this post.

If you don't know Eagle pretty well you want to skip this blog entry, it won't mean squat to you. But if you use Eagle all the time, as I do, it might be useful.  OK without a lot more blah blah:

Here is the issue.  

When I am designing a board layout, a series of Pads might look like this:

When how I want it to look is this (note the absence of what Eagle calls "NAMES")

Pads without names is useful in some situations--I can now use text tool on the tNames layer to silkscreen a clear callout, in this case V++:

So how can you remove names?  You can't call a named part "" (so, no value) or you get an error when saving.

The only way I could figure out how to do this is change the actual part itself, getting rid of the >Name placeholder for each part I want to use on my board, and save it in a custom Eagle Library.

Fortunately it's not that hard to do.

Here are the steps:

  • Close Eagle if it's open.

Create your own library after making a copy:

  • The libraries that come with Eagle appear to be read only.  
  • You will have to copy an existing Eagle library to a new custom location you create.
  • In my case I added a new folder to Dropbox so I can use my custom libraries across different computers, but any folder you have to which you have modify privileges will do.
Next, open Eagle and go to their "control panel" which looks like this--it's the first screen you see when you open Eagle; you can't have any boards, schematics etc. open or this will never show up.

Tell Eagle where you are going to put your custom libraries. 

Go to Options >  directory, click in the Libraries field to add the new folder you created for custom libraries.

Click Browse > Open.

Navigate to your custom library location and click OK.

Eagle will now look not just to its default locations for libraries but to your new folder as well.

Copy a library into your new library repository so you can edit it.

Hint: Eagle provided libraries in Windows 10 and probably Windows 7 live here:

C:\Users\[your username]\AppData\Roaming\Eagle\lbr   

You knew that right? You may have to unhide hidden system files to find this content.

  • Use Windows search and look for a library like this one:

  • Once you find it, copy the testpad*.lbr file to the new "personal" library folder you created above.  Yep, all you do to "import" a stock library is copy the file to a different location.

Edit the personal library.  

  • Close any boards, schematics, etc., you have; you must be back at the Eagle "Control Panel" (not to be confused with Windows control panel!) 

Now issue the command:

file > library > open

Open the personal library you just copied to your new folder.

Again, try as you might, as far as I can tell, users cannot edit libraries that were installed when you got Eagle going--only ones you copied somewhere else. Am I wrong about this?  Anyone?

Time to edit--I am now going to edit the testpad.lbr library, and specifically the group of parts called "TP":

Expand the lbr file as you see on the left of the screenshot above, then Right click where I have the Blue Hi-light, the TP set of devices....I do this because TP has the specific pad I want to modify

Once selected, right click, and from the pull down, left click Open In Library".

A new window opens--the library editor.
  • You will see a column on the the individual part you want to edit by left clicking on it.
  • Then right click on the part that needs its name blitzed--in the screen shot below I have circled it in red:

When you right click, choose "Edit Package" from the drop down.

This takes you to the package editor, where you can get rid of the part's name--choose the garbage can icon, then left click on the + to delete the part's name:

You can also change the description by clicking on the description link and adding HTML for the part's description.  Maybe change description to "TEST PAD-no name"

After the name is gone, hit the save (floppy disc) icon.

To change more parts, go to Library > manage devices and start the process again by choosing the next part you need to alter.

Using the Library

You get a library of many pads with the Names already removed from my GitHub. These are libraries where the entire TP device collection--about 20 parts--all have their names removed....I use this any time I want to use Text on the tNames layer vs. part names.

To use these parts, fire up your schematic, and use add > library manager > browse and find and then select your custom library.  Pick the custom parts you want to use and drop them into your schematic.
For ones with the names blitzed in the manner above, the schemo will still show you a part name, but on the board it will be sans name.

UPDATE: I have used the "nonames" parts above several times now for different PCBs.  So far, all seems to work. In the meantime, if you have comments, questions, or find a mistake in this blog entry, please comment below so I can fix this thing.

Monday, May 21, 2018

One Cheap Arduino Nano Clone-o Plus one Cheap 1.8" TFT Display = An Entire Sunday!

Who can resist Amazon Prime Points?

Who can resist a cheap TFT display?  (I couldn't)

A million and one uses--as I develop my skills with Analog DIY and Digital hybrids I can justify all of this right?  (right???).

My goal this time: to design a simple DVM I can incorporate into audio gear. OF COURSE I can buy a DVM for like 25 cents that will probably work better.  And OF COURSE I already have  DVMs already. So why not stash one in my studio and use that.

(Answer: what fun would that be?)

Along the way, getting TFT displays going is an unfamiliar process for me, having never worked with a small display like well as understanding more about DACs, ADCs, and in general,  creating semi-precision applications--usually I just throw op amps at things and hope they work?

Anyway: these clones appealed due to their super low price ($6.50 US on a good day?), good online visibility and online .h libraries already written, like the Adafruit 7735 library

So just fire up an Arduino Nano clone, wire up the TFT, load in the Adafruit test sketch, and go?

Nope--Not that fast!

Here is the pix of my first Arduino clone….

I discovered the clones are.... "diff'rent".

To wit: some clone Arduinos don't use an FTDI USB chip you find in real Arduinos--the clono cuts corneros and uses cheaper USB chips.

So the drivers you have in your PC, used by the Arduino IDE to talk to a "real" Arduino chip, may not work with the clone board.

How this manifests: It's like you never hooked the Arduino up via USB at all--there is literally no USB port for the IDE to use to upload code to the board.

This is a first world problem.....

OK what to do: go to the Internet of course.

Turns out you can flip over the clone board and read the chipset used for USB, and google that to get the driver online?

But for my Nano clone, someone had scraped off the chip designation.  NICE!!!

From research online: this is the chip used to control USB on Clono-nanos but who scraped off the damn chip designation?

So I did what every tech does: I had to guess. Trial and error? I **hate** trial and error when fixing things!  From more reading: most clone Arduinos use CH340 USB chips.  The SOC layout of the USB chip looked like a CH340-CH341 so maybe that's what it is?  Just get the driver and go?

Driver is here  PLLUNNKKK!!!

(WARNING do not use this driver!  I took out the hyper link above!  It crashed my Mac!)

WTF???  I am using a Mac Sierra.  the chip's mfgr site says to use USB V1.3 for Mac. I downloaded that driver from the .cn site that will not be named and poof!  OS crashed.  mac unbootable. Yes, Elmo, the driver downloaded from the .cn vendor messed up an otherwise working Mac and made it unusable.  And maybe installed a keystroke reader and god only knows what else? VERY VERY NICE!

Forturnately I fix computers for a living so getting the Mac back wasn't that hard....the whole command + R thing.

Then a thorough anti-virus/anti malware pass. I  removed the butt driver and the Mac booted fine and appears to be secure again.

Back to square one--I still have the initial issue--how do I talk to the Arduino Clone?

Turns out--you need to get "the patched driver" for CH340/Mac OS sierra after removing the butt driver.

Time wasted: about an hour.  Arrg!

Now--with the right driver--now at least I can see Arduino no name-o Clone-o Nan-o and upload my code to it.  (OK no more o's)

Marvey. how do I wire the TFT?  How do I send proof of concept test code to it?

Trial and error pretty much? This time I felt it couldn't be avoided....

The TFT 1.8" device is a no-name unit with zero documentation. No links to the vendor's site. No vendor name silkscreened on the PCB I can use to track down  the pin-out designations.

And the pins didn't seem to match anything to do with SPI or MOSI really, but some of them say MOSI on them?  Hello?

I could go on and on.  But here is the last complaint: There was a QR code on the bag it came in, would that be a link to the mfgr's website maybe? but someone covered it up with a "made in China" sticker that I couldn't remove.  ARRRG!

The best link I could find, with pins that closely matched (but didn't exactly match) what I got on amazon, is here.

My OCD kicked in and I was determined to get this to work.  Who needs to do laundry?

After about 2 more hours I got this pin combo to work:

LED+  > hook to 3.3 V on the Nano clone board.
LED-  > GND (GND by the 6 pin header on the nano, not the GND down towards the other side of the board--the other GND on the nano clone didn't work)
CS  > CS
MOSI > SDA (you knew that right?)
AO > DC (you knew that one too?)
Reset  > reset
VCC > 5V
GND > GND by 6 pin header.  There were 2 GND pins on the clone arduino Nano I used and the one of them didn't seem to be attached to anything.

There were other pins on the cheapo 1.8" TFT--some with very similar names--including one that tauntingly said "MOSI" that wasn't used at all when making the thing work.

(And of course the pin silkscreens on the TFT were on its underside, not the top.  So I had to write down a mirror image of how the pins are marked to figure it out.)

Once I got some life out of the board  I then modified the sample code provided by Adafruit with these pins and names:

#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SPI.h>

//how to wire from cheap-ass H340 based USB nano.
//vcc to 5v
//gnd to gnd by 6 pin header
//LED+ to 3.3 V
//LED- to GND by 6 pin header

#define cs    4  //there are 2 cs pins, don't use cs pin by the //LED+, wrong cs pin, but you knew that
#define sclk  5  // sck on TFT board
#define mosi  6  // sda connect on board, but you knew that
#define dc    7 // ao connect on board, you knew that as well
#define rst   8 // reset, not 'rest'
Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, mosi, sclk, rst);

And it works!

The takeaway here: the super cheap .cn clones may not be worth it.  Stick to things (like TFT displays) that are well documented and offer at least support on a user forum.

it took me an entire Sunday to get the proof of concept you see here working, and I think if I just bought "the real deal" it might have only taken me a couple of hours.  What is my time worth, really?

As long as I am throwing stones: I am also pretty disappointed with Adafruit's GFX documentation. that's the library used to get graphics going on the board.

I thought since Adafruit is after hobbyist business (?) they would provide endless docs and code examples online, but I couldn't find their GFX tutorial at all, and their library documentation is powerfully short on useful examples. I guess it's way better than nothing, but their PDF needs to at least have working code examples in it.

What do I mean by this?

What the GFX Adafruit docs say:

void drawPixel(uint16_t x, uint16_t y, uint16_t color
); working code must look like this (only after instantiating an object called tft):

void tft.drawPixel(1, 1, 1 0xFFFF); Shouldn't I be able to just figure that out? Sure, and I did. But it wasn't as easy as it should have been.

UPDATE (5-24-18): Makerfocus, who read my less than favorable Amazon review of their Arduino clone's lack of drivers and scraped off SOC chip, contacted me several times to make sure I was OK.  
I should have had the common sense to Amazon message them as soon as I had issues with their driver vs. just assuming no one was out there and no one was willing to help. 

They were not only helpful and enthusiastic, I would venture to say they were downright sweet and kindhearted about making sure I had a fix.  Really!!! I will do business with these guys again...and I  have to remember all the time that the folks at the other end of the great global keyboard are humans, except for United's AI phone service?, trying to make a living, to stay sane and safe and get on with things--it's so easy to forget with this massive impersonal, loving and hateful system we all rely on, accurately called the "interweb", that we are DEVO....oh nevermind!

Friday, May 18, 2018

Random Resistance Vactrols--Creating a random CV generator with one--Rolling My Own Optoisolator--HowTO do this....

Howdy again!!! 

Can you say Vactrol?  Or Opto-Isolator? I just knew ya could....

In case you don't know what these are, take a look here.  The basic idea is that you power up an LED, which hits a nearby photo resistor; you use the resistor to control V- or current-to-resistance circuits, which of course, are at the heart of a lot of synth and pedal DIY.

And maybe more important? these are fun little doodads....use 'em for compressors, for trem pedals, for filters, and a lot of other things where you need to convert voltages or currents to resistance.

I have bought Vactrols and optos from surplus places like Electronics Goldmine and Small Bear in the past, and had hours of fun, but in this post I am going to cover how for I built some optos for myself out of junk bin parts.

Oh yeh!!  It was easy!

But!!  a few things about Vactrols before we go further:

  • There is a diode in one end, and like all diodes, if you push too much current through it, you blow the Vactrol up.
  • There is a diode in one end, and like all diodes, if you polarize the diode wrong, it won't work--you probably won't kill anything, but you also won't change the opto's output resistance, ever.
  • Optos, at least the ones I have messed with, are not linear, and their characteristics vary a lot for unit to unit.  So, CV goes in, but the amount of resistance change on the other end doesn't correspond in a 1:1 manner with the amount of current you pass through the diode even for the same kind of vactrol. Is that a show stopper?  For things like volt per octave Frequency modulation of VCO's tuned up for western music, maybe.  For everything else, maybe not. You have to choose your parts; sort of like building tube amps: you have to experiment with different parts of the same value to get one you like.  These aren't .05 tolerance calibration resistors!
  • There is a lag (turbo lag sort of?) between sending current through the diode and having the change show up on the other end.  Again, this makes optos good for some things but not for others.
Why did I make one? I  was reading the electro-music forum and dudes were talking about using LED's from dollar store fake candles to make Lunetta type CMOS sounds.  Wait, that's a SMOKING good idea!  Why not use flicker LEDs in opto isolator form to control CV's?

Fun weekend project! I bought 20 flame LED's from Goldmine and got to work.  I don't know of a "random opto" you can buy right?  So let's DIY!

First, what to wrap it in.  I think you can use anything--I read about using drinking straws, film cannisters, styrene tubing, whatever.  I used a plastic tube for one that I got working on the perf below but here I am using sheet copper rolled up.  

BTW the sheet copper was bought bulk on Amazon, I used "Maid o' Metal", easy to cut and fun to work with! I always gravitate towards any product name with "o'" in it....

OK let's roll that puppy!  LED goes in one end, photo resistor in the other....super easy.

Put on the shrink tubing and melt it down....

Still with me?  I put two more little pieces of shrink tubing on each end...not looking too shabby?

The end that has dissimilar lengths is the diode--the longer lead is +, the anode.  I should have marked that with p-touch tape but I didn't, so we just have to remember that eh?

I can also use a diode tester on it I guess.  OK, now let's seal the ends.  I use the duct tape of glues--
J-Bweld, for that.  1:1 black dukey and "hardner" will do the trick.

MMMMMM tasty!  Now get a stirring stick stolen from Starbucks, stir em up and apply it to the ends of the Vactrol thingy. We want to keep ambient light from getting in and out of our little rolled masterpiece. Hint from the crafts world--do any sort of small volume epoxy mixing on PostIt notes.  When you're done, tear off the top piece with the dried glue and throw it away.

OK let the "random vactrol" dry overnight.


There are lots of circuits that use vactrols on the Internet, and I have a vactrol based VCF on my site that I'm tinkering with all the time.

But for this I thought I'd start fresh and create a random CV source from the flame vactrol.

(it didn't help that much to put a second random vac in parallel, left that off...)

I put that together on Perf and used a simple non inverting op amp buffer board from my website.  For the buffer, don't use the resistor values I have on my site, for this project they aren't the right values.  Instead I used a 5K trim for the offset pot, with 1K resistors in series with it, and then use a 4x gain with 100K and 390K resistors.

 if anyone wants the exact wiring setup I used on the buffer, put that in a comment below and I'll post it but I figure if you've made it this far you can figure that all out.

This is powered from +/- 15v BTW which feeds the hand made 15V to 5V 7805 linear regulator circuit; most everything I do is. +/- 15V to start.   +/-15V is used for the op amp.

Did it work?  Um yes it did (once I put a 741 op amp into the socket....)

Here is a tiny sample what the random output CV looks like on my scope.  Yes that dancing trace is a CV randomly jumping around. This DC voltage from the vactrol is buffered by the 741 and has a 1K output impedance resistor at its output like most everything else I do, so I figure "it will just work".  I have no idea how it will sound however as a modulation source.

UPDATE: I mounted everything on Perf and made a simple FracRack panel for it.  Yes it works--good CV from 0V to 5V that sounds truly random.  Sounds, well, interesting ??. I can't adjust the  frequency of the signal as is, it sort of jumps around any way it wants, but perhaps could employ some sort of 4066 switching to help w/ to that, but not right now--need to keep working on other things.

Somewhere down the road I'll post a quick audio file: how the random VAC sounds when modulating FM. It doesn't sound a lot like anything else I've ever heard, which I think is one of the fundamental ideas of Lunetta Synthesis

so: Not sure if I will really use it for anything serious but it was fun to build.