Pages

Wednesday, 3 January 2018

This is my third post in a series about building and hacking a BIT40 radio. The previous post may be found here.

For future reference links to all the Arduino software, articles and discussions I write about can be found on the Arduino Links Page which is listed in the Pages and Links gadget to the right.

In post one I built the radio. In post two I employed some hardware hacking to correct an unfortunate property of my radio. You may have to do something similar, or maybe your radio works well out of the box. Now it is time to look at how we can modify the radio operating software.

Installing Arduino Integrated Development Environment (IDE).

I could write a lot about installing the Arduino IDE, but it would be difficult to come close to what the Arduino folks have already written. So follow that link and read up about programing the boards and install the IDE on the system(s) you want to use. If the system you want to use is a Raspberry Pi, don't worry. Installing the IDE on a Pi is very easy and the people at MagPi have you covered. Actually even if you aren't going to use a Raspberry Pi that article is still a recommended read.

BITX40

There are a number of choices of available software:

Farhan's original code, with updates since your Raduino was programmed.

Munters mods which support a series of hardware mods and provide some attractive features.

Costa's fork of Farhan's original and his own Si5351 library. This supports some of Munter's mods and adds some others.

Your own mashup taking pieces from these or other sources and adding your own features.

All of these are possible. I will walk through option 2 in this post. Of all the options this is the one I recommend starting out from. It is feature rich and has ongoing development and support. You will want to implement at least the function button hardware mod.

A Word About GitHub

The git program is a very advanced source code control system that allows multiple developers to work on a body of code and manage the issues which arise therefrom. The use of git tools is beyond the scope of this post so I will be showing you the simplest way to get the code. If you want to contribute back with your own work, or even if you just want to be able to get the latest updates easily you should look into using git and GitHub.

Munters Mods

To download the latest release of the code click on the green "Clone or Download" button and select "Download ZIP":

Use your favorite ZIP management tool to extract the contents to the sketches directory you created when you installed the Arduino IDE. Because I am working with three (or more) options and each will have a sketch called bitx40 I also created a sub-directory for each option, in this case Munters:

As you can see the extracted directory is called bitx40-master. This is a feature of GitHub encoding the branch on into the ZIP file. Double click on the raduino_v1.27.3 Arduino file to open the sketch in the Arduino IDE. The IDE will complain about the sketch name not matching the directory name. Just click "OK" and the IDE will sort it out for you. Open the Tools menu and set the Bord to "Arduino Nano".

Before we can compile the sketch we need to ensure we have access to a library. In the readme file for the code starting at version 1.27 the PinChangeInterrup library is required. The Arduino IDE manages well know libraries very well. From the Sketch menu go to Include Library and select Manage Libraries... Enter PinChangeInterrup where is says filter your search:

Select the entry for the PinChangeInterrupt library and click Install.

You can now Verify and Compile the sketch by selecting "Verify/Compile" from the Sketch menu. This should compile without warnings or errors. Now the sketch is ready to be uploaded. Connect the Raduino to your development machine with an appropriate USB cable. If the radio is off this will power up the Raduino and start running whatever sketch was previously loaded. Using the Tools menu make sure the correct Port is selected. Consult the Arduino getting started guide if you have to. Now you can upload the sketch by selecting "Upload" from the sketch menu.

Enjoy your updated BITX40 software. Make some of the hardware modes as well. If you want a quick and easy taste of what making software mods can do try this. Somewhere around line 460 you will find the printLine function. The original looks like this:

/** Display Routine This display routine prints a line of characters to the upper or lower line of the 16x2 display linenmbr = 0 is the upper line linenmbr = 1 is the lower line*/

