Wednesday, September 26, 2018

A simple 8-channel receiver voting controller for enhanced repeater coverage and usability


One of the often-overlooked means of improving the coverage of an amateur radio repeater is the use of multiple receivers in a voting configuration.  It's often the case that a user can hear the repeater fine, but for whatever reason cannot get back into it - particularly if they are using a portable radio (a handie-talkie) and a compromised antenna, such as a rubber duck antenna.  By extending the reach of the receive portion of the system with several geographically disparate receivers on the same frequency the effective, usable coverage can be increased without the need to have a linked repeater system - which may require additional frequencies - and it reduces the necessity of the user to switch between linked repeaters to maintain coverage.

While this article describes a specific 8-channel voting system, it should contain enough information to be able to implement a similar voting controller using other hardware.

Why a voter?

Figure 1:
As-built voting controller board.
The small board contains 8 LEDs to indicate which receiver(s)
are active and being voted.  This voting controller
has been in service for about 15 years - and this picture,
from a very early digital camera, is lower resolution than
one might like.
Click on the image for a slightly larger version.
Why improve the receiver coverage without a commensurate improvement in transmitter coverage?  This makes sense if the repeater is an "alligator" - that is, "big mouth, small ears" where it can be heard over a wider area than it is often possible to get into it - something that is particularly true for users of handie-talkies - especially when the repeater itself may be located at a "busy" RF site with a high noise floor that limits the sensitivity of co-located receivers.

The use of "extra" receivers also takes into account an important property related to how hams actually use repeaters:  When the signal from the repeater is weak, the user will jockey about to find a "hot spot", but when transmitting to the repeater there is no obvious means of feedback to help that same user find reciprocal hot spot - which may or may not be in the same place as for the receive.

A more subtle  problem with transmitting is that user naturally places the radio very close to their face which may not be conducive to the best transmitted signal to the repeater and it is the tendency for many people to "drop" their radios a bit, holding the antenna in a way other than vertical - something that often goes unnoticed because, while transmitting, they cannot know the quality of the signal making it to the repeater and adjust their position accordingly.

How it works:

When an FM signal gets weak, it doesn't get quieter - it gets noisier - and we can use this property to determine which, among several receivers, is getting the worst signal(s) - but how do we do this?

Figure 2, below, shows what happens.
Figure 2:
A graph representing the relative amplitude of noise with strong weak FM signals.  It is the upward tilt of the noise energy to which "Triangle" noise refers - the angle getting "steeper" as the signal degrades.  Also represented is a high-pass filter that removes the modulated audio, leaving only the noise to be detected.
From this diagram one can begin to see why pre-emphasizing audio along a curve similar to the "weak signal noise" line can improve weak-signal intelligibility by boosting the high-frequency audio on transmit (and doing the inverse on receive) to compensate for the noise that encroaches on weak signals.

When the signal is strong, the noise in the background is at quite a low level - often inaudible but as the signal gets weaker, the noise increases in amplitude with the noise at the highest frequencies getting stronger more quickly.  Because the audio (e.g. voice) occupies the lower frequencies, if we look only at the higher frequencies, we can detect this noise, more or less independently of the audio.

With amateur radio, however, we don't really us "FM" (Frequency Modulation) per se, but rather "PM" (Phase Modulation) or its equivalent.  Saving a complicated explanation and some math, the reason for doing this can be divined by taking another look at Figure 2, above.  What one notices is for a given signal - strong or weak - that the amplitude (loudness) of the noise increases with frequency.  What this means is that if we were to use "true" FM (whatever that is) on a weaker signal we would hear sharp-timbered noise at higher frequencies creep in to the signal.

In an effort to reduce the effects of this noise, in Amateur Radio the "highs" of the transmitted audio are pre-boosted (called "pre-emphasis") to counteract this effect and on the receive side, they are then "un-boosted" (called "de-emphasis") to restore them to their original frequency response.  Because of this "un-boosting" the high-pitched hiss is also reduced and the end result is that when one hears hiss on a weak signal on, say, 2 meters, the noise doesn't have that high-pitched timbre, but it sounds rather like white noise.  This has the overall effect of reducing the amount of noise that is perceived on a weak signal, allowing such signals to sound better than they would were it not for this combination of "pre" and "de" emphasis.
Figure 3:
A typical squelch circuit found in FM receivers.


An analog representation of a squelch circuit may be seen in Figure 3 with the audio typical taken from the discriminator of the receiver, before the de-emphasis as we actually want to preserve this high-pitched (ultrasonic) noise.  What all of this means is that if we have several identical receivers listening to the same frequency, we can tell something about how "good" the signal is simply by comparing the amount of this high-pitched noise is coming out of them:  The one with the highest amount of noise represents the weakest signal.

Comparing remote receivers:

The comparison of this noise is easily done if all of the receivers are located in the same place, but what about the typical situation where the receivers may be scattered about, being "connected" to the common point via radio links?  The problem with doing this is that the high-pitched noise due to weak signals received via the remote receiver can't easily be transmitted via the link owing to bandwidth concerns - and if we were to try to do this, the squelch on the link receiver itself may be fooled into thinking that the retransmitted noise was actually on the link.

For practical concerns, audio transmitted by an amateur FM transmitter is typically low-pass filtered around 3 kHz so that much of the audio above this would be just  noise in the case of a weaker signal, but in a link from a remote receiver we would take this receiver's audio - and its noise - and cut it off, causing us to lose that ultrasonic energy that we'd use to determine the signal quality.

While we would normally use this ultrasonic noise for squelch threshold determination, we can still use what is left to compare two signals.  When we listen to an FM signal with our ears, we can tell if it is weak because we hear noise in the background - and the level of this noise is constant, whether the signal is being modulated by the user's speech or not.  What this means is that if we simply look at the audio coming from two receivers - and compare them - the one that is weaker will have audio plus noise and will, overall, be a bit louder.  If we filter this audio a bit, keeping only the higher-pitched audio - say, that above about 2 kHz - we can more easily make this comparison as most of the audio power of speech is located below 2 kHz, so what we get is a greater percentage of noise and less voice, making the determination easier with simple circuitry.

In the case of the voting controller described, the method of "the lowest noise above 2 kHz is the best signal" is used.  This makes it fairly easy to use several signals from disparate receivers to achieve a comparison.

Comment:
There are other methods of determining "which is the weakest signal" - but they all rely on determining which signal is noisiest.
Another method that is used by some voting systems - one that does not rely on high-pass filtering - is an "inverse peak" detector that measures the maximum "quiet-ness" of the signal being received.  By determining how quiet the "quiet parts" are (between words, etc.) the best signal may be determined because a noisy signal will have more noise in the quiet parts than a "full quieting" signal.  This method typically employs a logarithmic detector to permit useful measurement of the wide dynamics between audio peaks and dead silence.   

A simple voting controller:

Figure 4, below, shows the schematic of the voting controller.


To simplify things, this voting controller sits in "front" of an ordinary repeater controller, taking the audio and COS inputs from the various receivers and outputting a single audio and COS signal.

If the repeater system in question uses subaudible tones, it is recommended that "discriminator" audio (e.g. that which has not been de-emphasized) that has not been subject to a squelch or tone detector audio gate be applied to the voting controller from the link receivers as well as any "local" receivers as this will assure that the voted audio will contain the subaudible tone.

By having audio that is not gated by the squelch or tone detector the response of the voting receiver system will be much faster and less-subject to drop-outs as it moves between receivers.  Having the subaudible tone detector following the voter will assure faster, more consistent operation, provided that one is careful to make sure that the received phase of the subaudible tones being received by all receivers (e.g. from a single transmitter being heard by all receivers) is as close to the same as possible.

Figure 4:
 The schematic of the as-built voting controller.
An alternate notch filter is depicted in Figure 6, below.
Click on the image for a larger version.
How it works:

Microcontroller:

The heart of the voting controller is U8, a PIC microcontroller.  Originally, a PIC16C84 was used with an R/C clock oscillator - but this device has long been discontinued, but a minor firmware change was made several years after it was put into service and was replaced with a somewhat more modern, pin-compatible device like a PIC16F628 or PIC16F819.  Even a more modern device like a PIC16F88 or a PIC16F1847 could be used with no wiring changes. Because there are no critical timing requirements, the on-board oscillator is used.

The job of the microcontroller is simply to look for active COS inputs and then select the audio sources and do a "noise comparison" to see which one is best and select it.

Audio source selector:

There are really two identical audio source selectors:  For the moment we'll talk only about "MUX A" using U2.

U2, a CD4051 CMOS 8-channel MUX is used to select the audio inputs:  This device is a genuine 4000-series device and is run from the 12 volt supply to minimize its internal resistance as well as allow the widest-possible swing of the input analog voltages.  To interface it with the 5 volt logic of the PIC, Q1-Q3 are used for logic level conversion, the "inverting" of the bits taken care of in software.

For U2 (MUX A) the selected audio also gets buffered by U4D which is passed to the repeater controller as the "voted" audio.

High-pass filter/noise detector:

Each of the MUX's inputs are capacitively coupled and biased at mid-supply (approx. 6 volts) and the selected output is buffered by U5A, a unity-gain follower and then applied to a 3 kHz high-pass filter.  This high-pass filter - which doesn't really gain its true effectiveness until below around 2 kHz - removes most of the lower-frequency energy related to the speech, leaving mostly any background noise (hiss) from weak signals.

