Posts Tagged SDR
As part of some protracted flailing around while trying to get GNU Radio running on a Raspberry Pi 3, I discovered Raspbian defaults to a 100 MB swap file, rather than a swap partition, and everything I thought I knew about swap management seems inoperative. The key hint came from some notes on
/etc/dphys-swapfile config file to set
CONF_SWAPFACTOR=2 for a 2 GB swap file = twice the size of the Pi’s 1 GB memory.
Start it up:
sudo dphys-swapfile swapoff sudo dphys-swapfile setup sudo dphys-swapfile swapon
And verify it worked:
cat /proc/meminfo MemTotal: 949580 kB MemFree: 194560 kB MemAvailable: 594460 kB Buffers: 85684 kB Cached: 377276 kB SwapCached: 0 kB Active: 600332 kB Inactive: 104668 kB Active(anon): 250408 kB Inactive(anon): 20688 kB Active(file): 349924 kB Inactive(file): 83980 kB Unevictable: 0 kB Mlocked: 0 kB SwapTotal: 1918972 kB SwapFree: 1918972 kB Dirty: 40 kB Writeback: 0 kB AnonPages: 242072 kB Mapped: 136072 kB Shmem: 29060 kB Slab: 33992 kB SReclaimable: 22104 kB SUnreclaim: 11888 kB KernelStack: 1728 kB PageTables: 3488 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 2393760 kB Committed_AS: 947048 kB VmallocTotal: 1114112 kB VmallocUsed: 0 kB VmallocChunk: 0 kB CmaTotal: 8192 kB CmaFree: 6796 kB
Then it became possible to continue flailing …
Rather than bestir myself to measure the Test Signal Source on the Ham-It-Up upconverter:
The 74LVC2G14 Schmitt-Trigger Inverter datasheet supplies useful parameters:
All of which come together and produce a waveform (clicky for more dots):
Which suggests the Test Signal ticks along at tens-of-MHz, rather than the tens-of-kHz I expected from the birdies in the filtered 60 kHz preamp response.
Of course, hell hath no fury like that of an unjustified assumption, so actually measuring the waveform would verify the cap value and similar details.
The dotted line comes from WWVB’s 1 Hz PWM (-ish) modulation: yeah, it works!
Well, not quite all the hash. Enabling the SDR’s hardware AGC and zooming out a bit reveals some strong birdies:
The big spike over on the left at 125.000 MHz comes from the Ham-It-Up local oscillator. A series of harmonics starting suspiciously close to 125.032768 kHz produces the one at 125.066 MHz, just to the right of the WWVB signal, which leads me to suspect a rogue RTC in the attic.
There is, in fact, a free running “Test Signal Source” on the Ham-It-Up board:
Although I have nary a clue about that bad boy’s frequency, measuring it and cutting the inverter’s power trace / grounding the cap may be in order.
The SDR’s AGC contributes about 30 dB of gain, compresses the hottest signals at -25 dB, and raises those harmonics out of the grass, so it’s not an unalloyed benefit. Manually cranking on 10 dB seems better:
The bump in the middle shows the WWVB preamp’s 2 kHz bandwidth around the 60 kHz filter output, so the receiver isn’t horribly compressed. The carrier rises 30 dB over that lump, in reasonable agreement with the manual measurements over a much narrower bandwidth:
With all that in mind, a bit of careful tweaking produces a nice picture:
I love it when a plan comes together …
The PDF “slides” for a lightning talk I gave at this month’s MHV LUG meeting: MHVLUG Lightning Talk – Bose Hearphones.
You don’t get my patter, but perhaps you’ll get the gist from the pix.
Summary: I like ’em a lot, despite the awkward form factor and too-low battery capacity. If you’re more sensitive to appearances than I, wait for V 2.0.
FWIW, I tinkered up a beamforming microphone array with GNU Radio that worked surprisingly well, given a handful of hockey puck mics and a laptop. Bose does it better, of course, but I must revisit that idea.
A reader (you know who you are!) proposed an interesting project that will involve measuring audio passbands and suggested using white noise to show the entire shape on a spectrum analyzer. He pointed me at the NOISE 1B Noise Generator based on a PIC microcontroller, which led to trying out the same idea on an Arduino.
The first pass used the low bit from the Arduino runtime’s built-in
Well, that’s a tad pokey for audio: 54 μs/bit = 18.5 kHz. Turns out they use an algorithm based on multiplication and division to produce nice-looking numbers, but doing that to 32 bit quantities takes quite a while on an 8 bit microcontroller teleported from the mid 1990s.
The general idea is to send a bit from the end of a linear feedback shift register to an output to produce a randomly switching binary signal. Because successive values involve only shifts and XORs, it should trundle along at a pretty good clip and, indeed, it does:
I used the Galois optimization, rather than a traditional LFSR, because I only need one random bit and don’t care about the actual sequence of values. In round numbers, it spits out bits an order of magnitude faster at 6 μs/bit = 160 kHz.
For lack of anything smarter, I picked the first set of coefficients from the list of 32 bit maximal-length values at https://users.ece.cmu.edu/~koopman/lfsr/index.html:
The spectrum looks pretty good, particularly if you’re only interested in the audio range way over on the left side:
It’s down 3 dB at 76 kHz, about half the 160 kHz bit flipping pace.
If you were fussy, you’d turn off the 1 ms timer interrupt to remove a slight jitter in the output.
It’s built with an old Arduino Pro Mini wired up to a counterfeit FTDI USB converter. Maybe this is the best thing I can do with it: put it in a box with a few audio filters for various noise colors and be done with it.
It occurs to me I could fire it into the 60 kHz preamp’s snout to measure the response over a fairly broad range while I’m waiting for better RF reception across the continent.
The Arduino source code as a GitHub Gist:
Putting a small capacitor in series with the tuning fork resonator pulls the series resonant frequency upward and reduces the amplitude:
So something around 10 pF, net of stray capacitance and suchlike, should suffice. Plunk a small twiddlecap on the preamp board and tune for best picture:
Using the DDS generator as a manual signal source with 1.0 Hz step size shows the resonator tightens up the preamp’s response quite nicely:
I’m not convinced the preamp will have filter skirts that low farther away from the peak, but it’ll do for a start.
Zoom in on the peak with 0.1 Hz steps:
The bandwidth looks like 0.6 Hz, centered just slightly above 60.000 kHz, which should be fine for a first pass.
I’m tickled: all the hardware & firmware fell neatly into place to make those graphs possible!
Next step: install it in the attic and see whether the filter cuts back the RF clutter enough to stabilize the SDR’s AGC gain.
The LT1920 instrumentation amplifier now sports two silver-mica caps on its inputs as a differential-mode input filter cutting back strong RF signals (clicky for more dots):
In principle, a DM filter should eliminate RF rectification from out-of-band signals, although I think the attic is quiet enough to not need any help. The caps form a simple RC LP filter rolling off at 5.490 kΩ × 150 pF → 193 kHz, high enough above the 60 kHz signal to not make much difference down there.
The silver-mica caps come from the Big Box o’ Caps, which contained an envelope with a few large 150 pF ±1% caps and a bag stuffed with similar 147 pF ±1% caps. Mixed in with the latter were some smaller 147 pF caps (*) of no particular tolerance (perhaps 5%), from which I neurotically matched a pair to 0.05 pF without too much effort. Doesn’t matter, given the other tolerances and suchlike, but it was amusing.
I’d inadvertently grounded the cold end of the 330 Ω input resistor in the LM353 bandpass filter, now properly tied at the Vcc/2 virtual ground to take the DC load off the LT1920 output: a 100 nF cap (27 Ω at 60 kHz) stores the bias level without messing up the filter shape.
A similar cap rebiases the protected resonator at the LT1010 buffer input:
The new caps aren’t all that visible and the resonator vanishes in the clutter:
Next: find out how well it works!
(*) Yes, there were two envelopes between 150 pF and 147 pF: