Showing posts with label amplifier. Show all posts
Showing posts with label amplifier. Show all posts

Saturday, April 11, 2026

A (simple) WWVB loop amplifier for radio-controlled clocks

Note:

The techniques described below should work - with only minor adaptation - for any "Longwave" time signal used by these radio-controlled (non-GPS) clocks - not only WWVB, but DCF77, MSF, BPC and both JJY signals as well.

* * * * *

Last year I moved a bunch of SDRs (KiwiSDRs, RTL-SDR) and a bunch of network gear to a new shelf in my shack, but this placed them much closer to the wall on which I'd previously mounted the two "Atomic" (e.g. radio-controlled) clocks which had been there - and operating - for years.  Since then, they hadn't been able to reliably synchronize to the 60 kHz WWVB signal out of Fort Collins, Colorado.

Figure 1:
The two radio clocks surrounded by
the four-turn loop, near a number of
pieces of "noisy"equipment.
The top clock is set to UTC and
the bottom for local time.
Click for a larger version.

While annoying, I wasn't terribly surprised.  There are several switch-mode power supplies involved in the aformentioned gear and it's not uncommon for them to operate in the 30-60kHz range, offering the potential of "jamming" the receivers.  As both the location of these clocks - and the nearby gear - is convenient, I wasn't too inclined to move them again and initial efforts to "filter" the switching power supplies didn't really help - but I wasn't surprised about this, either, since it's likely direct coupling of their magnetic fields that is the culprit rather than any electrostatic field as the clocks themselves use ferrite loopstick antennas sensitive to just the H-field.

A solution

 Many years ago a friend came to me to solve a similar problem in a downtown Salt Lake office building where the WWVB clocks in a conference room never synchronized and I constructed the remote loop and amplifier/coupling system, described here:

  • Getting "Atomic" (WWVB) clocks to work indoors and in weak signal areas - LINK 

In short, a rooftop loop antenna amplified the signal and it was conveyed into the room with the clocks where it was further amplified and then, using inductive loops placed in the proximity of the clocks.  This is how the WWVB signal was coupled to them.  To my knowledge, this system worked for many years (well over a decade) and for all I know, it may still be in use.

 Why revisit?

I've tackled this type of problem before - but I decided to revisit it as the circumstances are slightly different:  I already had a signal source as noted below plus I wanted to see if I could do this with more commonly-available components in a simpler manner.

While I don't have a WWVB loop on my roof, I do have a dedicated LF E-field whip antenna - a 40 year old LF Engineering LF-400B with integrated low-pass filter.  This antenna has been on the roof wherever I have lived almost continuously since I purchased it in the mid-late 1980s and with a few repairs over the years, it still works well, having been on the roof of my current house for several decades.  Its use for LF reception as described on the following page:

  • A (semi)-typical suburban E-field whip receive system for the 630 and 2200 meter amateur bands - LINK 

The fact that I already had an LF/VLF receive antenna system meant that I had a "clean" source for WWVB, and other devices that receive signals below 500 kHz (e.g. LF receivers for 630 and 2200 meter operation and my Blitzortung "Blue" receiver) and I decided to add one more to the list.

Other types of outdoor antennas 

Note that the circuit described here should work well with other types of active antennas including E-field types such as the PA0RDT "Mini-Whip" and the DX Engineering ARAV3 - to name but two.  An amplified loop such as the Wellbrook and similar will work, provided that it is not oriented such that the desired time station's transmitter is not in its nulls.

Buffer/Amplifier

Through back-of-the-envelope calculations I figured that the already-amplified signal from the active whip needed another 15dB or so of boost and it could then be applied to a loop of wire around the WWVB clocks on my wall.  One thing that helps greatly is that the WWVB signal is extremely strong here in northern Utah - on the order of 5mV/meter or so - and connecting an oscilloscope to my LF-400B whip's signal output showed that the amplitude-modulated time code of the 60 kHz signal from WWVB was visible among the many others.

What I needed to do was to tap off the signal (e.g. "bridge" the connection) from the existing coaxial cable without affecting was was being sent to the other devices using it, amplify it. and apply it to the loop - and I did this "tap" using a BNC "Tee" connector on my antenna feed.

The circuit diagram below gives more details:

Figure 2:
The schematic of the loop buffer/amplifier/driver showing the isolation from the power supply
via L1, the buffer circuit of Q1 and the amplifier and loop driver of Q2.
Click on the image for a larger version.


Circuit description

Of high importance is L1, a common-mode choke, liberated from a failed switch-mode power supply somewhere.  This particular unit has an inductance of about 1mH per winding meaning that it has about 377 Ohms of impedance at 60 kHz and helps to prevent a ground loop and the coupling noise from the power mains.  If you replicate this circuit I would strongly suggest that whatever you use for L1 have at least a similar amount of inductance.  On either side of L1 are electrolytic capacitors (C1, C2 - preferably of low ESR types) to offer low impedance and a degree of reinforcement of common-mode rejection through L1 while C2 and C3 provide RF bypassing for the circuit itself.

A buffer amplifier consisting of Q1 - with a high-impedance input, but no actual gain - couples the signal from the existing antenna:  Having several k-Ohm of input impedance, it is unlikely to appreciably load the existing antenna system.  On the feed from the E-field whip, I simply installed a coaxial "T" connector to allow me to bridge across the signal feed rather than split the signal, which would have been complicated owing to the fact that the DC power for the whip was also being carried on that same cable.  The connection to the amplifier in Figure 3 was made using a very short piece of coaxial cable (about 2 feet long - less than a meter) and since this whip is not used for reception above about 500 kHz, neither its presence or that of the added amplifier had any discernible effect on the other received signals.

Coupling from the existing antenna are series components L2 and C4, selected to resonate at about 60 kHz:  The resonance is extremely broad, so finding a capacitor combination precisely equal to the "ideal" value of C4 - according to the formula below actually calculating as 0.007uF (7000 pF) - is unimportant.  This series resonant circuit is probably not essential and a simple coupling capacitor of 0.01uF (10000 pF) could be used (omitting L2 entirely) but I chose built it with L2 to broadly filter off-frequency signals - something that might be important if your E-field whip antenna doesn't have a low-pass filter to remove AM (Mediumwave) signals as mine does as well as to block any stray coupling of HF signals when I transmit.

Figure 3:
The circuit of Figure 2 built on a piece of prototyping board
in the case.  Bifilar choke L1 is on the right with the BNC
connector (J1, input) and output to the loop (J2) on the left.
Click on the image for a larger version.
The buffered signal from Q1 is then passed to amplifier Q2 which is configured to have "about" 15dB of signal gain.  This circuit is, perhaps, slightly more complicated than it needs to be, but with its feedback, it is very stable and tolerant of large signals.  The use of electrolytic capacitors for C5 and C6 is, perhaps, overkill (0.1uF ceramic would probably suffice) but I used them as they were handy.

As the signal from WWVB is quite strong at this location, there is only one stage of amplification shown in Figure 2, but if I lived more distant, greater overall system gain might be required.  Replicating the circuit involving Q2 (R4-R8, C5-C6) and cascading it with the existing amplifier would add yet another block of gain to boost the absolute signal level - but this would presume that whatever active antenna you were using outdoors to pick up the WWVB signal was working well, providing a "clean" signal and that the deficit was just in signal strength at the clocks rather than than signal-noise ratio.

Due to the smallness of the project box that I chose I couldn't mount the bifilar choke "through" the prototype board so it was mounted on the edge to minimize height.  To hold it in place I used UV cured resin along the edge to prevent it from breaking the pin connections mechanically:  UV cured resin is very handy as it's about a strong as epoxy, but it is cured almost instantly meaning that it's able to be handled immediately.  For the BNC connector, the one that I found in my parts bin didn't have its matching mounting nut, but more UV-cured epoxy did the job for that, too!  As can be seen in Figure 3, I didn't bother "mounting" the board in the box, letting it hang about on its own wires.

Indoor Coupling loop

The "coupling loop" - visible in Figure 1 and shown on the schematic - is just a loop of wire - and it is used to inductively couple the signals from the outside antenna to the clocks.  In my case, I measured a rectangle that would encompass both of the wall clocks and found a cardboard box with similar dimensions and on it I wound four turns of 22AWG hookup wire.  Connecting this loop to the amplifier, I used some shielded microphone cable:  Coaxial cable would have been fine as would just some single-pair speaker wire as this frequency is not all that much higher than audio!

Neatly forming the individual conductors, I used small "zip" ties to hold them together and with four screws, attached it to the wall, placing the clocks inside the loop of wire.  Within the loop, signals from the amplifier would be strongly coupled into the ferrite loopsticks in the clocks themselves - but being very small in terms of the 60kHz wavelength, this loop is unlikely to radiate more than a few feet/meter outside it.

To improve efficiency of the coupling loop I wanted to series-resonate it at around 60 kHz as this would increase the amount of energy transferred to the loop from the amplifier somewhat, effectively providing "free" signal gain.  Measuring the inductance of the loop I found that it happened to be about 22uH and using this simple formula, I calculated the value of C7 - the resonating capacitor in Figure 3:

LC = 25330/(FMHz)2

Where:

LC is the product of the inductance and capacitance (e.g. Capacitance in pF * Inductance in uH)

FMHz is the desired resonant frequency in MHz (e.g. kHz/1000)

Knowing that we have 22uH of inductance in the coupling loop and a frequency of 60 kHz (0.06MHz) we end up with "LC" being equal to 7036111.  Dividing this value by the known inductance of our coupling loop (22uH) we get  the capacitance, as in (7036111/22) = 319823pF, or 0.319uF.

Figure 4:
The finished amplifier in its box, hanging
out below the loop - connected, and in
service.  (It's just visible in the bottom
of Figure 1)

Click on the image for a larger version.

As 0.33uF (330000 pF) is the closest common capacitor value, I used that for C7.  Again, as with C4 and L2, the resonance is very broad and precision isn't too important.  The article linked near the top of this page goes into more detail on how one would construct and resonate a coupling loop.  Based on this formula, if I wanted to resonate the same loop for use with DCF77 at 77.5 kHz I would have picked a 0.18 or 0.2uF (180000 or 200000 pf) capacitor, instead.  Similar changes could be made to accommodate longwave time signals on other frequencies (e.g. 40 kHz, 50 kHz, 68 kHz).

The formula above can also be used to calculate the value of C4 with the 1mH (1000uH) L2 inductor:  If your interest was for another frequency, such as DCF77 at 77.5 kHz, C4 would be 0.0047uF (4700 pf), instead.

It need not be said that this loop should not be placed very close to whatever outdoor receive antenna you are using - but more than about 10-15 feet (3-5 meters) should suffice:  If they are too close to each other, feedback (oscillation) could occur - but as this loop is only around 0.01% of a wavelength in circumference it does not radiate efficiently at all - and since it's inductive, its signals won't efficiently couple to an E-field antenna, anyway.

In the diagram, C7, the resonating capacitor for the coupling loop, is shown at the amplifier - but it could have been placed at the loop itself.

Power supply  

First off, do not use a switching power supply for this device!

As noted, common-mode choke L1 was used to "decouple" the power supply from the amplifier - and also from the coaxial cable of the LF antenna.  To power this loop amplifier I would strongly recommend using ONLY a transformer-type DC power supply and NOT any type of switching power supply for the simple reason that the switching power supply will be comparatively noisy, and it - its harmonic - will likely operate at/near the frequency of WWVB or whatever time signal you are trying to receive.

This power supply does not need to be regulated:  Simple capacitor filtering with low-ish ripple (a few hundred millivolts) will suffice and any voltage between about 11 and 16 volts will work which means that about any old "wall wart" in that voltage range - regulated or not - would be fine.

Conclusion

Having had the parts on hand it took only a bit more than an hour to piece this together and almost as long to put it in the box seen in Figure 4.

