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...


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. 


Saturday, September 30, 2017

New Rig: SDR-2017

It's been almost a month since my last post.  It's not that I haven't been busy, but because I've been doing some high-intensity noodling and trying, with limited success, to get a handle on coding in Python.  But, I'm making progress and finally at the point where I can cut/bend some metal and melt some solder!

In previous posts, I mentioned that I'd be doing a "Software Defined" rig as my next project, but I didn't want to simply regurgitate what others have done. No, I want my stink all over this one.

I started experimenting with SDRs in the mid 2000s when I stumbled across Tony Parks, KB9YIG's early Softrock kits.  These are really incredible little radios, and lots of fun to build - so much so that I built way several, including a couple that I never really intended to use, one of which I modified and re-used in this project.

As nice as Tony's kits are, once the novelty wore off, I lost interest in the operating experience, which is, to me, more like operating a computer than a radio.  This is by no means a criticism, just that it wasn't for me - I prefer a radio that "feels" like a radio.  So, I shelved the SDRs and went back to using more traditional radios at the same time that SDRs started becoming insanely popular with the rest of the amateur fraternity. 

Anyway, I started getting ideas for this project earlier this year when I came across a 40m Softrock receiver that I'd forgotten about, hooked it up and marveled at how competent a receiver it is.  Then, while rummaging through my desk at work, found one of my "surplus" Softrock transceivers hiding in one of the drawers.  That got the wheels turning: Why not build a "real" radio around it?  So, here we are...

The Softrock serves as the modulator/demodulator stages in the new rig, and is controlled by an embedded Raspberry PI 3B running N2ADR's Quisk software. The Softrock has been adapted so that it's frequency is controlled by one clock of the venerable Si5351 in much the same way that others and I have used it to provide the BFO signal in conventional rigs.  In other words, the Softrock is tuned to the IF signal.

The Si5351 is controlled by an Arduino Pro-Mini, that's also used to select the appropriate band and low-pass filters and handle all of the rig's switching duties.  The Arduino and Pi talk to each other via their USB ports: The Pi tells the Arduino when the frequency or band is changed in Quisk, and the Arduino tunes the Si5351 and switches the filters.  Conversely, when the frequency is changed using the rotary encoder, the Arduino tells the Pi about it and Quisk updates the operating frequency.  Cool!  A big "Muchas Gracias" to Pavel, CO2WT, for his fantastic library that makes the Arduino look like an FT-857D, allowing me to use the standard Hamlib libraries to make this all tick.

Referring to the above photo, the pot at the lower left is the AF gain.  I'm using an LA4425A amplifier to bump the soundcard's line-level output up to a few watts of glorious, room-filling audio.  In the upper left corner is a momentary switch used to power the rig on and shut it down gracefully; I've got the first part working, but need to debug the shut-down code (Damned Python.)

The display is a 7" touch-screen, which is about the perfect size to control Quisk in small-screen mode.  The Pi is attached to the rear of the display using a homebrew bracket/enclosure.  I found that the Pi would overheat after running for several hours, so I combated that by installing a small cooling fan on the Pi's enclosure.  I can now leave it running for days without it going into melt-down.

Left of the display is a 100 PPR encoder that I got ($20) from Marlin P. Jones. I love the resolution of the encoder, but am not wild about the clicky detents and intend to see if I can defeat that feature.

So, at this point, I have a working SDR operating at 9 MHz - which deserves mention:  9 MHz is a good single-conversion IF on all HF bands except 17m, where it's a pain to filter the 2nd harmonic of the BFO from the transmitter's output.  But, since there are no fixed IF filters being used and the 2nd LO is programmable, I can change to a 17m friendly frequency with a few lines of code.  Excellent!

That's where I'll leave it for now.  Until next time,

73 de Steve N8NM

Sunday, September 3, 2017

Huffing Lacquer

After building up the preamp for my Crosley 86CR, I decided that it was time to finish that radio completely.  You see, I repaired, stripped, grain filled and prepped the thing for lacquer over two years ago, and have using it in a partially assembled state ever since.

I like working with lacquer because it gives me lots of somewhat valid excuses for procrastination:  It's too hot, too cold, too humid, etc.  Since we've had temps in the upper 60s to low 70s, with low humidity, for about a week, I just couldn't put off breaking out the HVLP sprayer and going to town.

Unfortunately, I didn't photo-document the process... I never intended to write it up... but here we are.  I'll do my best to paint a word picture.

Here's what I started with in 2015:

It was actually in decent shape, though there was some veneer damage to the dial panel and a few dents from having things dropped on or banged into it.

To repair the veneer, I removed the dial panel and removed a section of veneer from a location that is hidden behind the side panel and surgically grafted it into the spot where the exposed veneer was damaged.  It took a few hours, but turned out well - the repair is all but invisible.

To work out the dents, I employed the XYL's iron and steamed them out.  This was easy - just lay a moist cloth over the dent, heat it with the iron and the fibers of the wood expand and the dent disappears.

After these and a few other minor repairs, I completely stripped the cabinet using Citru-Strip.  I like this stuff because it doesn't stink, so I'm able to do it indoors.  The trick to using it is to get a feel for how long to leave it on before scraping it off; too soon or late and you make extra work for yourself, but find the sweet spot and you'll have naked wood in no time.

Once stripped, it's time to sand.  This set has some fairly beefy veneer, so I was able to get quite aggressive with it in some spots.  It's not rocket science, start with a coarse grit and keep working it and progressing to finer grits until it's smooth.

