7th February
2013
written by Todd Harrison

This is (PART 1). Links to all parts: (PART 4), (PART 3), (PART 2), (PART 1)

A friend has a Kenwood TS-520S HF (high frequency) ham radio. He does not have the optional DG-5 frequency display and calibrating the dials between bands is not much fun. He gave me some information about the DG-5 and through some review I believe I can make a substitute for the DG-5 using an Arduino, LCD Shield and hand full of chips.

He could buy a DG-5 but that would cost more than he paid for the whole rig and it really is not necessary to use the radio, just more convenient.

This is part one so watch this video which covers my idea and some pre-testing. All looks good so far and I’m already working on part two.

 

I got the Arduino frequency library from this site:

http://interface.khm.de/index.php/lab/experiments/arduino-frequency-counter-library/

In the video I just use the library example scketch so I have no code to share in part 1.

 

I also followed some circuit examples shared at these two sites which both built HF frequency counts and were great sources of information to help me on my way to building an Arduino derivative HF frequency counter. My counter is for a single custom application and so doesn’t incorporate all the features these other builds include.

http://aade.com/DFD2inst/DFD2inst.htm

http://www.avr-asm-tutorial.net/avr_en/fcount/fcount_m8.html

 

Arduino website to get development software and sample code:

http://arduino.cc

http://playground.arduino.cc/

 

I got my Arduino and LCD shield from Adafruit.com

http://www.adafruit.com/products/50

http://www.adafruit.com/products/714

 

Some chips and data sheets I have used in part one:

CD74HCT93

Used in 3 bit binary ripple counter mode for divide by 8 with input at CP1 and output at Q3

http://www.ti.com/lit/ds/symlink/cd74hc93.pdf

 

CD74HC153

Dual 4 to 1 Line Selector/Multiplexer

http://www.ti.com/lit/ds/symlink/cd74hc153.pdf

 

Here are some photos of what I covered in part one. CLICK ON PHOTO for hi-resolution image.

 

My Arduino I will be using to count freq and do some line select inputs and math.

My Arduino I will be using to count freq and do some line select inputs and math.

RGB back light despaly by Adafruit.com for my freq display

RGB back light dispaly by Adafruit.com for my freq display

This are the freq I measured coming out of the three RCA jacks on the back of the TS-520S ham radio. I need to count these freq and do some math to know the freq the radio is using.

These are the freq I measured coming out of the three RCA jacks on the back of the TS-520S ham radio. I need to count these freq and do some math to know the freq the radio is using.

I can measure the VFO and BFO with the Arduino directly but not the HFO. I will need to use a prescaler to divide the HFO by 8 before it gets to the Arduino.

I can measure the VFO and BFO with the Arduino directly but not the HFO. I will need to use a prescaler to divide the HFO by 8 before it gets to the Arduino.

The library I'm using is coded to use just the one input so my plan is to use a line select chip to multiplex the three signals to this single Arduino input.

The library I’m using is coded to use just the one input so my plan is to use a line select chip to multiplex the three signals to this single Arduino input.

For a test of the Arduino measuring the BFO freq level directly I just created a nice clean 0-5v square wave at 3.395MHz on my freq generator and put it into the input pin the Arduino is coded to use per the library. As you can see it can count this just fine.

For a test of the Arduino measuring the BFO freq level directly I just created a nice clean 0-5v square wave at 3.395MHz on my freq generator and put it into the input pin the Arduino is coded to use per the library. As you can see it can count this just fine.

I use my leader to valdiate the Arduino is correct.

I use my leader to validate the Arduino is correct.

I then double check the Leader and Arduino with my HP counter. All instruments agree to within a 1Hz. WOW. Nice.

I then double check the Leader and Arduino with my HP counter. All instruments agree to within 1Hz. WOW. Nice.

For the HFO I have to use a MFJ-259 SWR analyzer to generate the higher 10 to 40 MHz signal for testing the Arduino.

For the HFO I have to use a MFJ-259 SWR antenna analyzer to generate the higher 10 to 40 MHz signal for testing the Arduino.

However this instrument only outputs a 1 to 1.5V peak wave which is too low of a voltage level for the Arduino to count.

However this instrument only outputs a 1 to 1.1V peak wave which is too low of a voltage level for the Arduino to count.

Even at the 5MHz level the Arduino only outputs 0 back to the serial monitor on the PC. It could measure the 5MHz but not at the low voltage levels. I will need to build an amplifier before the Arduino can use the SWR output for testing.

Even at the 5MHz level the Arduino only outputs 0 back to the serial monitor on the PC. It could measure the 5MHz but not at the low voltage levels. I will need to build an amplifier before the Arduino can use the SWR antenna analyzer output for testing.

On to testing the divide by 8 prescaler. I output a 4MHz square wave 0-5 v from my function generator.

On to testing the divide by 8 prescaler. I output a 4MHz square wave 0-5 v from my function generator.

I then pipe this 4MHz into the 4 bit binary ripple counter in 3 bit mode. It should output a clean divide by 8 signal at 500KHz

