Header Image - Kilo Charlie 4 Romeo Charlie Romeo

Category Archives

3 Articles

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.

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!

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!