But, even when it's smooth, you still have to fill the pores, which is my least favorite part of the job.  Ever see a refurbished antique that, when viewed from different angles, looks like it's had glitter splashed on it?  They skipped this step.  Again, it's not rocket science, the stuff goes on sort of like a slurry and you rub it into the grain, then scrape off the excess by dragging something like a credit card sideways across the grain.  The more you're able to scrape off, the less sanding you'll have to do in the next phase.

More sanding, this time with 400 and then 600 grit until the surface is as smooth as possible.  Light should reflect from it when it's done.

Then it's out to the garage for sprayin'.  Wear a respirator, the stuff ain't good to breath.  Before doing any color coats, I spray a very thin "spit coat" of lacquer over the entire cabinet.  The purpose is to seal the grain and all that grain filler so that it stays put.  If you don't, it'll all come out when you apply masking tape - ask me how I know...

Once that dried (overnight), I taped off the field and shot the trim with a couple of coats of heavily tinted lacquer. I had to play with the amount of dye to get the color right.  It's good to have lots of scrap boards from different species to experiment with.  Lacquer dries to the touch fairly quickly, and I removed the masking tape as soon as I was able to do so.  I've had bad experiences from leaving it on longer than necessary, so once I'm able to handle the piece, it's gone.

Then came the color coats, where the whole cabinet was shot with several coats of dyed lacquer - again, the correct color and shade was determined by experimenting on scrap, and then the "formula" noted so that I'm able to duplicate the mix.  I wasn't counting, but I'd guess I shot 6 color coats over two days before being satisfied that I had enough coverage.  I should mention that I use gloss lacquer for these coats; I think it covers better, but that's just me.

Once the color coats have cured (24 hours or so), I wet sanded the cabinet, first with 400 and then 600, before shooting the top coats.  I did dye these, but not as dark as the color coats.  As before, I wasn't keeping track, but I probably shot 5 or 6 coats of satin lacquer, then let it cure for a couple days before bringing it indoors for assembly.

Which is where we are now.  I apologize for the poor quality picture, the lighting in the shop is terrible for photographs.

 Yet to be installed is the speaker box (more on this at another time), grille cloth and decorative grill.  It's close to midnight, so I'm done for today!

Wednesday, August 30, 2017

Noodling The Next Rig: What If?...

There's a good chance that anyone who reads this has at least heard of Tony Parks and his Softrock SDR kits (www.fivedash.com).  If not, check 'em out - they're fun to build and an inexpensive way to wet your beak in the world of SDR.

I've got a number of his older (V6.2) transceiver kits built for different bands and can't say enough good things about them, so this is, by no means, a criticism:  While they work fine and do everything well, the operating experience is, as Bill, N2CQR would say: Very appliancy.  

This got the wheels turning: Why not use the SDR as the "back end" (modulation/demodulation and audio) of a "traditional" transceiver?  The idea's been festering in my mind for a few years now, I suppose it's time to lance that boil.

As with any other project, if you want any chance at bringing it to a successful conclusion, you need to start with a plan.  At this stage, I know what I want:

- 80 - 10 Meter coverage.
- Power output > 20 Watts.
- Front panel touchscreen display.
- Rotary controls for audio and tuning.
- Integral processor (Rasp. Pi) for SDR.
- Arduino Pro-Mini for user interface and system control.

So, I took those requirements and drew the above block diagram to use as a road-map.  As I said before, the only way to eat an elephant is one bite at a time.  This is the basic recipe I'll use for making elephant sandwiches. 

Moving forward, I'll determine the specs for each block, which will lead to more noodling before I even think about melting any solder.  Sure, it's fun to just jump in and make shi... stuff up as you go, the problem is that projects started that way tend to either go unfinished or don't work right when they are.

Tuesday, August 29, 2017

An Adequate Preamplifier for the FM band.

I've been trying to focus on cleaning the shack, but keep falling victim to spontaneous construction.

The other night, I fully intended to get some organizing done, so I went down to the shack and fired up my trusty old Crosley 86CR so that I could catch the Tigers game while going about the task at hand.  The 86CR is an interesting old set in a couple ways:  It covers the current FM band (was manufactured in '47), but the dial is calibrated in FCC channel numbers rather than the more familiar frequencies of 88-108 MHz.  It also uses an odd double conversion scheme, 5825 and 167.5 KHz, on the AM and SW bands.  

Apparently, the 86CR wasn't intended to be used from the basement of a home at the fringes of a metropolitan area, as it lacks an RF amplifier ahead of the mixer.  So, as I moved around the shack while listening to the ball game (on FM), the signal would fade in and out.  Irritating.  Gotta fix that, but don't want to put much time, effort or money into it.  

I call the circuit that I whipped up "The Adequate Preamplifier".  It's nothing particularly special or unique, costs about a buck, and gets the job done.

 The circuit uses a pair of J-310 JFETs in cascode.  Some folks like to think of this as being similar to a dual-gate FET, which I suppose it is, but when I look at it, I see a common-source amplifier (Q2) direct coupled to a common gate amp (Q1.)  Tomato, tomahto.  

The input network provides some semblance of a bandpass filter.  The LC network is comprised of L1, C3 and the gate capacitance of Q2.  With the antenna - a couple feet of wire dangling behind the set - connected as shown, there's enough load on the circuit for it to provide gain across the FM dial without retuning.  

The output transformer, made from a broken TV balun, provides balanced outputs to mate to the old Crosley. 

Performance?  I made no effort to quantify anything - it's got gain and doesn't oscillate, and the voices of Jim Price and Dan Dickerson are coming through the speaker loud and clear.  Performance: Adequate.

The next step will be powering it from the Crosley and hiding it below deck.  It doesn't draw beans for current, so maybe I can power it across the cathode resistor of the 6V6...

At this rate, I doubt the shack will ever get cleaned.