Wednesday, 23 of April of 2014

“The Maker Movement”: Wall Art For Your Workbench — Prints Now Available!

I’m very happy to announce that prints of my photo “The Maker Movement“, shown above in mockup of the 10×20 Standout, are now available for purchase. As I wrote originally:

I’ve wanted to do a photograph which captured what I think of when I think of makers, and which makers themselves would enjoy as a work.

All of us started the same way — as curious kids (maybe big kids). At first, most of us were following in the path of someone else — along what feels like a straight, well-defined line. But there’s a point where things start to diverge, and we go off and do our own thing. That’s what making is all about, and that’s what I tried to capture here.

Symbolism aside, I just dig this image. I’d like to sell it as a print, with a portion of the proceeds going to charity. What I’d like to know from you is if you’d be interested in buying such a thing. It’s always hard to judge whether or not a print will sell, especially for the artist, who is often too close to the work to be objective — that’s what galleries and curators are for. But I don’t want this to be a gallery piece. I’d like it to be an affordable work that people can hang in their homes, hackerspaces, shops, or offices and enjoy, so I’m asking you directly.

Many thanks to everyone for your compliments and support! It’s been a long time coming, but it’s finally here (yay!) — head on over to the SmugMug page to check it out!

 


PCB Layout: Why Vias Under Pads are a Bad Idea

I was going to write a long-winded introduction here, but then I changed my mind. Instead, I’ll just jump right in and say ‘don’t do this‘:

By ‘this’, I mean don’t place vias under pads*. All the offending pads above are connected to the ground plane, as they should be. However, placing the via directly under the pad is a bad idea. It’s tempting to do something like this when you’re trying to keep the size of your board small and you don’t have a lot of room to play around. Or maybe you just wanna be clever. Electrically, the idea is sound, but in practice it can be more trouble than it’s worth. When you get to the assembly stage and beyond, this can cause problems.

Heat, the engineer’s ancient and wily foe, has a hand in things here (naturally).

Let’s say you’re assembling this board by hand, and you get to working on pin 2 of the MCP1703 above. This pin is connected to ground, which on this board is a copper pour roughly the size of the board itself. That’s a lot of copper, and it’s going to radiate a lot of heat. When you touch your iron to this pad, the heat is conducted through the via and then radiated off the backside of the board. Your iron is basically dumping heat into this thing, because a significant portion is being radiated away by the ground plane. As a result, the temperature at the actual pad may be lower than it’s supposed to be. It may still be hot enough to just melt the solder and make it flow, but not enough to make it properly flow and form a good, wet bond.

At the same time, some of that solder is flowing into the hole in the via, conducting even more heat straight to the ground plane (instead of to the joint), so the problem rapidly escalates. In this case, you will have to dwell there a bit with your iron, and perhaps even set it slightly over temp, in order to get the solder to flow properly. Otherwise, you might find yourself with a nice cold-solder joint on your supply bypass capacitor, and a very noisy power rail.

Now let’s say you’re running this board through a reflow process instead. The reflow curves given in datasheets and other dox rarely take this sort of topology into account — and never explicitly, so you might need to adjust the ‘soak’ time accordingly. Unless you’re a metallurgist, you lack a reliable way to characterize the problem, so you’ll have to find the new soak time through trial and error.

This isn’t such a problem with one-offs, where you can take as much time as you need. However, in volume production, you don’t have time to be doing empirical soak tests. And anyway, extending the soak time means less units per hour, which lowers overall production efficiency.

The other reflow method — skillet — is quite the opposite. Assuming the ground plane is on the bottom, the pad connected to ground will actually get hotter than the other pads more quickly, and the situation will be reversed.

Finally, this situation will make rework an absolute nightmare — one terminal of the device will be sinking a lot more heat than the other. This is not a situation hot tweezers are designed to handle well. Hot air might be a little better, but it’s still going to be difficult.

The problem of supply planes sucking up heat has been known since the thru-hole days. The solution was to create thermals, which you can see within the bright red circle in the image below:

 The capacitor terminal above is connected to the positive supply plane by way of thermals. That is, it’s connected by three distinct traces, rather than all around the perimeter of the pad. The thermals impose a restriction on heat flow, so that the pad can heat up to proper temp, and the solder can flow and bond correctly. Just like electrical resistance, thermal resistance is proportional to the cross-sectional area of the conductor. Most EDA programs (including Eagle, shown here) will automatically create thermals on pads connected to supply planes, unless you specify otherwise. AFAIK, there is no way to get Eagle to automatically create thermals on vias. Note here that I’m not talking about ‘thermal vias‘, which are something completely different.

