2017年7月30日日曜日

RTL-SDR upconversion with diode-ring mixer: part 2

This post describes an improved version of my homebrew, one-transistor RTL-SDR upconverter, including a circuit diagram and videos of the unit in operation.

Cleaning up the oscillator signal


The previous version of my homebrew RTL-SDR HF upconverter used a Pierce crystal oscillator with a crystal that was marked as 49.8 MHz.

Monitoring on a nearby receiver revealed that the oscillator was generating signal energy at 16.6 MHz and 33.2 MHz as well as at 49.8 MHz. Therefore, the simple Pierce oscillator was exciting the crystal at its fundamental frequency, with the desired LO energy at 49.8 MHz being merely a side-effect. So the LO was producing signal energy at many harmonically-related frequencies, which will introduce a host of unwanted mixing products at the mixer output, greatly increasing spurious signals and IMD.

To force the oscillator to oscillate only at the desired overtone frequency, I changed the oscillator topology to a common-base Colpitts, using the crystal to ground the base at RF. An LC tank circuit in the collector is tuned to approximately 49.8 MHz to prevent gain all other frequencies, in particular the fundamental frequency of the crystal. In practice, the base was first grounded with a 100 nF capacitor and the LC circuit tuned (by removing/stretching/squashing the turns on L1) to approximately 49.8 MHz. The oscillator's frequency could be monitored by watching the waterfall display on the gqrx SDR software (or alternatively by listening on a separate VHF receiver for the radiated signal). After adjusting L1 for oscillation at approximately 49.8 MHz, then the grounding base capacitor was replaced with the 49.8 MHz crystal. Finally, monitoring on a nearby receiver revealed an oscillator signal only at 49.8 MHz, but not at 16.6 MHz or 33.2 MHz -- just as desired.

The current circuit diagram is as follows.




I then connected the oscillator to the RF input port of the mixer, through a 100 nF capacitor. Unfortunately, this stopped oscillation. A 1000 pF capacitor allowed oscillation and was used.

Results