When I forced both clocks to re-acquire WWVB's signal for syncing they immediately set themselves to the correct time and date - and since it had been the start of daylight saving time the night before but had not been able to synchronize prior to this - they "knew" the new, correct time, too!

* * * * *

This page stolen from ka7oei.blogspot.com

[END]

Sunday, May 17, 2020

A quick look at the QB-300 RF amplifier

Available from many surplus sellers (e.g. via EvilBay) - and (usually) for a reasonable price - is the QB-300 RF amplifier.  Originally made by Q-Bit corporation, this same device has borne several different manufacturers markings over the 30+ years since it was introduced - but it is (pretty) much the same device.
Figure 1:
The BNC-connectorized version of the QB-300.
This appears to be the "original" version, actually made by Q-bit
Corporation.  The voltage specification is slightly ambiguous, being
shown as "+15/24 Vdc".
Click on the image for a larger version.

Having several of these on-hand I decided to take a quick look at its apparent performance - with the general specifications for this device being listed below for your convenience:
  • Frequency range:  1 MHz-300 MHz
  • Gain:  23dB (or 24.5 +/- 1 dB, depending on source)
  • Gain flatness:  1 dB
  • Noise figure:  3.8dB (frequency not specified)
  • Input/Output VSWR:  <=1.5:1
  • Power output (1dB compression):  +22dBm
  • 3rd order Intercept:  +37dBm
  • Current consumption:  155mA (voltage not specified)
Depending on which data sheet you consult, there are a few discrepancies - for example:
  • The data sheet from "API Technologies" shows the input/output return loss as 1 dB - clearly a typo.
  • The maximum voltage rating is all over the map:  Some versions of the data sheet show a maximum of 20 volts, others show 24 volts.  The units that I have clearly show the voltage rating as being "+15/24Vdc" and the equipment from which it was pulled provided 24.0 volts.
Knowing the provenance of this equipment, I would have no problem running my amplifier from 24 volts, but based on the ambiguity of the data sheets, I would operate a version that did not explicitly specify 24 volts ONLY from 15 to 18 volts.

A quick test:

Curious about a few aspects of these amplifiers I decided to test it with my DG8SAQ Vector network Analyzer, checking its gain versus frequency in the input matching (e.g. S11) - the results being displayed in Figure 2, below:

Figure 2:
A sweep of the amplifier from 100 kHz to 500 MHz showing the apparent gain and input matching over the frequency range.  Because the DG8SAQ and the interconnecting cables are increasingly imperfect with increasing frequency, expect increasing uncertainty in the S11 readings above 100 MHz or so.
The gain, S11 and VSWR values at specific frequencies can be seen in the upper-left corner.
Click on the image for a larger version.
Of particular interest was the usability of this amplifier above and below its "official" frequency range - and we can see that it's probably useful down to at least 250 kHz and above 450 MHz, albeit at reduced performance (e.g. lower gain, maximum output power, increased noise figure, increased input VSWR.)  Specifically, I measured, below the 1 MHz minimum frequency specification:
  • The gain at 285 kHz was still above 21dB - a bit more than a 2 dB drop from the peak gain.  The input VSWR was still below 1.5:1.
  • The gain at about 200 kHz was around 18.7dB
  • The gain at about 173 kHz was around 16.8 dB and the VSWR had increased to about 2.7:1. 
Above the 300 MHz maximum frequency specification:
  • The gain was above 22dB at 400 MHz
  • The gain was about 21 dB at 440 MHz
  • The gain was around 18dB at 500 MHz.
The reader is reminded that it is likely that above and below the rated frequencies that the maximum output power - not to mention noise figure - is likely to degrade.

Gain versus operating voltage:

Figure 2 was captured with the unit operating at 18 volts and readings were taken at lower voltages, comparing the gain - but your mileage may vary:
  • Gain dropped by approximately 0.1 dB at 15.0 volts.
  • The gain was about 0.2 dB lower at 12.0 volts than at 18 volts.
  • The gain was about 1 dB lower at 8.0 volts than at 18 volts.
  • The gain was about 5 dB lower at 5.0 volts than at 18 volts.
  • The amplifier began to exhibit signs of low-frequency instability below 5 volts.

Although not directly measured, one should expect the maximum output power (P1dB) and the intercept point to drop below the specifications when operating it from lower than 15 volts:  The amplifier is likely to be perfectly usable in the 12-14 volt range, but it's likely marginal at 8 volts and below.

A peek under the hood:

Popping the top cover, we see this:

Figure 3:
A look inside the QB-300 amplifier:  The input and output is on the left and right sides, respectively.
Click on the image for a larger version.

 It is immediately apparent that this is not a run-of-the-mill consumer device:  Rather than a circuit board, the unit is built onto an alumina substrate with both soldering of components and spot welding of wires being used.  Two RF transistors are obvious:  The black, 3-lead device near the upper-left corner and the white ceramic device marked with "Q-21" just to its right.  The rest of the components are likely related to feedback/equalization as well as regulation of the operating and bias voltages for the RF devices.

Clearly, it's not hermetically sealed or conformally coated, so  weather protection is certainly warranted if this were to be operated outside.

Uses for this amplifier:

This amplifier was designed as a general-purpose gain block in the HF-VHF range, but it is likely useful into the low UHF range meaning that it should work from the 630 meter amateur band (on the low end) into the 222 MHz - and possibly the 70cm - amateur bands on the high end.

For general HF (amateur radio) amplification purposes, it should be an excellent performer - provided that one keeps in mind that it's gain may be a bit too high in certain applications in that a signal input level of a around -5dBm will push it into overload - and off-air signals of this strength might appear from:

  • Local AM broadcast stations.  Especially on a long wire antenna (longwire, rhombic, end-fed half-wave) these signals can, by themselves, overload the amplifier if you live anywhere near  a transmitter.  A simple high-pass filter can effectively reduce such signals and prevent overload.
  • High-power shortwave stations.  On a good antenna, signals on the 49, 41 and 31 meter band can be extremely strong in Europe and some parts of the U.S.