void printLine(char linenmbr, char *c) { if (strcmp(c, printBuff[linenmbr])) { // only refresh the display when there was a change lcd.setCursor(0, linenmbr); // place the cursor at the beginning of the selected line lcd.print(c); strcpy(printBuff[linenmbr], c);

for (byte i = strlen(c); i < 16; i++) { // add white spaces until the end of the 16 characters line is reached lcd.print(' '); } }}

Change the function prototype (the first line of the function) by adding const in front of char *c like this:

void printLine(char linenmbr, const char *c) {

Then add these three lines immediately after the function prototype:

if (linenmbr == 1 && strlen(c) == 0) { c = "your callsign"; }

This is a kludge, there is a much better way but it involves changes scattered around the source code. I have created a request to have the code included in Munters' repository. In the mean time you can get the updated source from my repository. These changes are now incorporated in Munters' repository.

Tuesday, 2 January 2018

This is my second post in a series about building and hacking a BITX40 radio. The series starts here.

Some BITX40 radios -- including mine -- built as designed exhibit tuning clicks. That is as the DDS frequency changes there is an audible click in the speaker or headphone output. There is some debate as to the cause. Some believe it is the result of how the DDS circuit is handled in software and that it can be fixed in software. Pavel Costa has written a library that has a number of benefits, including eliminating the tuning clicks. That link has some interesting reading, and the first thing I did was to compile and install his software and his modification of the BITX40 sketch. I still had tuning clicks, so not entirely a software problem.

The other solution proposed on the internet was that the Raduino voltage regulator was insufficiently decoupled from the 12VDC supply. Heavy computing and circuit use surrounding a change in frequency would cause an increase in current draw, which was bleeding back across the regulator to the main power circuits and appearing in the amplified audio. There are a number of ugly and somewhat dubious solutions adding components to the back of the Raduino board. None of these appealed to me so I took a different route.

If the problem is decoupling of the voltage regulator I could de-solder the regulator from the board, replace it with a header, then I could experiment with the required circuit. So that's what I did.

Raduino with regulator replaced by header.

While the iron was hot I also soldered in a 5 pin header in the area used for other hacks to make things easier in the future.

With the header in place I could put the regulator on a prototyping board and build up the required circuit. I found a 66 ohm resistor in series with the input 12VDC line and a 333uF capacitor between the 12VDC line and ground eliminated the tuning clicks.

Prototype decoupling circuit.

Here are some YouTube videos of the radio tuning without and with the added decoupling circuit:

The kit doesn't come complete, which makes it easier and less expensive to ship. But that does mean you will need to come up with a power supply, a case (or at least some way to mount the boards and controls), complete or find a microphone assembly and some others things. Some may see this as a drawback, but I see it as an advantage if your goal is to experiment with the radio rather than simply use it as you would any other appliance. You have the option of only building that which you need for you experiments.

My radio kit arrived in September but I did not really have time to put the radio together, and had not decided on a case. I finally settled on a case from Amateur Radio Kits World-Wide, the colour is very nostalgic of my days as a signalman.

Universal Case Siemens Grey II & Accessories

It comes with some useful parts not included with the BITX40

The case, like the BITX40 ships from India, but the only shipping options is by Post. Never the less it arrived at my mailbox in Canada less than three weeks after I ordered it right in the middle of the holidays. Perfect timing to put it together.

The first thing I did was test fit the boards and parts into the case. Doing this while reading the wire up instructions gives you a better idea of how the wires traverse the case and a chance to consider various options. I learned three things while doing this.

First, the BIT40 diagram is a bit confusing because it shows the Raduino board from the side facing the front of the case, rather than the side you would be looking at while running the wires. The text instructions are better, but again from a point of view I would not have chosen. But this is not a huge problem.

Second, I had to ream out some of the mounting hols to get them large enough to mount the parts. Again not a huge problem, nor unexpected since the case is powder coated, but one you should be prepared to deal with.

Third, the voltage regulator on the Raduino protrudes past the left side of this style of case. Again easily dealt with by carefully folding the regulator the other way.

Voltage regulator folded back between the Raduino and the LCD display.

The rest of the installation was quite easy as described on the BITX40 web pages.

Left side of the radio.

Right side of the radio.

If you look closely you will notice that I have not completed the hook up. I have not:

provided for MIC or headphone jacks,

installed a PTT switch or any way to get the radio to transmit,

trimmed the shaft of the tuning pot.

This is because I intend to do a number of modifications. The first step in this process will be to decide on which firmware to run. But these are discussions for a later post. I will leave you with pictures of the front and back panels and an anecdote of my first test.

Front panel.

Back panel.

The only antenna I have at home is a 2m ground plane whip in my attic which works well for me on 70cm as well. Once the radio was completed and knowing there was no way I could accidentally transmit and perhaps damage the rig I hooked up this antenna and started tuning around the band. I quickly game across a stations calling "CQ contest" likely for this RAC event. I was able to make out some VA3 call signs. Some more tuning and I came across a station from Long Island NY calling "CQ DX" and listened to him for a while. Not a bad days work as a HAM if I do say so myself.