Chirp on Pi

10 Nov 2017

Today I will be going over a way to setup Chirp on a Raspberry Pi, in this case a Pi0 (Pi Zero).

I personally have had a Pi0 and a Pi3 for approximately a year now. I had originally set it up on the Pi3 and when I found it works well there (which I had done 6 months ago and forgot some steps), I decided to go through the process on the Pi0. I did this primarily because the Pi3 is a Kodi setup in the other room, so it is essentially a media center. Since everything is slow speed serial connection to the radio, even the low power Pi0 should be able to handle this, which it does.

Due to the developmental nature of Amateur Radio, it is fitting that the developmental nature of the Raspberry Pi and similar devices (like Arduino) also are being adapted for various amateur radio uses. As a bit of a disclaimer, I have been using Raspbian Jessie since I got these Pi devices. There is the newer "Stretch" version of Raspian available out there but I have not tested or used it yet.

Some people are daunted by the "command line" and "do it yourself" nature of Linux, so they remain Windows or OSX users. Personally I still have Windows computers for various purposes, but I have also dealt with Linux enough to teach myself quite a bit (enough to be a server admin for the past decade or so). Just like anything else, you need to take a little time with whatever it is, regardless if it is a computer, a Raspberry Pi, or driving a car, to become comfortable with it. Luckily the software for the Pi is all free so if you mess up, you can start from scratch and try again without worrying about additional costs or the archaic activation process with Windows and OSX. I know when I started with the Pi devices I had to do this at least 3 or 4 times before I started to really enjoy using them. I will likely be doing it again pretty soon to use the newer "Raspbian Stretch".

Initial info

So, the quickest and easiest way to install Chirp is open the Terminal at the top, type a simple command, and follow the prompts:

sudo apt-get install chirp

This should also get the needed packages for python-serial and python-libxml2 (or equivalent). The problem here is that this retrieves the latest version from the Pi repository (for Jessie) which is 0.4.0-1+deb8u1, which dates back to March 2014 when all the Chirp team handled was Baofengs and maybe a few other radios. The issue here is that over the past few years, they have greatly expanded their compatibility list covering several hundred models from various companies, not just Baofeng anymore. If you just have an old Baofeng UV-5R from 3-4 years ago, this is really all you need, but for the rest of us that have newer radios and other brands, we need a much newer version of Chirp. If you are using Stretch, it appears they do have much newer versions available dating to earlier this year (Jan. 2017), but it is still out of date, so I suggest going through this process anyways.

Baseline setup

Before you can install chirp, you will need a few packages as mentioned on their website: "Make sure you have python-serial and python-libxml2 packages installed. For more information about using CHIRP under Linux, see the Running Under Linux page." This is also where I am using some of the sources for my setup. As I use the Raspian OS (Jessie) for my Pi, the commands will essentially be the same as Debian/Ubuntu. If you are not familiar with those, don't worry, it does not really impact this enough to worry about. For those curious, "Raspbian" is essentially a mash up of Raspberry and Debian, it is a stripped down and slightly altered version of Debian made to run with the ARM architecture of the Raspberry Pi devices.

So for the first set of packages as stated on their site, we will need to do things a little differently because this is a Pi and not Ubuntu/Debian, the key difference is gtk2 instead of gtk. At the top of the "desktop" for the stock Raspbian OS, it should have the black square for command line items, hold the mouse on top without clicking, should say "Terminal". If you do not feel comfortable doing this, I suggest having someone else more familiar with Linux stop by and do this for you.

sudo apt-get install python-gtk2 python-serial python-libxml2

It will likely ask to install other packages as well which should not be a problem, these are required for proper function of these packages and programs. Next we need to get the actual Chirp program itself. Some like to use the newer OS folder to do this (more Windows-like), others prefer command line, either way should work.

Folder - open the folder at the top, then at the bottom left select + / and click that plus, open the "usr" folder then "src". Then you can right click, Create New > Folder, and I name it chirp.

Command line - In the command line it would be:
mkdir /usr/src/chirp
This will be storage directory for the "install files", similar to the Windows "Downloads" or "temp" folder.