If you have strong signals that could overload the amplifier, beware using an attenuator on the input of the amplifier in your receive system.  As an example, if you wish to be able to hear the background noise at 10 meters to be able to hear the weakest possible signals you will need to make sure that your system noise figure is no more than about 15dB - but if you had a cable loss of 3 dB in "front" of your amplifier (between the antenna and the amplifier) and you used a 10dB attenuator in this signal path, you are already at 13dB - and the nominal 3.8 dB of noise figure of this amplifier will push that number to about 16.8dB meaning that your system noise will now likely be high enough that you can no longer hear atmospheric noise if you are fortunate enough to be in a very "RF quiet" location.

In short:  If you hear more noise when you connect your antenna system to your receiver system than when you connect it to a dummy load, you are OK - but if you can't hear the difference, your system will not be sensitive enough to hear the weakest signals.

For receive-only purposes it is often the case that with a low-noise amplifier, a good, quiet (in terms of noise) receive antenna will not need to have much gain from the antenna itself - and if the gain is low, you are less likely to intercept enough absolute signal power to overload the amplifier.  Here are just two of the many possible examples of antennas to consider:
  • Small receive loop.  This type of antenna - usually around 3 feet (1 meter) diameter for MF and HF use can offer local noise rejection as well as the ability to null signals from directions broadside the plane of the loop.  This type of antenna will have negative gain (e.g. less than 0 dBi) but its performance can be quite good with a decent, low-noise amplifier like the QB-300.  For an antenna like this, one would place the amplifier at the antenna to minimize cable losses.
  • Beverage on the ground.  Also known as the "BOG" antenna, this is simply a wire - as long as possible - laying on the dirt and working against a good (and electrically quiet) ground consisting of one or more ground rods and counterpoise wires and its feedline electrically decoupled (with a "current" balun) to prevent noise from the shack from being brought to the antenna.  This antenna - mostly useful in rural areas - is reported to work well overall despite the likely "negative" gain.  As with the receive loop, it's best to place the amplifier at the antenna feedpoint.
Amplifier and receiver protection:

It should go without saying that any amplifier (or receiver) connected to a large antenna should be preceded by adequate lightning protection to prevent damage to the amplifier from wind static/discharge and nearby lightning strikes as depicted in Figure 4, below.  Such filtering should be placed after any filtering that might precede the amplifier.

Decent protection can be had with four ordinary silicon diodes - two series pair connected anti-parallel (back-to-back) with a bleed resistor (4.7-100k) to shunt voltages above about 1.2 volts.  It's worth noting that the amplifier itself would already have overloaded before signals can a high enough level to cause the diode protection to conduct and cause distortion!
Figure 4:
Depiction of simple input protection circuitry.
On the left, the diodes ("D") are ordinary silicon diodes connected in series for approximately 1.2 volts of conduction.
On the right, a common full-wave rectifier module is used with its DC "output" shorted, providing an equivalent to the circuit on the left.  It is suggested that a low current (2-5 amp) rectifier be used.
The voltage rating of the diodes is not particularly important - a 50-100 volt rating being just fine.
Resistor "R" is not critical and can be anything from 4.7k to 100k and it is used to dissipate any accumulated DC in case the antenna itself does not have a DC ground.  An inductor can be used in addition to or instead of "R" - a value of 22-100uH (e.g. 8-10 turns on an FT50-75 toroid) being suitable for 630-10 meters.
Click on the image for a larger version.

Provided that one avoid excessive signal input level, it can also be used as the basis for a receive multi-coupler.  For example, following the amplifier with an 8-way RF splitter - which, itself, will have a loss of around 10dB - the overall gain will be in the range of 14dB while preserving the system's overall noise figure to allow reception of weak signals on the higher HF bands.

This page stolen from ka7oei.blogspot.com

[End]

Wednesday, September 28, 2016

Automatic volume tracking for a TV

A couple of years ago I was given a non-working 50" Philips flat-panel TV.  As is often the case with these things, there was actually very little wrong with it and in this instance it was a pair of bad capacitors in the power supply, costing about $3 to fix.

With the working TV, I now had another problem that is all too common:  The internal speakers sounded terrible!

Rummaging around my storage room I found an old JVC 35 watt/channel audio amplifier/tuner from the 1980's and using the "audio output" on the back of the TV I connected it to the amplifier and that to a pair of high-efficiency JBL 12" 4-way speakers:  It sounded pretty good - lots of volume, good highs and thundering bass with "only" 35 watts (I wouldn't need a subwoofer!) - but the volume control had no effect.  Finding another cable, I then tried the headphone jack on the side of the TV, but its volume wasn't affected even though the speaker was muted!

WTH, Philips?!?

Figure 1:
A view of the volume tracker showing the connections,
indicator and controls.
I've seen this same issue on at least one other TV, but with some of TVs one can find an option - often deep in a configuration - that makes the audio line output track the volume control - but not this one.  What this meant was that if I was using an external audio amplifier and I wanted to be able to adjust the TV volume with a remote I would need either two remotes, or program a universal remote to do the task.  This latter point isn't too much of a problem as there are many universal remotes that can be configured to split tasks amongst different boxes, but the audio amplifier that I was planning to use (and the only one that I had that would fit in the TV stand)  - the 1984 JVC tuner/amplifier - did not have a remote.

So, I did what any nerd type would do:  I threw a computer at it!

It occurred to me that I did have a reference on which I could base an outboard volume control:  The internal speakers of the TV.  I surmised that I could "listen" to the audio level coming out of the speakers, compare it to the fixed-level audio line output from the TV and based on that, adjust the volume of an outboard amplifier based on the difference.

I figured that this could work if I could place a sense microphone very close to the speaker and in this way the sound level at the microphone would be very high as compared to the room volume of the external loudspeakers and I could make it so that not only would the TV's internal speakers still be quite low for a fairly high volume from the outboard speakers.  Doing this would also minimize the effect of the sound from the outboard speakers being picked up by the microphone which could cause the volume to increase even more in a feedback loop.