Reception results (using my M0AYF-designed active loop antenna -- reference: http://www.qsl.net/m0ayf/active-loop-receiving-antenna.html) were much better than before with far fewer spurious signals. Shortwave signals were where they were supposed to be (WWV at 5, 10, and 15 MHz, ham signals at 7 and 14 MHz). Furthermore, occasionally ionosonde signals could be seen, and the ionosonde signal progressed from low frequency to high frequency on the software's waterfall display. If many spurious mixing products were present, we would expect mirror images or duplicate images of the ionosonde signal, but none were observed, indicating the HF upconverter is mostly working.

Here is a short video showing the reception results. You can see ionosonde signals at 01:35 and 02:33 in the video.

The video also shows the effect of adjusting the LNA gain, starting at 02:20. If the gain is too high, spurious signals and IMD start to appear. If the gain is too low, sensitivity suffers.


Here is a short video showing the physical layout of the completed circuit.


Next steps

The crystal oscillator signal seems to be noisy, as evidenced by raspy tones when listening to CW signals. I suspect the 5V voltage taken from the USB hub is not sufficiently filtered for oscillator use. I will investigate voltage regulation and/or filtering on the Vcc line.

I still have no way of measuring the oscillator output power (e.g. an RF probe). Most likely, the oscillator is not delivering the required 7 dBm into the mixer's LO port. Nevertheless, the converter seems to be working reasonably well, so perhaps the LO drive is sufficient for casual listening purposes. If possible, I would prefer to keep the circuit simple (just 1 transistor) rather than adding more amplifier/buffer stages after the LO.

Some minor FM broadcast interference was still audible at some locations in the shortwave band, but the interference is limited to a few specific frequencies. A simple LPF on the RF port could fix this.

Addendum 2017-08-05

After playing with my upconverter a few days, I have a few additions and corrections to this article.


Correction: The LO is not noisy


I previously mentioned that the crystal oscillator seemed to be noisy due to raspy-sounding CW signals. It turns out that the oscillator is fine and is generating a clean signal.

The debugging process was first to listen to the radiated LO signal on a nearby receiver in CW mode. The radiated signal sounded very clean, which was puzzling because I suspected a dirty LO signal. Nevertheless, I thought it might be remotely possible that while the radiated signal was clean, perhaps the signal tapped off of the emitter (and fed into the mixer) might be dirty or distorted. The next step was to power the LO from a battery instead of from the USB power, to see if a dirty supply voltage was distorting the LO signal. However, powering the LO from a battery yielded no change in the quality of CW signals. Next, I powered the active antenna from a battery as well, instead of from an AC adapter. That also yielded no change. Therefore, either (1) the problem was due to noise somehow getting into the oscillator via another route, or (2) the problem had nothing to do with the oscillator. It turns out that (2) was the case.

The raspy tones I heard when listening to CW were due to a too-high sample rate being set in the gqrx SDR software. I was originally using a sample rate of 2.8 million samples per second. I reduced this to 2.4 million samples per second, and then the CW signals sounded pure and clean as they should. Probably, with the higher sample rate of 2.8 MS/s some samples were getting lost, which led to the unclean-sounding CW signals.


Perhaps the LO drive is sufficient


The web page of VK6FH at http://www.vk6fh.com/vk6fh/RF%20MIXERSdiode.htm describes some of the consequences of reduced LO drive level for diode ring mixers. A quote from that page follows, describing the effect of lower LO drive for commercially-available diode ring mixers.
Some designers shy away from using these passive double balanced mixers (DBM) because of the fairly high LO drive required.  However, they can be used successfully with lower drive levels. The efffect will be the conversion loss and port-to-port isolation (defined below) will get worse, but since we are using these devices at the very bottom of their 1GHz range, the effects are minimal. LEVEL 7 mixers can be used by driving the LO port with a single transistor crystal oscillator, delivering about +3dBm which is 0.32V rms into 50 ohms (2mW ) with good results.

VK6FH's web page presents a table showing the effects of reducing the LO drive from +7 dBm to +3 dBm -- slightly more conversion loss, and slightly worse port-port isolation. But these effects are not catastrophic, especially for a casual hobbyist receiver as this one is.

Also note that VK6FH specifically says that a single-transistor crystal oscillator (such as the one I am using) is capable of driving a level-7 mixer as long as the oscillator can provide about 0.32V RMS into 50 ohms.

So the question remains: is my single-transistor oscillator capable of delivering 0.32V RMS into 50 ohms? I lack the test equipment to test this currently. However, before building the oscillator, I did simulate it in LTspice and adjusted the circuit constants such that the simulated oscillator delivered more than 0.32V RMS into 50 ohms. Given the simulation results, and given the good reception results in practice, I see no need to attempt to increase the LO output (which would undesirably increase the circuit complexity).

A future article will explain the LTspice simulation of the local oscillator circuit.

---

2022-03-18 update

I noticed a jump in traffic, and it seems that this article was linked from hackaday.com again. :-) So here is an updated picture of the converter. I rebuilt it on a smaller piece of copper foil, affixed to a bit of cardboard. One of these days I may make a small 3D-printed enclosure for it.

 



2017年7月23日日曜日

RTL-SDR upconversion with diode ring mixer: part 1

This post describes my first experiments with using a homebrew upconverter to receive HF on an RTL-SDR dongle.

Problems with direct sampling


A previous post described my experiments with RTL-SDR direct sampling, where a short connector wire is connected directly to the RTL2832 chip, bypassing the internal device's tuner. The connector wire is routed outside the plastic case of the RTL-SDR dongle, and a wire antenna is then connected to this short connector wire.

I encountered two major problems with this approach:

  1. Because this approach bypasses, in hardware, the internal tuner of the RTL-SDR device, the signal is no longer routed through the device's software-controllable low-noise amplifier (LNA) stage. Therefore, it is no longer possible to control the signal gain via software. This is disadvantageous because with a broadband front-end, it is essential to control signal levels to minimize IMD.
  2. Even with no wire antenna connected, with only the short connector wire in place, severe breakthrough of broadcast FM stations was audible in shortwave frequency bands. Therefore, avoiding FM breakthrough with the direct sampling approach would require more careful wire routing, use of shielded conductors, adding extra shielding inside on the existing and small PCB, etc. This greatly complicates the design process.

