Connect to 3G networks in Uganda using the Linux command line
If you are a Linux user living in Uganda and use 3G internet, you may want to try out my tools to connect to the Internet. These are a couple of scripts I created a while back, however, I’ve now updated them to allow for the following:
- You can now connect to Airtel, Orange/Africell, MTN, UTL, and Smart telecom.
- I have added the capability to use your PC (or device such as a raspberry Pi) as a router, this way several devices can access the Internet using one 3g dongle. You can create a MiFI of sorts if you’re inclined to.
- Query your modems for: EMEI, Serial, IMSI numbers, Lock status, Model/firmware version, etc.
- A few BUG fixes and script clean ups.
Want to try it out? Visit my Github repository
How to stream FM Radio using the Command Line in Linux
With all the advancements in IT, one piece of technology has persisted and seems not ready to die yet: FM radio. Unlike its companion AM, FM radio continues to be the primary source of information and entertainment. For example, in the United States, FM radio is still alive, and is used by many as a discovery medium. Most people especially teenagers will tell you that they first heard a song on terrestrial FM radio, before they went on to streaming sites such as YouTube, Spotify etc. In Uganda, like elsewhere in Africa, expect traditional FM radio to continue being king of information. Our limited Internet infrastructure is still very limited to a small section of the population, speeds are still horrible, so on-line radio is still not an option for many.
As I work on my upcoming digital product, I debated a lot about whether to include FM radio as a feature on this device. With all the above said, there was no doubt, FM radio would quickly become one of the most requested for features. So I got down to playing, recording, and streaming Live FM radio using the Linux command line. The cool bit is that you can stream a live FM radio show to all your devices in the house or office. No need for you to buy a radio.
What you need:
a) Analog Video for Linux (V4L2) FM radio tuner. You can either use a USB stick or PCI-E based card.
b) Linux distribution – Am using Fedora 20. But any Linux distro will work, although you will need to adjust the install commands where necessary.
Available Linux CLI tools:
There are a whole lot of GUI based applications that you can use to play radio in Linux, For example Gnomeradio, Kradio, gradio etc. However, using the command line gives you much more flexibility, as the following commands illustrate. You can control an FM radio tuner using CLI tools like MPlayer (which is installed on most Linux distros), ivtv-radio, and fmtools. In this ‘how to,’ I use the latter, fmtools, which comes with a set of tools (fm and fmscan) for controlling V4l2 based tuners.
Installation:
1. Install fmtools
yum install fmtools
(On Red-Hat based Distros such as Fedora, CentOS)
2. Install SoX
yum install sox
(On Red-Hat based Distros such as Fedora, CentOS)
3. Install VLC
yum install vlc
(On Red-Hat based Distros such as Fedora, CentOS)
FM Radio Commands
The basic arguments for the fm command line tool are:
fm -d [device] -T [time] [freq] [on|off] [percentage]
-d The radio device created by your USB or PCI based tuner
-T The duration of play
-q quiet | No verbose
[Freq] The radio channel
[on|off] Turn on or mute radio
[Volume] The desired volume
Tune and play FM 91.3
fm -q -d /dev/radio0 -T forever 91.3 100%
Mute:
fm -q -d /dev/radio0 off
Unmute:
fm -q -d /dev/radio0 on
Recording FM Radio
To record FM radio, use parec a utility that is packaged with pulseaudio, the default sound subsystem on most Linux distros.
1. First tune to the desired radio station as shown above.
2. Capture the audio:
parec -d alsa_output.pci-0000_01_01.0.analog-stereo.monitor | sox -t raw -r 43000 -e signed -L -b 16 -c 2 - /var/tmp/fmradio.wav
NOTE: You will need to change the variable -d i.e. output pulse device for your system. To find yours, just run the command:
pactl list | grep -A2 '^Source #' | grep 'Name: .*\.monitor$' | awk '{print $NF}' | tail -1
The recording will be stored at /var/tmp/fmradio.wav. You can change that to another location if you wish.
Stream FM Radio to other PCs or devices (such as smart phones)
Start the capture process as shown above, and proceed immediately to the stream command below:
vlc -I dummy -I http --daemon --no-video --no-sout-display-video --verbose 2 /var/tmp/fmradio.wav --sout #duplicate{dst=standard{access=http,mux=asf{title='JambulaRadio',author=FM-91.3-Radio-Kampala(Uganda),copyright=2015-2016-Joseph-Zikusooka-All-rights-reserved,comment=Broadcasting-Live-from-Kampala-Uganda,rating=PG14},dst=192.168.0.10:8090},dst=standard{access=http,mux=asf{title='FM-Radio',author=FM-91.3-Radio-Kampala(Uganda),copyright=2015-2016-Joseph-Zikusooka-All-rights-reserved,comment=Broadcasting-Live-from-Kampala-Uganda,rating=PG14},dst=172.16.0.1:8080}"}
NOTE: Here, I’m streaming on both wired and wireless LAN, and my machine IP addresses are 192.168.0.10, and 172.16.0.1 respectively. The http stream port is 8080. Change these to suit your environment.
If you are using a wired connection, use VLC on your client PC or mobile phone to access the stream as follows:
vlc http://192.168.0.10:8080
If on Wireless, use vlc on your client PC or mobile phone to access the stream as follows:
vlc http://172.16.0.1:8080
Enjoy!
Uganda’s digital TV Migration – A status update
With only 5 months left before the international deadline for analogue TV switch off, here is where Uganda stands in the move from analogue to digital TV broadcasting.
As of January 2015, the following areas have access to the Over-the-Air digital TV signal: Kampala, Entebbe, Bombo, and Mityana. Basically only a small part of central Uganda is covered. Also DVB-T tuner tests indicate that depending on your location, you may still not be able to access the DTV signal which is being transmitted from Kololo. For example in areas East of Naalya an Outdoor Antenna may be required.
Also, only a few TV stations are currently broadcasting in Digital TV. For example,
NTV Uganda, Bukedde TV 1, WBS TV, Urban TV, UBC etc. For a specific status on each of the local TV channels, take a look at the Digital TV Migration Status page
With regards to equipment, some merchants in Kampala have already started to sell analogue-to-digital TV converter boxes, which is what the majority of household with require. However, at prices of up to 150,000/=, this might still be prohibitive for the majority of homes in the country.
With the the looming deadline, Uganda Communications Commission (UCC), has promised to start rolling out Digital transmission to other areas of Uganda. We look forward to that.