Comment:
Instead of using a microphone I could have tapped into the audio from the internal speakers, but moving this heavy TV and taking it apart is quite difficult with just one person - and I wanted to try out the "microphone" approach, first.
If I have reason to take this TV apart in the future I may add an external connection to one of the speakers via a resistive pad and 1:1 isolation transformer.

To test this theory I hacked together a bit of code that did nothing but measure the audio level from two sources:  A microphone and the audio line output and then dump those levels, in dB, to the serial port where I could see what was going on.  It seemed to look pretty good as the two audio sources seemed to track fairly well.

I could now get down to the task of writing some software and building a dedicated board.

Using 5 MIPS of computing power to adjust a volume control

I chose a PIC16F88 for this task.  This processor has a whopping 368 bytes of RAM and 8 kwords for program space and it also has an onboard 10 bit A/D converter and UART so that it can both accumulate analog data (audio, in this case) and send out statistics to a serial port so that the results could be analyzed.

Several years ago I'd written some code for the PIC (in C) that took audio fed into the A/D port. calculated the average level and spat it out in dB below "full scale" of the A/D converter - all based on integer math - and in comparing it to a genuine, mechanical VU meter I found that it matched quite closely.  In testing, this code seemed to be perfectly capable of providing accurate readings (to within better than 1dB) to about 100 kHz - a frequency well above the actual sample rate.  With 10 bits of A/D conversion and the use of  (at least)16 bit integer math, I had a usable dynamic range of a bit over 60dB due to "oversampling".

Starting with that code I rewrote it so that it would be able to take two separate channels of audio and produce the sound level, in dB, at an update rate of about 10 readings per second.

In a nutshell, the code works like this:
  • In an interrupt, an A/D reading is taken from audio channel A and converted to a signed integer.
  • At the next interrupt, an A/D reading is taken from audio channel B and converted to a signed integer.
  • On the fly, after each channel is taken the following "pre-processing" is done to each channel.
    • The absolute value of that A/D reading is taken and summed with past readings from this same channel using a 32 bit accumulator.
    • Any instances of hitting "at or near maximum" on an A/D converter set a flag to indicate that we have "clipped" our audio and that the results may be suspected to be bad.
    • This "interleaving" of A/D accumulation and readings helps assure that both channels are treated the same way and get similar results.
  • Once the sum of 500 pairs of data had been taken the code signals via a flag that new results are ready.  Since we have only one A/D converter, we can't digitize both channels simultaneously so spreading the readings over time helps assure that the readings would be very similar if the same audio were present in both channels.
  • The main code copies the results of the accumulated data, clears the summing registers and restarts the interrupt so that new data can be gathered.
  • The sums of the absolute values of each audio channel are then converted into two separate dB readings using a set of lookup tables and interpolation, the result being accurate to within 1dB.  Obtaining a numerical reading in a logarithmic scale such as deciBels is important since ratiometric differences in the two channels can be easily compared regardless of the absolute amplitude.
  • Knowing the difference between the two audio sources (e.g. the "line in" from the TV and the audio level being detected from the speaker) a lookup table is referenced to set the digital potentiometer in the the line level audio path to the power amplifier as needed to provide the appropriate change of audio being applied to the amplifier:  The higher the detected amplitude from the speaker with respect to the audio on the line in, the lower the attenuation between the line in and the amplifier and the louder the amplified sound.
Comments:
As noted above the audio is being "undersampled" since the frequency of the audio content exceeds half the actual sampling rate - and also that because there is only one A/D converter that is multiplexed, the two audio sources, the microphone and program audio, are not being sampled at exactly the same time.

For our purposes, this is irrelevant as audio is generally redundant in the nature - and we are looking at absolute voltage levels rather than anything having to do with spectral content.  What this means is that if you feed the same content into both inputs at the same time, you get completely identical results from the VU meter readings with the amplitude staying flat within 1 dB to about 100 kHz - the frequency that is (more or less) limited by circuit capacitance.
Because we are comparing two ostensibly identical audio sources there isn't any need to apply any "weighting" to the readings other than what is done already.
Having converted the audio levels to dB readings actually makes the task of comparing audio levels much simpler as our two audio sources - a sample of the line out from the TV and the audio from the TV's speaker - should following each other, differing only in the loudness difference between the two sources.  In other words, all I really needed to do was to adjust the audio line output level so that it tracked the audio level difference between the two sources:  If I increased the audio level to the speaker by 6 dB, I would see that in the output from the microphone and know to increase the line output to the audio amplifier by 6dB as well.

Figure 2:
The "guts" of the volume controller.  In the upper left one can see U1, the input and output buffers and to its
right U2, the electronic potentiometers.  In the lower left is U3, the microphone and comparison
filter/amplifiers and in the upper-right, U4, the PIC16F88 processor.  Just below U4 are the
power supply components.
Click on the image for a larger version.

Sounds simple, right?

Actually, it's fairly tricky when you get right down to it.

While 60dB sounds like a lot of audio range - and it is, in fact, a million-to-one level difference - it turns out that we can easily experience this in normal TV programming between a loud explosion and very quiet parts of the audio, particularly when you take into account the fact that one could easily use at least 30dB of that range in the volume control alone!

Since this PIC has only a 10 bit A/D converter, the range was theoretically limited to about 60 dB so I configured each audio channel to have a switchable "high/low" gain setting so that an extra 20 dB or so could be measured.  Since that amount of gain difference was always the same when I switched settings, I could simply add that gain into the appropriate dB reading to compensate for the difference.  The way this worked was that if I saw an audio level that near the bottom of the usable range (say, 40-50 dB below full scale), I would switch in the extra gain but if it was too high (perhaps within 10-20 dB of full scale) I would switch it out.  The result was that I now had about 80 dB of usable measurement range - not bad for a cheap computer chip with only 10 bits of A/D and a couple of op amps!

