Header Image - Kilo Charlie 4 Romeo Charlie Romeo

admin

Streaming Audio Using Darkice

It is easy to use a Raspberry Pi to stream audio to your own webserver (running on the RPi) or using a global site such as Broadcastify. Though I used a RPi to build this, it is not unique to the RPi and can run on a variety of systems (I have used the same setup on my Ubuntu laptop).

Here’s what you will need:

  • Raspberry Pi (any will work but I use a RPi4 with 4GB RAM)
  • USB Audio Dongle
  • Speaker to Line Audio Converter (build or buy)
  • Scanner (or other radio output device)
  • Assorted audio connectors and cables
  • An Internet connection of course

Assumptions:

  • You have a working knowledge of installing the Raspberry Pi Operating System and can access it on your network or directly from a console setup
  • Your scanner or radio receiving device works and has an antenna and can receive the frequency or range you wish to broadcast
  • You are able to open a port for port forwarding on your Internet router to the port running Icecast (if you want to open the server to the world)

First, get your Raspberry Pi set up however you like with the Raspberry Pi Operating System according to the instructions found here (or using your own method). The instructions here should work for pretty much any modern Debian-based Linux distribution.

Now for the hardware setup. Your scanner or radio’s audio needs to be taken down from speaker level to line level. They do make converters you can buy such as these on Google. But you can also build one. I used this design found here with two 3.5mm jacks for the connections:

Speaker to Line Level Converter from https://www.epanorama.net/circuits/speaker_to_line.html

One note on this, it assumes your scanner is mono so no reason to use a stereo 3.5mm plug. Here’s my built version on the above diagram:

Speaker to Line Converter (using Mono to Stereo Connectors)

On an older version I had a commercial converter shows in this picture:

The SNI-35 Line Output Converter

Now let’s put it all together with the USB Audio device inserted into the RPi and the microphone jack running through the speaker to line converter to the speaker out jack of the scanner. By the way, this setup is in my laundry room because it is opposite the ham antenna side. There will still be some de-sensing on transmit especially with these older scanners. There is an external discone antenna it is connected to (see BC760XLT Scanner Repair for the background story).

RPi with USB Audio Device
Scanner Connected to RPi Audio

Now we move on to the software side of things. Boot up your RPi and once you have the system up and running how you like it, install Darkice via the command:

sudo apt-get install darkice

You will need to create/modify the Darkice configuration file. The default location is in /etc but you can specify an alternate location when you run the darkice command to start your streaming.

There is a great darkice.cfg example at the following link which is the one I used as my starting point on the Raspberry Pi:

https://wiki.radioreference.com/index.php/Live_Audio/Ubuntu_Darkice

You will need to sign up for a Broadcastify feed provider account and get the “mountpoint” and “password” from your account page and input it in the configuration file. Also note you may have to change the configuration slightly depending on your hardware. I had to change the “device” setting to “hw:2,0” and “sampleRate” to “44100” based on my configuration. You can view your hardware location via the “aplay -l” command. NOTE! When I rebooted headless (no monitor) the HDMI connection changed the hardware ports, so be aware this might happen.

Similar to the issue described on the page linked above, Darkice does not reliably restart on reboot. I’ve tried various configurations, running it as root, etc. and nothing has proven effective. If I find a solution I will post it.

Darkice should be run as a normal user, not root. The reason for the comment here is that when you run it as a normal user it will tell you try running as root, that is not needed.

If all is well, run darkice from the command prompt and your feed will show active over at Broadcastify! As I said before, you might have to fiddle around with the sample rate or other settings to get it just right for your configuration. For reference, here is how I start my Darkice instance:

nohup darkice -c /home/pi/darkice.cfg &

The “nohup” signifies No Hangup which leaves the process running after I log out. The “-c” specifies the configuration file and the “&” means run as a daemon/background process. Since I run headless, I ssh into my RPi and start darkice this way from my remote terminal.

BREAK BREAK BREAK… Okay you are done if all you wanted is a Broadcastify feed. But some have asked how you would host streaming audio on your own. the following section describes the additional steps which will be needed to do this.

If you want to run your own server you can install Icecast2. Darkice will feed to Icecast. Install Icecast using apt:

sudo apt-get install icecast2

Icecast will install in /etc/icecast2 and run the auto configure program for you. Be sure to remember your passwords as you will need the source password in the darkice.cfg file. The port you choose to run on (default 8000) is the one you will point your browser to on the RPi IP address. You can always edit the icecast.xml configuration file found in the installed directory mentioned above. Another good install document can be found here. Once you have finished the configuration, run:

sudo systemctl start icecast2

You can always replace “start” with “restart” or “stop”. You can also enable it to always run on reboot with “enable” (or do the opposite with “disable”). Once running you can point your browser to http://yourRPiaddress:port where that is the RPi’s IP and port number you chose in the setup. If you are local, you could use http://127.0.0.1:8000, for example. You should see this:

Icecast2 with no Streams

If that page came up, great news you are almost there. The next step is to feed Darkice into Icecast. You do that by adding an Icecast section to the darkice.cfg file using the password you set up in the Icecast installation for sources. If your darkice.cfg has an “[icecast2-1]” section already you can edit it, otherwise add the following, tailored for your installation:

[icecast2-1]
bitrateMode = abr # average bit rate
format = vorbis # format of the stream: ogg vorbis
bitrate = 96 # bitrate of the stream sent to the server
server = 127.0.0.1
port = 8000 # port of the IceCast2 server, usually 8000
password = SOURCEPWD # source password to the IceCast2 server
mountPoint = KC4RCR # mount point of this stream on the IceCast2 server
name = DarkIce
description = KC4RCR Scanner Traffic
url = http://www.kc4rcr.com
genre = Mostly 2 meter ham repeaters around the VA area
public = no # advertise this stream?

Now restart the service using sudo systemctl restart icecast2 if applicable and go back to your web browser and reload the Icecast page. You should see something similar to the following:

Icecast Streaming

You can also login via your admin password (username admin) and see the stream stats and listener info. It is just one mount point here so that’s all that is displayed. Icecast supports a variety of configurations if you are interested. Visit icecast.org for more information.

AM Broadcast Rejection Filter Testing

by admin 0 Comments

I have a 270 foot off-center fed dipole which works pretty well for my 160m and other band needs (with an external tuner). My HF rig is a Yaesu FT-450D which appears to have a great front end to suppress unwanted signals. Occasionally I like to look at the spectrum in Gqrx with my RTL-SDR dongle. But take a look at the image below!

That’s a lot of annoying interference

The RTL-SDR does very little to clear this up, but given the reasonable price and utility of the device, it is not unexpected.

I have the RTL2832U model SDR which works on HF

I have a number of very strong AM broadcast stations nearby so I thought I would give a couple filters a go at it. First, I tested with a cheap RTL-SDR brand “Broadcast AM Reject Filter” which attenuates below 2.6MHz.

RTL-SDR Broadcast AM Reject Filter

Now let’s take a look at the Gqrx spectrum waterfall

40 meters in Gqrx with SDR filter

That’s a great amount of cleanup! Now I know my FT-450D does a better job than the SDR dongle, but I figured I would check out a legitimate filter which can be used with a transmitter. I found the M-402x by Morgan Systems which attenuates below 1.8MHz and can tolerate 200 watts of power (they have another version if you don’t use 160m). I ordered this from KF7P Metalwerks which came quickly and excellently packaged.

M-402x Filter

Now let’s take a look at this filter in the Gqrx spectrum waterfall like we did with the other. Obviously my attenuation is a little bit less because I wanted to use 160m which is close to the AM broadcast band. Also, these pictures were taken at night when the signal was hitting me the hardest (in the day it looked even better).

Gqrx with the M-402x

I am very happy with the results and the M-402x is now installed with the FT-450D and I am currently listening to a great signal on 1.900MHz!

BC760XLT Scanner Repair

So the preamble to the story is that I just moved into a new QTH and while my ham gear is protected by multiple ground rods and polyphasers, my scanner was not.

Now, it was a cheap scanner (found on eBay for under $50) connected to a Raspberry Pi 4. It was at the service entry point to the house and I hastily set it up. I used it to live stream audio to a web server on the Pi that I could access with my phone. The antenna was set outside, not raised up much or anything (power lines above). I just needed to pick up the local repeaters when I was away and wanted to listen in. Everything was plugged into a small UPS but I knew the antenna was susceptible. It would work for now until I can get back to it.

