Category Archives: DG5 Emulator Project

A lot of updates to the DG5 project

I finally had some time the past two weekends, and I made a lot of updates to the project – the code has been updated, I released code for the Nixie and LED versions, I finished off the LED version by mounting it in a chassis, I broke up the project into 3 separate pages for LCD, LED, and Nixie, and finally, I moved the code and PCB project files over to Github.  Whew!

The current version as of this writing is 2.0.2.  Updates will be directly published to the Github project page. Version 2.0.2 includes:

  • Stability Enhancement. Locks the values used for the HFO and BFO, updates then only if they have moved more than 500Hz and 100Hz, respectively.  This should help eliminate some wander/wiggle by keeping the two “fixed” frequencies stable.
  • Released the LED version, uses MAX 7219 based, 8 digit, 7-segment display.
  • Released the Nixie version, uses I2C SmartNixies.
  • Added correction factor (optional)
  • Added smoothing/averaging to reduce display jitter – averages over 4 readings (adjustable)
  • Code cleaned up and better documented
  • Changed frequency counter logic to the FreqCount Arduino library
  • Tested with latest Arduino IDE (1.8.2)

That’s all for now, click on the project pages to see more on the LED and Nixie versions. If you have a DG5 emulator running, give the new code a try!


A few DG5 updates

I have done some digging into frequency accuracy of the past few weeks, and discovered a few things that I want to share, as well as some code updates. Some background…

When the new run of boards came in, I built one to verify that they work OK. As I have two DG5’s already built and running (one LCD, one Nixie, mounted in cases) I decided to get this new board working on a clone Duemilanove board I ordered on eBay. It worked, but the frequency was 400 to 500 Hz off, and the calculated USB/LSB/CW was wrong. So, I tried the new board on one of my existing Duemilanove’s, and everything worked just fine. So, what was going on with these clones?

I measured the crystal on the clone board by holding an piece of insulated wire near the circuit when the board was running, and monitoring the signal on my HP 8924C – the crystal oscillator circuit was about 925Hz low from the desired 16Mhz, which translates to a 57ppm error. So, I ordered up some 10ppm crystals from Mouser, and replaced the crystal with the new one – it only measured 55-58 Hz off, or about 3.5ppm. Much better. When I hooked it up to the TS-520, the measured frequency was correct. The accuracy of your frequency measurements is only as good as your reference. The program measures the frequency by direct count of the sampled signal in a given time period, which is 100mS in the program. If your reference is off, your measurement is going to be off.

However, there were some other things I noted when troubleshooting this problem. I was using the DEBUG mode which is accessed by typing “DEBUG1;” in the Arduino serial monitor In this mode, the board will print all the measured frequencies – useful for figuring out what the program is seeing from each input. While troubleshooting, I wanted to make sure I had a stable, known frequency to measure, so I used the HP 8924C’s signal generator to give me 5.000000 Mhz and fed it into the VFO input while monitoring the readings in DEBUG mode. I was getting some errors that I couldn’t really account for, and as I changed the gate timing during troubleshooting I got even stranger errors. Increasing or decreasing the gate time by factors of 10 should only change the resolution / number significant digits, but it was changing the measurements as well.

So, I did some searching on the web and found a different frequency counter library, and I substituted it for the existing code, and things seemed to stabilize. I’ll post links to the new code as soon as I am done testing and porting it to the LCD version – I was working in the LED version to make the change.

But a few other things came up. The original DG5 did not compute the mode (USB/LSB/CW), I added that in as I wanted to be able to read the frequency and mode into logging software, and figuring out the mode was just a matter of looking at what the BFO frequency is. In the TS-520S Service manual on pg. 6, it describes the frequencies used by the BFO for the different modes. It states, “Frequencies are 3396.5 kHz for USB, 3393.5 kHz for LSB, and 3394.3 kHz (receive) and 3395.0 kHz (transmit) for CW.”

Here’s the piece of code that does the figuring:

// use the BFO (CAR) frequency to determine USB/LSB/CW

