New Encoder – QSD Receiver

13 May

A couple of posts ago, I talked about the difficulties I was having with the cheapy mechanical encoder as it wears out. There are software methods to prevent acceptance of bad encoder values but they only result in skipped steps, not correction of the issue that caused the skip. Besides, cheapy mechanical encoders typically only have a relatively small number of steps per revolution, requiring spinning like crazy to traverse the band. That’s how it wore out. Lastly, I prefer the silky smooth feel of the tuning knob on a high end rig. Today I started down a path to fix that using this optical encoder I purchased on EBay for about $15Hand Wheel Pulse Encoder 100RPM 5V CNC System Engraving 4 Terminal Eletronic

It puts  out 100 detented encoder values per revolution. As it is, the detents are pretty mild, but I opened it up and removed the detent mechanism, so now it is silky smooth. If you’re tuning at 100 hz/step, then this results in 10 khz per revolution, a very comfortable rate. However, due to the high rate of output changes per revolution, you can’t poll it in the code’s main loop. It just wouldn’t keep up. I’ll be using interrupts to process the output, which is what I’m doing with the present encoder.

More Firmware Infrastructure – QSD Receiver

3 May

Click Here to see the project from the beginning

As is often the case in firmware-defined hardware systems (“Embedded Systems”), there is a constant interplay between firmware and hardware as the design progresses. This system is no exception and the time has arrived to implement some firmware infrastructure before the next major hardware addition. I’m speaking of a fast A-D acquisition process that can capture audio samples for the coming AGC system. These samples will be used for the S-Meter and the firmware controlled AGC processes.

In order to get accurate and regular samples of real-time audio, we need to sample it at least twice the rate of the highest frequency we want to capture. Trying to do this in the main code loop or by using the Arduino analogRead() function would be way too slow and too irregular. We need some way to capture samples much faster and without interference from other code. My solution involves setting up the A-D hardware sub-system to ‘free run’ in the background at a fast rate defined by an on-board timer. Then another hardware timer, running at a slower rate, can pick up a sample at regular intervals. This technique doesn’t tie up any processor throughput except to respond to the interrupts created by the data collection timer.

If done properly, this process can get samples from multiple A-D ports at varying user-defined rates with little to no interaction between measurements or significantly slowing down the main loop. This allows one very fast rate for audio signal sampling, another slower rate for handling events from the rotary encoders, and an even lower rate for measurements that aren’t very timing critical. I actually had this code from a project I did with the uBitx board. Today I snagged that code and got it working in this project.

Now I can move on to the voltage-controlled audio amplifier, the software defined AGC system that controls it and the S meter functionality that is a byproduct.

Encoder Frustrations – QSD Receiver

2 May

Click Here to see the project from the beginning

I’m presently using one of those cheapy 20 pulse per rotation mechanical rotary encoders from Ebay.

The good news is that they’re cheap, about $1.00 if you shop around. The bad news is that contact bounce becomes worse as they age. I have enough experience ‘debouncing’ these things, with hardware, with software and even with sequence decoding state-machines to know that they eventually wear out and become problematic in some way. That’s the point I’m at now. Time to look at something better.

Some time ago, I purchased a couple of these 100 PPR optical encoders, also on Ebay. They can be had for around $15 if you shop.

Although the next step planned in the radio evolution is to get the TDA7051A voltage controlled audio amplifier going, retrofitting this encoder could jump to front and center as my frustration with the present unit grows.



Looking Ahead – QSD Receiver

1 May

Click Here to see the project from the beginning

As I get closer to having everything working to my satisfaction, I’m beginning to look ahead to make the project reproducible by others. An obstacle for many might be that I use SMD components extensively, and many builders might have issues there. Therefore, before the next round of PCB redesign, I am modifying all the component PCB patterns so that either thru-hole or SMD components can be used. For all the common components such as resistors and capacitors, I have a new PCB pattern that looks like this:


This pattern will accept SMD hand-soldered components up to 1210, thru-hole 1/4W resistors on-end, or thru-hole capacitors with lead spacing up to 0.15″. I understand that it is not a recommended practice to put holes in SMD pads if the board is to be machine soldered, but I doubt if anyone will do that.

I intend to incorporate provision for SOIC-to-DIP adapters (below) into any redesigns so that the builder can solder DIP’s and SOIC IC’s directly to the main board or use the adapter board to simulate a DIP. With the DIP option you can socket the IC, which is useful during prototyping and debugging. I intend to post all the schematics, the PCB Gerber files and Digikey/Mouser part numbers as well as instructions for how to order custom PCB boards really cheap.

My first redesign will probably be the QSD detector board, as I’m not totally satisfied with the circuit architecture I chose there. I hope I can fit everything with the new larger patterns. Next will be the PSN/filter board and so on. I intend to make all the board outlines the same so they can be packaged in the little tins I used for the QSD.

Stay tuned.

Sideband Selection – QSD Receiver

30 Apr

Click Here to see the project from the beginning

I had about 15 minutes to spend on the project today, so I got the sideband selection function working. Since it’s just a matter of swapping the I and Q LO phases, and those phases are defined in the Si5351 software, it was merely a matter of a few lines of code. With a signal tuned in, touching the Mode button on the touch display makes the signal go away and appear again when you tune to the other sideband. It’s an interesting way to qualitatively assess the opposite sideband suppression.