The very day I set out to ground and protect the antenna, I was outside trying to get things finished when a freak storm rolled up. Well glad I came in to take a break with the rain because lightning lit up my property (my ham shack was disconnected). I am sure I heard electrical arcing in the house when it hit.

Later that evening I noticed things were offline with the Pi. And as you probably guess from this title blog, my scanner was dead from the lightning induced voltage spike in the antenna. That and the Raspberry Pi were toast.

Dead. Can you find the smoked component? Hint: Upper-left quadrant

Nothing I could do for the Raspberry Pi. No way I could solder that. Next for the scanner. There were no visible marks but it did turn on with distorted garbled audio which faded off to nothing. It smelled of burning electronics. That was GOOD for me! I opened it up and poked around. The part that was smoking was definitely a problem!

That IC was smoking hot!

Looking up the part number it turned out to be an audio amplifier circuit. That made sense why the audio went out! I also tested the voltage regulator (8V as designed according to the part number). Strangely the power supply transformer was putting out 18V instead of 13.5! At least that was within range of the voltage regulator to handle (I changed that out too).

Well I am terrible at soldering and the leads on the printed circuit board burned very easily so I decided to make a modular design (hopefully not to replace often). While waiting on the $5 part, I soldered jumper wires in the IC socket to connect to a solder-less breadboard just awaiting the IC.

Jumpers I use for RPi projects soldered into the IC socket points

Now here is the modular design in action. Luckily the age of the scanner makes for a lot of extra space in the case.

Modular design

And now here is the final product. I wouldn’t want this rattling around in a mobile installation but it works well for a stationary setup. It will have adhesive to keep it somewhat fixed.

Lots of room
All done!

AllStar Node Build

I enjoy ham radio nets and try to reach out to the furthest ones I can pull off with my 2-meter radio and J-pole antenna (81.4 miles is the record to the K3NQT repeater as of this posting on 21 Apr 2020). I have used EchoLink to reach out to some West Coast nets in California and Washington (usually the Puget Sound Repeater Group nets) but I prefer using a radio over my cell phone. Also, building my own AllStar node would allow me the flexibility to control the link. Furthermore, I wanted to join in the East Coast Reflector which I could only break the squelch on the nearest repeater.

Credit goes to K3KDX for providing me with instructions as to how he set up his node which I based this built off of.

East Coast Reflector AllStar connections. See if you can find KC4RCR (Hint: Connected to Node 27339).

Here are the items I used to build the node:

  • Alinco DR-135 MkIII (2 meter single band transceiver)
  • Raspberry Pi (I used a RPi 4 4GB/RAM, but 3B+ is fine)
  • RIM-Alinco (Interface from Pi’s USB to Radio’s DB-9)
  • Dummy Load (Use one sized appropriately, this one is 50W)
  • SMB-201 Cooling Stand (Reuse of this, you can use a cheaper fan)
  • SD Card with HAMVOIP image installed
  • Keyboard, Power, HDMI, Coax and other cables as needed
  • Raspberry Pi Case with fan recommended
  • Register with AllStarLink for a server and node
  • A second radio that is the control point you wish to use

The first recommended step is to register with AllStar. They validate your license and it takes a bit of time for them to set up your node in the database. This only took a few hours in my case, but it’s better to do this ahead of time if you can. You need to register and set up a “server” under the “Portal” menu. The server is just the name and location. Next you have to create a “node” for that server, also under the “Portal” menu. AllStar will take the time to create a node number and password. You will need these in the setup of HAMVOIP.

Next load the HAMVOIP image onto the SD card. Choose a good quality card. I had a Samsung 32 GB card handy, so I used that. The HAMVOIP site has instructions on how to install the image on to the card (if you have not done this before). I already had win32diskimager on a Windows machine so I downloaded the Windows .exe (execute to decompress the image) and used the win32diskimager to write the image to the SD card.

Raspberry Pi 4 / 4 GB version with metal case and fan

Here is how the RIM-Alinco device arrived. It looks of excellent quality. Note that this is a mini-USB not the more common micro-USB. The RIM-Alinco comes with this cord so no worries about finding one if you don’t have it. Install this to the DB-9 connector on the radio. Note the lack of heat sink fins on the bottom side of the radio, we will come back to that later…