Knowing when not to act:

There's yet another problem to consider.  If we have audio from both the line input and the speaker, we can easily make a comparison and determine which is louder/quieter, but what if the audio from one source - or both sources - is too low to make a valid comparison?

An obvious example of this would be during a brief pause at the time of a commercial break - or, perhaps, when you are loading a video disc or waiting for a program stream to start.  If you didn't detect the "silence" and prevent the unit from adjusting the volume control, it would probably go out into the weeds whenever it was "too quiet."  The work-around is, of course, to have the computer detect quiet parts and not make adjustments at those times.

Another time during which we should not act is, as noted above, during those instance when we suspect that one or both the input channels is clipping:  That's easy - just set a threshold above which you do not make any decisions to adjust the volume.

Another concern is clipping - which can come from several sources.  As noted previously, too high an input level could exceed the dynamic range of the A/D converter on the PIC and if this happens, two things can occur:
  • Our readings are bogus since we don't know by how much the audio exceeded the range.
  • On the PIC - as is the case with many CMOS analog MUXes - if you exceed the voltage range of the input by going above the supply voltage or below ground you can affect the other A/D channels - even if they are not selected.  In other words, clipping in one channel will probably wreck the readings in the other channels as well!
If the gain of an audio channel has already been set to "low" and we are still clipping in that channel, the proper course of action would be to simply ignore that reading:  If the clipping is happening fairly infrequently, we can afford to do this as we will soon get another reading that we can use.

Figure 3:
The automatic volume tracking box, sitting behind and under the TV.
Another source of clipping can be the TV's own speaker amplifier and/or the microphone near it.  Since the sense microphone is placed right in front of the speaker it is possible that on audio peaks we could hit the maximum level of which it is capable.  This condition is a bit harder to detect since we aren't actually causing clipping of the A/D converter in this case so all we can really do is to be careful in the initial setup of the system so that we don't encounter either instance.

Differences in audio sources:

One problem with using a microphone to pick up speaker audio is that the audio detected via that route will not sound the same as the "pristine" audio output from the back of the TV.  This inevitable result is due to neither the speaker or microphone being perfect in their ability to faithfully produce their outputs:  There will always be at least a small difference due to frequency response differences and mechanical resonances.

In order to minimize these differences I decided to purposely limit the frequency range over which the audio from either the microphone or the line out would be analyzed and this was done using a low-Q 1 kHz bandpass filter.  The idea here is to pass audio only in the low-middle range of what can be heard and the general audio range in which most of the audio is actually present.  The "low Q" audio filter means that while its passband is centered at 1 kHz, it doesn't attenuate lower or higher frequency particularly quickly - but it is sure to knock down the low bass or the highest treble significantly - those being the frequencies at which the speaker/microphone combination is likely to have the least fidelity and depart from the sample from the line input.

Putting it all together:

The schematic diagram of this circuit is shown below.

Figure 4: 
Schematic diagram of the automatic volume tracker.
Click on an image for a larger version.

Only the left channel audio path will be described:  The right channel audio path is identical.

The audio from the TV's LINE OUT is fed in via C101 to a unity-gain follower op amp circuit (U1a) which is biased by R101 at a mid supply voltage, 2.5 volts.  The output of U1a is then fed to an electronic potentiometer, U2a which is also biased from the mid-supply voltage so that variations in U2a's settings do not cause a DC offset to occur.  The "wiper" of the U2a potentiometer is connected to another unity-gain follower, U1d which is then connected to the audio output.

Because unity-gain followers are used, there is no audio gain provided in this circuit, but setting the electronic potentiometer to "full scale" will result in very little attenuation of the audio being passed through the system, pretty much as if this entire circuit were bypassed.  When the electronic potentiometer is at the bottom end of its scale the attenuation is over 50 dB - more than enough range for our purposes.

Because there is only one "sense" microphone, jumper JP1 is used to select the corresponding LINE IN audio channel for the channel being monitored with the microphone:  Since it it is common for the left/right channel content to differ quite considerably in stereo programs, it is important to make sure that JP1 is set to match the speaker being monitored by the microphone.

From JP1 the selected signal goes to a 20-ish dB pad consisting of R301/R302 and then to a non-inverting amplifier built around U3a.  It may seem odd to attenuate a signal just to amplify it again, but this configuration was made during the initial design stages when it wasn't certain what the absolute audio levels would be.  It was also desired that both channels have similar circuitry and as such, amplifier U3a's gain adjustment mechanism would work only if it had a fairly high gain to begin with.

If the processor detects that the line level audio is too low, it sets the PROG_GAIN line to a LOW state, effectively grounding it and the bottom end of R304 and causing the gain to increase by nearly 20dB.  C302 is used to prevent this action from causing a DC bias offset and R305 provides a bit of constant leakage to prevent C302 from discharging if the amplifier is in the "Low gain" mode (e.g. the "PROG_GAIN" pin set to a high-impedance state.)  Conversely, if the audio is high enough that the extra 20dB is not needed, this pin is switched to be a digital input where it may float.
Figure 5:
Placement of the "sense" microphone:  Against the speaker!
Surprisingly, the microphone doesn't seem to be very prone
to "clipping" or saturation even at high speaker volume
levels - something that could skew the comparison. The
microphone is taped at the edge of the cone using
polyimide tape, mostly out of sight.

In testing, it was noted that better performance was obtained by setting the PIC's input to a "Digital input" mode rather than an "A/D" input mode, this being due to the fact that because of C302, the signals on this pin swing below ground potential.  When this happened while in "A/D input" mode the other A/D channels (on the same MUX) were badly disrupted and excessive clipping on the input of that pin caused audio distortion on U3a as well as affected the apparent gain of the stage as well.

From U3a the LINE audio signal passes through a low-Q audio bandpass filter consisting of U3d centered at about 1 kHz.  This filter's passband is (more or less) in the middle of the audio spectrum in which much of the energy of speech and music is contained and the thought is that discrepancies between the qualities of the audio directly coupled from the LINE input and those picked up by the microphone after they have first been reproduced by the speaker will be reduced.

