Thursday, August 2, 2018

40106 Quad opto coupled VCO--Lunetta Lives!

All hail Lunetta Synthesis--the CMOS anything-goes way of thinking about Audio DIY?

One thing that appeals: Stanley Lunetta is from the California Central Valley, same as me--from my reading his studio was about 40 miles from where I was recording back in the day.

Does this prove that we Central CA folks aren't all farmers and politicians?  Does it need to be proven? Growing up I remember a great music scene, at least in the 70s. Makes sense--there was very little else (legal) to do!

OK: In honor of Lunetta Synthesis and all Central Valley artists I decided to fab a quad VCO one of the great CMOS chips, the 40106.

I've messed with this chip before but this was my first attempt at doing something this, well, VCOish.

I went through a few generations of experimenter boards by designing in Eagle, and sending off to EASYEDA for a test fab.  I almost have given up on perf'ing things. It's faster and easier for me to have boards fab'd abroad, sent back to the US, and if they don't work, try to kludge them into operation or just toss them and start over.

OK, The board I ended up using for this is here (on my website) tests working.  Yeh!

FREEBEE ALERT, comment if you are interested in one of these experimenter boards (I have way more at this point then I will ever use) and I will send a few of you one free!  Yes Free!!!  Wait free?  Um yes, free!!  Open source, baby!  Until I run out....


Here's the schematic....you can get a zip of this in Eagle format on my site.


This is a bit un-Lunetta but I wanted to get the output waveforms 10V P/P or close. So I also incorporated some quad TL072 based buffer boards I have been messing with for a few months. I will try to post more details on my website soon but this is four of the non inverting op amp gain stages you can find on my website fab'd on one PCB.

I had to go through a few generations for this--the first gen had a bozo mistake with how I laid out the resistors, but what is below worked.  I have already designed Gen3 with a more logical layout for the resistors which you can see are all over the place in GEN2.  this is the world of easy PCB prototyping?

This is basic op amp stuff, but the quad non-inverting board can be used to take four different CMOS type signals and turn them into say +8V Peak to Peak with a 4V DC bias offset.  Since you have to buffer the triangle out of the 40106 I had to do something like this right?


To control the R value of the RC, i.e., changing pitch, I used four optocouplers bought surplus from Electronics Goldmine, but for this design go ahead (!!) and use whatever vactrol or pot or resistor or thingy you care to use. Experimentation is the key here, have fun!!!!

I could get pretty decent (but highly non-linear) output from very slow LFO, maybe 2hz? to about 12K and up.  Good enough for F/X.

One thing to keep in mind: the 40106 is a lot of audio for the buck but in reality can't hold a pitch to save its life. Any temperature or current variation--even a slight one--drives the output pitch crazy. Even power cycling the chip changes its pitch for a given RC value.  So it's no substitute for say an ASM VCO.  But for effects and noisemaking, it's just fine.

Another interesting thing: it's way easy to add FM to this. Add a diode reverse biased and a 1K resistor in series ahead of the RC that sets pitch and then feed it any audio signal above maybe 2V P/P for um.....interesting results.  I will try to post some bleep-bleep sounds but for me this is hours of fun.

In other words: take this fragment and put it between your audio signal and the FM1, FM2, FM3 etc. inputs you see on the board.  Does it get easier?



Some build photos......

Finished module, still need to do front panel artwork.  

Perfland, easy way to make a few small boards into one big module
OK time tor record.....in case anyone wants to see more here is a zip of the entire design pdf.  if anyone has other ideas about this please comment, I'm always up for seeing what others are doing in 40106 land.  And I will try to add sound samples down the road.  Don't breathe the fumes!

Tuesday, July 17, 2018

DIY Synth and Electronics Pseudo Silkscreening using "Lazertran"--How To Do This!

I am still trying to figure out how to make low-cost, low quantity front panel silk screen art but can't figure that one out.

And: I have tried etching/fabrication services like Front Panel Express but find their CAD tools difficult to use and their services expensive for one-offs.

The good news: I have been using a water slide decal process to get me close to silk screen type front panel finishes using something called "Lazertran".