RIM-Alinco device as received in packaging
RIM-Alinco connected to the radio’s DB-9 with the provided mini-USB cable connected to a RPi USB Port

I had an unused SMB-201 cooling stand which fits the form-factor exactly. The only catch was the Alinco radio has the majority of the heat sink fins on the top, not the bottom. Originally I set this up facing the “proper” direction.

Alinco on cooling stand, original position

However, look at the above picture. There is a lack of heat sink fins on the bottom side (do not run the length of the radio). While the fan on the bottom still kept the radio at a reasonable temperature (low power), I decided to flip it over for proper cooling. Eventually I’ll make a stand that inverts the entire setup.

Inverted on stand. Fan toward heat sink
Need to invert the whole stand but this is the most efficient position given the side of the heat sink and fan position

Remember, the radio is a node so the TX and RX duty cycles are reversed. That means the TX duty time is the time you are listening on your node channel on your other radio. That is a very heavy duty cycle especially for long nets. I am hoping the Alinco can handle this long term. This is why cooling is extremely important. Also, setting the power at the lowest setting necessary is also very important. Right now I use a dummy load because the radio is nearby. Low power on this radio is listed as <5 Watts. This is 50 Watt dummy load so I have no overheating issues or SWR problems. I measured around 4.5 Watts output at the radio on low power. Oh, and I recommend setting the radio to tone-coded squelch so you don’t rebroadcast other simplex users inadvertently. Set the radio to the simplex frequency you plan to contact your node with.

50W Dummy Load

If not done already, connect everything together as appropriate and power the devices. Set up the RPi to display the HDMI on a monitor/TV and have a USB keyboard plugged in. When you boot the RPi, it will launch the installation program. It will ask for your assigned node number and password (from registering with AllStar). It will also ask you for a number of setting choices. The RIM-Alinco page provided a few seen here:

I noticed my TX was quiet, so I modified a few settings. Don’t worry you can always go back in and adjust things as needed. When you boot from now on you will see this screen allowing you to modify the settings as needed. I performed the system updates after I set up WiFi. There is also an echo function in the simpleusb-tune program which helped me set the audio levels.

Here are the settings directly from my configuration files: simpleusb.conf and simpleusb_tune_usb.conf.

AllStar has a list of commands you give the node over the radio (starting with a “*”). I prefer to use the command line (Asterisk CLI client). That way I’m not keying the radio all the time to issue commands via RF. This is not necessary but a preference on my part.

Connecting my node (51461) to node 27339 (East Coast Reflector)

That’s all there is to it! It took me no more than an hour to set up. The hardest part was waiting for the parts to arrive.

I’ve also set up the node to relay weather information using the AutoSky SkyWarn module. Setup can be found here from HAMVOIP.

Next, I plan to dual-purpose the Alinco. Since it’s a well-performing 2-meter radio, I want to use this as a base-station as well when not in use on a node. I have programmed a momentary switch in Python which is connected to the RPi GPIO pins to shutdown and restart the AllStar node asterisk service. That way I can disable the node and use the radio as a normal 2-meter transceiver when I want without having to SSH to the RPi and turn off the node. Once I formalize this, I will publish the process and Python code.

Raspberry Pi Projects

by admin 2 Comments

This page will be where I post about the Raspberry Pi projects I have created or are working on.

Years ago I learned C++ extensively (my Computer Science degree). I started looking into Raspberry Pis in 2019 and started learning the Python programming language.

I’ve written a lot of home security programs, home automation and also stream my favorite local repeater.

I’ll write more here about the projects soon.

Mobile Installation in Ram Truck

by admin 1 Comment

Built only from parts found at your local hardware store. No modifications to vehicle for mounting.

Initially I built this as a single mount for my BTech GMRS-50×1 mobile radio. I have a bench seat in my Dodge Ram but very little room elsewhere to mount the radio. Years ago you could drill into the dash when they were metal…not so easy anymore.

I bought two L-shape brackets and two straight brackets with assorted hex bolts. I also included four rubber feet with the intent of sliding the bracket under the center front seat.

It started out wide but I had to make it more narrow due to restrictions under the seat. The holes already drilled made this easy.

As you can see the BTech GMRS-50×1 radio fit quite well on the bracket and with the rubber feet, it slipped great under the seat. For added security I left the bottom metal strap long and zip-tied the two side holes to the seat mount points.