If you come from a crystal filter radio world, you’re probably used to the character of the noise changing when you switch from USB to LSB. This is because the crystal filter bandwidth is not symmetrical and you hear more noise when the BFO is tuned on the lower  skirt than on the upper skirt, or vice versa. With the phasing mode of demodulation, that doesn’t happen and the noise is absolutely the same no matter the mode. Neat!

Now I have to decide which sideband is appropriate for receiving CW signals.

All Systems are Go – QSD Radio

27 Apr

Click Here to see the project from the beginning

Over the weekend I installed the 8-pole audio lowpass filter as well as a temporary 40m band-pass filter at the front-end. Already I can hear the difference in bandwidth and absence of QRM from off-channel signals. I haven’t rigorously tested it yet, But I’ll do that this weekend.

I listened to a contest on Saturday using a little 3″ speaker laying on the bench. Sensitivity seems comparable to my TS-450 and audio quality is good, given the compromise speaker. Sunday, the band was dead until evening.

I wrote a little dissertation on my experience with this rendition of Tayloe detector. You can find it here:

More tests and specs to follow.

AM Broadcast Bleed thru – QSD Receiver

26 Apr

I reported in a previous post that a nearby 5000W AM station was bleeding through in the microvolt level. Today, I threw together a quick and dirty 40M bandpass filter. That solved the BCI problem, but in my haste, I somehow blew up the Nano board for the 3rd time. The receiver’s working now but I’ll have to put in an order for 5 or 6 more Nanos.

Quick and dirty 40M bandpass filter

Ironically, now that the BCI is gone, the band is somewhat dead. It does pick up signals though. Yesterday there was a contest and I heard lots of CW and SSB signals. It’s pretty broad though. Gotta get that 8-pole audio lowpass filter installed.

Switching Gears – QSD Receiver Software

23 Apr

Click Here to see the project from the beginning


I found another TFT touchscreen in my ‘archive’ of parts, so I took the opportunity to switch gears for a while and work on the firmware system. I’ll probably do that for a couple more days, then back to hardware.

The tuning knob in this system is implemented with a rotary encoder that has a push-button switch in the shaft. The tuning resolution can be set anywhere from single Hz per encoder step to single Mhz per encoder step. Pushing the knob in while turning it moves an underline cursor to show which digit is being controlled. Pushing the button and holding it without turning for about 2 seconds saves the whole radio state to EEPROM so the radio always powers up in the state you left it in. Pushing the knob and holding it for about 5 seconds clears all the digits lower than the cursor position to zeros. This is all working now. Another encoder will be added to control the volume of an audio power amp with voltage-controlled-gain via a DAC. This will be the underpinning of my intended software defined feed-forward audio AGC.

Touching any of the on-screen soft-buttons toggles to the next control state state of that button. Touching the orange “Menu” button redefines all the buttons with a different set of control functions.

The S-Meter is a moving bar that will be calibrated in accurate S units.

All the firmware infrastructure for these features is in place, waiting for hardware to control.

Back to that soon.

Re-grouping – QSD Receiver Project

22 Apr

Click Here to see the project from the beginning

I built up the 8-pole audio lowpass filter board and it’s waiting to be tested. I also re-worked some of the DC power distribution so the whole receiver up to the audio power amp can be operated seamlessly on either 5V USB power from the Nano (w/no audio power amp) or on 6V-14V external power (w/audio power amp) without any switching.

In the process of doing that I blew up the Nano board and the TFT display board. I have the system back up and running, but with a junkbox TFT display board that doesn’t have touch capability. I have some new display boards on order, but they might take a couple weeks to arrive. Meanwhile, I’m cleaning up some firmware matters. I now have a function to save the whole radio state to EEPROM and automatically restore it on power-up. I also have some GUI cleanup matters that I’ve been putting off.

After repairing my EFHW wire antenna which was knocked down by a concrete truck when I had some work done on my house last year, I was a little disappointed to hear a local 1440 kHz AM station punching through down near the noise threshold. That station runs 5000 watts  and is only about 1/2 mile away, so maybe it’s to be expected. It does point to the need for front-end filtering.

Hopefully I’ll get the 8-pole lowpass installed and tested in the next several days.

Active Lowpass Filter and AGC Noodling – QSD Receiver

14 Apr

Click Here to see the project from the beginning

Now that I have the signal chain functioning from antenna input to speaker output, I’m starting to work on the final missing function block – the steep-skirted audio lowpass filter. One of the PCBs I developed is an 8-pole active lowpass filter.


The 8-poie lowpass filter PCB

This will go just before the audio power amp which is presently an EBay LM386 module. I have a PCB for a TDA7052A which is an audio power amp with 80dB of voltage controlled gain reduction.

The TDA7052A Audio Amp PCB

One of the things I want to try is sampling the audio amplitude with a Nano A-D input and a software peak detector and using that number to index through a lookup table which gives a control voltage value to keep the final audio output constant. This “feedforward” method, if I can make it work. has several advantages which I’ve written about.

I hope to have the lowpass filter built up and in the signal chain this week.

Stay tuned


Dian Kurniawan - YD1OSC

electronic for better life

N6QW ~ The Ham Oracle

For Ham Radio Experimenters

SolderSmoke Daily News

For Ham Radio Experimenters