Sunday, September 1, 2013

Building a Bass Guitar Kit, Part 1

Although I play a Fender Jazz bass, I've always been curious as to how the Precision bass sounds and feels, especially with its wider neck.  Normally, one would just go to the local guitar store and try out one of their many basses.

The problem is, I'm left-handed.  This makes test driving a P bass almost impossible: of the three guitar stores in my area, not one had a lefty P bass (if they had any left-handed basses at all!).

So, if I wanted to try a P bass, I pretty much had to purchase it, sight unseen.  And without the chance to play a bass first, I didn't want to spend too much money on something that I might find clunky and awkward to play.

During my search for an inexpensive P bass I came across a P bass guitar kit.  And I thought, "Why not?"  I could paint it a color I liked (rather than being left to the limited color selection of most left-handed guitars).  And as for the assembly, well, how hard could it be?

The kit was ordered from Canada, and after a bit of a wait, it arrived:

Christmas in July

First things first.  After inventorying the parts (discovering a few minor discrepancies) I started assembling it.

The body and neck both needed sanding -- I believe they were coated with Polyurethane, but the surface of both the body and neck was very rough, and the kit supplier recommends that they first be sanded down (starting with 180 grit, then 240, and finishing off with 320).

Also, you need to drill 17 holes:  4 holes for the mounting screws for each of the four tuners, and 1 hole for mounting the string tree.  All in all, not terribly difficult.

Here's how it looked when fully assembled.  Not bad!