So what should you do? The simplest solution is to create your own thermals by running a trace between the pad and the via. It’s not hard — you just have to get over your inclination to make things As Small As Possible. The trace doesn’t need to be very long — the example shown above is actually exaggerated a bit to illustrate the concept. The main idea is that at no point should the via and the pad overlap.  The trace shouldn’t be too thin either, especially for a supply pin. Confer with this trace calculator to get a better idea: don’t forget you want to rate the trace for the maximum expected current, not the average current.

A tenth of an inch or two with a trace-width of 12-16 mils should do for most chips. Chips handling larger currents will require larger traces, or multiple small traces — you may end up having to trick your software into doing this by running multiple traces before you place the vias. It might give you grief in the meantime, but just ignore it. In the end, it’s worth it because you’ll have more balanced thermal conduction on your board.

And now you know.

*- There are certain circumstances in which vias-under-pads are necessary and useful, such as with dense BGA packages. In this case the vias have thermals connecting them to the plane for the reasons mentioned above. Chances are, if you’re working with this kind of technology, you don’t need to read my little tutorial here.


BB-313 PCBs Now Available

I am happy to announce that I am now selling PCBs for my BB-313 project. Since first announcing the design back in February, I’ve gotten several emails a week enquiring about PCBs, so I decided to go for it and start selling them.

These are nice, lead-free boards with a good-quality silkscreen, and they’re available in any color you want, as long as it’s green. Boards are $5/each + $2.50 shipping within the US. International shipping is $5.00 for up to 15 PCBs — this is automatically applied at checkout.

You can read all about the BB-313 at the project page, which also contains a cross-referenced BOM and Mouser project that makes it easy to get all the components required to build one. The BB-313 is Open Source Hardware, so you can make your own boards if you prefer.

Please note that I’m only selling PCBs right now, not kits.

UPDATE: I’ve now got it set up to apply the correct shipping for domestic and international orders, and to accept quantities greater than one.


Art for the Maker Movement

This is an idea I’ve been kicking around for awhile — I’ve wanted to do a photograph which captured what I think of when I think of makers, and which makers themselves would enjoy as a work.

All of us started the same way — as curious kids (maybe big kids). At first, most of us were following in the path of someone else — along what feels like a straight, well-defined line. But there’s a point where things start to diverge, and we go off and do our own thing. That’s what making is all about, and that’s what I tried to capture here.

Symbolism aside, I just dig this image. I’d like to sell it as a print, with a portion of the proceeds going to charity. What I’d like to know from you is if you’d be interested in buying such a thing. It’s always hard to judge whether or not a print will sell, especially for the artist, who is often too close to the work to be objective — that’s what galleries and curators are for. But I don’t want this to be a gallery piece. I’d like it to be an affordable work that people can hang in their homes, hackerspaces, shops, or offices and enjoy, so I’m asking you directly.

This would be an 8×12 digital c-print, matted to 6×10, without a frame. The image above is a mockup of the final print in a frame. You can see a larger version of the image here. The price would be no more than $30/print and would include a custom matte.

Please respond in the comments if you’re interested.

UPDATE: Wow! Thank you all so much for your enthusiastic response! I’m currently working out distribution (shipping cost, setting up a shop, etc.) but it looks like this could really happen. Prepping the image for print takes some time too, because I set very high standards for myself when it comes to prints. Thanks again for your amazing comments and encouragement — they mean a lot to me!


Arduino Leonardo Pinout Reference

I made this Arduino Leonardo pinout reference for anyone considering building shields for the Leonardo. Please note that shields designed for the UNO, Duemilanove, Diecimila and others will most likely NOT WORK on the Leonardo, because alot of the pin functions have been moved around. This image helps you see some of the differences.

For example, the lower 8 digital pins are no longer all a single port, and many of the pins, with the exception of the RX and TX lines, are moved around. Some of the PWM lines are in the same place, but are now connected to different ports and OC registers than they were before.