By the time the audio leaves U3d, the bandpass filter, its level is close-ish to 5 volts peak-peak for the highest level audio that would be present with U3a in the "low" gain mode - this being done to maximize the dynamic range of the PIC's A/D converter.  By virtue of the AC coupling of the bandpass filter (via C303) and the 2.5 volt bias on U3d, pin 12, the output of the filter is also centered at 2.5 volts, mid-scale for the PIC's A/D converter.

The audio from the microphone follows a similar path except that its variable-gain amplifier, U3b, has more maximum gain to compensate for the relatively low level from the microphone as compared to the LINE input.  As with the LINE audio, it too is bandpass-filtered at 1 kHz, this time by U3c, the output of which is sent to the PIC.

Monitoring and adjustment:

One may notice that there is also a serial port (output) shown on the diagram, the DE-9 connector being just visible in Figure 3 along with "Gain+", "Gain-" buttons and a dual-color LED.  In operation the serial output is constantly sending the detected microphone audio level, the program audio level, the difference between the two, the difference between the actual audio level and the level predicted based on it and the gain setting and whether or not the A/D was at or near clipping.

During TV program audio - particularly at a high volume level - this "telemetry" data is used to determine how well the device is tracking the audio and whether adjustments are needed using the "Gain+" and "Gain-" buttons which adjust how speaker audio correlates with the attenuation that the processor applies to U2, the digital potentiometer and save the settings in the processor's nonvolatile (flash) memory. The LED is used to provide a visual indication of what the devices is doing:  Red indicates that the audio "gain" is being increased (e.g. the attenuation of U2 decreased) while green indicates a decrease in audio gain while a yellow color - created by the processor switching between red and green rapidly - is used to indicate that U2 as at minimum attenuation - which is the same as maximum volume.

How well does it work?

I've been using this on the TV for nearly 3 years now and only tweaked the code slightly after installing it.  At low volume levels it does tend to "hunt" a little bit (e.g. volume go up and down several dB - usually not noticeable) with differing program material - likely due to some "spillover" from the large, room speakers into the sense microphone, but at normal volume levels it is quite consistent.  There are a few instances that do still cause it to "hunt" (some types of music, a few specific voices) but its not been severe enough for me to record such clips to the DVR and try to figure out what, exactly is happening.

[End]

This page stolen from "ka7oei.blogspot.com".

Monday, November 9, 2015

Repairing the TUNE capacitor on the Heathkit HL2200 (SB-220) amplifier

Figure 1:
The front panel of the HL-2200 amplifier - which is really just a slightly
modernized version of the SB-220.
Click on the image for a larger version.
Earlier this year I picked up a Heathkit HL2200 amplifier (the newer, "brown" version of the SB-220) at a local swap meet for a reasonable price.  What made it particularly attractive was that it not only had a pair of new, graphic 3-500Z tubes in (Chinese-made, but RF-Parts Inc. tested/branded) but it also had a Peter Dahl "Hypersil" tm power transformer rather than the "just-adequate" original Heathkit transformer and an already-installed circuit that allowed the milliamp, low-voltage keying rather than the 100-ish volts of the original.

Obligatory Warning:
The amplifier/repair described on this page presents lethal voltages in its circuits during normal operation.  Be absolutely certain to take any and all precautions before working on this or any piece of equipment that contains dangerous voltages!
This amplifier was unplugged and the built-in high-voltage safety shorting bar operated by removing the top cover was verified to be doing its job.
DO NOT work on equipment like this unless you have experience in doing so!
 Problems with the amplifier:

While it was servicable as-is, it did have a few known issues, namely a not-quite-working "10 meter" modification (the parts are all there, apparently having been pulled from an old SB-220 or from the previous owner having obtained a "10 meter" kit) but my interest at this time was the tendency of the "Tune" capacitor of the output network to arc over at maximum RF output power.

Figure 2: 
Some "blobs" on several of the rotor plates of the TUNE capacitor.
 Click on the image for a larger version.
If I operated the amplifier in the "CW" position with just 2.4 kV or so on the plates (at idle) everything was fine, but if I switched to the "SSB" position with 3.2 kV (at idle) then the capacitor arced over, causing signal distortion and high grid current - not to mention a loud hissing and the smell of ozone.  In popping the cover (with the power removed and the shorting bar doing its job!) I could see a few "blobs" on some of the capacitor plates which meant that when this had happened to the previous owner, it had probably been in sustained operation - obviously long enough to cause parts of some of the aluminum plates to be melted, further decreasing the distance between plates and increasing the likelihood of even more arcing!

Figure 3: 
In the center of the picture, a rather serious "blob" on one of the stator
plates.
Click on the image for a larger version.
After having had this amplifier for several months and operating it only at reduced power I finally got around to taking a closer look at what it would take to extract the TUNE capacitor and effect a repair.  Even though it is slightly cramped, it wasn't that difficult to do:  Remove the front-panel knob,  the left-hand tube, disconnect the blocking cap from the TUNE capacitor, remove the rear screw and nut holding it down and loosening the front screw and nut and pulling out the capacitor.



Disassembling the capacitor:

Fortunately, the capacitors used in these amplifiers are constructed from lots of small pieces rather than, like some "high-end" capacitors, press-fit into finely-machined rods and brazed.  What this meant was that simply by undoing a few bolts and screws the entire tuning capacitor can be reduced to a large pile of spacers and plates!

Figure 4:  A pile of parts from the disassembled rotor.
The still-intact stator is in the background.
Click on the image for a larger version.
The capacitor itself was disassembled in a shallow cookie sheet that I also use for assembling SMD-containing circuits:  It was fairly likely that any small part will be trapped in this pan rather than wander off elsewhere, such as onto my (messy!) workbench or, even worse, disappear into the carpeted floor!  Because this capacitor has several small parts and many spacers I felt it prudent to take this precaution - particularly with respect to the small ball bearings on the main shaft and the single bearing at the back end of the capacitor:  These smallest of parts were carefully sequestered in a small container while I was working on the capacitor.