I then pipe this 4MHz into the 4 bit binary ripple counter in 3 bit mode. It should output a clean divide by 8 signal at 500KHz

My Leader records the 4MHz in and the HP records the 500KHz out of the chip so we can compare to the Arduino freq count output.

My Leader records the 4MHz in and the HP records the 500KHz out of the chip so we can compare to the Arduino freq count output.

The Arduino reads spot on with the HP at 499,997Hz

The Arduino reads spot on with the HP at 499,997Hz

This just to show that the Arduino can then do some math to multiply what it counted back to 4MHz  with (frq*8) code.

This just shows that the Arduino can then do some math to multiply what it counted back to 4MHz with (frq*8) code.

Close up showing the Leader which is counting the source at 4Mhz agrees with the Arduino's math down to 1Hz. NICE!

This shows the Leader which is counting the source at 4Mhz agrees with the Arduino’s math to within +/-4Hz. NICE! I only need to be within 100Hz in the end for this to work as a ham radio freq display

That is it for part one. Part two will start with signal amplification then multiplexing and more. I'm not sure how may parts this will end up being but it is fun to share and I hope fun to follow along.

That is it for part one. Part two will start with signal amplification then multiplexing and more. I’m not sure how many parts this will end up being but it is fun to share and I hope fun to follow along.

 

