Thursday, 30 July 2015

CW decoder – The Arduino

This is arguably the simplest part of the project. As mentioned Budd Churchward had created a series of videos on how he wrote the Sketch,  created a PCB and published his code. (Budd's Sketch is available here)

I simply downloaded the sketch and uploaded it to the Arduino. Well almost.

I did actually make a couple of changes to Budds sketch. As I mentioned I wanted to create a buildable project that students can understand the radio, electronics and the software element of this project. 

I created a couple of functions that simply look for a LOW on 2 pins. If this exists the Arduino loads a debug function where it writes out some text to the screen, and flashes an LED.  This is an important step for the build project I have in mind, as I want the students to build a bit then test a bit etc. For those who have seen the RSGB Century PSK receiver - and the instructions I wrote to accompany the project, you will instantly know what I mean.

I also included a write out to the Serial port the serial address of the I2C display. And finally add the I2C libraries to enable to I2C display to be used.

Another alteration was to create an auto reset function where if the Arduino cannot resolve 10 characters in succession, it calls the auto reset method, and simply reboots the Arduino.

That’s it. If you didn’t want to change any of the code, I would simply grab Budds latest version and use that. It works perfectly fine. Connecting the circuit again couldn’t have been easier. I took the output from Pin 8 of the LM567, and installed it onto PIN 8 of the Arduino.

Here is the board and Arduino working on the 1st attempt of connecting it all together.

That’s it. However I didn’t want to stop there. So I made some changes and improvements on a Vero board version. I also looked into finalising the Circuit on a PCB. I will cover more of this in an upcoming blog post. and how the new version is looking.


  1. A simple addition to my sketch will greatly improve the copy when noise is present with the signal. At the beginning of the keyIsDown() funtion add a short delay of only a few milliseconds. I made mine adjustable with a button, but you can simply delay(5); or delay(8); (it has to be shorter with high speed CW) and then test again to check that the tone is still there. If it is not there use return; to bail out of the function, you just got a spike of noise. I have obtained an oscilloscope since the original sketch was posted and I could see that noise on the band was fooling the decoder into thinking it was the tone. This, of course, trashed the text and I got a lot of #'s. Adding this simple test made a big difference. I did the same with keyIsUp()

    Good luck with your project.
    Budd Churchward

    1. Hi Bob, first of all many thanks for the sketch. It inspired me to blow of the dust from the UNO, so i hope my enthusiasm will rub off for reaching out to our young clever minds ! Thank you for the heads up on the 2 functions. I will grab the scope out and investigate further. I know exactly what you mean about the noise. I noticed this got worse when applying the Narrow filter on the radio - and thought it was entirely down to the audio level on the output. I got though about 80% of the noise by removing the pre amp, and that seemed to help. odd eh ?

      I will be completing a YouTube video on the final project, i would value your feedback.

      Kind regards

  2. Most interesting. I have been looking for the complete schematic for the project but have not found it. May I have a link to it, please? I found a picture with the NE567 part.