Once the capacitor was "decompiled" all of the plates were very carefully examined for damage and it was found that there were two rotor plates and just one stator plate with large-ish blobs and some very minor damage to one or two other plates.  As is the nature of these things, it was the blob on the stator plate that was the most serious as it was the "weakest link" in terms of breakdown voltage and was always the smallest distance between two points no matter the setting of the capacitor (rotor) itself.

"Fixing" the damage:
Figure 5: 
The most badly-damaged capacitor plates, with an undamaged stator plate
(upper-left) for comparison.  The surfaces show evidence of oxidation
due to arcing.
Click on the image for a larger version.

If the damage is comparatively minor, as was the case here, then the "fix" is fairly simple:
  • Identify all plates that have any sort of "blob" or sharp edges.
  • Grind down any raised surface so that it is flush with the rest of the plate.
  • Using very fine sandpaper, eliminate any sharp edges or points.
If the plates are hopelessly melted you have the option of finding another capacitor on EvilBay, making our own plates, or simply cutting away the mangled portion and living with somewhat reduced maximum capacitance:  It is unlikely that the loss of even one entire plate would make the amplifier unusable on the lowest band, and it is also unlikely that more than two or three plates would have sustained significant damage, either, as this sort of damage tends to be somewhat self-limiting.

Placing a damaged plate on a piece of scrap wood, a rotary tool with a drum sanding bit was used to flatten out the "blob" on each of the three damaged plates.  Once this was done the plate was flat, but it was not particularly smooth, the rather coarse sandpaper having left marks on the plate, so I attacked the plates that had been "repaired" with 1200 grit wet-dry sandpaper and achieved a very nice luster where the grinding had taken place.  I also took special care to "ease over" the edges of the plates to remove any sharp edges - either from the original manufacturing process (stamping) or from the grinding that was done to remove the blob:  This is important as sharp edges are particularly prone to leading to ionization and subsequent arcing!

Because many of the plates showed some oxidation I decided that, while I had the capacitor apart, to polish every single plate - both rotor and stator - against 1200 grit "wet/dry" paper and, in the process, discovered several small "burrs" - either from minor arcing or from the plate having been stamped out of a sheet of metal.  I also took the trouble of "easing over" all edges of the capacitor plates in the process:  Again, sharp edges or points can be prone to arcing so it is important that this be considered!

Once I was done I piled the plates into an ultrasonic cleaner containing hot water and a few drops of dishwasher soap and cleaned them, removing the residual aluminum powder and oxide.  After 2 or 3 cycles in the cleaner the plates were removed and dried yielding pristine-looking plates - except, of course, for the three that had been slightly damaged.

Reassembly:

Figure 6: 
A rotor and stator plate having had the "blobs" ground off, but not yet
having been polished with 1200 grit sandpaper.  A bit of lost
plate material is evident on the left-hand side of the round rotor plate
as evidenced by its assymetry.
Click on the image for a larger version.
I first reassembled the stator, stacking the plates and spacers in their original locations and making sure that none of them got "hug up" on the rods with the last stator plate to be installed being the one that had been damaged.  The rotor was then reassembled, the job being fairly easy since its shaft is hexagonal, "keying" the orientation of the plates.  Because there had been two plates that had been damaged, I placed these on the ends so they were the first and last to be installed:  There is one more rotor plate than stator plate which means that when fully meshed, the two "end" (outside) plates are on the rotor.  Even though I was not particularly worried about it, by placing the "repaired" plates at the ends it would be possible to bend them and increase the distance slightly if they happened to be prone to arc without significantly affecting the overall device capacitance.

Having degreased the bearing mounts and the ball bearings themselves I used some fresh, PTFE-based grease to hold the bearings to the shaft while it was reinstalled, using more of the same grease to lubricate the rear bearing and contact, aligning it carefully with the back plate and finger-tightening the screws and nuts.  Once proper positioning was verified, the screws and nuts holding the end plates in place were fully tightened.

Both the rotor and stator plates are mounted on long, threaded rods with jam nuts on each end and by loosening one side and tightening of the other it is possible to shift the position of the rotor and/or stator plates.  Upon reassembly it was noted that, unmeshed, the rotor plates were not exactly in the centers of the stator plates overall so the nuts on the rotor were loosened and retightened as appropriate to remedy this.  On fully meshing the plates it was then observed that the stator plates were very slightly diagonal to the rotor plates overall so the appropriate nuts were adjusted to shift the positions of those as well.  The end result was that the majority of the rotor plates were centered amongst the stator plates - the desired result, as the capacitor's breakdown voltage is dictated by the least amount of spacing at just one plate.
Figure 7: 
The reassembled TUNE capacitor with a slightly foreshortened
and "repaired" rotor plate at the far end.
Click on the image for a larger version.

Inevitably there will be a few plates that are closer/farther and/or off center from the rest and that was the case here so a few minutes were taken to carefully bend rotor and/or stator plates, using a small blade screwdriver, as needed to center them throughout the rotation.  When I was done all plates were visually centered, likely accurate to within a fraction of a millimeter.

The capacitor was reinstalled quite easily with the aid of a very long screwdriver.  The only minor complication was that the solder joint for the high-frequency end of the tank coil - the portion that consists of silver-plated tubing - broke loose from the rest of the coil, but this was easily soldered by laying the amplifier on its left side so that any drips fell there and not into the amplifier.

"Arc" testing:

After reinstalling the top cover, verifying that it pushed the safety shorting bar out of the way, and installing the many screws that held it and the other covers in place I fired up the amplifier into a 50 ohm dummy load and observed that at maximum plate voltage and with as much input and output power as I could muster, the TUNE capacitor did not arc!

One of these days I need to figure out why the 10 meter position on the band switch isn't making proper contact, but that will be another project!

[End]

This page stolen from "ka7oei.blogspot.com".