Onward, and upward

I decided to try an upconversion approach instead, where the entire HF band from 0-30 MHz is converted upwards by about 50 MHz, to lie between 50 and 80 MHz, which is then directly receivable by the device.

I chose 50 MHz (approximately) because I happened to have a 49.8 MHz crystal available in my parts bin, purchased some time ago because I vaguely thought it might turn out to be useful someday. And indeed, it did turn out to be useful.

Constructing the oscillator


I built a simple 49.8-MHz Pierce oscillator roughly following the guidelines in http://www.rakon.com/component/docman/doc_download/234-single-transistor-crystal-oscillator-circuits. I used a 2N3904 transistor, which  is barely suitable in this application. The transition frequency (ft) of the 2N3904 is about 250 MHz, and generally ft should be 10x greater than the desired oscillation frequency of 50 MHz, so ideally we should use a transistor with an ft of 500 MHz.

Power for the oscillator comes from a USB port of a USB hub, which supplies 5 volts, though the document above shows oscillators designed for a 3-volt supply.

Due to the unknown crystal parameters, my use of a 5-volt instead of a 3-volt supply, and slight deviations in my design from the recommended component values, I have no idea exactly how much power this oscillator is capable of delivering. As the oscillator is intended to drive a diode-ring mixer, the oscillator should provide a 7 dBm signal into the mixer's LO port.

I strongly suspected that this single-transistor oscillator would not provide enough LO drive to properly drive the mixer. Nevertheless, I proceeded to construct the rest of the upconverter circuit, assuming the circuit would work well enough for me to hear something.

Constructing the mixer


Next I constructed the mixer. From my bag of about 100 1N4148 diodes, I selected a handful and picked 4 diodes that had roughly the same forward-voltage drop, as measured by a multimeter.

The 4 diodes were then twisted into a ring and soldered together.



Two trifilar-wound baluns were also constructed, each wound on a FT50-43 core. A YouTube video by W2AEW clearly illustrates the process: https://www.youtube.com/watch?v=a8ViWS61hsU.

Putting it all together


The diode ring was connected to the baluns. The LO was then connected to the LO input winding of the appropriate balun, and the IF output centre tap (on the other balun) was connected to a coaxial cable, that then connected to the RTL-SDR dongle's antenna input. The RTL-SDR dongle was plugged into a small USB hub, that then connected to a laptop computer running Linux. Another USB cable connected to the hub provided power for the LO.

The entire constructed circuit looks as follows.




Here is a close-up image of the completed diode ring mixer.




Here is a close-up image of the oscillator portion of the converter. This construction practice is rather poor for 50 MHz, with long component leads acting as antennas that both radiate the oscillator signal and pick up stray signals from the environment. However, because the oscillator circuit is probably not yet in its final form, I did not attempt to miniaturise it yet.



Results


I started the gqrx program on Linux and listened around 49.8 MHz to find the LO signal. Having found the LO signal, I determined its exact frequency on the software's waterfall display, and entered the LO frequency into the appropriate field in the gqrx software, so that all displayed frequencies would have the LO frequency subtracted, to display the actual HF reception frequency (e.g. 7 MHz) instead of the converted frequency (e.g. 57 MHz).

I then connected a random wire antenna (about 2.5 meters length) to the mixer's RF input port and attempted reception using the gqrx program on Linux.

Encouragingly, the noise level did increase when the antenna was connected, implying that the mixer/oscillator were  at least working in some basic fashion. However, even with the LNA gain set to maximum, only one shortwave station was weakly audible around 6.9 MHz.

