Thursday, October 26, 2017

SDR-2017: Progress and Modularity

If you've read my earlier posts, you know that I'm a big advocate of the modular approach to design and construction, and that it all starts with "Noodling" - thinking about what I want the rig to do and laying-out how I want to accomplish it in a block diagram, which will serve as the project's "road map". 

I used to scratch out these diagrams on paper until I discovered the Yed program, which is now my tool of choice.  It takes a little more time, mainly to get all the boxes uniform in size and all the lines straight, but I find that process also helps me think in a little more depth than I do when drawing on paper, and it's certainly easier on trees.

Anyway, above is the SDR-2017 diagram that I "finalized" back in August, and I've "X" marked the modules as I've completed them. Notice that I haven't deviated from the original design concept; the diagram keeps me on track and prevents succumbing to "feature creep"!

 At this point, I've got a pretty respectable software defined receiver that covers from below the AM broadcast band up to the lower VHF spectrum, where it begins to run out of steam around 100 MHz.  Good bones for what'll ultimately become a 160 to six meter transceiver.

 My primary use for this rig will be on the amateur bands, but I also want the ability to occasionally use it to receive shortwave broadcasts, which makes designing the bandpass filter networks a bit more complicated than it would be otherwise.  Being lazy, I borrowed much of the bandpass filter design from a commercial rig (IC-735), with some tweaks to optimize the circuit based on this application and what I have in my junkbox. 

What I did first is create models of the Icom circuit in LT Spice, so that I could see what the Icom designers came up with.  Below is a model of the filter for the 160 Meter band:
 In this case, where I'm shamelessly stealing someone else's proven design, these models wont be used so much to tweak the design as they will to confirm that, once constructed, it's working as it should - more on this in a minute.

My next step was to build the inductors.  Sure, I could just order them from Mouser, but what's the fun in that?  So, I spent a few hours working with a spreadsheet that I put together years ago for this purpose, which spit out the number of turns and type of core for each filter element, then spent a few more hours winding the bloody things.  I don't know of anyone who enjoys that, but if you do, something's wrong with you...

With all that info, I drew the schematic shown below and began putting the filter board together.
 Rather than using diode switching as in the Icom, I'm using relays for a couple of reasons: First, I haven't had much luck homebrewing diode RF switches; I can get 'em to work, but the isolation is always poor.  Second: I got a good deal on the relays.  I started construction with the input switches, and will add the output switches as each band's filter is completed.  Doing it that way makes building the filters easier because I'm not reaching over the relays while working.

Speaking of that, there's been significant noodling involved in determining the physical layout of the filter board.  The board itself is 6" square, and I've divided it into seven "lanes" - one for each band - of about 0.75" each.  The input switches are at one side of the board and the outputs on the other.  Since the RF signals on this board are going to be low (<0dBm), I don't expect that there'll be any crosstalk between the filters, but if so, I'm leaving room to install shielding dividers between each lane.  I'll post pictures as I get further along in the construction.

As of last night, I've completed the 160m filter and "swept" it using my spectrum analyzer (Rohde & Schwarz FS-315.)  The response matches the LT Spice model so closely that it's almost spooky!  The curve is virtually identical, the only differences are in the loss (actual filter slightly better than model) and frequency of the peak (actual filter peaks slightly lower in frequency, but still FB in the amateur band.)  Excellent!

Once I have this board completed, I'll circle back and complete the T/R switching and mic audio circuits; much of this is incorporated into the Softrock hardware and Quisk software already, so that *should* be fairly simple... We shall see.

This is the point in any project where it becomes exciting and I have to fight the temptation to "pull an all-nighter" to get things done.  I'm getting close to retirement when that'll become practical, and man, am I ever looking forward to that!



Tuesday, October 17, 2017

SDR-2017: Assembly, First Light and Audio Tweaking

Receiving AM Broadcast station - note the IBOC "sidebands".
After lots of "noodling", I'm finally getting to the fun part: Putting it all together. 

Touching a bit on the mechanical aspects: I didn't want to fall in to my usual trap of trying to squeeze 10 pounds of stuff into a 5 pound bag, so this rig has a large form factor when compared to my others.  Dimensionally, it's 16" wide, 12" deep and 6" high, so with any luck, I won't be building each module 3 times in effort to make it fit into the smallest available space.  We'll see how that goes.