On the other hand, you now have access to twice as many ADC pins as you did before, and you don’t have to give up 2 ADCs for I2C. You also get two more low-level interrupt lines and, of course, USB native functionality, which (I personally feel) is exciting!

You can see the full-size image (about 2200×1600) in my Flickr photostream. This pinout was derived from the info found here. The Leonardo image is from the official Arduino Leonardo page.

Happy hacking!


New Arduino Library: INA219 i2c Current/Power Monitor

I’m happy to announce a new Arduino library –  my first ever — for the TI INA219 current/power monitor chip. This is a neat little chip that has an isolated shunt voltage amplifier tied to a 12-bit delta-sigma converter. It has on-board oversampling (up to 128 samples) and is addressable over I²C. The I²C is handled by the Arduino Wire library.

The INA219 can provide the four main figures of interest for a DC bus: shunt voltage, bus voltage, load current and power. Note that it will not work with AC — it cannot calculate RMS values, or account for lead/lag phasing due to reactive loads — but it’s still super handy for monitoring the power consumption of circuits with DC rails.

You can download the library and an example sketch over on GitHub.

Happy current sensing!

 


Eico 377 Audio Generator, Part I

This weekend I picked up a very nice Eico 377 Audio Generator. When I first took it home on Saturday, I fired it up and checked it on the scope. The output looked good — the only thing amiss was a burned out power indicator lamp. I figured that could be easily replaced, so I set it aside and left it until Monday. On Monday, I took the unit apart to replace the lamp:

(Yes, it’s supposed to look like that.) In case you’re wondering about the light bulb, it’s part of the Wien bridge oscillator circuit. The negative resistance of the lamp acts as a variable parasitic path to ground — it keeps the gain around the feedback loop steady at 1 (unity), so that the ringing never saturates or dies out. The light bulb resistance is a clever hack originally invented by Bill Hewlett of Hewlett-Packard — since its introduction in the 1940′s, it became the standard topology for many Audio/IF oscillator circuits.

After replacing the power indicator bulb, I turned the unit back on to play around with it some more. On start up it worked fine, as it had on Saturday. I left the room for a few minutes to let it stabilize, and when I came back, the output was different. It looked like the top trace in this image:

Bear in mind that the scale in the bottom trace is off by a factor of 10. It reads as 5V/div, but it’s actually 50V/div. The Tek scope is not detecting that the HP probe used here is a 10x type, so it’s not correcting the scale.

I suspect that at some point while I was out of the room, something went amiss inside the output buffer tube (V-4 in the schematic).

(schematic from NostalgicKitsCentral.com) this schematic is actually from an earlier version of this unit — my unit has a dual-ganged vari-cap (not quad-ganged as shown here) and different range selector resistor values, but other than that the circuit is the same.

The bottom trace in the scope image above is from the wiper of pot R22, which is just to the left of V-4, beyond the coupling cap C-14. Pot R22 is the amplitude pot on the front panel. As you can see, the bottom trace is a nice, clean sine wave, so V-4 is getting a decent input, but it’s putting out garbage. This garbage has a characteristic though — you can see how the ‘spike’ in the output is aligned perfectly with the crown of the sine wave of the bottom trace. Obviously, there’s some rectifier action going on. Only at the peak of the waveform is there enough potential to push beyond the threshold and cause some current to flow at the v-4 cathode (the output). I

This leads me to believe that V-4 is either very weak, or completely bad. I tested the tube down at the local electronics shop, and it tested right on border of ‘good’ and ‘weak’, so it’s probably not entirely dead, but it still has some problems. I have no idea when that tester was last calibrated, though, so it could be totally shot. I’ll hopefully be getting a replacement tube next week, so then I’ll know for sure if it’s the tube or something else. It may also be one (or more) of the passive elements around the tube, but I doubt it. I checked them (with the tube removed) and they seem to align with the values printed on the sides, but you never know.

In the meantime, we can look at the schematic to get a basic idea of how it works. This is what I’ve figured out so far:

V-1 (6SJ7) is the active element in the Wien bridge oscillator.

V-2 is a buffer for the oscillator, which makes sense because you wouldn’t want to load the Wien bridge directly.