if (bfo > 3396500){
USB = true;
LSB = false;
CW = false;
mode = ‘U’;

else if (bfo < 3393500){
USB = false;
LSB = true;
CW = false;

USB = false;
LSB = false;
CW = true;

The program tests a few conditions based on this information, and testing that I did on my TS-520S.  On my unit, if the BFO measurement came in ABOVE 3396.5 kHz, it was in USB – so that’s what I had the program do.  It’s never going to be sitting exactly AT the frequency stated by Kenwood – I needed to divide up the boundaries and see if it fell into one of these areas.  The issue is, what worked for my TS-520S might not work for others, based on inaccuracies in the clock on the Duemilanove (one source of error) and inaccuracies in the TS-520S itself.  (BTW – I used both a mode variable (U, L, or C) to track, as well as some boolean flags (true/false) – this would probably be cleaned up as only one is necessary.)

So, if your display is showing “c” no matter what mode the radio is in, enter the debug mode by typing “DEBUG1;” in the serial monitor (9600 baud) and press the “SEND” button. You screen should start streaming updates every 1/3 od a second or so, from here you can see the actual measured BFO frequency as you click thru the different modes. Adjust the section of code (shown above) to reflect the range for your TS-520. You might have to play with this to get it dialed in.

I’ll get an update posted here as soon as I port the new library to the LCD version. and do some testing.  I hope you’re having fun and learning – that’s what this is all about!


New run of DG5 PCB’s now shipping!

UPDATE 4/18/16: Got 6 orders for 10 boards total in the first 24 hours, I guess there’s still demand! I have sent everyone who asked about availability an e-mail as of this evening. I ordered 100 boards this time, so hopefully they will last a while and everyone who wants to build one can get one. Thanks for the continued interest!


Thanks everyone who has e-mailed for your patience, I wanted to build one to make sure the new run of boards are OK to go as I am using a new manufacturer. I am happy to report that they work 100%. So, the new boards are ready to ship, I have boards reserved for everyone who e-mailed me and will send you an e-mail soon – if you’re reading this before you get an e-mail from me feel free to order below. The boards can be ordered using the “By Now” button on the project page, or right here:

Click the “Buy Now” button below to order a DG5 Emulator PC Board ONLY:

Few notes. I purchased a couple of Duemilanove boards from China – these looked like the original board, they both have the silkscreen of Italy on the back, but BOTH are about 1K in frequency off. I thought something wrong with my build, but when I plugged it into a real Duemilanove it worked 100%. Next steps will be to check the crystal oscillator to see if they are both off, or if there is something else going on – they were both off by approximately the same amount.

Please remember to read thru the project page BEFORE ordering so you know what you’ll need!

Thanks for your continued support!


New PCB’s in, Nixie version mounted in case

The new run of boards came in and look good visually – I want to build one and test before I start selling them since I used a different manufacturer this time. I have used them before with excellent results, but it’s been a few years. Just want to be sure before I start shipping these things all over the world!

I got the Nixie version mounted in a case a few weeks ago:

The case is a bit larger than I needed, but it gives me room to add a DDS VFO in the future, something I’ve been meaning to do. I haven’t posted the code for the Nixie version yet, if you’re interested, let me know. It uses Taylormade I2C Nixie modules that use the Russian IN-12B tubes.

For those who have requested that I e-mail them when the new boards come in – I will send you an e-mail when I am ready to ship, hopefully later this week. I might sell off the built test board as I am not sure if I really need 3 of these floating around my shack as I only have one TS-520S – more on that when I get it built. It would include the built board, an Arduino Duemilanove, and either an LCD or LED display – no case. Just a thought at this point.


DG5 update – switched to LED’s, and prepping for Nixies!

After a little over a year of selling boards, and a busy life with a new job, I finally had some time to do a few things I have been meaning to do for some time. I have always wrestled with what I released – the hardware seems pretty solid, but I never liked the code all that much, and the LCD display was actually added in version 1.1 – the original version only was for creating a computer interface for the TS-520. So, when I added the display I used what I had on hand – a 2×20 line LCD. It works, but lacks character. Actually, it displays characters just fine…

This past weekend I had some time to do several things – clean up the code so it’s more readable/serviceable, fork the code to a version with a MAX 7219 based LED display instead of the LCD display – more true to the original DG-5. I also added some averaging/smoothing code to help with display jitter (switching between 2 least significant digits), added correction factor if needed – more on that below, changed the gate timing so hopefully it is more accurate for most folks (again, see below).

But the real reason I got in there and cleaned things up is I am planing on interfacing some IN-12B type Nixie tubes. The original DG-5 was LED based, sure, but it at the time that LED’s were just supplanting Nixie tubes, so a Nixie display would be “right”, and totally cool and retro (just like the TS-520)! However, just about EVERYTHING out there running Nixie’s today is a clock, there is little beyond time keeping in the Nixie world today. I ordered 2 Nixie clocks to see what I can do to convert/adapt the hardware and software to a frequency display.

I have one of the clocks up and running, an it’s gorgeous. It’s from John Taylor’s shop Tayloredge in San Diego, he has IN-12B nixies on a I2C PCB – perfect for interfacing to a micro-controller! I have another, Arduino based Nixie clock on order and I’ll see about what way I want to go with this. If others are interested in a Nixie based DG-5, let me know.

Couple of observations after spending the weekend hacking. I built a DG-5 board to do testing on, and for initial tests I used a Arduino UNO clone at first, and wow, a ceramic resonator as a clock is TERRIBLE for a frequency counter project! Which is why I tell folks to get an Arduino Duemilanove – they use a real crystal. I observed a 3k dial error, and 1.8k of drift as it warmed up! The Duemilanove uses a +/-100 ppm crystal (as far as I can tell), which is still not all that great, but it works satisfactorily in this application. +/- 10ppm crystals that will fit on the Duemilanove are only $0.49 from Mouser – I might grab some next order and see about upgrading a Duemilanove – that should be way more than enough accuracy/stability for this application.

Anyway, I’ll post the code in a day or two – I managed to use the existing LCD headers to connect the LED display, pictures to come.

Edit – Video of the new code in action on the Max based LED display:

Edit – here are the new Arduino INO files. The new code has the improvements listed above, even on the LCD version that many folks have. Please load it on to your DG5 emulator and let me know what you think. Hoping to get the Nixie version done sometime soon!

LCD Version 1.6.2

LED Version 1.6.2