Because of my limited metal working skills and facilities, I've built the chassis from 26 gauge galvanized steel.  Getting this rather flimsy material formed into a rigid housing took a little thought and some trial and error, but it's working out reasonably well.  Basically, it's a lot like modern cars in that it's a box that gets its strength from being made from smaller boxes.  So, while it's very light in weight, it's structurally rigid, and very easy to work with - except for the bleeding part; some of the edges are pretty sharp.

Electronically, I haven't deviated from the topology that I laid-out in my initial block diagram:  The touchscreen equipped Raspberry Pi, running Quisk in "kiosk mode" talks to the Arduino that handles all the hardware switching and programming of the synthesizer, while a modified "Softrock" connected to a USB soundcard handles the modulation/demodulation.  Ahead of the Softrock is a diode double-balanced mixer that converts the received signals up or down to 9 MHz.  This is all working fairly well, though there's still a lot of refinement work to be done.

An example of this is in getting the receive audio sounding decent.  My original intention was to take the line audio out of the pi and feed it, through a 10K pot, to the LA4425A power amplifier.  This works, but picks up a ton of stray computer noise unless I significantly load the input to the power amp, which reduces gain more than I'd like.

The LA4425A has a rather high input impedance, somewhere in the 10s of K Ohms, while the output of the on-board soundcard is fairly low Z, and I think this mismatch is causing the problem.  So, I'm going to try a simple common-base transistor amplifier between the soundcard and volume control. 

The common base amplifier's characteristics are: Low input impedance, less than unity current gain, moderate output impedance and relatively high voltage gain; exactly what I think is needed.

I've built enough transistor amplifiers that it's almost become second nature, but I still like to go through "the design process" first, then model the circuit in LTSpice before melting any solder or frapping any silicon.

When it comes to designing a common-base amplifier, I tend to approach it in much the same way as I would a common emitter circuit.  R1 and R2 form a voltage divider that's "stiff" enough, current-wise, to keep the base voltage at about 2.1 volts.  This biases the circuit so that the drop across R4 will be about 1.5 volts.  Dividing 1.5V by 100 Ohms gives us the quiescent current flowing through the device, about 15 mA. Next, I want the collector to be able to "swing" about a volt, so I chose a resistor of 560 Ohms, which has the collector resting at about 3.25 volts.  Cool.  

Plugging these values into LTSpice, I was able to see that the model confirmed the numbers that I'd come up with.  Yes, they're not exactly the same, due largely to my assumption that the B-E Voltage drop was 0.6V, but still well within in the ballpark.  
 
Initially, I ran the model without C3 in place, and the predicted gain was just under 18 dB from a few hundred Hz to well beyond the audio spectrum.  Since this isn't a hi-fi, I added C3 so that the gain rolls-off above about 3-4 KHz.  Since I had the circuit already "running" in LTSpice, I simply plugged-in different capacitance values until I got the response curve I was looking for, but this could be determined algebraically with just a little more effort.  
 
This response shaping cost  around 4 dB in overall gain, which is insignificant in this case because I'll still have more than enough signal to push the LA4425A to it's maximum.  Actually, I think I'm probably going to have to reduce the gain a bit... Maybe not, we'll see.


The next step will be building the circuit, plugging it into the rig and seeing if it works as intended.  Stand by!

73 de N8NM



Wednesday, October 11, 2017

SDR-2017: More Controlling the Beast

The diagram (and board) are starting to fill-out nicely! I've added a couple of things since my last post:  Outputs for the cooling fan for the Pi and for switching the low-pass and band-pass filters.

The fan output is straightforward:  I use a 47 Ohm wire-wound resistor to drop the voltage and slow the speed a bit, and a 470 uF capacitor to eliminate any electrical noise. Easy peasy.

The filter select lines were slightly more involved.  Since the Arduino will always be aware of the frequency of operation, I added some conditional statements within the sketch to activate the appropriate filter-select lines based on that frequency. To conserve the Arduino's I/O, I'm using a 74AHCT138 3 to 8 bit decoder.  I'll throw-up (unfortunate choice of words) the code sometime in the next day or two.