S-3 is the waveform switch, which selects between sine and square wave output. When ‘sine’ is selected, the V-2 output is routed directly to V-4 input via the R22 amplitude pot. When ‘square’ is selected, the V-2 output goes to V-3, which acts as a schmitt trigger to produce a square wave from the sinusoidal input. The output of V-3 is then routed to V-4, the output buffer (again via R22), which is where I suspect the problem is. Here’s the square wave version of the scope capture above:

Again, the input to V-4 is shown on the bottom (but the V/div scale is off, it’s actually 50V/div), and the output is shown on top. The jitter is caused by variations coupled in from the power rail.

One final interesting note is that the suppressor (topmost) grid of V-4 is not connected to anything, so this pentode is basically acting as a beam tetrode. In fact, both 6K6 tubes (V-2 and V-4) leave the suppressor unconnected, so I’m guessing the designers simply used this tube because it was cheaper (for them, at least — perhaps they had a lot of them in stock) than a dedicated beam tetrode.

So, that’s it for now. Hopefully I’ll get this output issue fixed by next week and I can share some more pictures.

The entire photo set is here.


BB313 Parts List Update — 2.1mm DC Barrel Jack

The BB313 parts list has been updated with a new DC barrel jack, after Mouser suddenly declared the old one obsolete. Mouser’s suggested replacement is (naturally) out of stock and isn’t expected until June, so you can use this one in the meantime, though it’s a bit more expensive.

Thanks to Steve Wall for alerting me about the change of status. This was unexpected, as I had ordered 25 of the old barrel jacks only a week earlier, and there was no indication of end-of-life. Goes to show you need to keep a close eye on your supply chain, even for generic parts.


Opampomancy: Feedback Networks and the Non-Inverting Amplifier

The purpose of this post is to lay out some of the stuff I wish someone had explained to me when I was first learning about electronics. This is a pretty entry-level introduction, intended by me to ‘fill in the gaps’ with regard to basic operating principles. Opamps are not all that complicated, but for many people they appear as a black box. With so many schematics available online, it can be very tempting to simply ‘cut-and-paste’ subcircuits into your own designs without understanding them. This is okay to a point, and useful for learning, but it may come back to bite you later if your design doesn’t work the way you expect it to.

 

First, let’s look at the schematic symbol for an op-amp and identify the pins and their functions.

V+ is the positive supply and V- is the negative supply. Often these will be omitted in diagrams, especially if the opamp is part of a dual or quad package. For most schematics, it is implied that the opamp is connected to such supply rails.

Vin+ is the non-inverting input. Because of the plus sign, you may be tempted to call this the positive input, but that would be something of a misnomer because the signal voltage applied to it can positive or negative with respect to ground.

Vin- is the inverting input. Again, the signal voltage applied here can be positive or negative with respect to ground.

Vout is the voltage output.

 

There are two concepts which are typically used to describe how opamps function. The first is: the voltage output of the opamp is the voltage difference between the two inputs multiplied by the gain of the device. The gain of the device is often denoted as A, and refers to the open-loop gain of the amp. Further, the voltage difference refers to the difference between the voltage at the non-inverting input (Vin+) and the voltage at the inverting input (Vin-). In other words:

(1)   \begin{equation*}V_o = A \cdot (V_{in+} - V_{in-})\end{equation*}

This voltage difference can be considered the input to the opamp. The order of terms in the above subtraction is where the inputs get their names. To explain, let’s assume that the voltage at Vin+ is X, and the voltage at Vin- is 0 (ground). Thus, Vin would be X – 0, which is just X. However, if Vin+ = 0 and Vin- = X, the input voltage would be -X (negative X), thus its sign would be inverted, hence the term inverting input. This sign inversion would hold true regardless of whether X itself was a positive or negative value (with respect to ground).

So now that we’ve dealt with the Vin terms, let’s talk about A. A, as mentioned above, is the open-loop gain of the opampit is typically very large, on the order or 10,000 or more. This huge gain factor makes an open-loop opamp pretty useless for most applications. There are very few occasions where you would need to multiply a signal 10,000+ times, and even then it would be unwise to do so using an open-loop opamp. The reason is that even though A can be regarded as quite large, it’s very difficult to control exactly how large it will be. This is due to a number of factors, but mostly it’s due to manufacturing variances. The gain of the opamp is directly related to the gains of the individual transistors which make it up. Transistor gain can be difficult to control, particularly in large numbers. While it is possible to create very precise transistors, and thus pretty precise opamps, it’s not at all cheap. Further, it’s completely unnecessary, as we will soon see.