It played well enough that I decided to continue with the project.  But before painting the body (which would be the lion share of effort and additional cost), I first needed to tackle some of the issues I found during the assembly process.  Specifically:
    1.  Parts Discrepancies:
    • No Allen-head Wrench (for truss rod adjustment).
    • Springs instead of compression foam pad for pickup height adjustment.
    I contacted the kit supplier and they sent me an Allen-head wrench to replace the missing one.  The springs versus pads were no big deal, and probably due to old documentation.

    2.  Wrong nut:  it looked like a right-handed bass nut hand been flipped around and installed in the neck.  This would be fine if the string channels were flat, but they weren't.  They were cut to slope towards the tuners when the nut was installed in a right-handed guitar.  The problem was:  in a left-handed guitar, they sloped in the the opposite direction, not towards the tuners, but toward the bridge.

    I contacted the kit supplier, and, although they didn't have any nuts for lefty basses, they did send me a nut blank.  Not sure if I wanted to try cutting nut slots, I also looked around on the internet and found an Allparts nut listed on Ebay with the correct width and a flat base.  It was this nut that I installed.

    Let me add -- the kit supplier was very willing to work with me to resolve the nut and the missing Allen-head wrench issue.  The other problems (listed below) were more problematic, because they weren't the fault of the kit supplier.  Instead, I believe they are due to lack-of-attention at the manufacturer (China, I believe).

    3.  Obscured fret dots.  Not a big issue.  But required some cleanup.

    (Click on image to view in its entirety)

    4.  Bridge Mounting Holes:  Angled and various depths (illustrated below with small dowels in the holes).  Not a big deal, just sloppiness on the part of the manufacturer.


    5.  Rear strap button hole:  not centered and drilled at an angle.


    This was more of an issue with me, so I:
    • Drilled it to make the hole slightly larger and then pressed-fit a wooden dowel into it.
    • Counter sunk the dowel.
    • Filled the counter-sunk cavity with Bondo.
    • When the Bondo dried, sanded it flat.
    • Then drilled the correct hole.
    Note:  Bondo is great for patching small holes and dents in the body.

    6.  Incorrect Wiring:  The bass had Jazz bass wiring (in which the pickup was connected to the wiper of the volume pot), rather than Precision bass wiring (in which the audio jack is connected to the wiper of the volume pot).  I fixed the wiring to be P bass wiring, per the photo below (note the paint job!).
     

    7.  The through-body holes for the four neck screws were too narrow.  This meant that, when screwing in the four screws to attach to the neck to the body, these screws were also cutting threads in the body wood, not just the neck wood.  Threads in the body wood prevents the neck from being sufficiently tightened to the body -- the screws snug up to the body first, rather than pulling the neck in as tight as it can go.

    The obvious fix is to widen the diameter of these four body holes so that the screws would pass freely through the body.  I used a 13/64 drill bit.

    8.  Fret Buzz when fretting either the E or A string at the 8th fret.  The 9th fret was noticeably higher than the 8th.  I tapped it down with a rubber-headed hammer, and this fixed that problem.  Buzz fixed!

    But with that fret now lowered, I quickly discovered other frets buzzing.

    Oh boy!  My chance to learn how to level frets! (Said with a distinct lack of enthusiasm).

    Still, why not?

    So I purchased a fret rocker and got to work, but I quickly discovered that the fret leveling issues where more significant than I imagined (or, more likely, I was making them worse by attacking them one fret at a time), and I needed to open up the wallet and add to the arsenal.  Here's my fret-leveling kit now...

    (Click on image to view in its entirety)

    Clockwise, from left:
    • Micro-mesh polishing pads for polishing the frets after they've been leveled and crowned.
    • Bass Guitar Neck Straight Edge (to ensure that the neck is flat and level *before* you start leveling frets).  Stewart MacDonald carries these, but I purchased mine from Ebay.
    • Brass brush (for cleaning files).
    • Fret File (for crowning the frets -- I purchased the Medium/Wide Double-edge Fret File from Stewart-MacDonald).
    • 320 grit sandpaper with adhesive backing (Stikit Gold Paper Self-adhesive Abrasive -- purchased from Steward MacDonald).  This is for the next item:
    • Fret/Fingerboard Leveler, 8 inch.  Stewart MacDonald carries these, but I purchased mine from Ebay.
    • Fret Rocker.  Another Ebay purchase.
    • Sharpie Pen.
    (Not shown is the masking tape used to protect the fretboard during leveling/crowning).

    When using the Fret Leveler it is important that you first adjust the truss rod so that the neck is flat.  And do this before you tape up the fret board.

    Stewart-MacDonald has a good video on using a Fret Leveler:


       
    Here's a picture of my Fret Leveler beam in action (again:  first adjust the truss rod to ensure that the neck is flat!!!).  No need to be aggressive when using it-- the weight of the beam itself is enough to sand down the frets.

    (Click on image to view in its entirety)

    Before I started leveling I first marked the tops of all of the frets with the black Sharpie pen.  As I leveled, the leveler removed the black markings from the high frets, and the low frets were yet be touched.  Below is an example of the different fret heights.  Note the areas that are still black.  The neighboring frets are still too high and must be leveled further.

    (Click on image to view in its entirety)
     

    Here are a couple of other fret-leveling YouTube videos that I found interesting, especially if you only need to level a fret or two.  If you search YouTube, there are more!

    Leveling inexpensively:    

    I like this guy's approach:  

    Some additional notes:
    • When crowning the frets after leveling, again mark the fret tops with the black Sharpie.  When you finish crowning a fret, there should only be a thin black stripe left running along the fret's top.  You may want to practice your crowning technique on the high frets (e.g. 20th) first.
    • If you need to dress the ends of the frets, you'll need an appropriate file to do this.  Fortunately, the fret ends were fine on this neck -- no protruding sharp edges.

    9.  Anemic and twangy sound when played.  I first thought this might be the pickups, but decided to try a different set of strings first.  Glad I did -- the difference was night and day.  It needs proper strings!
    OK, those problems were fixed.  Now on to painting and finishing!

    Finishing the Neck:

    I decided on a clear satin Polyurethane finish.  The local hardware store had a can of exactly what I needed:



    Fret board taped off, a thin coat of Poly applied with a cloth, and now to the drying...





    After the polyurethane dried, I sanded it smooth with a very fine grit sandpaper to make the neck smooth and fast.


    Disclaimer:

    This was my first time doing any of this:  fret leveling, painting, etc.  Before you tackle your own project, do your research!  Don't depend solely upon my experiences.


    Next installment:  Painting the body! (Click here!)



    Links to Bass posts of mine...

    Sonic Blue Bass (part 1 of a 3 part series)

    Mellow Yellow Bass

    Short-scale Telecaster Bass

    Bass Guitar Painting Jig

    Repairing a G&L Butterscotch Blonde Paint Chip

    G&L ASAT Bass Strap-button Extender

    Tuesday, June 25, 2013

    Homebrew Horn Strap-button Extender for the G&L ASAT Bass


    This is not my typical blog post, but it's a problem I recently became interested in, and others might find it useful.

    Being a lefty, it's difficult to purchase a bass guitar.  Most guitar stores, if they have any left-handed basses at all, will only have one or two, and these are typically entry level models.  So it can be a frustrating endeavor if you want to find specific models to try out prior to purchase.

    It's almost enough to make one switch to playing right-handed!

    Almost.

    I recently picked up (via the internet) a G&L ASAT bass.  The seller was too distant for me to try out the bass in person, so I took a gamble.  Overall it was a good purchase, but...the ASAT does have one flaw:  Because the horn is short, the strap button mounted on the horn has moved, horizontally, much closer to the guitar's center-of mass, compared to the strap button location on other basses (such as my Fender Jazz bass).  This shift in position of the horn strap button creates two problems:
    1. As this button moves horizontally closer to the guitar's center of mass, the guitar's weight distribution between the two ends of the strap (neck side and bridge side) shifts towards the neck-side end of the strap and away from the bridge-side strap.  That is, the neck side of the strap pulls down harder.
    2. The neck-side strap drops more vertically, thus, more of the strap is grabbing onto your shirt-front and pulling it down, resulting in shirt bunching.
    The overall result, for me, is that the ASAT is not a very comfortable bass to play when standing up.

    I did some Googling and discovered that this is a known problem:  http://www.bassesbyleo.com/forum/viewtopic.php?f=4&t=385

    There's a clever design shown in the above link.  Here it is:



    Unfortunately, this extender seems to no longer be available (also, it's designed for a three-hole mounting system that is not compatible with my ASAT, whose neck-mounting scheme has 6 holes in a rectangular pattern).


    Well, I thought, if I can't purchase an extender like the one above, why not make an extender myself? 

    I did, and here it is:






    The Design:

    As you can see, the design differs from the original one shown in the earlier link.  This was dictated by my design goals, which were:

    I wanted to keep the amount of metal I would need to purchase to a minimum, which dictated that the holes to mount the extender to the guitar's body be somewhat in-line with the hole for the strap button.

    I also wanted to play around with the location of the strap button.  On my Fender Jazz bass (and many other basses), the button is above the 12th fret.  The ASAT's button, by comparison, is above (roughly) the 17th fret.  Was there a better location for that ASAT than above the 12th fret?

    I also didn't want the extender to interfere with my fretting hand as it slid down towards the body, so the extender needed to quickly bend up above the neck (but not so quickly that it looked awkward).

    Given these constraints, I decided to use the two holes below (shown sans screws) for mounting the extender.



    Notes:
    1. The distance between the centers of the two mounting holes is 1.95 inches.
    2. The original "shoulder washers" will be left in their respective holes (as shown above), so that they'll be available if someone wants to remove the extender.
    3. The original screws are also used -- they have plenty of length to provide adequate grip.

    I dropped by a local surplus-metals shop and had them cut me some 8 inch long pieces of 6061-T6511 aluminum flat bar stock (0.125" thick by 1.5" wide).  I drilled a hole in the lower corner of one of them, mounted it to the lower-middle neck mounting hole shown above, and rotated the bar about this mounting point until I had it in a position that seemed good.

    Important Note:  Put something between the bar and the guitar body to keep burrs and other sharp bits of metal on the bar from scratching the body when rotating it.  Thick paper or cardboard should work fine (but use your own judgement) -- I cut a piece from a manila folder and put this between the bar and the body.

    (I also purchased some 8" lengths of 3/16" thick flat bar stock, but it turns out the 1/8" thickness is fine).

    Once the bar's position seemed good (I wanted to try mounting the button above the 12th fret and at the same height that the button was currently mounted), I then determined where I wanted to place the second mounting hole.  After drilling it, I also drilled some holes for experimentation with the strap-button placement (to give me a range of choices to play around with).


    Here are my final dimensions:


    (click on images to enlarge)




    (The only important dimension is the 1.95" center-to-center distance between the two mounting holes.  You can play around with all of the other dimensions to suit your personal design esthetic).

    Here's the bar mounted on the bass (for testing strap-button positions)


    ...and its view from the front (note that the strap-button is not in its final location). 




    By the way, the strap button is held on with a 6-32 screw and nut with integral lock (star) washer.

    I played around with the location of the strap button and decided that I liked it best near the 13th fret -- As the button is moved further out from the body towards the neck the guitar body will shift in the opposite direction.  I decided that I didn't like the way the tummy cutout was hitting me when the button was at its furthest location, and that a good compromise was with the button near the 13th fret.

    If you like rectangles, you can stop now (although your fretting hand will probably run into the extender, however, as you slid it down the neck towards the body).  But I wanted something a bit more curvy, to go with the curves of the ASAT and to also put the extender out of the way of my fretting hand.

    Here's the design I came up with:


    Cut, File, Sand:

    To make hacksawing easier, remove metal by drilling around the shape's outline.
     
      
    Hacksaw!
    You won't be able to hacksaw too far along the curves (at least, I couldn't).  Whenever you get stuck, just cut as far as you can go along the outline, then remove the hacksaw and make a new cut from the outside of the bar to the last hole that you cut through.  Or if the metal is still held to the body by a few thin channels of metal between the holes, you can use a pair of pliers to bend the metal piece back and forth until the metal at the holes fatigues and the piece breaks away.

    Filed and sanded.  Ready for paint.

    Paint and Backing:

    The extender is painted flat black.  No primer was used because, well, the paint I used is supposed to contain both paint and primer -- it's Rust-Oleum Painter's Touch 2X Ultra Cover Paint+Primer (picked up at Home Depot).  (We'll see how well it holds up).

    After the paint dried (I gave it 48 hours) I buffed it down with a soft cloth and then added a green felt backing to protect the bass body (felt is usually available at Arts and Crafts or Hobby stores and ought to be inexpensive -- a piece of 6 inch by 9 inch green felt only cost me 29 cents).

    The felt is held in place with a spray adhesive (be sure to mask off the rest of the extender!).  I used a can of 3M Super 77 adhesive that I've had around the shop for a few years.  A very thin smear of Elmer's glue in lieu of spray adhesive would probably work fine, too.



    After the adhesive dries, mount the extender onto the bass, attach your guitar strap and away you go!

    Ahhhh...that's better!


    A Bit of Physics (extra-credit reading):

    So what's going on?

    First, let's talk about the guitar's center of mass.  Where is it?  (Actually, we're really talking about the center-of-gravity, but in the case the two are essentially equivalent).

    I found its approximate location by balancing the back of the bass on top of a pill bottle.  Doing this, I discovered that it runs along the center of the bass neck.  For a more accurate position, you can hang an object from a string, and a line drawn along that string must pass through the center of mass.

    For example, the ASAT center of mass (the red dot):



    For comparison, Fender Jazz bass center of mass:

    It is the distance between these strap buttons and the guitar's center of mass which is important:  what happens when the position of the strap button is shifted horizontally with respect to the guitar's center of mass?

    First, we need to recognize that, because the guitar is not moving (that is, it isn't falling towards the ground, nor is it rising towards the heavens), it is at equilibrium:  all of the forces acting upon it (gravity pulling down, my body pulling the straps up) sum to zero (this is one of Newton's laws of physics).

    What are these forces?  For the sake of discussion, let's simplify them to be the following:
    1. There is the tension of the "neck" end of the strap pulling down (and, as shown below, it's also pulling horizontally to the right).
    2. There's the tension of the "bridge" end of the strap pulling down (and, as shown below, it's also pulling to the left).
    3. And then there's the force my neck is exerting, pulling UP, to keep everything from dropping to the ground.

     Here's a drawing showing how these vectors sum to zero:

    (Click on image to enlarge)

    What is important to me (and my neck and shoulders) is the vertical component of these forces.  The horizontal components cancel out without any effort on my part (they are equal and opposite), but I myself must counteract the weight of the guitar, transmitted to my neck via the "tension" on the two ends of the strap.  That is, the force I'm exerting pulling up equals the sum of the forces on the two sides of the strap (neck side and bridge side) pulling vertically down.

    Of the two vertical tension components shown above (neck and bridge straps), it is the neck strap tension that we are affecting when we move its strap button left or right.  And, because the neck strap button is closer to the center of mass than the bridge strap button, it carries the majority of the guitar's weight.  What happens when we move its position?

    Changing the position of the Neck strap button will change the angle "alpha" shown above.  As the neck button moves towards the center of mass, the angle alpha becomes smaller and smaller.  Assuming the angle of the Bridge strap doesn't change when we move the neck button (it does, but let's not worry about that), this means that the vertical component of "Tension, Neck Strap" increases (and therefore the vertical component of "Tension, Bridge Strap" must decrease, because they both must still add up to be the weight of the guitar, which itself is unchanging).  That is, as I move the neck button in towards the body of the guitar (and its center of mass), the "Tension, Neck Strap" vector's point moves down along the vector I've drawn for "Tension, Bridge Strap".

    Here's an image showing this:

    (Click on image to enlarge)

    Note how the vertical component of the Tension, Neck Strap, has increased while the vertical component of the Tension, Bridge Strap has decreased by an equal amount.

    On the other hand, as I move the neck button away from the center of mass and towards the fingerboard's nut, the force exerted upon the neck strap will decrease, and the bridge side of the strap takes up more of the weight.

    And this is what we are doing when we move the strap button away from the body of the guitar:  we are lessening the weight felt on the neck-side of the strap and transferring that amount, instead, to the bridge-side of the strap.


    Other stuff:

    Link to post at TalkBass Forum:  http://www.talkbass.com/forum/f8/homebrew-g-l-asat-strap-button-extender-994333/


    Links to other Bass posts of mine...

    Sonic Blue Bass (part 1 of a 3 part series)

    Mellow Yellow Bass

    Short-scale Telecaster Bass

    Bass Guitar Painting Jig

    Repairing a G&L Butterscotch Blonde Paint Chip

    G&L ASAT Bass Strap-button Extender

    Saturday, September 1, 2012

    K6JCA Beacon

    We've just set up a 10 Meter Beacon!

    At the moment, the equipment consists of a Radio Shack HTX-100 running 20 watts into an inverted-vee and keyed with an ID-O-Matic keyer.  (Please note that the keyer identifies the station as being 1 watt ("1 W") -- I'll update this to the correct power as soon as I can get my laptop to the keyer).

    Beacon frequency is 28.222 MHz.

    The beacon is located in Carmel Valley, California (between Salinas and Carmel), near the summit of Laurales Grade, at an elevation of about 1,620 feet.  Grid square is CM96dm.


    Let me know if you copy it.  You can leave a comment here, or you can reach me at:  jca1955 at sbcglobal "period" net.

    By the way -- if you'd like a QSL card for reception of the beacon, please send a QSL and a self-addressed stamped envelope.

    Thanks!

    - Jeff

    Monday, July 30, 2012

    Worst-Case and Temperature Analysis with LTSpice

    In a previous posting (here) I discussed using Linear Technology's SPICE program (LTSpice IV) to perform Monte Carlo and Worst Case circuit analysis.

    When doing these sorts of analyses, I usually also want to know how the circuit performs at temperature extremes  to ensure that, given the temperature characteristics of semiconductor junctions, the circuit's performance is still acceptable.  So, while analyzing the circuit for worst-case component variations, I can simultaneously use the SPICE .step command to step the temperature (in degrees Celsius) over the range I'm interested in.

    Here's a simple circuit demonstrating this:

     (click on image to enlarge)

    This is a comparator circuit in which the reference voltage is set by a zener diode, D1.  I'd like to know how this circuit performs at the temperature extremes of -55 and +125 degrees C, as well as how it performs for the worst-case resistor values, given their tolerance of 1%.  So there are two .step commands:  one to vary temperature and one to vary resistor values.

    Because I'm only interested in the two temperature extremes and not in any intermediary temperatures, I'm going to define the temperature to step from -55 degrees to +125 degrees in a single step of 180 degrees.  The command is:

    .step temp -55 125 180

    (Note that if I wanted to step the temperature between these two limits in, say, 10 degree increments,  the command would be:  .step temp -55 125 10).

    The second .step command defines that there will be 50 runs, for each of which the values of the resistors will be randomly varied between their worst-case values (as defined by their tolerances).

    So we have two .step commands, one which will vary temperature between 2 values, and the other which will perform 50 worst-case runs.  Spice nests the step commands, so, overall, there will be a total of 100 runs performed (2 temp runs for each of the 50 worst-case runs).

    This circuit has hysteresis (via R7), but what effect will it have on the switching threshold, given that a zener is used for the reference voltage?  I'll define the input voltage source V1 to linearly ramp up from 9 to 15V and then to ramp back down to 9V over a 1 second period (there may be a simpler way of doing this with SPICE, but this method works, too), to check performance during low-to-high and high-to-low transitions.

    Below are the plots from the 80 runs, showing how the comparator threshold changes due to component tolerances and temperature variations (component tolerance, even though 1%, results in the greatest variation in performance).  The left half of the plot shows the comparator threshold as the input voltage increases from low to high, and the right half shows it as the input voltage decreases from high to low.

     (click on image to enlarge)
     
    Here's a plot showing how the voltage at the node "V+" (the node attached to the zener diode) changes between the two temperature extremes (there's about a 50 mV delta):

      (click on image to enlarge)


    Additional Notes

    1.  As mentioned, this circuit has two step sweeps:  one for temp and one for run (in which the resistor values are varied for worst-case analysis).  Note that LTSpice allows step sweeps to be nested up to three deep.

    2.  LTSpice is available, for free, from Linear Technology, and can be found here.

    Sunday, July 29, 2012

    Monte Carlo and Worst-Case Circuit Analysis using LTSpice

    SPICE is a handy tool for evaluating circuits without having to first breadboard them, and through its "directives," it provides a powerful method for analyzing how a circuit might perform with components exhibiting real-world tolerances. 

    One such method of "real-world" analysis is Monte Carlo analysis, which, with each new analysis run, randomly varies parameters (within their user-defined limits) to give the user a useful picture of actual circuit performance.

    However, as a circuit designer, I'm most often interested in worst-case performance.  That is, I want to know how a circuit performs at the extremes of component values, to ensure that  I've met whatever design specification I'm designing to.  And although Monte Carlo analysis can tell me what the performance is at these limits, if the circuit contains many components, it can take quite a lot of runs before its random selection of parameter values happens to simultaneously correspond to the worst-case limits of all of the components (and it's quite possible that I'll never see the true worst-case limits -- after all, it's a matter of chance).

    To truly evaluate performance at a circuit's worst-case limits, we can perform a "worst-case" analysis in lieu of a Monte Carlo analysis.  This analysis has an added advantage, too, in that not as many runs are required to ensure that we've truly evaluated all of the components over all possible variations in their tolerances -- after all, we don't need to measure between the tolerances limits (which is what Monte Carlo analysis does).  For example, if one of the components is a 10K ohm resistor with a 5% tolerance, worst-case analysis will only use resistance values of 10.5K and 9.5K for this component  and not any other value between these limits (whereas Monte Carlo analysis would randomly use any value between, and including, these limits).

    Linear Technology's LTSpice can handle both Monte Carlo analysis as well as worst-case analysis.  Unfortunately, it's not obvious how to do this from their "Help Topics."  For example, "Monte Carlo", when entered into LTSpice's search field, returns no results.  Not much use, that!

    Nevertheless, LTSpice does indeed have a pre-defined Monte Carlo function.  This is the "mc" function, and a search of the Help Topics for "mc" will point to the .PARAM topic, and under this heading we find the function mc (x,y), which, when invoked, returns a "random number between x*(1+y) and x*(1-y) with uniform distribution."

    To use this function, rather than define a resistor's value as, say, 10K, we define it as "{mc(10K,0.05)}", where 10K is its nominal value, and 0.05 is its tolerance (5%).  (An example will follow below).

    OK, so the predefined mc function handles Monte Carlo analysis, but there is no pre-defined "worst case" function.   We need to create this ourselves, but it's not too difficult.  This can be done using Spice's ".function" directive.  Here's an example of a function for worst-case analysis (we'll use this later, too):

         .function wc(nom,tola) if (run == 1, nom, if(flat(1)>0,nom*(1+tola),nom*(1-tola)))


    In this definition:
    • .function is the Spice directive for defining a function.
    • wc is the name I've given this instance of this worst-case function.
    • nom is the "nominal" value (e.g. 10K for a 10K resistor).
    • tola is the tolerance (defined elsewhere with a .param directive (e.g. 0.1 for a 10% tolerance)).
    • run is a variable (defined elsewhere in the .step directive) identifying the current run count).
    • flat(1) is a Spice function that returns a random number between -1 and 1. 
    (Note that the definition of .function and flat can both be found in LTSpice Help).
      So how do we use this function we've just defined?

      Take as an example a 10K ohm resistor.  Normally, we'd just label its value in the LTSpice schematic as "10K".  However, to vary its value between its worst-case values, we instead use a more complex label for its value.  Rather than entering "10K", in this case we'll enter "{wc_a(10K,tola)}" into the component's value field.  (Note the use of the curlicue brackets).

      So what happens when we run the analysis?

      If this is the first analysis run (run is defined elsewhere in the .step directive and simply is the current run being performed), then, because run = 1, the function returns the value assigned to nom, in this case, 10K.

      But for each new run after the first run, and for each component defined with a wc_a function, the function flat(1) is re-evaluated for that component.  If the random result returned from flat(1) is greater than 0, then the tolerance is added to the component's nominal value (e.g. for a resistor whose nominal (nom) value is 10K, if tola is 0.1 (10% tolerance), the resistor's value is set to 11K).  Otherwise, the tolerance is subtracted from the component's nominal value (e.g. the 10K resistor is set to 9K).

      Here's a demonstration of both Monte Carlo and Worst Case analysis.  Consider this basic circuit: 

      (Click on image to enlarge)


      Given these component values, a frequency sweep of the input from 1 Hz to 1KHz shows that the circuit has the following gain and phase transfer function when measured at its Vout node:

      (Click on image to enlarge)

      But what happens when the component values vary over their tolerance range?  Let's suppose that the resistors have 10% tolerance and the capacitors have 20% tolerance.  Let's perform a Monte Carlo analysis on this circuit, given these tolerance values. The same circuit, but now set up with its Monte-Carlo functions and .param directives, looks like this:

      (Click on image to enlarge)

      (Note that within the "mc" function, I'm not setting the tolerance field to an actual number (although I could have done it this way, too).  Instead, I'm using a separate directive (.param) to define the tolerances (in this case, 10% and 20%) globally.)

      Running the Monte Carlo analysis 1000 times (via the directive ".step param run 1 1000 1") gives us the following spread of gain and phase plots:

      (Click on image to enlarge)

      But we can't be sure that we've truly evaluated worst-case performance.  So let's instead use our new "worst-case" function for a worst-case evaluation.

      The schematic, with its new Spice directives and functions, now looks like this:

      (Click on image to enlarge)

      And the analysis output, after 40 runs, looks like this:

      (Click on image to enlarge)

      Note the discrete intervals between plots.  This is because the worst-case analysis is only using component values that are at the +/- tolerance limits for each component, and not any intermediary values (except for the first of the 40 plots, which uses the nominal component values for its analysis).

      (Note:  the above was edited on 29 May 2020 to replace two "worst-case" functions (wc_a and wc_b) with a single worst-case function, wc.)


      Optimized Worst-case Analysis
      (This section added 29 May 2020)

      The worst-case analysis component values selected on a run-by-run basis for the simulations, above, are a function of random numbers.  Therefore, to ensure that all combinations of "worst-case" component values have been evaluated, many runs need to be evaluated (above and beyond the "optimal" number of runs equal to 2^N, where N is the number of components being varied).

      In the "Comments" section of this blog post, Harry Dymond (Electrical Energy Management Group, University of Bristol, UK) on November 9, 2012, posted an excellent technique for optimizing the number of runs necessary to perform a complete worst-case analysis.

      If we consider, for worst case analysis, that each component has two possible values (nominal value plus tolerance, and nominal value minus tolerance), then these two value "states" can be represented by a single binary bit.  In Harry's technique, "1" represents "nominal value plus tolerance", and "0" represents "nominal value minus tolerance.

      Therefore, if we have N components in our circuit that we would like to vary the tolerances of, we can represent these components with N bits.

      If we then stepped through all possible combinations of these N bits (from 0 to (2^N)-1), and at each step ran a simulation using the appropriate value of each component as defined by the state of its bit for that step, we would step through all possible combinations of the worst-case values without repeating or skipping a combination of values.

      In other words, we would have optimized the number of runs to be the minimum set required for a complete worst-case analysis of our circuit

      The table below demonstrates the component "bit" values for the 16 runs required for a complete worst-case analysis of 4 components:


      Each component (that will be varied) is assigned a unique "Component Index" number.  This index starts at 0 and increments by 1 for each component.

      For example, if we are going to vary the tolerance of four components in a circuit, these four components are assigned index values starting with 0 for the first component, 1 for the next, 2 for the third, until we reach 3 for the fourth (and last) component.

      You can think of these index values as each being a "bit position" in the N-bit word (where N, in this particular example, would be 4).  For example, index 0 refers to the 2^0 bit location, index 1 refers to the 2^1 bit location, etc.  You can see this in the table, above.

      This table determines how the tolerances are set for each run.  For Run = 0, all entries in the column for that run equal 0.  Therefore, all four component values will have their tolerances subtracted from their nominal values.

      For the next run, Run = 1, the component whose index is 0 will have its tolerance added to its nominal value.  All other components will have their tolerances subtracted from their nominal values.

      For the next run, Run = 2, now the component whose index is 1 will have its tolerance added to its nominal value.  All other components will have their tolerances subtracted from their nominal values.

      And for the next run, Run = 3, now the two components whose indexes are 0 and 1 will have their tolerances added to their nominal values.  All other components will have their tolerances subtracted from their nominal values.

      And so it goes, in a binary-counting fashion, until we reach the last run count of 15.


      How do we do this using LTSpice?  Here's the new schematic, using the same four components that we analyzed in our earlier, non-optimized worst-case analysis, above.


      The differences between this new LTSpice simulation and the earlier version are:

      1.  The "wc()" function now has a third input variable: "index" (i.e. the "component index", and the function is now:

      .function wc(nom,tola,index) if (run == -1, nom, if(binary_digit(run,index),nom*(1+tola),nom*(1-tola)))

      2.  The wc() function for each component (in each component's "value" field) is assigned a unique index.  The index for the first component is 0, and indexes increment sequentially by 1.

      3.  The "binary_digit" function is a new function.  It returns either a 1 or a 0, depending upon run-number and component index:

      .function binary_digit(run,index) floor(run/(2**index))-2*floor(run/(2**(index+1)))

      4.  The "run" parameter now starts at -1 (as mentioned by "anonymous" on December 13, 2012, in the comments section, below).  When "run" equals -1, the circuit simulation is run with nominal component values.

      There are 4 indexes (and thus 4 bits) for this circuit.  Thus, a complete worst-case simulation will require 16  runs to test all combinations of worst-case tolerances, plus there is one additional run with components set to their nominal values.  So there are 17 runs, total.


      OK, let's run the example!

      First, here's the LTSpice schematic, again:


      And here are the plots of the voltage at the "vout" node:


      Please note that this technique (as described by Harry Dymond in his November 9, 2012 comment in my comments section below) is also described in the following article written by Linear Technology Corporation, in 2017:

      https://www.embedded-computing.com/articles/getting-the-worst-case-circuit-analysis-with-a-minimal-number-of-ltspice-simulation-runs

      (Note, too, that in my example, above, I've replaced Harry's use of "powerOfTwo" with the shorter word "index", used by the LTC authors.)


      Other Notes and Caveats:

      1.  In the "comments" section, "Thomas", on December 2, 2016, points out that worst-case analysis could miss LC circuit resonances.  If your circuit contains inductors and capacitors, Monte Carlo analysis (in lieu of Worst-case analysis) would probably be more appropriate.

      2.  Further information on Worst-Case and Temperature Analysis can be found here:

      http://k6jca.blogspot.com/2012/07/worst-case-and-temperature-analysis.html

      (And check out the other comments in the comments section, below, too).


      Resources:

      LTSpice is available for free from Linear Technology.  You can find it here

      Tuesday, January 24, 2012

      New QSL Card!

      Finally, a new QSL card:


      (My design. Printed by KB3IFH).

      Thursday, June 9, 2011

      Quickie Pneumatic Antenna Launcher

      [21 Feb 2015 Update:  for an improved design, please see this newer post:  Improved Antenna Launcher.]

      I need to get wire-antenna supports up into some tall pines at a remote location, and the slingshot that I would normally use to do this is at my brother's house. So...in its absence I thought I'd instead make a "pneumatic antenna launcher" to help me get the supports up into high tree branches.

      A quick Google search revealed a number of plans for pneumatic antenna launchers, the most common using 2.5" PVC pipe. Although these designs were usually pretty fancy (using adapted sprinkler valves to trigger the launchers), I thought they might form the basis of a simpler design that I could quickly assemble. So off to Home Depot I went to pick up some 2.5" PVC and accessories.

      Unfortunately, when I arrived I discovered that the local Home Depot only has Schedule 40 PVC pipe up to 2" inner-diameter, but not 2.5" pipe.

      Well, why not use 2" pipe? With this diameter in mind, I searched through the bins of various PVC couplings and parts, designing the launcher in my head as I discovered what bits and pieces Home Depot had in stock.

      With money dispensed, home I went, and not much later I had my launcher! Here it is:

      (Click on image to enlarge)
      The air-chamber and barrel are made from 2" I.D. Schedule 40 PVC pipe. Overall length is 90 inches. The barrel is 32 inches long, and the air-chamber is 52 inches long (roughly 2.5 quarts in volume).

      I chose 2.5 quarts as a compromise between air-volume and length of the chamber. Other designs that I found on the internet seemed to use a volume of about 3 quarts for their air chambers, but, with 2" PVC pipe, this would require a chamber length of 60 inches, which I thought would make the overall launcher a bit too unwieldy. So I shortened it up a bit, which, for me, puts the "trigger" at a nice height when the end of the launcher is resting on the ground.

      For the "trigger," rather than try adapting an expensive sprinkler valve as others had done, I went with a low-tech, low-cost ball valve which I'd seen used in the following photo of a potato launcher.

      (Click on image to enlarge)
      James and Devin with potato launcher (circa 1999?)

      I chose a 1/2" ball-valve after I discovered, while testing various size valves at Home Depot, that it was the one that I could turn the easiest:

      (Click on image to enlarge)


      The 1/2" ball-valve is threaded at both ends. To connect it to both the 2" air-chamber and the barrel, I screwed into each end of the valve 1/2" (threaded) to 3/4" (female slip) adapters (with a generous amount of Teflon pipe-tape on the threads), and then I glued short lengths of 3/4" PVC pipe into the slip-joint ends of these adapters. In turn the other ends of these short lengths of 3/4" pipe are glued into 3/4" (slip) to 2" adapters. The barrel and the air-chamber connect to these 2" adapters via 2" slip couplings (again, glued).

      Note that the threaded couplings allow the launcher to be disassembled for easier transport. And, should I ever decide to change to a fancier trigger mechanism, they would allow me to easily swap out the original ball-valve trigger for something different.

      To fill the air-chamber I used a Presta valve from an old bicycle inner-tube that I had lying around. It's threaded and has a nut, which eases its installation.

      (Click on image to enlarge)

      A Schrader valve would have been preferred, as Presta valves are a bit fragile, but the Presta valve was what I had on hand.

      To ensure a good seal between the valve and the air-chamber pipe, I cut out two pieces of the bicycle inner-tube rubber, each piece roughly a circle 1" in diameter. Into the center of each piece of rubber I cut a small hole slightly smaller than the diameter of the Presta valve. I pressed these each over the valve and worked them, one at a time, down the stem to the end that would be within the air-chamber pipe.

      I drilled a small hole in the pipe just past the point where the end-cap would stop (do NOT attach the end-cap yet before you install the valve!), and then I inserted the valve into this hole. With its nut tightened down, the rubber "gaskets" I'd made provided a good seal against the inside of the air-chamber.

      After I'd installed the valve, the air-chamber was capped off with a 2" PVC cap, glued in place.

      Because the pipe is only 2" in diameter, I couldn't use normal size tennis balls. A visit to Jon, K6JEK, and his wife revealed exactly what I needed. Their dog Buster likes to chase 2" tennis balls.

      (Click on image to enlarge)

      I tested one of these tennis balls in the launcher, and it worked great! Buster was too attached to his tennis ball for me to try to take it (and his others were chewed beyond recognition), so it was off to the local Petco (pet supply) store to search for more 2" tennis balls!

      (Click on image to enlarge)

      The yellow balls are a bit softer than the blue/pink ball, and they are "squeaky" toys. I drilled a couple of holes in one so that I could insert a tie-wrap to use as an attachment loop. Then, at the other end, I cut a thin slit with an X-acto knife so that I could insert pennies to add weight. Per another website, the ball should weigh between 4 and 5 ounces (as the best tradeoff of height, safety, and the ability to pull the line down over tree branches and foliage). Getting it up to 5 ounces pretty much fills up a 2" tennis ball with pennies! (Each penny is roughly 0.1 ounces).

      Here's a finished tennis ball, with tie-wrap attachment loop:

      (Click on image to enlarge)


      Using a bicycle tire-pump, I've tested my chamber up to about 80 psi and it seemed to hold its pressure fine (at least for the time it took me to insert a ball and launch it). The 2" pipe itself is rated to 280 psi (and the 3/4" pipe to 480 psi), but the ball-valve is only rated to 150 psi. I'd recommend keeping the max pressure well below this point, though.

      A small paint bucket can be used to hold the line and keep it from becoming entangled in ground debris (e.g. twigs and leaves). Tie one end of the line to the bucket handle!

      (Click on image to enlarge)

      Results:

      Shooting the weighted 5 oz. tennis ball straight up into the air resulted in the following heights:
      • 20 psi: 15 feet
      • 40 psi: 35 feet
      • 60 psi: 65 feet
      (Note: I only tested once at each psi level. Heights are approximate, based on a rough measure of how much line played out).

      While erecting my 80 meter full-wave loop, I discovered that I needed the ball to be heavy so that, if it were in an environment with many branches, it had a better chance of pulling down the line attached to it. I had started with a 4 oz. tennis-ball load, but finally decided I was better off with the ball loaded with as many pennies as I could fit into it. The result is a ball which weighs about 5.5 oz.

      Even at this weight, sometimes the ball wouldn't drop all the way to the ground, and I would have to "finesse" it down by wiggling the line or trying other tricks. And sometimes I just had to pull the ball back and start over again. Perhaps a more "slippery" line might have helped the ball descend, but in the end I was able to get all of the supports up and the loop raised without either having the ball become permanently stuck in a tree, or my having to run to the store to purchase yet one more thing.

      Ready, aim...

      Notes:

      1. Mechanically, the weakest point is the smaller-diameter pipes and adapters that make up the trigger mechanism: this is where you'll see the launcher bending. To protect these parts when transporting or storing the launcher, I'd recommend unscrewing the barrel from the ball-valve, and not unscrewing the air-chamber. Keep the air-chamber screwed into the ball-valve, because it's important to maintain a good air-tight seal at the threads to prevent pressure loss.

      2. More height-per-psi might be achievable with a better (faster) trigger mechanism (e.g. adapted sprinkler valve), but I'm satisfied with my results -- they work for my application, and the design is very simple and easy to construct. Also, because the tennis ball is narrower than 2", air can escape around it as it's moving through the barrel. Some sort of circular disk to minimize escaped air (say, made out of an old mouse pad?) first placed at the bottom of the barrel with the ball then inserted so that it's lying on top of it might improve performance. But in the end I've decided that all I really need to do is add a few more psi with my bike pump to get the heights I need.


      Resources:
      1. Here (An excellent site!)
      2. 2" ID launcher
      (Googling "spud gun," "potato gun, and "tennis ball launcher" will provide other sites with great ideas, too.)


      Caveats:

      If you build one of these, use common sense and, above all, use at your own risk! Follow instructions for gluing PVC, allow adequate curing time, and, when finished, don't overstress the PVC by pumping in too much air!