Later on, I got my ham license and wanted to add my Yaesu FT-2980. That radio is larger so I decided to flip the BTech GMRS-50×1 GMRS one to the top and put the Yaesu on the bottom.

I already had wires through the plastic firewall knockout and I didn’t want to disturb them so I found it easier to drill a second small hole in the same knockout. I removed the connector (the pic was actually to make sure I put it back on with the correct polarity…I triple checked!).

I mounted the BTech GMRS-50×1 radio on top and fitted the Yaesu FT-2980 bracket on the bottom side. Because the bracket wasn’t originally designed for this alignment, I had to add some spacers, etc. but it did fit exactly in the space between the seat and extended cup holders. The angles changed a little as well, but it wasn’t bad.

All in all, the entire bracket seems quite secure and does not vibrate or move when on the road!

(Oh and if you are wondering why I have green and red labels on equipment it is for the family. That way they know NOT to pick up ham equipment but they can use GMRS as covered by the WREY366 license).

Original Dry-Run Assembly
Needed a narrower fit under seat
BTech GMRS-50×1 Mounted
Pin removal from connector
Plastic knockout in Dodge Ram Firewall
Positive post directly between battery and under-hood fuse box
Flipped the GMRS radio to the top position
Needed spacers/washers because the top side was not built originally to mount a bracket
Finished Product!

2 Meter Quick J-Pole Antenna

by admin 2 Comments

Being stuck at home during the COVID-19 outbreak I wanted to explore building a J-Pole antenna for the 2 meter band. I spend most of my “ham time” on the 2 meter repeaters in my area jumping on the local traffic nets.

The Virginia QSO party was starting that weekend so I built this as quickly as possible.

I had built one J-Pole before for GMRS frequencies (Call sign: WREY366) tuned around 465 MHz.

The design I chose came from the Oroville Amateur Radio Society in California website. Their posted J-Pole antenna design is shown to the right. I did need to adjust the connection points as expected. Mine have a bit more distance than the ideal specifications. The analysis is posted below.

As a quick test to see if my VSWR was on track, I held it together with duct tape! It was kind of just for fun but it actually worked surprisingly well. (I use a cheap radio for these tests).

Next was the soldering. I expected the VSWR to change because of, well, adding soldier and the end caps. Minor adjustment was needed at the hose clamps, but it wasn’t far off to start.

Next came the fun part. I used a kid’s bow and arrow set here to send fishing line up over the highest trees. I tied the ends to paracord and pulled that up, anchoring the first end to the ground.

Over the area I wanted the antenna to be fixed, I tied a loop in the cord to hang the antenna by fishing line as a separator to keep water off. Two additional ropes are added to prevent swinging and orient the “J” stub as desired for the repeaters I want to reach. The far end of the suspension rope is tied off with lots of excess so I can lower it as needed. I used split ferrite beads on the RF cable looped as a choke.

This is obviously a temporary construct but it seems to work exceedingly well. If I were to leave this up long term I would redo this with cable as the rope will decay in the weather (but I’d have to make sure it was far from the radiating element field as needed–maybe add rope only over the antenna section?). Also the antenna is not water-proofed. So far the rain it’s taken on doesn’t seem to interfere too much. The wind is more of a problem if it spins and moves around. Again, it hasn’t been too bad even in high (30 MPH) winds.

This was a quick project using what I had around the house. Paired with my Yaesu FT-2980 (pulled from the truck), I have been getting great range! I can now join nets and other 2 meter discussions from the convenience of my living room using my mobile radio.

SWR minimum at 146.800. Not too bad!
Lower end near 144.400 MHz still decent at SWR of 1.17. Curve looks dramatic because of scale.
Smith chart showing impedance of 49.0 ohms at 146.800 MHz. Pretty darn close to 50 ohms!
TX to WA4TSC repeater on uplink of 147.9 MHz. SWR of 1.04 double checked by a second meter
Courtesy Oroville Amateur radio Society
Quick test before soldering (it actually worked pretty well with duct tape!)
Time to solder it all together
Final connector bound with 14 AWG copper wire
Fun games: getting a rope in the air
RF Choke using split ferrite beads
Hanging about 40 feet above ground level and at 1,415 feet above sea level
Mobile radio on inverter in living room