It’s much better to approach opamp design from a different angle. Rather than create a device which has a large but precise gain factor, it’s better to create one with a theoretically infinite gain and provide some other constraint which can be used to control it. This brings us to the second big concept for opamp functionality:

 

“An opamp tries to keep the voltage across its two inputs at zero.”

 

In fact this is the fundamental operating principle of all opamps, but when I was first learning about active devices, I always found this statement to be very confusing. The problem is that very few sources go on to explain why this is so. It seems a little counter-intuitive. Amplifiers aren’t supposed to make things smaller (or zero), they’re supposed to make them bigger, so why is the opamp trying to mitigate it’s own inputs, and how the heck does it do that?

I’ll answer the second question first. The how is with a feedback network. The original statement would be more complete if it read:

 

“An opamp tries to keep the voltage across its two inputs zero by using a feedback network to control one of the inputs with the output.

 

The construction of the feedback network will determine the extent to which the opamp has to swing the output one direction or another, so that one of the inputs is equal to the other input. The easiest way to explain this is by looking at a simple circuit — the non-inverting amplifier:

In the non-inverting amplifier, the input voltage is applied to the non-inverting (+) input of the amp. The output of the amp is connected, via a feedback resistor, to the inverting (-) input. There are two resistors here which make up the feedback network. The first is the aforementioned feedback resistor (R_feedback or R_f), and the second is a resistor from the inverting input to ground, called R_ground or simply R_g. Let’s ignore the non-inverting input for now and just look at the feedback network — it forms what is known as a voltage divider. Below is an example of a simple voltage divider circuit.

A voltage divider is so named because it provides a fraction of the input voltage as its output. The simplest voltage divider is made with two resistors, R1 and R2. In the figure above, the output voltage (Vout) is equal to the input voltage (Vin) times the ratio of the lower resistance, R2, to the total resistance, R1+R2. The lower point of R2 is tied to ground.

(2)    \begin{equation*} V_o = V_{in} \cdot \frac{R_2}{R_1+R_2} \end{equation*}

The nice thing about the voltage divider is that it has lots of applications, one of which is in our non-inverting amplifier feedback network. In that case, the input to the voltage divider would be the output of the opamp, and the inverting input of the opamp is the output of the voltage divider. Seems very confusing, I know. Perhaps a diagram will help.

The formula for the voltage divider still applies, and we can substitute the terms from the non-inverting amplifier from above:

(3)    \begin{equation*} V_{in-} = V_o \cdot \frac{R_g}{R_f+R_g} \end{equation*}

To make things a little clearer, let’s replace the resistor fraction with something less cluttered — the greek letter Beta:

(4)    \begin{equation*} \beta = \frac{R_g}{R_f+R_g} \end{equation*}

–thus–

(5)    \begin{equation*} V_{in-} = V_o \cdot \beta \end{equation*}

Ok, now we need to relate this equation to the whole circuit, so that we can come up with the transfer function for the non-inverting amplifier. A transfer function is an equation that describes the output in terms of the input. It’s usually written as follows:

(6)    \begin{equation*} \frac{output}{input} = transfer function \end{equation*}

In other words, it’s a function that describes the ratio of the output to the input. This is an easy form to understand and use, because to find the value of the output, all we need to do is multiply the transfer function by the input value. Remember that the input to the whole circuit is at the non-inverting input, so we are going to need to include that in our function as well.

NOTE: From this point on, it’s mostly just a lot of algebra — moving terms around between both sides of the equation until we get a nice Vout/Vin transfer function. If you’re thinking of studying electrical engineering, you should know that this stuff is critical. Being able to do algebra like this quickly is something you should make an effort to get really good at, because you will use it all the time. There aren’t really any shortcuts here — you just have to do it.

One of the problems when you’re studying this stuff is that textbook authors tend to ‘skip steps’ when reducing or reconfiguring equations, because they assume some intermediate steps are self-evident. Sometimes they are, particularly if you have a lot of experience working equations, but for n00bs (or sleepy college students), they are not. As such, I’m going to try to show each and every step, and explain what I’m doing, so you can understand it.