That's what this post is about.  And no, I don't work for these guys. This isn't an ad. It is the best way to do this I have found to date however.

So if you already have your metal work done, and want to get close to professional looking, one-off front panel art,  for about $1-$2 USD per panel, please read on.

Still with me?

First, go out and get this stuff: "Lazertran."  You can find it online direct, also at Blick Art, Amazon, and several other online suppliers.  Your local art store may also have it, or can order it for you.

There is one Lazertran version for laser printer and another for inkjet. I only have tried this with the laser version.  You can get legal sized sheets or 11 x 17.  Here I use 8.5 x 11. I'm interested in knowing if the inkjet material works the same way as described below, if you know it does I'd be grateful for comments.

Before we go on: be safe! This process involves putting metal into an oven and cooking it for several hours.  I probably don't need to go over safety instructions but will anyway--you have to be sensible  or you wouldn't survive a week of DIY.....So please, don't be a bozo about this.

E.G.: Don't clean the panel with gasoline then put it in the oven.  Don't touch really hot metal with bare fingers.  Don't use a chainsaw or small explosive device to open your stove door--just pull it open. Don't put plastic front panels in your oven (they will melt, burn, and stink up your house). And above all, never, ever listen to Barry Manilow's "I Write the Songs" in spite of how damn catchy it is.

Nuf said??


Lazertran is not cheap--about $2 US per sheet--$20 for 10 sheets....but that's way cheaper than one-off silkscreening services or other solutions....

You will also need:
  • The metal front panel you want to use, ready to go. Since we are going to bake the panel in an oven, plastic, wood, parchment, etc., panels won't work. If you've painted your metal panel, make sure it will withstand a 300 degree oven bake. So, high temperature paints, like those used for car engines, are best. I leave figuring out the right kind of paint to you.
  • You'll need an oven that goes to 300. Most of us have those, or use mom's? Whatever. I imagine toaster ovens will do as long as you can reasonably control the temperature.
  • Scissors to cut and trim the decal.
  • Computer software to design, modify and flip your decal--Adobe Illustrator is what I use but there are lots of programs you can use to create two-dimensional artwork.
  • Tongs or BBQ implements to handle your panel when it's hot.
  • A credit card for smoothing out tiny bubbles
  • 800 to 1200 grit wet/dry sandpaper.
OK let's go:

First: Deburr and clean the metal panel thoroughly beforehand. For Lazertran to work, the front panel has to be very smooth--the decal with tear and hang up on any burrs or rough edges. Also, make sure your panel is clean; the decal won't stick to oil and dirt.

Next this may be obvious, but: take careful measurements of your cleaned up panel. If you mess up your measurements you will have Lazertran decals that don't fit your panel, and we don't want that.

If you really don't want to measure things: I have used a Ricoh flatbed scanner to scan a 1:1 image of the front panel(s) in question; then used the PDF output from the scan as a background in Adobe Photoshop. Before printing I hide the background layer.  As long as the original scan is really 1:1, this will work.

But more recently I found another way: I first draw the front panel in a CAD program (Eagle in my case) to create a down-to-the-millimeter drawing of anything that needs Lazertranning. Save it as PDF and then use that as the background in Illustrator.

I'm not going to go into details about using Illustrator here, it's beyond the scope of this post, and there are tons of Adobe Illustrator tutorials online, also you may wish to use another program.

Illustrator can natively open PDFs and allow panel artwork to be easily added on top of the PDF background. As a bonus, the PDF background becomes an easy way to make sure the decal details line up with the panel since it's an exact duplicate. As long as the elements you see in the background are holes, drills, dimension layer outlines, and mills, they won't show up in the final panel,  but can be used to design and align the decal.

A bit of an aside: about color decals: If you are doing a color panel you're in territory unfamiliar to me, I only do B&W, but keep in mind that almost all lasers and inkjets can't print white. They assume the background is white and treats white artwork as clear so it can "show through".

I imagine from model making that other colors may appear a bit faded or washed out if it's like other waterslide decaling.  Thus I tend to stick to black on an aluminum metal background, but you may wish to try things here.

