RadioBot
RadioBot is a tiny bot designed to sit on an IRC channel and tune a radio receiver following commands given on the
channel itself.
Audio can than be fed through the likes of Teamspeak, Skype, MP3/OGG streaming or other voip solutions.
See below for some suggestions.
RadioBot caters for a very specialistic use (ie. it's quite pointless), and I'm sure more effective ways to perform
this task could be devised. Still, it seemed a funny idea and helped me in understanding a bit about hamlib,
which I may use in a broader scheme to control my shack.
REQUIREMENTS
- Perl;
- Net::IRC and Data::Dumper Perl modules. Please refer to your distribution docs for details
about getting and installing modules.
- Hamlib handles the radio control part.
My first attempt was to do a proper job and work using Perl or Tcl bindings to Hamlib. Unfortunately compiling that
part is a real pain in the back and there's very little documentation about calling the functions themselves.
Nevertheless I got a version working, but eventually dumped it in favour of portability and ease of setup.
The current version uses calls to RIGCTL to perform the task. This is ugly because:
- I'm pretty sure it represents a security risk. Although I tried to build-in some basic
protections, chances are that a malformed command to the bot
may result into hijack of your PC. You have been warned. Proceed at your own risk.
- Sometimes commands may fail without getting an error message.
- Handling some commands (in future developements) may be impossible.
|
CONFIGURATION
The following parameters MUST be edited in the script:
- bot name: the nick used by the bot on IRC;
- server: IRC server to connect to. RadioBot has been designed and tested to (more or less) work
on ZIrc. Other networks may have different parameters and/or policies banning it from working or being used
altogether;
- channel: IRC channel to sit on;
- path to RIGCTL: full path to RIGCTL (es. c:\\program files\\hamlib\\bin\\rigctl under Windows or
/home/yourname/hamlib/bin/ under Linux);
- serial port the radio is connected to, in the proper format (es. COM1 under Windows -
/dev/ttyS0 under Linux);
- serial speed in baud. Must match speed set on radio;
- radio: receiver model ID, according to the Hamlib
table of supported radios;
- CI-V address: for Icom radios connected through the CI-V interface the corresponding decimal
code must be entered. Please note that this is not necessary when the radio sports a RS232 interface (es. R8500).
Default CI-V code or your radio can be found on the user manual.
Hex can be quickly converted to decimal using Windows's calculator. PUt it into "scientific"
mode, thick "hex", enter two digit code (es. 32 for Icom R72), thick "dec". Done (result 50 for the example before).
Editing details about the audio feed or the shack (RX model, location, antenna...) won't stop the bot from
working, but makes it more useful.
COMMANDS
Once the bot is sitting on a channel, the following commands can be issued:
COMMAND | FUNCTION | EXAMPLE |
[bot_name] help | prints out help message | RadioBot help |
[bot_name] freq | retrieves current frequency and mode | RadioBot freq |
[bot_name] tune fffffffff | tunes to frequency fffffffff Hertz |
RadioBot tune 145500000 |
[bot_name] mode XXX | sets to mode XXX | RadioBot mode FM |
Instead of RadioBot you'll obviously use any other name you choose for the bot.
RadioBot will politely welcome new users on the channel and give a small help message.
CROSS PLATFORM
RadioBot was developed on Linux and Windows XP boxes.
Since both Perl and Hamlib can be compiled on other platforms, it may work under OSX or other more exotic
environments.
Any report on the matter will be appreciated.
Thanks AlphaVax for testing.
KNOWN ISSUES
- As I was experiencing random timeouts on my IRC server, I used a very coarse workaroud by sending it some rubbish at
predefined times. This also causes some warning messages in the output window when running. Should you need to
remove it, just comment out the "&keepalive" by adding a "#" in front of it or delete the line.
# here we start a scheduled task sending some rubbish to the IRC server to keep the connection alive
&keepalive ;
- Because of the bindings issues mentioned above, RadioBot doesn't use Hamlib they way it was intended to.
Every time a command string is received from IRC it calls the RIGCTL utility, which in turn executes the command and
then quits. This causes some radio/interface combo to behave strangely.
For example sending the tune command my R72 will output error messages, but the frequency is tuned nevertheless.
This happens because the homebrew CI-V interface (actually a scavenged Nokia data cable for a long gone 3210) takes its
power from pin 4 and/or 7 of the rs232. Unfortunately such pins only go "high" (from 0 to 12V) when RIGCTL is running and the
CI-V interface isn't ready to work yet when the data stream arrives. PC to radio interface with external power supply
shouldn't be affected by this oddity.
LICENSE
RadioBot is released under GNU/GPL license.
DOWNLOAD
AUDIO STREAM |
While not part of RadioBot itself, some hints on the way to stream your audio, based on "free" (mostly GNU/GPL)
software: |
audio from RX > soundcard > MP3/OGG encoder > MP3/OGG streamer |
MP3/OGG encoder = OddcastV3 under Windows,
DarkIce and DarkSnow
under Linux |
MP3/OGG streamer = Icecast under both Win and Linux. |
Several Linux distributions (mostly Debian based) will provide prepackaged versions of the above software without
MP3 support (ie. OGG only) for copyright reasons. On my pc I preferred recompling all the relevant packages to use MP3
as it's more widely supported by multimedia players, even on basic portable devices. I also found that the OGG format
introduced some more lag in the signal, but it's probably due to my inablility to do a proper configuration. |
If you need the stream to be accessible from the internet, you'll need to configure your firewall accordingly.
If you don't own a public IP address use dynamic IP readdressing services like DynDNS.
|
Any feedback is welcome at contact below.
Contact:
Published: Apr07 - Last update: 21Aug07
Home