Getting back to the problem at hand, we need to create a transfer function for our opamp+feedback network. In order to do that, we will take equation (3) and substitute it into equation (1), replacing Vin- with the voltage divider equation. Doing that, we get:

(7)    \begin{equation*} V_o = A \cdot \left(V_{in+} - V_o \cdot \beta\right) \end{equation*}

–or–

(8)    \begin{equation*} V_o = A \cdot V_{in+} - A \cdot V_o \cdot \beta \end{equation*}

The next step is to get both Vo terms over on the same side of the equation, so let’s do it:

(9)    \begin{equation*} V_o + A \cdot V_o \cdot \beta = A \cdot V_{in+} \end{equation*}

Now we extract the Vo term as a common coefficient of both terms on the left.

(10)    \begin{equation*} V_o \cdot \left(1 + A \cdot \beta\right) = A \cdot V_{in+} \end{equation*}

Our original mission, of course, was to find the transfer function of Vo/Vin. Vin, in this case, is Vin+, so we want to find Vo/Vin+, so we divide both sides by Vo.

(11)    \begin{equation*} 1 + A \cdot \beta = \frac {(A \cdot V_{in+})}{V_o} \end{equation*}

Now we’ll divide both sides by A:

(12)    \begin{equation*} \frac{\left(1 + A \cdot \beta\right)}{A} = \frac {V_{in+}}{V_o} \end{equation*}

which becomes:

(13)    \begin{equation*} \frac{1}{A} + \frac{A \cdot \beta}{A} = \frac {V_{in+}}{V_o} \end{equation*}

Now we can use a little trick to simplify things. Recall that A is very large — theoretically infinite. As such, 1/A is very small, theoretically zero. We can use this to our advantage, because it means we can get rid of the 1/A term by equating it to zero. Further, looking at the second term on the left, the A in the numerator and the denominator cancel out, so we can get rid of them too.

(14)    \begin{equation*} 0 + \frac{A \cdot \beta}{A} = \beta = \frac {V_{in+}}{V_o} \end{equation*}

Oh snap! Look how much simpler that is! Now we can substitute back the resistor fraction for Beta:

(15)    \begin{equation*} \frac{R_g}{R_f+R_g} = \frac {V_{in+}}{V_o} \end{equation*}

and we invert both sides to get the Vout/Vin form we’re aiming for:

(16)    \begin{equation*} \frac {V_o}{V_{in+}} = \frac{R_f+R_g}{R_g} \end{equation*}

Rg/Rg = 1, so:

(17)    \begin{equation*} \frac {V_o}{V_{in+}} = \frac{R_f}{R_g} + 1 \end{equation*}

To figure out Vo in terms of Vin, we simply multiply:

(18)    \begin{equation*} {V_o} = V_{in+} \cdot (\frac{R_f}{R_g} + 1) \end{equation*}

And that’s the equation of a non-inverting amplifier. Now that we know where that formula comes from and how it’s derived, it’s a little easier to understand the concept of a feedback network. In order to create a voltage at Vin- which is equal to the voltage at Vin+, the opamp has to produce an output voltage  which, when attenuated by the Rf/Rg divider, is equal to Vin+. So, if the voltage divider is set up to output 50% of its input, the opamp has to produce a voltage twice as large as the voltage at Vin+ in order to mitigate it. As such, it is indeed acting as an amplifier with a gain of 2. Likewise, other voltage divider values would produce different gains, as expressed in equation 18.

So now that you know how it works, you should build a couple circuits to try it out. Happy amplifying!

About the equations: the equations here are rendered as alpha-channel PNGs with the WP QuickLaTeX plugin. This is a great plugin which renders LaTeX beautifully and even provides equation numbers. If you want something that will allow you to write nice-looking equations on a blog, you should check it out.


BB313 Pinout Reference Sheet

I created this reference sheet for my BB313 board outlining all the alternate pin functions and descriptions. While I’ve pretty much got the pins memorized at this point (from constantly cross-checking with the ’313 datasheet), I wish I’d thought of this earlier. The sheet is a single-page 8.5×11 PDF, so you can just print it out and keep it for reference at the workbench (or desktop). You can get the PDF, as well as all the project source files, at the GitHub project page.