OK what panels will this work on? I am going to go out on a limb and say--pretty much anything made from metal that's not a completely crazy shape? It's hard to hold Lazertran down--this stuff really works!

In my DIY studio, I use Paia FracRack 3U boxes as a tip of the hat to trusty old PAIA.  These guys got me started in DIY many years ago and the measurements of FracRack (1u = 1.5" x 5.25" with 1/2" grids for pots and jacks etc.) are extremely easy to calculate.

BTW, I have PDFs and eagle BRD files that can get you FracRack guys started, comment below and I'll post 'em somewhere but I figure most DIY synth readers use Eurorack or something else like it.....


Eagle BRD file of a Fracrack 2u panel, with 6x pots and 12 3.5mm jacks

Ok getting back to it: Using your favorite illustration program draw your text, images, cartoons, logos, rounded rectangles, and save in native format.  

Here I am fabbing a new one-off panel for a Triple Moog-like VCA clone for which I did a PCB board design, as well as the GCS/EFM/everyone else Norton 3900 amp based Serge Waveshaper (hence the Serge logos--give 'em credit where it's due--this is a really cool bit of electrical engineering on Serge Tcherepnin's part--you can get details, boards, gerbers etc. for it everywhere, my version is here).  

Here's what I ended up with in Illustrator for the Serge module:


Hint: Before printing to your $2 a sheet decal paper, check to make sure all your artwork fits your panels!! So: check your printer settings, print out a 1:1 of your  artwork, and lay it over the panel to see if everything lines up. You want to do this with normal paper before committing to Lazertran.

Here I've done that with cutouts of standard 8.5 x 11" paper--yep looks OK.




OK once everything is to your liking, go back to your art program, select all the elements in your design and flip things, so it's 180 degrees flipped along the Y axis, like this:


Save the flipped file--we are going to need to print the flipped decal image to Lazertran.

Once you're sure everything is going to line up properly, put a piece of Lazertran in your printer (it needs to print to the shiny side of the material) and print that puppy out.

We're not quite ready to apply the decals yet however. 

Now here's a semi hidden secret. You have to BAKE THE DICKENS out of the Lazertran sheet before you take the decal off the backing. Otherwise your decal will bubble during the baking process. The instructions say to use a heat gun for this pre-bake but that's never worked for me.  I have had to literally hold my nose and bake the decal sheet in my oven before I apply decal to metal.

For this pre-bake-your-decal-sheet process, preheat your oven to 225 degrees F and then put in the decal for 5 minutes.  

 As the decal bakes you will smell a gross plastic burning scent. And when you take out the decal paper it will look like you tried to Barbeque it:




The good news is--I learned this by trail and success??--the decal will still look OK even though the backing paper got charred. Whew!

Next, cut out the decal along the panel lines:



…..and then soak each decal in warm tap water for about a minute--if you've ever made model airplanes or whatever the water slide process will probably be familiar to you.





I didn't get a photo of this, but apply the flipped decal face down to the front panel by sliding it off the backing and onto your front panel.  

Line it up carefully.....

Now you've got to get rid of the air bubbles that invariably live under the decal you just applied. 

I have tried all different ways to "de-bubble" but the best way, the way I always come back to, is to gently (!!) use a credit card edge to smooth all the bubbles out and then reposition the decal.  

Again no photo for this--I was too busy trying to not tear the decal and get rid of all the bubbles. But with a gentle touch it's not a problem.  

Hold the panel up to a light and see if you can see bubbles under the decal. If you can still see bubbles, gently repeat the credit card process.

Once you're bubble free it's time to bake the decal onto the panel.   

With the oven still at 225, put the decal in there for 5 minutes.  IMPORTANT!!  After 5 minutes remove your panel with tongs, and check the panel and make sure tiny or larger bubbles haven't formed.  If you have bubbles at this point you can often quickly touch them to flatten the bubbles or pop bubbles with a pin, but in my experience after about 10-15 minutes they are there to stay.....so set your timer and do this check.




(I have done Lazertran bakes in a pan, on tinfoil, and directly on a rack--I can't see any difference, so do whatever is easy..,.)  

After the five minute check, and maybe another one at 10 minutes, you're past the bubble popping stage.  Keep the panels in the oven for another hour.  

Then increase to 250 for an hour, then 275 for an hour, finally 300 for an hour.  Don't go over 300--the decal might burn if you do.  Not 100% sure about this--I have gone to 350-400 without issues, but other times not. It seems to me that the longer you bake, at around 300 degrees, the better the decal sticks to the panel.

When this is done, remove the panel with your tongs. After your 4 hour bake, if everything went OK, you end up with a pretty good looking panel, not quite pro silk screen looking, but really super close.  
And after a full bake if all went well, the finish is really baked on--I have had difficulty removing the decal with 500 grit sandpaper.  Yeah it's on there!

For clean up, you may need to take an X-acto blade and get rid of any remaining decal material that's sitting over a drill, outline, or cutout.  But for me after a few hours most of the decal that went over holes and milling has baked all the off and is long gone.  

And....if you did end up with bubbles, you may be able to sand them off.

To finish things, I use 800/1000/1200 grid wet n' dry sandpaper to gently sand the panel to give it an even more uniform look.  Don't be too rough--especially with the 800--but if you baked the decal on for hours it should withstand a lot of abuse.

Here's what I ended up with while doing this blog post:


OK that looks pretty good I think! 

We're now ready to finish things.  Bolt on the PCB, mount pots, knobs, etc.

Here is how my Serge Waveshaper clone looked when I was done.


Not too shabby?  You can get very fine details out of this process--the "1", "2", "3" by the jacks is 6 point font and is fully legible, and the "normals" illustration below the gain knobs is even smaller but came out just fine. You get the idea.

One  more hint:

If you're in the process of fabbing your panel, you might try experimenting with baking on the decal following the process above and then drilling out remaining holes and millwork.  

As long as you drill and mill carefully--a skittering drill bit will tear the decal, screw up your panel and possibly injure you--this works better than drilling/milling then decaling.  You can add x marks to your decal where you need to drill....this helps with panel symmetry and drill placement.  Again this is due to the toughness of baked on decal.  

OK that's it for now, give it a try and let me know what you think.  I am always working on improving this process.  Thanks.

   







Friday, July 6, 2018

QUICK ONE: Super Microvcf--8 components?

Quick one--

I am on a quest not sure why to find a VCF with the lowest parts count.  I could get one of those one chip solutions but that's cheating?

I created a long time ago a Vactrol VCF that's pretty low but I may have beaten it here....

I found this on the web.  8 parts!! It's from an old PAIA stompbox design.

I can sort of understand how it works I think, we are robbing current from the Op amp's feedback path, which changes the cutoff frequency.....but I was curious how it sounded, so I perf'd it.

I tried different cap values--anything from .01 to about .2 is worth a listen. The NPN can be whatever I figure, I used a 3904.  I used a 741 for the opamp since that seems appropriate for the era.

The 1MB values must be to not suck too much current out of whatever is feeding this filter I am guessing.  I didn't mess with those values, but overall, parts values are not critical; from messing with this micro circuit the caps can be different values for instance and the VCF will still work.  I mocked it up in everycircuit and it appears to be a lowpass of some stripe.

So how does it sound?  Well, strange. With a triangle wave going in it sounds to me like some of the filters you hear in really old japanese drum machines.  It's worth taking 15 minutes and perfing I think.

I will incorporate it into a Lunetta VCO sound maker I am building and then post some samples somewhere.

Here is the schematic:


Here it is on perf:



More later....in the meantime Don't breathe the fumes!

Tuesday, July 3, 2018

Creating Custom GUI Elements in Reaktor 6

Putting down the soldering iron this week to focus on software that lets you DIY your own FX plug ins--Native Instruments Reaktor.

With Reaktor 6 you can whip up synths and what not, I feel Reaktor synths usually sound a bit thin, but for recording projects, Reaktor is VST duct tape, used to solve simple and maybe not simple problems.

Need to flip L and R channels in a WAV file?  Reaktor can do that (it's easy).  Need to make a stereo WAV into a mono file and control overall volume of the result?  Easy.  Need to rerecord a stereo file as mono, add EQ and a tape delay, then use the whole Mishpucha as a VST in Ableton, and then loop it?  You can do this with different software, but Reaktor makes it really easy.  Those are some damn clever guys at NI. Audio duct tape!  Yeh!!!!

For instance: I did a session the other day where the DJ dude wanted a drum roll that started at normal speed and slowed down in a controlled manner. There are probably 100 ways to do this, but to see if I could work fast, I created a simple reaktor wav player-recorder and tied a slider to it, so when you hit a start button, it started playing, and the slider adjusted playback speed that fed into a Recorder.  Save what's in the recorder to stereo WAV after the sample playback is finished and dump the modded WAV into ableton. We are done!

And of course after the session was over left I couldn't help tweak the duct tape ens file:
  • The playback/record starts when the Manual "speed" slider is put at the top of its travel.
  • A "Counter" that allows you to dial in the frequency at which the playback sample slows down if you don't want to do this manually.
  • A switch to allow the sample to start slow and speed up vs. start fast and slow down (oh wait, haven't added that yet?  Damn, you are never done with Reaktor....)
  • A custom UI for this thing.  Makes me look like a cool DSP dude working for Ohmboyz?  Not really, this is more script kiddee than math wiz but I can pretend?
That's the thing about software right?

OK, in case anyone is interested, here's how to create custom GUI elements in Reaktor.  It doesn't change your synth, It doesn't change your duct tape, but it changes the look and feel.

It will turn an ens., instrument etc. from this:



Into this:


(Why?)

( I have fun with messing w/ this....no other reason....)

OK What do you need to do this?
  • A graphics app that can produce PNG files where you have good control of what graphic element goes on what pixel in a controllable manner.  Adobe Illustrator is what I use but lots of programs can do this.
  • NI Reaktor, the $199 version, not the free player.  Comes with Komplete. You can't edit things with the player but you can play things made with the editor.
  • Optional: Knobman, a totally great free Java based app that allows you to easily create elements like knobs and sliders to use in your plugins--like the ones we make here.
  • Some time to mess around and have fun with this mindless Audio DIY distraction.

First figure out the size of the ensemble background, (you can guess and tweak) for my sample player/recorder/speed tweak ensemble it's 1000 x 300 pixels W x H.

Using Illustrator, I created a background PNG and gave it a kind of blue meany color.


And then added some basic elements.  Yes you have to know some Illustrator basics to do this, but it's not that hard a program to use to make basic shapes like rectangles and whatnot.  As I always say: if I can do this anyone can do this!



Illustrator has a native format on Windows: *.ai.  Assuming you're using that, save the .AI file, and then file > export as PNG.  Make sure PNG backgrounds are saved as transparent.  If you use a different program (Linux GIMP comes to mind) your process for this will be different....but at the end of the day, you want PNG graphics with transparent backgrounds--those work for me anyway.

Hint: as you go, do many "saves as", use github for version control, or whatever.  And: Always save versions of the graphics file in its native format (.ai or whatever) as well as the exports of PNG files. So you want "slider1.png, slider2.png etc. as you tweak things more and more.  I can't tell you how often I have to go back to previous versions for whatever reason!

OK with a working PNG file, let's add the background to the ensemble.
  • Open the ensemble and click on the EDIT button, then unlock the panel: 


So, go from this:


To this:


We now see a grid of dots in the background.

We need to change the background image:

Click on VIEW tab > STYLE > Bg Image:


And choose the PNG image you just created.  You use open from file...etc--this is self evident?



Once selected you should see the new background with the original buttons and sliders. Something like this:



Next it's a matter of modifying the background elements and replacing each slider etc. with whatever new artwork you want.  You can change some, all, or none.  As Bob Ross used to say--it's your wet on wet.  Wait did he say that?

To change out elements, select by clicking on the component in the Reaktor editor and then click on VIEW tab > Image.  Select a PNG file and see how it looks.

Let's examine that a bit more closely:

to make the elements not slide all over the place, go to your ens and add an image element. Now choose some sort of graphic you can pin to the corners. I usually put small Phillips screw images in each corner of the background image, or fully transparent 3 x 3 pixel PNG files.  You may or may not want to do this but here I did.  It defines the boundaries of the plug in and makes it so things don't move all over the place as you work.

After inserting these corner images into the ens, turning them on but turning off their labels; you are usually going to want to not use NI labels, rather text you create from your graphics program.



Once your "canvas" is set, you can tweak each image and its properties.   For each PNG file you can drop into your Ensemble or instrument or whatever Reaktor widget, below where you see the link to change the graphic, there is another link for "graphics properties".  Often the default values work, but one value that may need adjustment:  Reaktor will need to know how many frames a graphic element has.  A single item, like a Phillips screw, obviously has one element.  But for a button, a switch, a knob, anything that is treated a more like a cartoon, you will have more.  For a simple switch, there are two, one with the button on, one with it off, get it?


This is a 60x30 PNG, with each ellipse exactly 30 pixels total on the Y axis, and 60 on the X axis; they are shoved together perfectly without any space or slop.  A slider can have 127 or 128 images.   You are answering the question: how many frames does my "cartoon" have?

In fact, you'll quickly find that this sort of thinking is needed when working with Reaktor graphics:
  • Know your pixel count at all times (put the pixel count into the PNG filename if that helps?)
  • Don't be sloppy about X and Y pixel count as you create your graphic elements. It takes me more time to get things right when sloppy vs. when I'm careful.
  • Same idea again. Unneeded spaces, incorrectly cropped PNG source files, misalignments, asymmetries, etc., will make your graphic element almost always look crappy.  Work clean and work slowly.
  • Always save everything you use, and even what you don't use, as PNGs or another compatible file format (PNG always works for me).  You want to build up a library of switch PNGs and whatnot and use 'em over and over.
  • Be conscious of how many frames any graphic needs. 
  • Be ready to experiment.
As I say "be careful about your pixel count" what does this mean?  How do you know if you are creating an element that is 50H x 25W pixels, with text at 10 x 10?

Managing pixels, rulers and guides varies from graphics program to graphics program, but in Adobe illustrator for Windows 10 it's pretty easy: 

Edit > preferences > guides and grid
Choose 10 pixels with sub every 10 (works for me anyway):


Say OK

Then make sure grids are turned on and elements snap to them:  View > show grid and view > snap to grid.  That tends to make things line up.

One tricky thing: dealing with a 2 position switch. In the ENS here, that's the MANUAL/COUNT switch.  For this I created this 20wide x 100high PNG file.


Note the spacing, it's not spread out equally--the top and bottom images need to touch.  Got that by trial and error.....

And then set image properties like this:





The final thing to discuss is the sliders. I  created these with Knobman.  There are good tutorials on line for this software, as well as several really good knob files including knobs, buttons, VU's etc. you can download for not a penny, but one thing to reiterate yet again is that the number of frames in Reaktor always needs to match the number of graphics elements created in Knobman; otherwise the slider or knob image jumps all over and looks really bad.

I created a knobman 180 x 40 sized slider with 0-127 frames which must be mimic'd here.




OK that's it for now. It's off to the 4th of July celebrations but when that's done and I have a few of these I'll try to post a few reaktor things on my site.


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?

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.
https://github.com/cslammy/arduino-random-gate

Schematic:


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:




However 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 the PCB design, but kludged around the issues for what you see here. I will do another run (this is a more expensive board than what I usually do due to its size) and probably use that for the Synth DVM that's also on my bench.

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!

Last thing to do is make a front panel for this, which I will fab using PCBWAY in China. Stay tuned.

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: the image that 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.

What order do I need to do to make this work?
You create a new device, then add the Symbol (using the add symbol icon from the left column or the command below), then add the package, then connect. 

When you say ADD SYMBOL it's like adding a part to a schematic--you have to drag and place the symbol into the symbol window.

You can also use commands for this:

Create your new device and then issue this command:  

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

and/or

ADD [symbolname]

CONNECT and then make sure you connections look 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)
   {
      tft.drawLine(lastState,64,64,125,0x000);
      tft.drawLine(meterx,64,64,125,0xFFF);
   }
   lastState = meterx;


   delay(1);
}


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.)