Monday, October 21, 2013

Rockin the LED Party Hat

Inspired by Adafruit's Electronic Halloween, and in particular Becky Sterns "Space Face" and "Firewalker LED Sneakers", I decided that I had to make something light up this Halloween (and maybe wear some make-up, too).  Here's what I came up with:


While the video above simply has the LEDs oozing through the rainbow colors (straight out of Adafruit's example code for the LED strip), my hat was also equipped with a bunch of sensors to allow it to respond to the world around it.  Check out the two other operating modes below:





So, you can count me as one of the multitudes of folks adding LEDs to hats for good fun at parties!  It may be simple, but it's SO MUCH FUN!

Interested in making your own world-responding LED hat?  Well, below are a couple pictures showing some details on how I put it together.



And my shopping list was:
The most expensive thing on my list is the Mongoose.  I happened to have one that I harvested from an old project.  It's nice and small and has all those cool sensors...but it's pricey.  If you don't want to spend the money for that, you could use a regular Arduino.  That will let you do pre-programmed LED effects (like the rainbow effect shown in the first video).  And that would be totally cool just by itself.  If you do want to add the ability to be sensitive to motion (like I did), you can still avoid the Mongoose by using a regular Arduino paired with one of those accelerometer / magnetometer combo sensors.  You could try this one from Adafruit.  I think that would work just fine.

One of the hardest parts for me was figuring out how to attach it all to the hat.  So, on my wife's very good suggestion, I used a little twine to tie the battery pack through the holes in the wicker hat and loops of thread to "sew" the LED strip to the hat at select locations.  Easy!  And, it was surprisingly effective.  (Maybe that's because my wife also helped greatly in actually doing the attaching!)

So, that's my story.  It was a great hat.  It was also (for me) a fun make up job.  Another set of thanks go to my talented make-up artist, Ange!



Sunday, September 15, 2013

First PCB - Board Has Arrived

As a follow-up to this post, my first PCB has arrived from the printer!  She's a beauty (to my eyes, at least)...and so tiny!


I used my multi-meter to ensure that all the connections go where they are supposed to go, and to confirm that the connections do not go where they are not supposed to go.  It looks like it's time to solder in the components and give it a go!

(Note, this'll also be my first time soldering surface-mount components...I designed the board with one SMT cap on the front and one SMT cap on the, just to give me a reason to give SMT soldering a try.  I'm hopeful!)

Follow-Up: I finally assembled the PCB. Check it out here!

Saturday, September 7, 2013

Rockin' the Casio

Sometimes, when you're away from home but still need the feel of some synth keys under your fingers, you just gotta go with whatever available locally.

