Self-snipe

September 10, 2012 7:03:25 PM CDT
Updated September 19, 2012 12:39:11 AM CDT

This last weekend at work was busy, so I'd planned to do a short, simple post showing the waveforms from the SMT square wave generators. In the process of gathering the information, I accidentally nerd-sniped myself.

Here are the basic waveforms:

long-period waveforms

The blue trace is the output, the yellow trace is the voltage at the RC divider that drives the Schmitt trigger.

The output looks unexpectedly nice, with clean edges that I can claim as a result of design. The peak-to-peak voltage from the nearly-flat batteries I used turned out to be 4v, and the frequency of the waves is almost exactly 1Hz. I owe both of those to pure luck.

The yellow trace shows a slight but classic RC charge/discharge exponential curve. It isn't a true triangle wave, with straight sides, but bows a little toward the blue trace above and below. The high and low points on the trace show the 74LVC1G14's upper and lower threshold voltages.

Here's another trace with a shorter time-window, showing a single period of the wave:

short(er)-period waveforms

The curve in the yellow trace is even harder to see at this scale, but you can see that the wave doesn't have a perfect 50% duty cycle.

If this was a perfect square wave, the rising and falling edges at either side of the screen would sit right on the grid lines, or at least be symmetric to them. As it is, the falling edge to the left comes about 470 milliseconds before the rising edge at the center, and the one to the right comes about 530 milliseconds after. The actual duty cycle for this circuit is 53% high, 47% low.

The asymmetry happens because the 74LVC1G14's hysteresis band isn't exactly centered between VCC and GND.

The formula for an RC exponential charge/discharge curve is (1 - e^-kt)V, where 't' is time, 'k' is the RC time constant, and 'V' is the voltage between "where the capacitor is now" and "where the capacitor will end up if we let it charge forever".

The generic curve looks like this:

A basic exponential approach 
curve

with 'V' being the distance between the upper and lower horizontal lines.

Thing is, the curve gets steeper or flatter as you make 'V' larger and smaller:

A family of curves

If you compare those curves to a fixed voltage (shown by the dark horizontal line), the steeper curve crosses the threshold earlier than the flatter one does.

(For the true math connoisseurs out there, just ignore those parts of the cuve to the left of and below the axes. I didn't bother to set a "time must be greater than zero" condition when I generated the curves)

Now, for this circuit we have four voltages:

  • VCC
  • Vhi, the 74LVC1G14's upper threshold
  • Vlo, the 74LVC1G14's lower threshold
  • GND

and three ranges that are important:

  • Vt = Vhi - Vlo, the distance the yellow trace has to travel
  • Vup = VCC - Vlo, the voltage that charges the capacitor
  • Vdn = Vhi - GND, the voltage that discharges the capacitor

Vt is constant, but Vup and Vdn aren't guaranteed to be the same. In this case, it looks like Vdn is a little larger than Vup, so the downward curve falls from Vhi to Vlo a little faster than the upward curve rises from Vlo to Vhi.

and off the cliff we go:

That would have been the end of things if I hadn't noticed a tiny blip on the rising edge of the output, and decided to take a closer look. What I found was nearly 3v of overshoot:

spikes at 
the rising edge

That's called an 'under-damped curve' or 'ringing'. Mathematically, it's the combination of a sine wave and an exponential decay curve, and in practice it means the circuit's jiggly bits are a bit too jiggly.

At first glance, this is interesting because it seems to be physically impossible. The batteries only supply 4v, and the 74LVC1G126 buffer that produces the output isn't capable of exceeding its supply voltage.

Turns out, the problem isn't actually in the circuit at all. It comes from parasitic inductance in the wires I used to connect the circuit to the oscilloscope:

The test setup

The white wire leads to the probe that shows the yellow trace (the RC curve), and the blue wire leads to the probe that shows the blue trace (the output). The white one is about an inch and a half long, an the blue one is about three inches.

As I've been reading in Steinmetz, current flowing through a wire creates a magnetic field around the wire. When the current stops, the field collapses. The energy from the collapsing field gives the electrons in the wire a push, creating another burst of current.

That current sees three parallel resistances:

  • the resistance of the scope probe (1 megohm)
  • the resistance of the 74LVC1G126's output stage (unknown)
  • the resistor limiting current through the LED (1 kilohm)

The first two are probably so much larger than the third that we can ignore them. So what we're seeing is a couple milliamps of current from the collapsing magnetic field around the blue wire.

Let the full-on nerdery begin:

The frequency of the ringing's sine wave component is set by the inductance and capacitance, and the decay rate of the exponential is set by the inductance and resistance.

I don't know the inductance off the top of my head (rough calculations suggest it will be in the high-nanohenry range), and won't try to guess the capacitance closer than "somewhere in the picofarads or nanofarads", but I'm pretty sure the resistance is about 1 kilohm and I can work out the frequency and attenuation from the 'scope traces.

Attenuation is one of those things that makes sense once it makes sense, but is a pain in the neck to explain. You have to figure it in terms of ratios, and the mathematician's favorite ratio is 1/e. That leads to a concept of 'attenuation frequency'. meaning "the number of times you'd have to multiply by 1/e per second to get the right answer."

That number is usually ugly.

You can make it slightly less ugly by changing from "number of times you multiply per second" to "number of times you multiply per cycle of the underlying sine wave". That tends to knock some of the large exponents off the numbers, at least. The result is still the natural log of the attenuation from one peak to the next, though.

In this case, the time from the first high peak to the second is about 20 nanoseconds, so the sine wave frequency is about 50 megahertz.

The first high peak is 9-10 times larger than the second one, so our attenuation is about 90% per cycle. Translating that into "number of times we multiply by 1/e", we get an 'attenuation factor' of about 2.2, meaning the attenuation frequency is about 2.2 times the sine wave frequency, or about 110 megahertz.

The formula for attenuation frequency is simple: a = R/2L where a is the frequency, R is the resistance, and L is the inductance. For the numbers we know (110MHZ and 1000 ohms), that gives a rough guess of 4-1/2 microhenries for the inductance. That's higher than I would have guessed, but it's in the right ballpark.

The formula for sine wave frequency is w = 1/sqrt(LC) where w is the frequency, L is the inductance, and C is the capacitance. Using 50MHz as the frequency and 4.5 microhenries for the inductance gives a capacitance of about 90 picofarads, which is entirely believable.

Random brain cookies:

You are here: *** *** ********* ******* ***** *** * But you're not all there.