While this version of board and code are doing their intended duties, they're still very much in the preliminary "proof of concept" stage; I may want the Arduino to perform some other tasks, such as a CW Keyer, that rely on pin-change interrupts, so I need to look at my port choices to work around the interrupt limitations of the Arduino.  Right now, the only interrupt-driven thing we're doing is reading the encoder, so it's not an issue...

73!


Monday, October 9, 2017

SDR-2017: Controlling the Beast.


My primary goal of this project was to envelope modern SDR software and hardware in a traditional package, making the user experience less "black boxy" and more familiar to those of us who've spent our lives operating what's now considered "Legacy" hardware.  In other words, I want the operator to sit in front of a RADIO rather than a computer monitor, keyboard and mouse. 

What I'm finding to be a challenge is in how to integrate "off-the-shelf" systems and hardware into the form of a traditional radio.  Getting it working is only half the battle, the other half is getting it to work the way I want it to.

An example of that is the simple matter of turning the rig on and off. 

Backing up a bit:  Architecturally, the "back-end" of the rig is a modified SoftRock RXTX V6.2 connected to a Raspberry Pi and 7" touchscreen via a USB sound card.  This makes for a fully-functional "black-box" transceiver on it's own, but it's hardly a traditional package; I want knobs, switches, and the ability to cover all HF bands (possibly including 6 meters...)  That's going to take some more hardware - and a LOT of noodling!

Since I've already built several rigs using Arduino controlled Si5351 synthesizers, that was a natural place to start - I've already got working code to handle this, plus switch the necessary filters and all that jazz.  The trick was in getting the Arduino to talk to the Pi so that the frequency displayed by Quisk would track that tuned by the Arduino.

Getting that working wasn't as bad as I'd thought, thanks to Pavel, CO2WT's FT857D library.  By integrating this with my Arduino code, I was able to take advantage of the off-the-shelf Hamlib libraries to get the Arduino talking to the Pi: Quisk think's it's controlling an FT-857.

So, at that point, I had two single-board computers talking to each other and the encoder/synthesizer and all was good.  All was good, except that I had no clean way to turn them all on and off together... That took a few nights to figure out!

Referring to the diagram above, switch S1 is a momentary pushbutton that, initially, is shunted by 1/2 of K1.  When S1 is pressed, power is applied to the Arduino and Pi through a DC/DC Converter (more on this later.)  Once the Arduino is initialized, port D5 goes high, turning on Q1, energizing K1. Meanwhile, the Pi is still booting; once it does, it, too, sends a high (from GPIO23) to the base of Q1.  In that manner, Q1/K1 will be turned on when the Arduino OR the Pi are running. 

Why the wire OR?  This drove me nuts:  When a serial connection is being established to an Arduino, the first thing it does - by design - is force a reset.  So, what would happen is that the Arduino would boot first and suck-in the relay, but when the Pi'd boot a few seconds later, the whole thing would shut down.  The "Wire OR" keeps the relay energized while communications between the devices are being established. 

Once powered-up, the "cold side" of S1 is re-routed through the 2nd set of K1's contacts to Q2 and Q3.  So, pressing the switch will then turn those transistors ON, placing logic LOWs on Arduino port D4 and the Pi's GPIO24.  Code in the Arduino switches port D5 Low, and a daemon running on the Pi initializes it's shutdown sequence such that it's final act is bringing GPIO23 LOW, de-energizing Q1 and K1, killing power to the DC/DC converter module.

It took a hell of a lot of head scratching to get this working, but man, is it ever cool!

Going back to the DC/DC converter for a minute:  My first pass at providing regulated 5V used a LM-317 driving a TIP3055.  It worked, but ran hot, and I really didn't want to have to bury a large heat sink in what'll eventually be the bowels of the rig.  So, I sat down and started designing a switching regulator, and looked over at the tray on my desk that holds paper-clips and other such office effluvia - everyone's got one of those... Anyway, in that tray was one of those USB converters that plug into a car's cigarette lighter; I'd gotten it as a hand-out at a trade show and never used it.  Checking the specs, it was rated for 3.4 Amps at 5V - perfect!  I cracked it open and installed the guts in a small shielded box that I bent out of galvanized flashing, and, as they say: Bob's your uncle.

With this milestone out of the way, I'm looking forward to the next, and relatively simple task of designing/constructing the audio amplifier stage. 

73!