So lets download the latest files, which are current as of the moment I am writing this article. There will be some permission errors unless you start with the very first command. Also you may need to run "sudo apt-get install wget" to download the file itself, some Raspbian installs do not come with this utility. I suggest doing this on the command line (Terminal) since the Chromium browser does not have write permission to the /usr/src/ folders or subfolder (at least it didn't on mine). this of course requires an active internet connection (I have a USB wifi dongle on my Pi0).

  • sudo -i
  • cd /usr/src/chirp
  • wget
  • tar -xvf chirp-daily-20171104.tar.gz
  • cd chirp-daily-20171104

Now at this point, if you really want to test it, you can open and use Chirp as is by typing "./chirpw" (no quotation marks). In my case I had to just remember it is a Pi0, so certain commands and downloads take a awhile to process and load properly (such as downloading from repeaterbook, or radio with a lot of channels programmed already). It should be quite a bit faster on a Pi2 or Pi3.

USB cables

As many of us know, there are a lot of different USB cables out there, some based on genuine Prolific chips, some fake Prolific chips, some FTDI, and others (usually custom) made from a CP2101 chip. In my case I have several Prolific-based cables, and I suspect they are fake Prolific, which in Windows can be a major pain, but Linux based distros (usually) do not care. As I mention below, this is not always the case as one of my cables does not work, and the other does.

To download from a radio, connect the USB cable to the Pi, connect other end to the radio, power on the radio. Then at the top of Chirp select Radio > Download from radio. It will bring up a small box, next to Port select "/dev/ttyUSB0" (or similar ttyUSB# port). Then select the proper vendor and model in the other 2 drop downs. After that click OK. Choose yes on the "developmental driver" box and it should read from the radio.
In some cases it may come back with a "error opening serial port" or similar error. They did mention a command on the Chirp website, which for this purpose would be "sudo addgroup pi dialout".

If you come up with errors there could be various issues why, I would suggest getting on the Facebook group Facebook - Chirp for Hams or going to the chirp website and asking for help. With mine, it did come back with errors on several radios (UV-5R, UV-82HP), "Radio sent incomplete block 0x03c0", and then with my UV-82X, it came back with "Radio did not respond".

What I did find to work for me was switching to a different cable. I recently received some cheap basic fake-Prolific cables off ebay (from China) for $2.11 each, which I connected for this purpose, and while they do work well in Windows (using the older Prolific drivers), here on the Pi (and likely on other linux distros) they came back with the mentioned errors. As soon as I switched to my 3 year old original Prolific (may be a fake) cable, it read and wrote from/to radio just fine. So if you are getting errors, stop by the BaofengTech site and buy a genuine FTDI cable (PC-03 programming cable). From that point on you should have no more problems with programing Baofeng/BTECH radios in Linux, the Pi, or Windows. Some people say "I bought my radio for the same price as that programming cable?", and for those people I suggest reading this: is that Baofeng real? No modern legitimate Baofeng labeled radio should cost less than $30.


As they mention, make sure your command line box is still in the /usr/src/chirp/chirp-daily-20171104 folder or whatever date code for your specific version, and then type/run this:
python install

This should go through the process of actually installing it on your system, even on my Pi0 it only took 2 minutes to go through the install process. Once finished the final program to run should be located at "/usr/local/bin/chirpw", although the simplest way to run it is open the command line box and just type "chirpw". This will open the Chirp program and allow you to do whatever you need to. Some like to add a link to the desktop, but I found if you update Chirp several times per year, that link can sometimes stop working.

Final words

So while it is not quite as easy as Windows "click and install", it is still not overly difficult, plus I found this is much easier than trying to get it working properly on a Mac (OSX). Of course even Windows users can be plagued by buying/using a cheap programming cable with the fake Prolific chip in it, which brings along its own set of problems and ways to fix. The majority of problems with Chirp come from people using poor quality cheap programming cables. Get the FTDI PC-03 cable I linked above (I make no money or benefits by suggesting this, I found they always work so I suggest them).
In a case like this using a tiny Pi0, there are plenty of options for a portable programming setup, and if you happen to use a larger SD card (like 16GB), this same Pi could easily be used for quite a few other amateur radio projects like fldigi (for PSK and other digital modes on HF), SSTV, APRS, d-rats, and plenty more (honestly I have not used this Pi for any of those at this time, so I cannot help with any of those). With a small 7-10" touch screen, it could be a portable programming/amateur radio "computer", or bring along a power supply and compatible HDMI cable to plug into the TV at the local club and be the guy helping to program radios, all using a Pi0 that in itself is half the size of a credit card.

I appreciate you looking over this information, and if you have any questions or comments, feel free to join me in the Facebook Baofeng "BARN" group and let me know, or send me an email at km4fmk -at- gmail -dot- com.
Thank you and 73!