I then connected my broadband, active loop antenna (design by M0AYF, shown here: www.qsl.net/m0ayf/active-loop-receiving-antenna.html) to the RF input port. Then, with LNA gain set to about 50%, several shortwave stations were audible across the entire tuning range from 0-30 MHz. Setting the LNA gain too high caused many spurious signals to appear, which was immediately visible on the waterfall display as a sudden emergence of several spurious signals across the entire receiver bandwidth. Setting the LNA gain too low allowed no signal reception. In practice, setting the LNA gain was very easy -- starting at 0, the gain is slowly increased until signal peaks and the noise floor from the active antenna become visible. After a certain gain setting, further increase in gain cause both the noise floor and the signals to increase. Gain should be backed off just before this point.

With the LNA gain set appropriately, it was possible to clearly listen to several shortwave broadcasts, and some amateur and maritime CW broadcasts.

However, it was not working perfectly:

  1. There was still some FM breakthrough at various parts of the shortwave spectrum, though nowhere nearly as bad as I experienced with direct sampling. A low-pass filter should fix this.
  2. Signal-to-noise ratio seemed lower than I expected and overall reception was noisy, compared with other videos I have seen of upconverted RTL-SDR reception. Also, CW stations sounded raspy. I can think of three possible reasons for the "noisiness": (1) insufficient LO drive leading to excessive conversion loss in the mixer; (2) noise on the USB power supply line causing an unclean LO signal; and (3) noise in the switching power supply used to power the active antenna.
  3. Even in bands where I knew no signal to be present (e.g. from 20 MHz to 30 MHz in the evening, when these bands are closed), I could strongly receive shortwave broadcasts. These are spurious signals. A clean LO signal, and additional RF filtering and IF filtering, could alleviate this problem.

Conclusion


The basic approach of upconversion works much better than direct sampling, due to reduced FM breakthrough, the ability to control LNA gain in software, and no need for dealing with small and critical wire placement inside the RTL-SDR device.

Sufficient LO drive must be ensured. LO drive could be measured with a simple RF probe, for example N5ESE's design at n5ese.com/rfprobe1.htm .

A clean power supply should be used for the LO and for the active antenna. It is not yet clear if the USB-port-provided power is clean enough for LO usage.

More RF and IF filtering is needed. Adding more filtering necessarily reduces the input bandwidth (into the mixer) and the output bandwidth (from the mixer), and this limited bandwidth unfortunately reduces some of the appeal of the RTL-SDR devices, namely the ability to instantly tune anywhere within the shortwave spectrum, and the ability to record 2.5-MHz-wide ranges of the HF spectrum for later playback. Perhaps a compromise would be to create a 2.5-MHz-wide, sharp-cutoff RF bandpass filter (e.g. 5.5 MHz to 8 MHz) and IF bandpass filter (e.g. 55.5 MHz to 58 MHz). That would cut off many sources of interference/IMD, while still allowing instant tuning within the 2.5-MHz range, and also still allowing recording of the entire 2.5-MHz-wide slice of spectrum.

LO signal radiation (due to long leads) and/or LO signal leakage into the IF port (due to imperfect mixer balance) may be desensitizing the receiver. Again, IF filtering should help here.

Finally, no particular attention was paid to proper termination of the mixer ports, but for best performance (minimum spurious signals) proper (pure resistive) termination of all mixer ports is important.

2017年7月9日日曜日

Hot-melt glue for RTL-SDR direct sampling

I have a generic Chinese RTL-SDR dongle which, as you probably know, is a very inexpensive USB device that, when connected to a PC with the appropriate software, can be repurposed as a generic software-defined radio capable of receiving from 24 MHz to more than 1 GHz. More on these devices can be read at, for example, http://www.rtl-sdr.com/.

For me, however, MW and HF (0-30 MHz) are more interesting, and there are 2 approaches to receiving MW and HF on an RTL-SDR dongle:

  1. Up-conversion
  2. Direct sampling, where an antenna is connected directly to the internal chip, bypassing the tuner. Reference: http://www.rtl-sdr.com/rtl-sdr-direct-sampling-mode/.
This post concerns direct sampling. The summary is that I used hot-melt glue instead of soldering to attach a wire to pin 4. The following photos show the details.