Following the high-pass filter is a rather high-gain non-inverting amplifier that boosts the filtered audio significantly.  Because most of the audio energy of a "clean" signal is below the 2-3 kHz range, the total amount of energy that remains is quite low, but by amplifying it, even low amounts of "hiss" can be detected.  During normal use, this noise amplifier will often be driven into clipping, but that's OK as a poorer-quality signal (e.g. noisier) will still have, overall more total audio energy.

The energy from this amplifier is rectified and smoothed by diodes D1 and D2 - with a small amount of DC bias for the diodes provided by R25, a 1 Megohm resistor which slightly improves low-signal sensitivity - particularly when several signals being received via the receiver(s) are at or near full-quieting.

Signal quality comparator:

At this point it's worth mentioning again that there are two audio paths - the "MUX A" path input via U2 mentioned above, and an identical audio path that uses U3 and the same amplifier and noise detector arrangement:  The only difference is that it is only the audio being selected by "MUX A" path (via U2) that is passed to the repeater controller, so that is always going to be the "best" signal if more than one is present.

Having two separate "noise" voltages, a simple analog comparator, U6, is used to see which one is the "noisiest".  In this case, an LM311 comparator is used, relying on microcontroller's internal pull-up resistor to provide a logical "high" signal - and this handily does the logic level conversion as well.  An LM339 would have worked fine, but since we need only a single comparator - and the '339 has four - I just used an LM311.  In a pinch it's possible that an op-amp could have been used as a detector, but care must be taken to assure that the chosen op amp will work properly with signals that are very near ground and can go up near the positive supply rail.

Comment: 
The originally-used PIC16C84 did not have a built-in A/D converter or comparator, but many more modern PICs do - and either one could be used in this case to compare the two signal paths' noise voltages.  Because the more modern processor was a retrofit for the original 'C84, there was no reason to get rid of the comparator.
If an internal A/D converter or comparator is used, be aware that the analog voltages from the noise detectors could easily exceed the maximum 5 volt rail of the processor so appropriate clipping/scaling should be applied.


COS Mux:

For each of the (up to) eight receivers, there is a corresponding "COS" input - that is, a line that is pulled to ground (typically by an open collector or drain) when that receiver picks up a signal that opens its squelch.  To convey these eight signals to the microcontroller, U1, a 74HC168 8-input shift register is used.  During normal operation the controller will strobe the current states into the register via the "/PL" line and then, using the clock and data lines, read them serially - all using just 3 processor pins instead of 8.

Note that there are two resistors on each input of U1:  R16(a-h) being used to pull the input up to 5 volts and series resistors R17(a-h) used to protect the input of U1 in the event that the COS input happens to go above 5 volts.

PTT Output:

If any COS input is active, the PTT signal from pin 2 of U8, the microcontroller goes high.  This signal then enables Q7 an NPN transistor that is used to pull the repeater controller's PTT line low.

Active channel indicator:

To indicate which receiver's audio is currently being passed to the repeater controller, U9, a 3-8 decoder - is used, monitoring the address lines for MUX A.  If no COS signals are active, U9's "E3" input, which is tied to the same microcontroller pin that asserts the PTT to the repeater controller, goes low, turning off all of the LEDs.

Comparing signals:


At this point it's worth talking about how the signals are compared and voted on.

MUX A is always used by the best receiver after voting so that it will be passed to the repeater controller.  MUX A is therefore always used as the basis of comparison to any other channels that might be active.
  • If there is one receiver active as indicated by its COS line, MUX A is used to select it, which pipes the audio to the output, to the repeater controller.
  • If there are two receivers active, the first one to have been detected active is set to MUX A and the second one is set to MUX B.
    • If the receiver on MUX B is "quieter" than the one on MUX A, the output of U6 will be generally low because of higher noise coming from the MUX A channel.  In this case, the microcontroller will swap the two signals, putting the "better" one on MUX A where it can be passed to the repeater controller.
  • If there are more than two receivers active, MUX B is used to switch between these other active receivers, comparing them to that "active" receiver on MUX A:  If another of these others suddenly has a better signal, it's immediately moved to MUX A where it can be output to the repeater controller.
  • If the COS for the receiver on MUX A suddenly disappears but there is at least one other signal present, the lowest-number signal is immediately switched to MUX A and the voting process resumes.
  • If there are suddenly no active COS signals, the output PTT signal from the microcontroller is dropped immediately.
How it works in Software:

(Note that the source code, in "C", is included below if you wish to "play along".)


In the "main()" loop of the software, the "update_sr()" function is called every time it executes, making certain that the COS inputs are updated very frequently. 
When the microcontroller is in it's "idle" state (no active COS input) both the "A" and "B" audio MUXes are set to receiver 1.  Besides being a convenient starting point, this allows easier adjustment of the noise detector circuits as they would be fed with the same signal, making it very easy to set them identically.


If, after being idle, a COS input goes active, the first one that the it runs across is assigned to MUX A and the PTT output is set active.  After assigning the first signal to MUX A - which causes that receiver's audio to be passed to the repeater controller - another portion of the code is then executed that looks for other active COS inputs.

If one or more active COS inputs are detected, it assigns the first one to MUX B.  Allowing time to for the readings to settle, the controller then does a bit of simple averaging over the next 25 loop cycles (which takes about 25 milliseconds) to see if the signal on MUX B seems to be "better" than the one on MUX A.

If the signal currently on MUX B is better, MUX A is switched to this input.  If the signal on MUX B is not better, the controller sequentially switches MUX B to other currently-active COS inputs and makes the same comparison.

In this same loop, an eye is kept on the COS status of the channel to which MUX A is currently set:  If this COS goes inactive, the code immediately re-scans to find another active COS input, assigning it to MUX A to make sure that audio from an active receiver is being passed to the repeater controller.  If it is determined that there are no active COS inputs, the PTT line is immediately dropped so that the repeater controller may do its normal "hang time" operations.


Other means of implementation:

For the original implementation I used a PIC microcontroller because I've long been familiar with them and have had the appropriate development tools, but it could be done using something like an Arduino if they'd existed when I first built this:  Even the cheapest, low-end UNO would even be overqualified for the task!

To do this, one would simply substitute the Arduino and its I/O pins for U8:  While the Arduino has available comparators and A/D converters, it would be almost as easy to use an outboard comparator rather than trying to get rid of it unless, as noted above, you are prepared to scale voltage appropriately.

It is possible for the entire device to run from a single 5 volt source, but if this is done rail-to-rail input and output op amps are strongly recommended and very close attention should be paid to the peak-to-peak voltage swings of all the analog signals:  Worst-case is typically the "no signal" condition where the radio is outputting noise and if an analog voltage goes above the supply voltage or "below" ground (as can happen with capacitive coupling) many analog MUXes will spuriously conduct this noise into other, de-selected channels, causing very annoying "popping" in the audio.

Using a "voting" tone:

Many voting systems include a tone that is sent along the circuit when no signal is present - and for best performance, such is recommended here.

For example, each remote receiver is configured with a 3.5kHz oscillator that is activated when the squelch closes and the audio being receive and then transmitted along the link to the voting site is muted - followed by a short (half-second or so) "hang time" with the remote receiver/link transmitter transmitting only this tone.

The reason for this is to minimize the number of "noise bursts" that one might hear as a user popped in and out of more than one receiver.  For example, if the user was "weak but solid" into receiver "B" but was popping in and out of "A" - often with a good signal - then the voter would select receiver "A" when the user was solid into it, but reverting back to "B" when the signal dropped out.

If the link transmitter were to key on and off every time the user dropped in and out of "A", the link receiver at the voting site would get a burst of squelch noise every time - and this would inevitably come across the link in the instant before it was detected, making the signal sound more "multipathy" and noisy than it really was.

If, instead, a strong 3.5kHz tone was sent down the link as soon as receiver "A" dropped out, the voter would detect this tone as if it were noise - but much more strongly so - and the voter would immediately switch away from it, to receiver "B", handily avoiding that burst of noise that would otherwise be transmitted from both the receiver "A" and its link transmitter dropping out at the same time.

This typically works because, in a voter system, one rarely drops instantly out of one receiver, but in the case of multipath this fade can happen very quickly:  Having the tone switch on helps make the voter switch more quickly with the squelch on the receiver "A" closing before the signal is completely gone.

Having this tone does mean that to those listening, a brief burst of that tone will come through - particularly if only one receiver is in use:  In that case, there is no "better" receiver to switch away from which means that the 3.5 kHz tone will blast out during the link transmitter's brief hang time.

To prevent this ear-piercing tone from being obnoxious, the schematic in Figure 4 includes a notch filter to reduce this 3.5 kHz tone.  As mentioned in the notes below this small diagram, it is strongly recommended that the pairs of capacitors and resistors be carefully matched to obtain the best notch depth (which should be well over 25dB).  It is suggested that this filter - or one of similar function - be placed on the audio output before it is passed along to the repeater controller.

Block diagram of an example system:

In Figure 5, below, is a block diagram of an example system.