21 Comments

  1. [...] Arduino Frequency Display for Kenwood TS-520S HF ham radio PART 1 [...]

  2. Jovian
    08/02/2013

    Hey Todd,

    Great video, as always.

    The 74hc93 is probably being powered by either the input signal since the protection diodes in the device are allowing the input signal to charge any bypass caps you have on the board (and the die capacitance), or it is being powered by the mode input pins, again through diodes in the chip. Most CMOS logic has input protection diodes, see: http://upload.wikimedia.org/wikipedia/commons/3/3f/Cmosunbuff.png for example.

    Regards,
    Jovian.

  3. 08/02/2013

    Jovian, Yup I’m thinking the same thing. I have seen this before but I never tested it or exploited it as a feature. I have seen some RFID cards exploit this with an attiny to run up the chip via the input pins so the chip gives the inductive switching needed to ping back it’s ID. I ran into it this time because I hadn’t turned on my power supply after a lunch break. When I got back the Arduino was not reading frequencies from the counter chip’s output so I started looking at my signals which were fine but when I removed the splitter that was going into my HP’s 50 ohm input the arduino started reading. So without the 50 ohm input load the function gen’s signal was now strong enough to run the chip in some manner. Then I noticed my power supply was off and turning it on brought everything back to normal. It was just funny to run into the issues like that I thought. Thanks for the feedback and link to this wiki.
    Todd

  4. [...] [Todd Harrison] really has our number. Like him, we don’t want to spend money when we don’t have to, and hacking our own solutions is a lot more fun anyway. This time around he’s helping out a friend who is a ham radio enthusiast. The friend’s radio didn’t come with a frequency display, and buying the add-on would cost more than the radio did. So [Todd] has set out to build an Arduino frequency counter for a Kenwood TS-520S HF ham radio. [...]

  5. [...] [Todd Harrison] really has our number. Like him, we don’t want to spend money when we don’t have to, and hacking our own solutions is a lot more fun anyway. This time around he’s helping out a friend who is a ham radio enthusiast. The friend’s radio didn’t come with a frequency display, and buying the add-on would cost more than the radio did. So [Todd] has set out to build an Arduino frequency counter for a Kenwood TS-520S HF ham radio. [...]

  6. Golddigger
    11/02/2013

    What are the limits of the arduino? What is the highest frequency it can count?

  7. [...] détail sur le blog Todd Fun l’explication en image de la conception d’un fréquencemètre simple avec un arduino. A [...]

  8. 12/02/2013

    @Golddigger, The arduino can measure up to 6.4MHz in this configuration accurately. One can push higher but you risk getting bad counts. That is why I use a high speed CMOS 4 bit binary ripple counter to divide higher frequency to values under 6MHz. Then the arduino can do simple math to multiple the freq by the scale value back to the original source freq with only a small fixed +/- error effected by the math function.

  9. Tom
    17/02/2013

    There’s a USB connector on the ‘duino board, and you have a frequncy calculated. Why not wite a piece of code to impersonate some popular modern transceiver? One can use it to automatically record qso frequencies in a computer logbook. I’ve seen a homemade ham receiver project somewhere in the net several years ago, which had “FT817 compatibility mode”. To the computer, tt looked like Yaesu FT-817. Every logger or other piece of ham software, which could communicate with FT-817, could also be used with that receiver. Of course, it would only be possible to use a (very) limited subset of a modern rig’s command list, but I think it’s still worth to give it a try. CAT protocols are quite simple, and usually well documented in manufacturers’ specs.

  10. 17/02/2013

    @Tom, Nice idea. I will ask my friend if he is interested in such a feature.

  11. Jovian
    20/02/2013

    Hey Todd,

    I was looking something up in “The Art of Electronics” and I noticed a nice little circuit that uses a 74HC04 (hex inverter) to amplify a small analog signal to logic levels (5V). The circuit uses two inverters and since the ’04 is a hex inverter you could build up to three of these with one chip (just the right amount). The schematic (Figure 3.64) is on page 158 in the second edition. The schematic has additional protection elements that are – most probably – not required for your application and could be removed. The input can be a sine wave as low as 0.05V rms to 5V so it should be able to pick up the signals you require (0.1V rms). It is used for 10MHz; however, you could use it at a higher frequency (you could even use a faster family of CMOS such as AHC – if it a problem).

    Regards,
    Jovian.

  12. 20/02/2013

    @Jovian, Thanks. Yes I have been looking into that option. I have been reviewing http://www.fairchildsemi.com/an/AN/AN-88.pdf but I will checkout my AOE when I get home to see what it shows. So far it looks like I will run out of gain before I get to 40MHz unless the chain idea works. I have read elsewhere that this type of amp setup is very unstable and fluctuates a lot with temp and different IC makers. If I have any in my parts bin I will try one. Thanks.

  13. Jerry Anderson
    22/02/2013

    Tod,
    Thanks for the video, I am working on a much less complicated problem. A friend gave me a Realistic DX-300 with a dead KHZ display. The receiver is known for blowing out the M54826 chip that drives the KHZ display. That chip unfortunately is obsolete and unavailable, you can not even find a data sheet on the net. The chip is TTL compatible, and is a frequency counter, and drives 3 7 segment displays. The light bulb moment came when I saw on the schematic the input into the chip was from 2.456 to 3.455 MHZ, 3455 – 2456 = 999. So to convert from that to a display of 000 – 999 KHZ is to subtract the lower number (2.456 MHZ) from the frequency from the receiver. I can use an Arduino Uno, along with the frequency library you mentioned, and a display shield to do the whole job. Keli

  14. 25/02/2013

    @Jerry, sounds like that will work just fine if you only have KHz issues and the MHz is separate and working. Let me know how that works, there are tons of 7seg example code out there. In fact you could also replace the current 7seg with one of Adafruit’s 3 in one LED display and there library to make the display super simple to implement.

  15. 02/03/2013

    You may take this one a step further: Use a CPLD and implement a 30bit counter with reset and enable on the thing. The µC gates the whole CPLD through the EN signal, takes the result of the counter and does the math when gatetime != 1s.

    With a small 64/32 CPLD from lattice (working up to 118Mhz) you may reach 100Mhz easily without the fixed divider that limits the measurement accuracy :)

    Just an advice though. I try to do that with a Spartan 3 as I began digging into VHDL :)

    I can’t wait for Part 2! Keep on moving! I like it!

  16. Jason
    27/03/2013

    Great video and is very similar to something i am working on.

    When will part 2 be out? Also I relatively new to this stuff so how did you determine the compensation factor? Also what frequency can you measure up to before you had to build a circuit because it looked like you had it plugged straight into the board. From what I have seen on other sites they build a signal amplifier and you didn’t

  17. 27/03/2013

    I’m really hoping to get to it some this week. I keep saying that but life gets in the way.

    I followed the calibration steps found at the link above to the library I’m using. In short you need a good lab freq counter as a standard and you just keep increase/decrease the cal number until the arduino matches the lab freq counter. That should then be the cal number for that exact arduino board.

    I could get up to 6.4MHz straight into the arduino as long as the signal is close to 5v pulses. I wouldn’t be able to measure anything frequency straight into the arduino if the pulses were much less ~3v pulses, at which time I too would need to amplify the input single. In this video I didn’t need to amplify any singles because I was generating test signals close to 5v pulses.

  18. Slim
    10/04/2013

    Just lost another auction for a DG-5..
    Your project sure looks interesting.

    Hope to see the rest sometime.
    Keep up the good work.

  19. Samuel
    14/06/2013

    Hi Todd ,thank you for a great project you have here would you let us know when the second part will be put together as i would really like to see the prescalling side of things as i want to condition a 75MHz signal and then sample it with a suitable prescaler for a arduino mega 2560 ,I have ran into a circuit used on a bs-2sx stamp (ez tuner -jim Garland )has a buffer (74HC14) then into a two divide by 10 chips (74HC4017).I dont have a scope to have a look at the signal but have a handheld frequency counter to check accuracy ,hoping it will do the trick .
    Any sugestions ?

  20. Robert Smith
    14/06/2013

    Hello Todd, I’m very interested in your project as I also have a Kenwood TS-520S. I purchased a arduino uno after watching Part 1 of your video. I am waiting for Part 2.
    Thank You for taking the time to research and post this project on the internet. It’s a great way to share information.

    Robert Smith
    KF6LUY

  21. 14/06/2013

    Robert Smith, Thanks. I really need to finish this project, it motivate me knowing others could use the solution. I will see if I can get more time in the garage soon.

Visit Our Sponsor: MROSupply.com - An e-commerce site of Mechanical Drives & Belting