I opened up my dongle and noticed it had two small copper islands which appeared to be designed for direct sampling. This makes it much easier to implement the direct sampling modification, as the necessary antenna wire can be connected to the relatively large copper island, instead of the tiny pin on the chip. Nevertheless, even though the copper island is "relatively large" compared to the pin size or the size of the nearby SMT capacitors, the actual size of the copper island is still quite small for hand soldering.



 

Though my board, as shown above, had copper islands, I actually expected to see a hole in the circuit board through which a wire could be pushed. The webpage at http://www.radioforeveryone.com/p/the-new-smart-manufacturer-link-can-do.html shows several examples of RTL-SDR board layouts with a pre-drilled hole in the same location. The idea is then simply to push a small wire through the hole, removing the need for soldering. Here is a sample photograph (from the above web page) of a board with a pre-drilled hole for the direct sampling modification.



My mistake: trying to drill my own hole.


Since I expected a hole where I only had a copper island, I thought perhaps I could drill a hole myself. I used a sharp hand tool and a magnifying glass to exactly place the tip of the tool in the center of the island.


I stopped drilling when a small hole had been created in the center of the island. Further drilling would have (due to the wide tool diameter) completely scraped away the copper island, so I did not attempt to drill all the way through the board.

To affix the wire to the board, first I placed a drop of hot-melt glue on top of the crystal, to hold the wire in place some distance from the desired connection point.



Then, with the wire held firmly in place by the hot melt glue, I bent the wire to lie exactly in the hole (or rather, the depression) that I had just drilled.



Unfortunately, even in this seemingly-perfectly-positioned condition, testing continuity with a multimeter revealed that the wire had no electrical contact with the copper island! It seems that my drilling had the effect of removing so much copper from the exact center of the island, that when a wire was pushed into the exact center of the newly-created hole, it was unable to make any electrical contact to the edges of the copper island lining the hole.

Salvaging my work


I bent the wire to make contact with the copper island's edges instead of the center of the hole. Testing with a multimeter confirmed contact between the copper island and the wire.

Then, being careful not to disturb the precariously-poised wire, I injected two dabs of hot-melt glue to encase the connection and hopefully hold it in place mechanically.


Finally, I added one more dab of hot-melt glue at the far side of the wire, and routed the wire outside through the RTL-SDR case.


Not working yet...


I ran my SDR software (gqrx on Linux) but unfortunately connecting an antenna to the newly-connected wire showed no change, indicating the wire was not actually connected anymore to the copper island.

Applying pressure


Through experimentation I found that if I pressed down hard on the hardened dab of hot-melt glue (that encased the connection point), the electrical connection would be made. Therefore, I can only conclude that either during handling the glue broke slightly loose, and/or during drying perhaps the glue changed shape slightly, shifting or lifting the wire away from the copper island.

To fix this, I placed a small piece of paper, folded about 4 times, on top of the hardened dab of glue, and closed the plastic case on top of the folded paper. The pressure of the closed case on the folded paper was enough to push the hardened dab of glue downwards to allow the encased wire to make electrical contact with the pad.

Reception results


FM broadcast signals are present in many places in the HF spectrum. This makes the quality of reception unacceptable (as the FM signals drown out the weak HF signals of interest), and a low-pass filter (or band-pass filter) will be mandatory for acceptable reception.

In the evening, with a 2-meter wire antenna, I could receive local AM stations clearly.

At 7 MHz, again there were severe problems with FM broadcast interference. However, I could weakly pick up one Chinese shortwave station, which is normally extremely loud when received on other shortwave receivers. No ham stations at 7 MHz were audible.

Next steps

  1. Use both copper pads and a balun for a differential input into the chip.
  2. Add lowpass filter to remove FM interference. Shielding the device may also be necessary.
  3. Add a separate low noise amplifier to boost the antenna signal. The software I use (gqrx) seems no longer to be able to control the device's internal LNA when direct sampling mode is chosen.

Addendum


The hot melt glue, if applied sparingly, can fairly easily be peeled off in case of a failed attempt, making this method perhaps easier than directly attempting to solder to the tiny pads.