Figure 5:
Block diagram of an example voting repeater system with two remote receivers and one receiver co-located with the transmitter.  An example of a "tone decoder module" is given in Figure 6, below.
Click on the image for a larger version.

Remote RX site:

The remote receiver (one of several, perhaps) is located at a site that offers complementary coverage - or perhaps to fill in a particularly badly-covered area where users may be able to hear the repeater well (perhaps noisily) or in an area where it may be advantageous to have a "local" receivers to allow good coverage via low-power handie-talkies (say, an area where public service events are commonly held.)  This remote site should include a rudimentary repeater controller capable of producing hang-time, legal identification and time-out should a signal get "stuck" on the receiver's input.

If the system is to be used with a subaudible tone it is recommended that the tone decoder not be located at the remote receiver, but rather that it be normal "COS squelch" and that the tone be able to be passed directly from the receiver to the transmitter:  Many receivers and transmitters have high-pass filters to prevent exactly this so it may be necessary to select the gear carefully and/or make some modifications to allow this.  The reason for this is that subaudible tones are quite slow to be decoded meaning that if a signal is weak or choppy, a lot of content can be lost during these portions of a transmission as the already-slow tone decoder will be even slower to respond if the signal is noisy.  If a subaudible tone is decoded at the link transmitter, expect there to be more "holes" in the audio as users transition between the two receiver sites than otherwise!

When the COS of the received signal drops, a 3.5 kHz tone is switched in instantly to "un-vote" the signal from that receiver:  This "loud" tone will instantly be detected by the voting controller as one that is "bad" (e.g. lots of high-frequency content - a stand-in for the noise of a poor signal) and it will vote "away" from this receiver - assuming that another receiver is still active.  If no other receiver is active, the notch filter (in the voting controller) will remove this tone so that users can't hear it during the remote site's transmitter's hang time.

The reason for the hang time (where the remote site is transmitting only a tone) is to reduce the amount of audible "chop" that might be heard when a signal is dropping in and out of a receiver.  By having a bit of hang time (with tone) the voter will be given a chance to "switch away" from it when a signal drops without there being the burst of squelch noise when the link transmitter drops, before the receiver at the voter site's squelch closes.

Repeater transmitter site:

At the repeater's transmitter site there may be one or more "link" receivers - but there may also be a "local" receiver.  As seen, the voting controller sits between the receivers and the repeater controller, the idea being that the voting controller will make the multiple receivers look like a single receiver.

In the simplest case, all receivers simply connect to the voting controller via their (unsquelched!) audio and their COS lines:  As with the remote receivers, the link receiver should be COS-only with no subaudible tone for the same reasons as mentioned above.  The subaudibletone decoder should only be present in the signal after the voting controller to provide the best response to rapidly-changing signals.

"Voting tone":

To prevent the shrill 3.5 kHz tone from blasting through the repeater during the hang time of a link receiver, the 3.5 kHz notch filter is depicted in the audio path between the output of the voting controller and the repeater controller.  At 3.5 kHz, this notch will have little or no effect in the quality or timbre of the received signals.

Figure 6:
 An example of a tone detector that can be adjusted to 3.5 kHz
along with another example of a notch filter for the tone.
This diagram also includes a de-emphasis circuit in the event
that were needed.  Note that all capacitors NOT used
for power supply bypassing (e.g. those in the de-emphasis,
notch filter and tone decoder) must be temperature-
stable plastic capacitors and not disk ceramic.
Click on the image for a larger version.
Also included in the diagram is a "voting tone" decoder designed to respond to the 3.5 kHz tone sent from the remote site and this is useful if it's desired that the hang time of the remote link transmitter (while the tone is active to "un-vote") be removed from the equation.  Its purpose is simply to detect that 3.5 kHz tone and de-assert the COS signal, causing that receiver to be not only "un-voted", but also to allow the COS from the voting controller to un-key immediately even if the receiver in question is one of the remote receivers with its own hang time.  This also has the effect of eliminating a "double kerchunk" caused when the user unkeys, and then again when link transmitter unkeys and its receiver's squelch closes.

It should be noted that if there is a direct wire connection between the receiver and the voting controller - as would be the case for a local receiver - none of this 3.5 kHz nonsense is required as there is, by definition, no extra "squelch noise" burst on that receiver as would happen on the remote receiver when its link transmitter un-keyed.

Final comments:

If you do plan to have an analog voter of any kind, also note that you must use a purely-analog receiver:  While tempting, radios that use "all in one" chips (such as Baofengs and other imported brands) are probably not usable as they tend to have a bit of delay, they may have no easy way to defeat the filtering of subaudible tones, and they also tend to automatically switch in a low pass filter on noisy signals - something that would mess up any comparison that you would hope to do - and this assumes that they actually have a "COS" output that is actually fast enough to be useful!

What about voting for a digital system?

While implementing a voting repeater system for an analog repeater is straightforward, the same cannot be said for digital signals.  To an extent, a radio could "know" of several different linked systems in a given coverage area, but having several systems not only requires a lot of resources (gear, frequencies) but it is arguably less convenient and less effective than having a voting system to increase the "grasp" of a receive system.  In theory, one could have very carefully designed receive systems that "seamlessly" switch between two receivers without corrupting bits (very careful attention to phase and timing would be required!) but the noise-like nature of digital signals makes their direct quality comparison a bit more difficult.

If some sort of voting system is used, it might also have individual digital demodulators at each site and then convey that digital signal to a more complex voting system that performs re-timing of the received signals and then monitors the apparent error rate, feeding the "best" result to the original repeater:  Such a system is beyond the scope of this article.



Addendum:

* * *
Source code:

What follows is source code, in "C", targeted for a now-ancient version of the CCS compiler.  This version of code assumes the use of a PIC16C84 microcontroller that used external R/C oscillator components.  (I couldn't find the version updated for the newer processor - but the changes required were very minor.)

It is not expected that one would use this code as-is, but rather use it as an example as to how the logic worked so that it could be applied to other platforms.

This code is supplied as-is with no expressed or implied warranty regarding usefulness or fit for any purpose.

* * *

/*
This code is for an 8-input voting controller.  There are two noise-detect channels on 8-input
MUXes:  Channel A is the "primary" channel:  This channel, when selected, outputs the selected
channel's audio.  Channel B is used to compare against channel A and if it is *better* than
channel A, then THIS channel gets transferred to A (thereby selecting it as the audio source.)
Note that ONLY those channels with active COS are compared.

Revision History:

0.01  20000610    Started work
0.02  20000611    First operational version (I think...)

Notes:
   - It is highly recommended that the audio inputs from the various
      receivers be UNMUTED by the COS.
   - When an input signal is active, the respective input COS signal goes
      LOW.  This is usually accomplished with an open collector at the
      receiver.
   - Unless ALL of the receivers are local, the audio inputs MUST
      be de-emphasized.
   - All audio inputs are to be adjusted identically at their
      respective receivers.  The more closely matched, the less difference
      will be heard when the voting occurs.
   - This voting controller does NOT affect the audio passed through it in
      any way (assuming that the amplifiers aren't clipping) other than by
      selection of the audio source.  Once the receivers are adjusted for
      EQUAL output levels, THEY SHOULD NOT BE READJUSTED!  Doing so will
      require complete realignment of the system/voting controller.  If
      additional transmit deviation is needed, this should be done by
      adjusting the CONTROLLER and *NOT* the the receivers!

Adjustment procedure:

   - This procedure assumes that the highest audio input level will occur
      with squelch noise.
   - The following test points are used:
      TP1 - Noise detector Channel A output voltage
      TP2 - Noise detector Channel B output voltage
      TP3 - Noise Channel A output level (highpass audio)
      TP4 - Noise Channel B output level (highpass audio)

   This procedure is to set the noise channel outputs (TP3 and TP4) to the
      highest level possible (without excessive clipping) so that, for the
      same signal, the detector voltages (on TP1 and TP2) are as close to
      identical as possible.

   1) MAKE SURE THAT ALL RECEIVER OUTPUTS ARE MATCHED IDENTICALLY WITH THE
      SAME AMOUNT OF DEVIATION!  That is, with 3 KHz of deviation, all
      receivers should be set to output the SAME audio level.
      Additionally, the audio equalization should be matched as closely as
      possible for all receivers.
   2) With *no* COS signals active and with (unsquelched) audio going into
      RX audio 1, connect an oscilloscope to TP3 (noise Channel A Highpass
      output) and adjust potentiometer RA for the maximum audio level that
      results no or only a slight amount of clipping.
   3) Move the oscilloscope to TP4 and adjust potentiometer RB for the same
      level as on TP3.
   3) Connect a voltmeter to TP1 (MUX Channel A noise detector output) and
      note the voltage.  It will bounce a bit as the noise, so note the
      "average" voltage reading.
   4) Move the voltmeter to TP2 and adjust it to the same average voltage
      as read on TP1.
   5) Using the oscilloscope, compare the outputs at TP3 and TP4.  If one
      is much higher than the other, reduce the highest one somewhat and
      set the other channel to the same using a similar procedure to the
      above.
   6) When done, make sure that TP1 and TP2 are approximately equal
      voltages (i.e. closer than 0.1 volts of each other.)

*/

#OPT 9

#include    <16c84.h>    // define use of 16c84a

#define        PORT_A_ADDR    0x05    // port A address
#define        PORT_A_TRIS    0b00001    // port A I/O mask (LSB in, RA1-RA4 out)
#define        PORT_B_ADDR    0x06    // port B address
#define        PORT_B_TRIS    0b10000000    // port A I/O mask (LSB and MSB in, others out)

#define     WAIT_TIME   7     // time, in milliseconds, that we should
                              // wait before starting to make any decision
#define     VOTE_TIME   25    // The number of "cycles" through the quality
                           // decision loop.  Each cycle takes about 1
                           // millisecond
#define     QUAL_THRESH 15    // this is the number "good hits" that are
                              // required during the "VOTE_TIME" to decide
                              // if "this" one is really better

#byte        PORT_A = 5
#byte        PORT_B = 6
#fuses        RC, WDT, NOPROTECT, PUT
// RC Oscillator, watchdog, no code protect, Power Up Timer, no
//brownout protect


#use delay(clock=225000, RESTART_WDT)  // 225 KHz = 33k & 82pf

#use    fast_io(a)        // set port A for fixed-mode of I/O direction
#use    fast_io(b)        // set port B for fixed-mode of I/O direction

// System definitions:


#bit SR_INDAT = PORT_A_ADDR.0 // Serial data from parallel-input shift register
#bit SR_CLK = PORT_A_ADDR.1   // Shift register clocking
#bit SR_PLOAD = PORT_A_ADDR.2 // Shift register parallel load
#bit COS_OUT = PORT_A_ADDR.3  // "voted" COS output (1 = active)
// PA4 is reserved
//
#bit MUXA_A = PORT_B_ADDR.0   // audio mux A LSB
#bit MUXA_B = PORT_B_ADDR.1   // audio mux A
#bit MUXA_C = PORT_B_ADDR.2   // audio mux A MSB
#bit MUXB_A = PORT_B_ADDR.3   // audio mux B LSB
#bit MUXB_B = PORT_B_ADDR.4   // audio mux B
#bit MUXB_C = PORT_B_ADDR.5   // audio mux B MSB
// PB6 is reserved
#bit COMP_IN = PORT_B_ADDR.7  // signal quality comparator (0 = "B" is *BETTER* than "A")

byte  cos_data;


#ZERO_RAM        // This macro causes code to wipe all memory locations

// This function gets data from the input shift register

update_sr(void)
{
   char x;

   SR_CLK = 0;             // initialize sr clock
   SR_PLOAD = 0;           // load data into shift register
   SR_PLOAD = 1;           // 'freeze' data in input shift register

   cos_data = 0;           // clear Carrier Operated Squelch input shift register

   for(x = 0; x <=7; x++)  {
      SR_CLK = 0;
      cos_data <<= 1;         // shift next bit of input data into position

      if(SR_INDAT)   {
         bit_set(cos_data, 0);   // Set the LSB of "cos_data" (this is a one-instruction PIC operation) if SR output is high
      }
      SR_CLK = 1;           // shift the data in
   }
}

void  setmux_a(byte b)     // this function sets MUX channel A
{
byte  temp;

   temp = PORT_B;             // read port B output register
   temp &= 0b11111000;     // clear 3 LSBs for MUX A
   b ^= 0xff;              // invert contents to account for inversion of level converter
   b &= 0b00000111;        // make sure nothing is in anything but bottom LSBs
   temp |= b;              // overlay MUX A data
   PORT_B = temp;          // send it out
}

void  setmux_b(byte b)     // this function sets MUX channel B
{
byte  temp;

   temp = PORT_B;             // read port B output register
   temp &= 0b11000111;     // clear the 3 bits for MUX B
   b <<= 3;                // shift the current MUX data to match bit positions
   b ^= 0xff;              // invert to compensate for level conversion
   b &= 0b00111000;        // make sure nothing is in this but the correct bits...
   temp |= b;              // overlay MUX A data
   PORT_B = temp;          // send it out
}


void main(void)
{
byte  x;                      // multipurpose counter
byte  qualcnt;                // "quality" counter
byte  mux_a;                  // holder/counter for mux_a
byte  mux_b;                  // holder/counter for mux_b

short cos_scanflag;           // flag bit used in scanning for COS activity
short recheck_flag;

   setup_counters(RTCC_INTERNAL, WDT_144MS);

    SET_TRIS_A(PORT_A_TRIS);    // set I/O direction for ports
    SET_TRIS_B(PORT_B_TRIS);
//
   PORT_B_PULLUPS(TRUE);

   COS_OUT = 0;               // clear output COS line...
   mux_a = 0;                 // initialize MUX selectors
   mux_b = 0;
   recheck_flag = 0;

   update_sr();               // grab data (to initialize shift register)

   while(TRUE) {
      update_sr();               // get current COS status
      restart_wdt();
         if(cos_data == 0xff) {  // is there *NO* COS activity? (bits go low when COS is active)
            COS_OUT = 0;         // yep - indicate such.
            mux_a = 0;           // always put both mux channels on 0
            setmux_a(mux_a);     // when no COS inputs are active...
            mux_b = 0;
            setmux_b(mux_b);
         }
         else  {              // there *is* COS activity.  Find out which one it is...
            if(!COS_OUT || recheck_flag)   {    // the output COS is not yet active *or* ONE
                                                //  became inactive, we need to find one that
                                                // is active is hearing the signal
               recheck_flag = 0;
               mux_a = 0;        // always make sure it we are starting out at zero...
               mux_b = 0;        // init mux B count
               cos_scanflag = 1; // init flag used for scanning COS bits
               while(cos_scanflag)  {     // this keeps happening while the flag is set
                  if(!bit_test(cos_data, mux_a)) {    // is it *THIS* bit that is active?
                     setmux_a(mux_a);                 // yes - set MUX to this address
                     COS_OUT = 1;                     // set COS activity
                     cos_scanflag = 0;                // clear flag so we don't go thru this again
                  }
                  else  {
                     mux_a++;       // bump count to next input
                     if(mux_a > 7)  {        // did we exceed our maximum count?
                        cos_scanflag = 0;    // yes - we bail out...
                        COS_OUT = 0;
                     }
                  }
               }
            }
            else  {     // COS *IS* active - lets look at other inputs to see if they are active
               if(!bit_test(cos_data, mux_b)) {    // is *this* COS bit active?
                  setmux_b(mux_b);     // change MUX to new channel...
                  delay_ms(WAIT_TIME);             // wait for comparator to settle
                  qualcnt = 0;
                  for(x = 0; x < VOTE_TIME; x++)  {
                     delay_ms(1);
                        if(!COMP_IN)    { // is this NEW a better signal?
                           qualcnt++;
                        }
                  }
                  if(qualcnt >= QUAL_THRESH)  {   // has the signal been better for enough samples?
                     mux_a = mux_b;                // yes - set both MUXes to the same place...
                     setmux_a(mux_a);              // set output to new signal put it there...
                  }
                  COS_OUT = 1;                     // make SURE we have COS output enabled
               }
               mux_b++;    // bump to next mux count
               mux_b &= 0b00000111;       // mask mux address
               if(mux_b == mux_a)   {     // are we attempting to look at the same input?
                  if(bit_test (cos_data, mux_b))  {   // is *this* COS bit INactive now?
                     recheck_flag = 1;                // yes - this signal went away - get new COS
                  }
                  mux_b++;                // yes - go to the *next* address
                  mux_b &= 0b00000111;    // mask mux address
               }
            }
         }
      }
}




This page stolen from ka7oei.blogspot.com

[End]

Friday, August 24, 2018

Preventing a GFCI from tripping on transmitted RF


Figure 1:
The installed GFCI (and chokes) in the
utility room/laundry room.
Click on the image for a larger version.
Several months ago I had need to rewire an outlet in my kitchen:  Rather than having just two outlets with a multi-outlet adapter I decided to replace it with a pair of duplex outlets to accommodate everything that would be plugged in.

It turned out that the electrical circuit for this outlet came from my (semi-unfinished) utility room where it powered the washing machine and gas clothes dryer.  Because it is recommended that both laundry and kitchen areas be equipped with some sort of protection against electrical shock, I decided to install a GFCI (Ground Fault Circuit Interrupter) at that point (it's an older home) to protect both.  The installation wasn't all that difficult, the hardest bit was cutting away a bit of tile on the kitchen backsplash to allow the installation of a bigger box to house the two additional outlets.  In the semi-unfinished utility room I replaced what had been a single duplex outlet with that pictured in Figure 1.

Everything worked fine, except that when I transmitted on 40 meters, especially with the amplifier, I would find not only the outlet in the kitchen dead, but also the Ooma VOIP phone adapter, which was also plugged into the Utility room outlet served by this GFCI which showed as having been triggered.  Clearly, the GFCI was "seeing" some RF energy and "tripping out".

Why it happens:

The mere presence of RF at the GFCI isn't likely enough to cause it to trip - more likely, it was some RF current flowing through the GFCI - and the way that one typically wires a GFCI and uses it makes it more likely that this could happen.  Taking a look at Figure 2 helps to understand the situation.
Figure 2:
Interconnection of the GFCI to other circuits and loads.  As mentioned in the text, most of these connections are made via long cable runs - which will naturally act as antennas.  As can be seen from the drawing, the AC power from the circuit breaker (itself a long cable run) goes through the GFCI which then has wires that radiate out from there, acting as sort of a multi-wire dipole that permits RF current to flow through the GFCI.  The fact that these units are "grounded" means little at radio frequencies where about any length of wire can act as an antenna!
Click on the image for a larger version.

At first glance, this diagram shows nothing special - just normal interconnection.  But in terms of RF, there are a bunch of antennas here:
  • AC Power from the circuit breaker - This line runs from the middle of the house to a corner, where the circuit breaker panel is located:  A lot of RF can be intercepted and flow through here!
  • Interconnect to the kitchen - This goes up, through the floor and into the kitchen - yet another leg of the antenna.
  • Items plugged in in the kitchen outlet - These further extend the "antenna" of the wiring to the kitchen.
  • The washing machine - This is a large, metal box that can act as a sort of antenna.
  • The clothes dryer - Like this washing machine, this is a large box - and it has a metal gas pipe attached to it that more or less goes to ground.
  • The Ooma phone interface - There is an extension cord (also an antenna) that goes to this device, which is capacitively coupled (via isolation transformer windings) to both in-house phone wiring and the Ethernet cable connected to it.

The end result is that RF can flow through the GFCI, mimicking a current imbalance that can be detected by its internal circuitry as if it were a real current imbalance on the line and neutral wires, causing it to trip - and the susceptibility of it can depend on the amplitude and frequency of the RF energy.  As is the nature of anything that acts as antenna, the amount of RF energy that is picked up depends on many things, such as the length of the wire, where it is routed, what is connected to it, and the frequency of the RF energy and the transmitter power, all of these things working together in ways that are often inscrutible.

While keeping the RF outside the house (e.g. preventing it from coming into the shack by assuring that balanced feedlines are actually balanced and that coaxial cables are adequately decoupled to prevent current from flowing on their shields) is of great help - and highly recommended - but significant energy can still be picked up "over the air" by mains wiring.

Preventing false trips:

Regardless of the specific situation, the trick to preventing the GFCI from tripping out in the presence of RF is to keep RF from flowing through it!

Practically speaking, it is very difficult to fundamentally alter where wires go and what is connected to them as these are usually part of the wiring in the house, behind walls, making it inconvenient to change - and that assumes that one somehow knew exactly how RF pick-up might occur from an antenna onto these conductors.   The easiest way of preventing a problem is to keep RF from getting into the GFCI in the first place using series inductance to choke the RF currents.

To see what was done, consider Figure 3, which is an annotated version of Figure 2, above:
Figure 3:
An annotated version of Figure 2 showing the locations of the added ferrite devices.  Devices weren't placed on the cords to the washer or dryer as they were quite short compared to the other conductors - and because it wasn't required.
Click on the image for a larger version.
To figure out what I needed to do I first unplugged everything from the related outlets.  In my case, the GFCI no longer tripped out on RF so I started plugging things back in, noting when it started to trip out again:  If I'd already plugged something else in by this point I removed it to see if it still tripped, or if it simply contributed to the problem, tipping it over the edge.  In other words, you'll probably want to tray all possible combinations (within reason, of course) while noting the results.

Having done this, I determined that one main culprit was an extension cord to the Ooma device (see below) but it seemed that every appliance added just a bit to the problem.


The drawing above demonstrates several things:
    Figure 4:
    Three snap-on chokes on the
    wires going to the box with the
    GFCI.
    Click on the image for
    a larger version.
  • Any long run (more than a couple of feet/meters) has on it a ferrite choke, located as close to the GFCI unit as possible.
By placing the choke as close as physically possible to the GFCI unit, there is less wire that can act as antenna.  This also reduced the amount of RF that can be coupled from one conductor into another from parallel runs of wire.
  • In my installation, the conductor that comes from the circuit breaker and that which goes to the kitchen outlet are paralleled for several feet/meters.  Near the GFCI one can see that both conductors go through a single ferrite for common-mode decoupling while a bit farther away, we see that there is a ferrite device on each, individual cable as shown in Figure 4.
In Figure 4 we see the three snap-on chokes:  The one with both cables is just above the junction box (bottom of the picture), the one on the yellow cable is just above it and near the top of the picture is the one on the black cable.  These were so-placed because there was just enough slack in the wire to allow their installation at those locations.
 
The choke just above the box provides common-mode suppression for signals that might appear on both cables while the individual chokes suppress the different signals that might appear on each.  This is probably overkill, but it seems to be sufficient.

  • There is a choke on the green extension cord (that goes to the Ooma box located a few feet away) that is located very near the plug (and GFCI). See Figure 5.
Figure 5
A multi-turn choke on the extension cord.
Click on the image for a larger version.
This choke actually consists of three turns in the core (as many as would fit!) to provide maximum reactance on this conductor.  It is this wire that seemed to be particularly problematic in coupling RF into the GFCI - possibly because this cord ran near some copper piping and furnace duct work, not to mention being connected to a device that has a degree of capacitive coupling into the house telephone wiring and, to a lesser extent, Ethernet cables.

I did not put similar chokes on the power cords connecting to the washing machine and clothes dryer, not finding it necessary to do so.  Being that they were right next to each other, they are likely to have very similar RF potential - and since we've effectively isolated all of the other RF paths to/from the GFCI with chokes, we've broken up possible paths for current flow, anyway.

Choke selection:

One of the problems with using snap-on ferrite chokes is that they are typically of little efficacy, the added reactance being quite small.  With the little reactance, lower frequencies - particularly 160-40 meters - may not be strongly attenuated.

The "typical" chokes that one finds on electronic devices are of a different material and have most of their efficacy at high HF and VHF/UHF frequencies where there is most concern when the device in question is facing EMC testing that may be required by regulatory agencies.  What we need is to use a ferrite device that is especially suited for lower HF frequencies.

Ferrite devices are available in a wide variety of "mixes" - the mix being a different formulation designed specifically to impede signals over certain ranges, the efficacy of most efficacy using being inversely related to the permeability of the mix:  In other words, materials with lower permeability often work adequately at higher frequencies while materials with high permeability are more effective at low frequencies - but often suffer somewhat at higher frequencies.

In general, on HF you are better off with the (less common, more expensive) higher permeability materials - and the higher the permeability, the better - particularly if you are only able to get a single turn (e.g. wire simply passing through) of the conductor through the device. 

A common material for snap-on chokes is "Mix 43" - a relatively inexpensive ferrite that is widely used and has best efficacy above 10 MHz.  Having a permeability of around 800, it will reasonably add a bit of extra reactance (resistance to RF) to the conductor over which it is installed.  In described case, I used two devices:
  • Fair-Rite 0443800506, which has an inside diameter of 13.2mm (0.52") and is 15.6mm (0.61") long.
  • Fair-Rite 0443806406, which has an inside diameter of 15.5mm (0.61") and is 16.2mm (0.63") long.
Note:  The above devices - and those below - are available from Mouser Electronics.

 The former will fit nicely over standard "12/2" "Romex" cable while the latter will fit over two of these cables:  The larger '6406 is what is used in Figure 4 right above the box's clamp and in Figure 5 over which three turns of the green electrical cord are wound while the upper two in Figure 4 are the '0506.

As mentioned before, these devices are typically used above 10 MHz and because of their nature, their efficacy decreasing with frequency.  Taking the '0406, it's rated impedance at 10 MHz is 24 ohms and 43 ohms at 25+ MHz, implying an inductance of approximately 0.33 microHenries.  To be sure, this isn't very much, and scaling this for other frequencies implies that at 40 meters its impedance would be on the order of 15 ohms, around 7 ohms at 80 meters and around 4 ohms at 160 meters.  Because the inductance increases with the square of the number of turns, the three turns wound around the green cable (in figure 5) considerably increased its efficacy - probably into the 30-50 ohm range on 40 meters.

This doesn't sound like much - and it isn't - but it is often enough to add just a bit of reactance to the connecting cables to reduce the amount of RF current flowing through the device - which is probably fairly well-protected in its own right - and also to slightly shift self-resonant frequencies in the wiring and the device to reduce the amount of intercepted RF.

What if it hadn't worked?


In my case, the Mix 43 devices were chosen because they were comparatively inexpensive, I had quite a few on hand and they did the job.  If the had not done the job, I would have used different devices - ones with a higher permeability so that the impedance of the conductor(s) over which it was used would also be higher.

The next logical step is to use Mix 31 which has nearly twice the permeability and, for whatever reason, are typically much longer in length.  Take, as an example, two devices of approximately the same inside diameter (e.g. able to accommodate one or two cables) as the two mentioned above:
  • Fair-Rite 0431164181 - 13.05mm I.D. (0.51") and about 31mm (1.22") long.
  • Fair-Rite 0431173551 - 18.8mm I.D. (0.77") and about 42mm (1.65") long.
Because of the size and length and material, these offer about twice the reactance as shorter versions - and cost about four times as much, too!

Even more impedance:

For those really difficult situations, there's yet another material - Mix 75 - and we can get devices similar to those above in that material as well:
  • Fair-Rite 475164181 - 13.05mm I.D. (0.51") and about 39mm (1.54") long.
  • Fair-Rite 475176451 - 18.7mm I.D. (0.74") and about 47mm (1.85") long.
Mix 75 isn't as effective at VHF, but that's not usually where the problem with RF susceptibility usually occurs.  They are about the best thing for HF operation, but at a cost - literally:  Because of the material - and the larger size of the above devices - they tend to cost nearly ten times as much as the Mix 43 material, but if you can only manage to get a single turn of a conductor through it (as would be the case for existing, in-situ wiring) it's the best thing to use.

For example, the Mix 31 '6406 device mention above provides only about 24 ohms of impedance at 10 MHz, but the Mix 75 '4181 device above has 100 ohms at the same frequency and close to 80 ohms at 40 meters.  To be sure, it's a bit of apples and oranges comparison because the '4181 device is about twice as long.

Final comments:

Similar techniques should work on AFCIs (Arc Fault Circuit Interruptors) as well as smoke/fire alarm cables that connect units together - just make sure everything still works when you are done!

In my case, the "semi-unfinished" state of the room allowed access to the "Romex" wires to the outlet, but this is likely not the case when wiring is concealed inside the wall - often with no additional slack in the conductor to permit installation of a ferrite.  If this is the case, the obvious first step toward diagnosing the issue would be to unplug anything on that circuit to see if it still tripped.

If the protector still trips with nothing plugged in, you'll have to get creative, perhaps replacing the box with a larger version (one that is deeper and/or has another "gang" position on it) or even adding a nearby box (with a blank cover plate) to which the wire could be pulled back and ferrite devices installed.

Whatever you do, be safe and sensible and make sure that everything still works as it should when  you are done!

[End]

This page stolen from ka7oei.blogspot.com


Monday, June 18, 2018

A limited attenuation high-pass filter for the KiwiSDR

NOTE:
Figure 1:
Inside the "limited attenuation" high pass filter, housed inside a small, die-
cast aluminum enclosure to which two BNC connectors were mounted.  Some
components were secured using small dabs of clear RTV sealant.
Click on the image for a larger version.

There is a follow-up articles to this one that describes a circuit that properly matches the source/load over a wide frequency range - See the article: "Revisiting the limited attenuation high-pass filter for the KiwiSDR" link and  "Revisiting the limited attenuation High Pass Filter - again".

 

Since the original posting of this blog entry I was made aware of an 1977 article on this very topic - you can read it HERE. (The article in question begins on page 3 of the PDF.)

* * *

One of the issues common with using a broad-band, direct-sampling SDR (software-defined radio) like the KiwiSDR is that of overload by strong, low-frequency signals, such as those on the AM (mediumwave) broadcast band - but there's another problem that should be considered as well:  The high generally-high signal levels at lower HF frequencies.  If one looks at an spectrum analyzer connected to a broad-band receive  antenna during the evening, one will immediately note that the lower the frequency, the higher the signals seem - particularly the background noise.

This becomes problematic if one is using an antenna with a relatively flat gain across the entire HF spectrum - and one wishes to make the receiver usable at both the top and bottom ends of this range.  As an example, I have a KiwiSDR connected to an antenna that is rated to cover from 3 to 30 MHz with roughly constant gain, but I noted that at the top end of the frequency range, around the 10 meter amateur band, the overall system gain was not quite sufficient to "hear" the background iononspheric noise.

The obvious solution to this gain deficit is to install an RF amplifier - which I did - but this had the effect of increasing the already-strong signals below 5-10 MHz even more, resulting in occasional "OV" indications on the KiwiSDR's S-meter signalling to me that the RF levels were high enough to "clip" the A/D converter.  While this wasn't too much of a problem during normal conditions, if the lower HF band were particularly noisy - as often occurs in the summer with thunderstorms on the same continent - reception across the entire HF spectrum was compromised when the loud static crashes would occasionally saturate the A/D converter.

It occurred to me that while I had about the right amount of system gain on 10 meters, I had far more than I needed at lower frequencies and could throw some of it away, so I set about designing a filter that would reduce signals at the low end of the HF spectrum, but have minimal effect at the upper end.

A "limited" high-pass filter:

Note:  The filter detailed below is NOT recommended as it does not match well to 50 ohms across Ll frequencies - see the follow-up article HERE for one that provides a good match/return loss.

 
The obvious solution to this would be the addition of a high-pass filter - but there's a problem:  Even a minimal high-pass filter would have increasingly-higher attenuation at lower and lower frequencies - potentially in the many 10s of dB - but we don't really want to get rid of the lowest frequencies.  What we need is a filter that will "knock down" signals by a significant amount - but not so much that they become inaudible.

In analyzing the signal levels, I determined that the goal of the design would be to leave signal levels above about 10 MHz unaffected, but reduce the signals below 8 MHz or so by 10-15dB.  This amount of attenuation (about 2 "S" units) would significantly reduce the amount of RF energy entering the A/D converter at the lower end of the frequency range (about 2 "bits" worth) but analysis of the noise floor and signal levels at these lower frequencies indicated that I would still be able to hear the noise floor.

The diagram of this filter is shown below:

Figure 2:  Diagram of the "limited attenuation" 10 MHz high-pass filter.
This filter attenuates by about 12dB (2 "S" units) below 8-10 MHz, reducing the overall signal power reaching the A/D converter of the KiwiSDR.
"R2" represents the 50 ohm input of the receiver and is not a resistor.
See text below for details of L1-L4.


The diagram above, as rendered by "LT Spice", depicts the load (the receiver) as R2, a 50 ohm resistor - and this is not an actual component that would be installed.

No real attempt was made to make this filter's input and output impedances "flat" across the entire HF spectrum - and to be sure, below about 14 MHz its input impedance a bit high, but this will have little practical effect on its operation - and we really don't need to be too precise, anyway.

As tested on a spectrum analyzer, the insertion loss is 12-13dB from DC to about 4 MHz at which point it gradually drops to about 2dB at 11 MHz and then dropping to less than 1dB by 30 MHz.  When doing an "A/B" comparison with and without the filter on the KiwiSDR, the waterfall above 10 MHz looked unchanged, but the signals below about 7 MHz were much less "bright" - and most importantly, the occasional "OV" indications on the S-meter pretty much stopped appearing altogether.

Comment:
In my opinion, the RF input on the KiwiSDR is slightly deaf, requiring a bit of gain (say, 6-10dB) to be able to reliably hear the background ionospheric noise on the higher HF bands - particularly when they are closed - a problem compounded by normal amplitude roll-off as one nears the Nyquist frequency.  To this end, the KiwiSDR at this location is preceded by a low-noise, high dynamic range RF amplifier that is flat from a few 10s of kHz to well over 30 MHz.
Update:
After this article was originally written it was determined by several testers using different KiwiSDRs that the absolute sensitivity of a KiwiSDR is on the order of -155dBm/Hz for 0dB S/N at 28 MHz.  This sensitivity level is about 6-8 dB below the expected noise at a "quiet" site using a unity gain antenna on the 10 meter band.

In the real world, it is likely that 10-12 dB of overall signal amplification should preceded a KiwiSDR to allow it to be sensitive enough to hear the noise on a "quiet" 10 meter band and the weakest signals.  If amplification is used, it should be placed as close to the antenna as possible in the signal path, but after a filter such as that described on this page (the filter will reduce the probability of overload by strong signals below 10 MHz and its loss at 10 meters is low and will have minimal effect), and before any splitter if you plan to feed more than one receiver from that signal path.  When the overall amount of amplification is calculated, be sure to include the loss of a splitter is taken into account.  For example, a 4-way splitter will incur about 7dB of loss, so if you wish the KiwiSDR to "see" 12dB of additional signal at 10 meters you will need an amplifier with a gain around 20dB.

The components for construction of this filter aren't critical:  The capacitors are high-stability NP0 (a.k.a. C0G) ceramic types while L1-L3 are wound using 30 AWG enameled wire with L1 and L2 having 15 turns and L3 having 12 turns on T37-2 toroidal cores, respectively.  L4 is a an inexpensive molded inductor and its value can be anything from 2.2 to 3.3 uH, or one could make it by winding 25 turns on the same type of T37-2 toroidal cores as used for L1-L3.

A look at the Kiwi's waterfall with the filter:

Figure 3, below, shows this filter in place on the KiwiSDR at the Northern Utah WebSDR site:

Figure 3:
A 1-18 MHz span of the waterfall from a KiwiSDR with the "limited attenuation" high-pass filter.  At the far left side a mass of signals from local AM broadcast stations can be seen.
The horizontal streaks are from wideband lightning static that is slightly "noising up" the A/D converter in the KiwiSDR.
Click on the image for a slightly larger version.
If you look at the waterfall above, there's no obvious evidence of the filter described on this page even being connected - and that's exactly the point!  The only evidence that something is a bit "strange" is the fact that the background noise between 8 and 11 MHz is slightly higher - and that's exactly where the filter rolls off:  At increasingly higher frequencies in this range, the natural noise drops off a bit - but the filter doesn't drop off at quite the same rate with the result being that the overall signal levels in this range are slightly elevated.

If I build another of these filters I'll push the "knee" up 1-2 MHz higher, starting the roll-off of signals below 11-12 MHz, instead.

Conclusion:

This filter seems to be very effective in reducing the total signal power from lower HF frequencies while having minimal effect at higher frequencies.  Because the signal+noise levels from a broadband antenna are much higher at the lower end of the spectrum, it is possible to reduce these signals by 2 "S" units or so without dropping the background noise - or the signals themselves - below the noise floor of the receiver.

For information on a filter system that is specifically designed to attenuate AM (MW) broadcast band signals, see the article "Managing HF signal dynamics on the RTL-SDR (and KiwiSDR) receivers", also on this blog.

Follow up:

There is a follow-up article to this one - "Revisiting the limited attenuation high-pass filter for the KiwiSDR" link where a variation of this filter is presented that passes the AM broadcast band and frequencies below it and is recommended for those installation where you wish to receive longwave signals.

[End]

This page stolen from ka7oei.blogspot.com
 




Thursday, May 31, 2018

A "floaty thingie" for keeping NiHM cells topped off

A charge-state maintenance device for NiMH cells


PLEASE NOTE:  Messing about with batteries/cells can be hazardous:  Most cells contain hazardous materials and injury and/or damage can result from mishandling them.

Cells that are shorted, improperly charged or otherwise maltreated can pose an explosion/burn/chemical or other hazard.  It is entirely up to you to do research and provide the appropriate precautions to prevent damage and/or injury.


You have been warned!

The problem:
Table 1:  Comparison of self-discharge of various types of cells.
Comparison of self-discharge rates of various types of cells

The table below shows the approximate amount of time that it takes to lose 10% of the cell's current charge capacity at different temperatures.

Cell
Type
0C
(32F)
20C
(68F)
40C
(104F)
60C
(140F)
Alkaline >15 yrs. 4 yrs. 18 mo. 3 mo.
NiCd 3 mo. 1 mo. 14 days 5 days (A)
NiMH 1 mo. 10 days 5 days 1-2 days
Zinc
6 yrs. 2 yrs. 10-12 mo. 2-3 mo. (A)
These are typical values for new cells, published by various manufacturers.  Note that aging/mistreated cells will probably exhibit much higher self-discharge rates.  The NiMH information above is for "standard" cells, not the so-called "low-self-discharge" variety.

NiMH cells are ubiquitous these days - and for good reason:
  • They have usable capacity comparable to that of an Alkaline cell of the same size.  A typical AA alkaline cell has 2.4-2.8 amp-hours of capacity whereas modern NiMH cells range in capacity from 1.8 to 2.8 amp-hours.
  • They are relatively inexpensive.  If you shop around you can easily find AA NiMH cells for $2 each - often much less!  This means that if they are used just a half-dozen times, they may pay for themselves.
  • They have low internal resistance compared to alkaline cells.  When you pull power from a battery, the output voltage sags - something that can make many devices such as digital cameras shut down before the battery is drained:  Alkaline cells typically have higher internal resistance than NiMH (or NiCd) cells which means that many devices cannot fully-utilize the energy of the cells - particularly when partially discharged.
  • NiMH cells are more forgiving than NiCd and LiIon cells.  NiCd battery packs suffer from a problem called "cell reversal" in which when just one of the cells runs down before the others - an inevitability when several cells are connected together - the weakest cell ends up being charged backwards as the others pull power through it.  This causes an irreversible chemistry change that robs the NiCd cell of its power - making it more likely to run down first next time and become even more damaged than before!  NiMH cells are more tolerant of such abuse.  While NiMH cells can take a bit of abuse, LiIon cells can not, which is why they should always be connected using "protection" circuitry to guard against overcharge and overdischarge.

About "Ready-to-use" low self-discharge types.


There are some types of NiMH cells that are marketed as being "ready-to-use" that have significantly lower self-discharge rate than the standard cells.  It would seem that these cells - at least when new - do, live up to the claim, but I've yet to see information as to how much the self-discharge rate increases as they age.  I've also noted that these types of NiMH cells tend to have lower rated capacities than some other NiMH cells, ranging between 1500 and 1800mAh for these types versus 2100-2800 mAh for "normal" NiMH AA-size cells.  Such cells shouldn't be damaged if they are put in the "floaty-thingie.

Dealing with self-discharge:

As wonderful as NiMH cells are, the higher-capacity types and older, heavily-used cells do have a drawback:  Self discharge.

Referring to Table 1you'll notice something:  At ordinary room temperature, a good NiMH cell will lose 10% of its power after just 10 days - which means that after 6-8 weeks it's already half dead - and that's just from sitting there, doing nothing!  At higher temperatures things get far worse.  If you have a device with NiMH cells in it in a car on a hot, summer day you can expect it to be mostly dead in just a week or two.  Remember that the lower-capacity, "low discharge" types lose their charge slower than this, but I have yet to find specific information on these devices.

The data in Table 1 also assumes something else:  Typical, new cells.  As they age they tend to self-discharge even faster.

What does this mean, then?

  • Don't leave NiMH cells around for "later use."  If you charge up your NiMH cells and the just leave them around, chances are they'll be mostly dead by the time you get around to using them - unless you have a system of cycling through them very quickly.
  • Don't put NiMH cells away in your emergency box.  You should not rely on NiMH cells for emergency purposes unless you have a system by which you can guarantee that they are kept fully-charged.  For those devices that are put away for months at a time, Alkaline cells are a much better choice as long as they are stored outside the device to prevent possible damage from cell leakage and/or accidental discharge.
The challenge, then, is to have a system by which you can be reasonably assured that any NiMH cell you pick up is likely to have a full charge - but you don't want to do anything that is likely to damage them.

Maintenance charge:

In the case of NiMH cells (where the self-discharge rate is rather high - especially as the cell ages) it may be desirous to leave it on a "maintenance" (or "trickle") charge for very long periods of time.  Recent recommendations by some battery manufacturers suggest a "C/300" current for this while other manufacturers recommend a charging rate as high as C/40.  Following the C/300 example, our hypothetical 1 amp-hour cell above, this would be about 3.33 milliamps - that is, 1/300th of the cell's rating.  I have not seen any specific recommendations for such a maintenance charge for NiCd cells, but I would expect that the same C/300 rate would be suitable.

It should go without saying that charging a "dead" battery at the maintenance charge rate may take weeks to accomplish!

Comment:
At this point in the article I would normally provide a link to the sites of several cell manufacturers - but I've observed that these links are constantly changing, so I'll forgo doing this:  I will leave it up to you to find the technical data for larger manufacturers such as Eveready, Ray-O-Vac, Duracell, etc. that give recommendations for long-term float charging.

A "Floaty Thingie" - A simple device to maintain NiMH cell charge during periods of non-use.

Because I extensively use NiMH cells - and because I'm aware of their tendency to self-discharge - I have built a simple device that does a maintenance charge for large numbers of cells.  This device, which I have called a "Floaty-Thingie" (a highly technical term, I know...) consists of several multi-cell battery holders with series resistors and LEDs to both limit current and indicate that a maintenance charge is occurring.  The battery holders are simply attached to a sheet of wood or plastic and powered by a 12 volt DC "Wall Wart" from my junk box.  Note that while I use mostly 4-cell holders, there is also one 2-cell and one single-cell holder so that I don't need exact multiples of 4 cells to fill a holder!


Figure 1:
Top:  The "Floaty-Thingie" used to maintain charged on NiMH cells.   (This version only does AA cells in groups of 4).  Even though there can be up to 48 cells being floated, a small 12 volt, 100mA wall-wart is all that it necessary.
Bottom:  The schematic of one section of the "Floaty-Thingie."
Click on either image for a larger version.

The circuitry is extremely simple:  A resistor and cell(s) in series with an LED - the latter being used to indicate current flow which allows you to be sure that the battery is connected.  All of this is powered by a 12 volt (nominal) voltage source.

Using a 12 volt (unregulated) DC "wall wart" supply (which ranges from 12-15 volts, depending on total battery load) a resistance was calculated, taking into account how many cells were used and what size.  My "Floaty-Thingie" handles only AA and AAA sizes as these are the most common, but using the information here and a simple application of Ohm's law, other values can be calculated.

For the maintenance charge I chose to follow the "C/300" float rate as this seemed to be adequately comparable to the self-discharge rate of the cell itself.  For typical AA NiMH cells, this would be about 8 milliamps - assuming a cell capacity of 2.5 amp/hours - and for AAA NiMH cells, this would be around 3 milliamps - assuming a cell capacity of 1.0 amp/hours.  These values are typical and are definitely not critical!   Do not worry if your AA cells have 1800 mAH or 2800 mAH capacity, for example!

At this point, a few assumptions are made:

  • A supply of 13.5 volts.  This is a reasonable voltage to see from a "12 volt" unregulated "Wall Wart" under moderate load, but anything from 11 to 15 volts would be OK.
  • About 1.5 volts per cell.  (We are assuming that our cells are already fully-charged.)
  • Float currents:  The float current is 8 mA for AA cells and 3 mA for AAA cells - values that roughly correlate with C/300 for typical NiMH cells of those sizes.
The series resistance for various cell combination under the above conditions is as follows:



Table 1: Typical values for different types and numbers of cells using the circuit in figure 1 with a supply voltage of 12-15 VDC
Number and type of cells Resistance value (ohms) with 2 volt LEDs (standard-brightness red/yellow/green) Resistance value (ohms) with 3.6 volt LEDs (high-brightness green/blue/white)
4 AA
680
470
2 AA
1000
820
1 AA
1200
1000
 
 

4 AAA
1800
1200
2 AAA
2700
2200
1 AAA
3300
2700

  • The above values are not critical and variations of +-25% should not be of any concern
  • 1/4 watt resistors or larger are suitable.
In Figure 1 may be seen the schematic of the "Floaty-Thingie."  As you can see it is very simple and there's nothing critical about it - except to say that any exposed wires should be insulated to prevent accidental shorting of any components:  Remember that NiMH cells can put out many amps under such conditions!

On the schematic, "R" is a resistance from the table above, "D" is the LED, and "B" is the holder, containing 1, 2 or 4 cells.  When operating from a "12 volt" supply (which can be anything from 11 to 15 volts) it is not recommended that more than 4 cells be used as you need several of volts of drop across resistor "R" in order to limit current effectively and maintain fairly consistent current with minor voltage fluctuations.

Note that Table 1 shows different resistance values for "2 volt" LEDs and "3.6 volt" LEDs.  The older-style "normal brightness" red, yellow and green LEDs (but not blue or white!) are of the 2 volt variety while the newer "ultra bright" LEDs (most notably green, blue and white) are of the "3.6" volt type.  When you by the LEDs, a quick look at the "forward voltage" specifications will tell you what you wish to know - but don't be worried by slight variations.  For example, the "2-volt" types may vary from 1.7 to 2.2 volts while the "3.6 volt" types may say anything from 3.2 to 4.1 volts.

A note about the use of 3.6 volt LEDs:

  • These types are usually the "ultra bright" (green, blue, white) LEDs.  If you use these - and you have a lot of holders - the total amount of light coming off the "floaty-thingie" may be surprisingly bright - even at just 8 or 3 milliamps.  If you build one of these, expect that they may still be painful to look at and also that at night, the entire assembly may be annoyingly bright!
Remember:  We aren't aiming for ultra-precise results here - just those that are "in the ballpark."

Using the "Floaty Thingie"

I've used this thing for several years now (over a decade!) - as have several friends who have seen it and made their own.  Here are a few observations and comments:
  • Put ONLY fully-charged cells in the Floaty-Thingie.  It will take a very long time to charge a dead cell (several weeks, perhaps!) at the above currents.  Since the whole idea is to have fully-charged cells on hand for immediate use it would be a bad idea to put anything but fully-charged cells in it in the first place!
  • Completely fill up the cell holder.  This should go without saying:  Unless every position in the cell holder is filled, you won't complete the circuit and do charge maintenance.  Because of this, I recommend having one single-cell holder and one two-cell holder - in addition to a larger number of four-cell holders for each cell size (e.g. AA and/or AAA.)  Doing this allows you to "float" any number of cells that you may have onhand.  Some people who have built it have used two-cell holders (and a single one-cell holder) instead of any four-cell holders, which works, too, but remember that since each holder takes the same amount of current, regardless of the number of cells, you'll be able to maintain fewer cells overall if your wall-wart is rather small.
  • Make sure that you adequately size the wall-wart.  When you pick your "wall wart" supply to run this, consider how much current you will pull from it if you load cells into every holder.  To play it safe, assume that each AA holder will pull 10 milliamps and each AAA holder will pull 5 milliamps and simply add the total number of holders of each size - and make sure your supply can handle this.  
  • Note that a one-cell holder pulls the same current as a two or four-cell holder of the same cell size:  The difference in power is "eaten" by the series resistor used to limit current.  Again, this means is that if you have a very small wall wart - of if you have a limited power budget (say, from a small solar panel) you can get better efficiency by using mostly four-cell holders rather than mostly two-cell holders.
  • Yes, you can use a 12 volt solar panel for this.  Since the sun only shines part of the day, don't worry if the voltage goes well above 12 volts (as high as 18-20 volts) during bright sun as the "average" current will be in the general range of what it should be.
  • This "maintenance" charge doesn't seem to have damaged the NiMH cells.  Over the past 5 10 years or so, neither I or others who have used a Floaty-Thingie have seen any evidence that its use causes loss of electrolyte due to overcharging, "Lazy Cell" syndrome (see below) or obviously shortens the life.  Nevertheless, it would be a good idea to rotate through and use all of the cells as this would reduce the possibility of "Lazy Cell" syndrome (if it is likely to occur in NiMH at this "maintenance" rate anyway) and it give you another chance to spot those cells that are going bad!  Even when treated well, cells won't last forever!
  • The "Floaty-Thingie" doubles as a night light.  Since my Floaty-Thingie can hold over 30 cells, its LEDs give off a surprising amount of light when all holders are populated and if you happen to use a mixture of different colors you can get some pretty cool effects!  Remember, though:  The modern "ultra bright" LEDs put out a lot of light - enough to make looking at them painful and keeping a room annoyingly bright at night.  If you do use these newer, modern LEDs be aware that many of them (such as the blue, white and green) have higher voltages - between 3 and 4 volts as opposed to around 2 volts for the old-fashioned, dim red, yellow and green "indicator" type LEDs, so be sure to take that into account when selecting the resistor values.
  • I try group group "like" cells together.  If you are like me, you have been acquiring NiMH cells for years so you not only have different brands, but different milliamp-hour capacities of cells - even of the same brand!  Grouping like-cells together will also assure that when you use them in a device that takes several cells, you'll get optimal performance.
    • Note:  When I buy rechargeable cells, I always write the month and year of purchase on them with an indelible marker as this also makes it easier to group them together.
  • DO NOT put alkaline cells in the "Floaty-Thingie."  When one attempts to recharge alkaline cells, they can do unpredictable things such as leak, so don't!
  • Come up with a system for "rotating" stock.  It is best if you make sure that all cells get as equal use as possible.  One way to do this would be to leave at least one empty holder at all times, knowing that the next holder contains the cells to be used when previously-charged cells are to be installed in the now-blank one.  In this way one can help assure more even usage of cells over time.
Can you put NiCds in the "floaty thingie"?  Yeah, probably...  It probably won't hurt them to keep them in there for short periods such as days, but I'm not sure that I'd leave them in the device for weeks/months at a time!

Using "similar" cells:

As with other types of cells, it is recommended that you avoid, as much as possible, mixing different brands/capacities of cells.  While the chemistry of NiMH cells makes it less likely than with NiCds that they will be damaged by cell reversal, it never hurts to play it safe.

This is fairly easy to do, actually:  Simply group the same brand and same-capacity cells together and use them as such.  Personally, I write the month and year of acquisition on cells when I buy them with an indelible marker, making it even easier to match the cells into groups - plus, it lets me readily identify the oldest of the cells and keep track of how old they are and whether or not they deserve further scrutiny as they age.

Detecting apoptosis (e.g. "cell death"):

The "floaty-thingie" has another use:  To detect cells that are near the end of their useful life.

Inevitably, cells will lose their capacity and die - but how do you detect that fact before discovering that the device you put them in quit working sooner than expected?

In using the "floaty-thingie" there are some signs that an individual cell may be "sick" and might have lower-than-expected capacity.  To do this, you'll need a reasonably accurate digital voltmeter:  It needn't be expensive - I've found that even the $3-on-sale digital multimeters from places like Harbor Freight have more than adequate accuracy.

Here's the procedure:
  • Charge the cell normally using your normal charger.
  • Put it in the "floaty-thingie" and wait a week or so.  This wait time is required to allow the cell to equalize and "do its thing" - that is, if it's really bad, it may take a few days for the symptoms to show up.
  • While in the holder, measure the cell voltage.  I have found that a normal room temperature that typical NiMH cells measure between 1.35 and 1.47 volts.  I've noticed that same-brand and same-vintage cells tend to stay very close to each other and that this voltage seems to slowly decrease over time as the cells age and self-discharge (leakage) currents increase.
If you find one cell that has radically different voltage from the others - especially if it was made at the same time and is of the same brand as the others - then be suspicious of that cell!  If the cell's voltage is unusually high after a week of being in the "floaty-thingie" (a reading above 1.5 volts should certainly set off alarm bells!) then it is very likely that there is something seriously wrong with that cell!

If the cell voltage is lower than it should be - say below 1.3 volts - mark it with a piece of tape (so you can tell it apart from the others) and then try charging it normally, re-install it in the "floaty-thingie" and wait another week or so - just to make sure that it is really sick.  If it tests OK this second time, chalk up the first "bad" results to, perhaps, accidentally putting a battery that was not fully charged into the "floaty-thingie" - but if it tests bad again, get rid of it!

Of course, it should go without saying that all batteries should be disposed of properly!

Disclaimer:


Again, messing about with batteries/cells can be hazardous:  Most cells contain hazardous materials and injury and/or damage can result from mishandling them.

Cells that are shorted, improperly charged or otherwise maltreated can pose an explosion/burn/chemical or other hazard.  It is entirely up to you to do research and provide the appropriate precautions to prevent damage and/or injury.

You have been warned!


This blog posting was adapted from an earlier article on my web site.


[End]

This page stolen from ka7oei.blogspot.com