The Classic Casio SA-76.
So I'm attending a conference in Boston.  I'm staying at a friend's house.  I didn't bring any of my synths (I mean, really, traveling to a non-music conference with one's synth would be a little silly).  The chaos of the traveling and of the schmoozing and meetings has made me uptight.  I need to chill-out, I need to relax.  But I got nothing with me...no keys, no musical instruments of any kind.  What to do?

Well, being a Renaissance Man (and his lady being a Renaissance Lady), my friends are raising their very young children delightfully, with full engagement with language and nature and arts and music.   So, while their young ones might still be a bit small for a proper Moog, they are not too small for the timeless power of an all-in-one Casio.  As can been seen, their particular Casio SA-76 is clearly Hello Kitty approved.

Looking at this synth, you might not be impressed.  Sure, the keys on this smokin' axe might be miniature, but my joy in having something -- anything -- to calm my traveler's nerves was anything but miniature.  Each one of its 26 little ivories and 18 little ebonies was a tender salve to my travel pains.

The Key to Casio Appeal...the Backing Beats.
We all know that the draw of a classic Casio is the depth of its pre-programmed beats.  And I was not disappointed.  Oh, "POPS", who knew that if you dropped the Casio's Tempo down to "4", your kicks would thump and your hi-hats would snap in such Hip-Hop-Horray that my stresses would be forgotten.

Then, by incrementing the pattern (#5, yes #5!), speeding the beat a bit, dialing in a tasty organ, who knew that the Casio would become a magical teleportation device delivering me to my musical happy place. And who knew that, on that day at least, my musical happy place would be Rockin' the Casio!


Tuesday, September 3, 2013

First PCB - MCP4922 DAC

I've done it.  I've made the leap.  I've designed my first PCB.  Yay!

Top and Bottom Illustrations of my PCB (from OSH Park)
The purpose of my new PCB is to be a breakout board for the MCP4922 DAC.  This is a 2-channel, 12-bit DAC that I've used for previous projects including: (1) a pitch CV quantizer for my theremin, (2) a pitch CV corrector for my ribbon controller, (3) a CV recorder/looper for my Korg Mono/Poly, and (4) an Arduino wavetable oscillator.  It's this latter project -- the wavetable oscillator -- that I'm looking to resurrect.

I'm eventually looking to make six of these wavetable oscillators -- one for each voice of my Korg Polysix.  On my previous projects, I just wired up each DAC individually by hand on some proto-board.  But, when making six, that's just too full of error possibilities.  So, I designed my first PCB to simplify the construction of six units.  This simple first board will be a stepping stone to my actual goal, which is to build a bigger board that includes two of these DACs (permitting 4 channels of audio and/or CV outputs) along with an Arduino-compatible AVR microcontroller to drive the DACs.  All of this will be on one PCB.  For a guy who has never designed a PCB before, I figured that it would be better to start smaller...such as with this MCP4922 breakout board.

Schematic that I Created in Eagle 6.5
For software to do the PCB design, I chose to use CadSoft Eagle.  I hear that Design Spark might be a better choice (also free, but with fewer constraints than Eagle), but most of the bigger DIY electronics sites (Sparkfun, Adafruit) seem to provide their designs and models in Eagle, so I went with that.

Any PCB design starts with defining the schematic for the circuit that you want to turn into a PCB.  Since I'm just doing a breakout board, the schematic ought to be very simple since their are so few components.  The primary elements are just the IC in the middle and some connectors (or through-hole solder points) around the periphery.  As you can see in the schematic above, I all the input signals to the DAC come in via an 8-pin header on the bottom left (I only needed 7 pins, but the PCB model for the 8-pin looked better).  As for the outputs of the DAC, I brought its two outputs to separate 2-pin headers, as shown on the right side of the schematic.   Pretty straight-forward.

In addition to the connectors around the periphery, it is common for a breakout board to include those supporting components (capacitors and resistors) that are necessary for every likely usage of the chip.  Looking at the chip's datasheet, I see that it always suggests that you use a couple of caps for power supply decoupling, so I included 0.1 uF and 10 uF capacitors in my design.  Also, after looking through the datasheet, I decided that I was never going to want to change the reference voltages applied to the chip, so I just tied those pins to the power supply, which the datasheet said was fine.

The centerpiece of this design is, of course, the MCP4922 chip itself.  Note that labeling on its symbol is poor ("REFDES TYPE", what is that?).  The problem is either that I don't know how to use Eagle (which is true) or that the device model itself is poor because it was robo-translated to Eagle format from the generic format provided by Microchip.  When I was done, I found a model for the MCP4922 in the Adafruit Eagle library.  I should have used that version of the model instead.  But, what's done is done.

2-Layer PCB Design as Performed in Eagle.  Red traces are on the top layer.  Blue are on the bottom.
After completing the schematic, I switched Eagle over to its PCB layout mode.  With a friend's help on how to use the program, I whipped out the design above.  Note that the traces use a few different widths...some are fat and some are skinny.  The inconsistency is my fault and it is only partly by design.  The default trace size is very thin.  I thought it important that the power and ground traces be thicker, especially between the IC and the decoupling caps.  So, I thickened those particular traces by hand.  I did not do a great job.  In the future, I'll try Eagle's "nets" feature so that the trace thickness is more automated.

You'll also note that everything on the PCB is through-hole, except for the two caps, which are SMT (surface mount).  This will be my first time soldering SMT.  Caps are pretty easy, so this should be good training for me.  If it goes well, maybe I'll use more SMT for my future, bigger circuits.

After completing the PCB layout, I had to choose where to get the board manufactured.  Being a fan of Sparkfun, I remembered one of their blog posts that talked about their BatchPCB service being merged with OSH Park.  So, I checked out OSH Park and it looked like a pretty good deal (2-layer board for $5 per square inch, and you get three copies).  A key benefit for me was that OSH Park allows you to upload your Eagle file directly, without going through the error-prone process of exporting Gerber files.  For a newbie like me, that's outstanding.

Before sending my PCB design to OSH Park, I downloaded their DRU file for Eagle, which specifies all of the design limits used in their manufacturing process.  This is important to ensure that your design can actually be fabricated.  When I ran the DRU check on my PCB,Eagle reported some errors with my design.  Mainly it saw that all of my "text" was assigned to the wrong layer.  If I didn't change anything, my "text" was actually going to be printed copper traces on the same layers as the rest of my traces.  This would have shorted everything out!  Oops!  Thank you DRU check!  So, I corrected the problem by moving my text to the correct layer ("21" in Eagle) and re-ran the DRU check.  Now everything was good.

I uploaded my design to OSH Park.  After processing the Eagle file, the OSH Park page produces a bunch of images of my board (like the one at the top of this post) so that I could check the design.  I noticed that some text was written wrong, so I fixed that in my Eagle file and uploaded the design again.  I iterated like this 3 or 4 times before I was happy.  When I was eventually satisfied, I accepted the design.  It's going to be $5.85 for three copies and the shipping is free.  What a deal!

Now I wait for them to arrive.   And to see what design errors I made.  Isn't this hobby fun!?!

(Oh, I shared my PCB design on OSH Park.  If you're curious, you can see it here.)

Follow-Up: The PCB's have arrived!  Check it out here.
Follow-Up: I've assembled the PCB.  Check it out here.
Follow-Up: I've tested the PCB.  It works!  Yay!  Check it out here.

Follow-Up: I've designed my second PCB.  Much more complicated.  You can check out the story here.

Saturday, August 31, 2013

Polysix - Flatten the Treble Response

Previously, I modified my Korg Polysix to remove the post-effects VCF.  To my ears, this mod nicely opened up the sound of the synth.  Others, though, thought that it now sounded too "raspy", which might be a way of saying that it now had too much treble.  That's a fair criticism.  In this post, I discussed how the Polysix has a built-in treble boosting circuit to partially compensate for its previous lack of treble.  Since my modifications to the post-effects VCF  restored some of the synth's treble deficiencies, the treble boost circuit might now be over-compensating.  Today, I discuss how I modified this circuit (in particular, around R168) to try to flatten its treble response.  As usual, let's first jump to the end of the story...here are some audio demos illustrating the effect of the mod to flatten the response.



Korg's built-in treble boost is on the KLM-368 Effects PCB.  An excerpt of this part of the schematic is shown below.  Looking at the schmatic, one can see the main part of the audio signal passes through R168, where it is attenuated as a voltage divider with the 1K resistor to ground.  In parallel with this main path, the elements circled in blue provide a second path for the higher frequencies, which means that the treble passes through with less attenuation than the lower frequencies.  By being attenuated less, the result is that the treble frequencies appear to be boosted relative to the lower frequencies.  In my most recent frequency response measurements of my Polysix, I saw that the boost starts around 2 kHz and peaks around 12 kHz.  At the peak, the boost is about 4-5 dB.  For a vintage synth, 12 kHz is very high pitched...it is basically just the "sizzle".  When boosting the sizzle by 4-5 dB, some ears might indeed find the new sound to be a bit obnoxious.


So, I looked at ways to flatten the treble response to reduce any obnoxiousness.  The most obvious modification would be to simply remove the elements circled in blue.  Unfortunately, that does not work well because some treble boost is needed to compensate for treble loss elsewhere in the system.  So, if we want to flatten the response, we need to adjust -- but not eliminate-- the treble boost of this circuit.

After some trial and error, I settled on the approach of adding a resistor in parallel with R168 (the 22K resistor).  The idea here is that, by adding a resistor in parallel with R168, I'm lowering the overall attneuation of the direct path while leaving the treble path unaffected.  Therefore, the relative boost of the treble via blue elements is lower when compared to the now-lessened attenuation of the direct path.  If the relative boost is lower, the overall frequency response will be more flat.  In the end, the best value for me was to add a 33K resistor in parallel with R168.

Implementing the modification is pretty straight-forward...just add a 33K resistor across the existing 22K R168 resistor.  Unfortunately, because of my modification to remove the post-Effects VCF, I already have a jumper wire flying into one leg of R168.  You can see what I did in the picture below.  The blue resistor is the newly-added 33K.  Below it, and slightly behind it, the tan resistor is R168.  You can see that I curved the leg of the blue resistor in a funny way so that it stuck out before looping back and connecting to the leg of R168.  Because of the perspective, you cannot see it loop back to connect to R168.  I then connected the yellow wire (my jumper wire going around the post-Effects VCF) to the looping leg of the blue wire.  Done.  Note that the green capacitor has not been touched in this modification.  The angle of my photograph may look like it is connected to my modification, but it is not...it is just unfortunately aligned in the background.

Adding the blue resistor (33K) in parallel with the R168 (the tan resistor underneath and behind the blue resistor).  The yellow wire is the audio input coming from my modification where I removed the Post-Effects VCF.  The green capacitor is not involved with this modification.
After doing this modification, I re-measured the frequency response of the synth (using the Maximum Length Sequence technique discussed here).  A comparison of the original and modified response is shown in the graph below.  As you can see, adding the 33K resistor did indeed boost the response through the low and mid frequencies.  The relative weighting of the high treble to the rest of the tone is now more balanced.

A side-effect of this mod is that the signal level is overall about 3-4 dB hotter going into the IC20.  For the loudest sounds, this might cause it to saturate a bit...for it to add a little compression or distortion.  I'll be keeping my ear tuned for that possibility.  Since Moog, with their Sub Phatty, has been extoling the virtues of adding a little OTA distortion, maybe any slight overdrive added here would be a good thing.  I'm not convinced either way, but I will keep my ear open for it.

So how does it sound?  Well, the sound samples at the top provide a comparison.  These are recordings straight from the synth to my M-Audio Microtrack.  Because the modified version was 3-4 dB louder, and since we humans are very sensitive to (and partial to) louder sounds, I cut the volume of the samples from the modified synth by 3.2 dB to equalize their RMS power.  So, even though I did not equalize their volumes on an A-weighted scale, hopefully I'm close enough that it is a fair comparison.

Do you think that the treble-flattening modification sounds better?  Or does it sound too dull?  I'm curious to hear your thoughts!

Follow-Up: I had this mod in my synth for a couple weeks.  I decided that I preferred the super-sizzly sound that I had before, so I removed the 33K resistor.

Monday, August 26, 2013

Polysix Deeper Bass - Properly Jumpering C61

Following this post and this one, I've decided that I like the sound of my Korg Polysix when bypassing C61.  So, I've decided to remove the clip leads that were shown in the pictures in those previous posts and replace them with a proper jumper wire.  So, I cut one to length and soldered it in.

The Red Wire Jumpers Around C61 by Connecting the Left Leg of Q15 with the Right Leg of R115.

Again, the Red Wire Jumps from the Left Leg of Q15 to the Right Leg of R115.
Now, I agree that the proper thing to do would have been to remove C61 and to solder a jumper wire into the holes of C61, but I didn't want to do that.  I just soldered in the red jumper wire shown above.  I don't perceive any additional added noise by using this flying lead, so I think that it's probably OK.  Plus, if I choose to un-do this mod, removing the red wire is easier than finding and installing a replacement for C61.

Smell the solder!

Sunday, August 25, 2013

Polysix - Frequency Response with Deeper Bass

In my previous post, I modified my Korg Polysix to strengthen the deepest bass frequencies.  The key is to bypass (or remove) C61 on the KLM-368 Effects PCB.  In my previous post, I attempted to show the frequency response due to this modification, but the graph was pretty poor.  Today, I have taken new measurements and made a much better graph.  Now we can clearly see the effect of bypassing C61.


Lower Cutoff Frequency:  This graph clearly shows that the low-frequency cutoff for the synth drops substantially by bypassing C61.  As measured at the -3dB point, removing C61 drops the cutoff from about 62 Hz down to about 20 Hz.  This means that removing C61 extends the deepest bass frequencies.  Whether or not this is a good idea is up to you.  For me, after living with it for a few more days since my original post, I like it.  I think that I will keep it.

Let's talk about some details of the measurement technique...

Measurement Approach:  By treating the Polysix as a "black box" system, I evaluated the frequency response by measuring the transfer function of the "black box".  I did this using a standard technique -- I injected a known broadband signal into the system and I recorded the output signal that was generated by the system.  Comparing the output to the input yields the transfer function.  By looking at the transfer function in the frequency domain, you get the frequency response of the system.  In this case, of course, the "system" is my Polysix.

Injecting the Test Signal:  All of the circuits that interest me at the moment are on the KLM-368 Effects PCB.  To measure its frequency response, I need to inject my signal before the audio pathway gets to KLM-368.  I chose to inject my signal at the end of Voice 1 on KLM-366, just before it is mixed with the other voices and sent off to KLM-368.  As seen in the picture below, I injected my signal at R133.  To allow my signal to mix properly into the synth's audio path at this point, I used a 10K resistor in series between my computer (which is playing the signal) and the green clip lead shown in the picture.  For the "output" of KLM-368, I simply recorded the main output of the synth because there is very little circuitry after KLM-368.

Injecting my Signal on the Lower Leg of R133 (the Green Clip).  Not shown is the 10K Resistor Between my Signal Source and the Green Clip.
Processing with Matlab:  To produce the frequency response graph shown at the top, I processed the audio recording of the input signal and of the output signal using Matlab, which is unfortunately not cheap nor readily accessible.  It is a very good programming environment for doing this kind of signal processing, but there are other choices.  The Matlab functions that I needed are the FFT function (which converts time-domain signals into frequency-domain signals) and Matlab's plotting functions.  As an alternative to Matlab, I believe that this analysis could be easily done in Octave (which is free) because it has a perfectly fine FFT function, as well as, perfectly fine plotting functions.

Compute the Transfer Function:  Whatever computational tool you use, the core of the calculation is to take the FFT of the output audio and divide it by the FFT of the input audio.  This division operation in the frequency domain yields the output/input transfer function of the system being measured (in my case, KLM-368).  Take the magnitude of the transfer function, plot as "dB", and you've got the amplitude response as a function of frequency.  This is what I show in my graph.

Chosing the Input Signal:  For anyone who has made these kinds of measurements before, you know that there are several different choices for "broadband" input signals that one can use.   Ideally, the input signal is flat in the frequency domain, so that any deviation from a flat output is most easily assessed.  The typical choice is to use either a linear frequency sweep or some random white noise.  Personally, I like to use noise.

Maximum Length Sequence:  In the category of "random white noise", I chose to try something new...instead of traditional Gaussian white noise, today I tried using a Maximum Length Sequence.  Unlike traditional white noise, which is only truly flat in the frequency domain after lots and lots of averaging, an MLS sequence is designed to be perfectly flat within whatever fixed period of time that you'd like.  As a result, you get much smoother results in a much shorter recording.

Smooth MLS Results:  I generated a sample of MLS using the "MLS.m" routine downloaded from the Matlab File Exchange. I generated the sequence and saved it out as WAV file, just like I would do for any other noise sample.  After running it through the synth and processing the results, I get the very nice graph seen at the top of this post.  This is the first time that I've used MLS and, given the smoothness of the graph (copied again below, but with different annotations), I like how the results turned out.



One More Look at the Graph:  OK, sorry for the digression about transfer functions and maximum length sequences.  Let's get back to the results at hand.  However I got there, this new graph shows the frequency response of the synth much better than my old one.  It shows that the effect of bypassing C61 is substantial, but only at the deepest frequencies.  As a secondary result, I also see that the KLM-368 PCB (with or without C61) produces a sizable boost seen in the treble frequencies.  I believe that this is the effect of Korg's built-in treble boost that was discussed in this older post.  I'm going to address this "feature" in another post later.

Update: I decided to properly bypass C61 using a jumper wire instead of my clip leads. See here.