Oinker — SMS to ham via text to speech

Brought to you by AF7HG — Troy E. Lanes

UPDATE 2014-05-21

Many, rightfully so, have pointed out that best amateur practice dictates to listen before transmit. While I have been careful to monitor before triggering an oink, I admit that it's a distinct possibility, while mobile, that somebody could be the inadvertent target of interference. So, armed with some python-foo I monitored the volume from the speaker out with a very low squelch setting. The results can be seen in the images, below.

Scatter plot of 146.88 (Bridger Repeater). X is time. Y is Volume Level. Made with matplotlib

Test transmission at 1206 MDT

Higher resolution of test transmission at 1206 MDT

Conversation between KG7KCV and AF7HG at 1718 MDT

Python via the alsaaudio module came in very very handy (code). Basically, I can now hold off on sending an oink until the previously referenced code detects 15 (you can adjust) seconds of silence. To get things working properly on the raspi I had to disable the onboard audio (see here), unmute the mic, and adjust levels in alsamixer (see below). Next, I'll stitch things together and have a listen before talk software solution. I'm also in the process of utilizing the RX led on the baofeng and a real PTT solution. Stay tuned.

ALSA mixer settings (alsamixer)

Update 2014-05-12

After experimenting with oinker with a couple local hams I quickly came to discover that the frequency, 421.000 MHz was in use by MRLA (Montana Repeater Link Association) as an interlink frequency between VHF repeaters. Despite listening before transmitting on 421.00 I was only occasionally able to hear chatter or blips of static so I continued using 421.000 as ARRL and others slot this guy as "experimental." Anyway, I soon had Rick ( W7AMT ) at my door :) After a good ragchew with Rich and Ric KB7KB we quickly discovered that I was transmitting on a UHF interlink frequency.

Anyhow, the lesson here is to check with your regional frequency coordinator to make sure that any experimentation isn't annoying other hams. Plus, it's good amateur practice. Also, I should note, that listen before talk is always important and always comply with local regulations and laws.

Initial Post

Driving to work one day, I realized I had left my trusty Baofeng UV-5R HT at home. There was an overturned semi on the Interstate that had traffic snarled. If only I had a way to notify fellow hams to avoid the route I was on... Thus, oinker was born.

If you haven't already guessed, oinker is a play on twitter -- tweet:Twitter::oink::Oinker and what do hams do? Anyway...

The setup is pretty simple and cheap. Get yourself a raspberry pi, an old laptop, etc, with an analog audio output, wire it to your rig taking care to properly adjust levels, switching on vox, driving PTT, etc. In my case it was easy easy as plugging in a stereo cable to the headphone jack on the raspi to the mic in on the UV-5R. You'll also have to modify the code a little to configure things like your email address, where you keep the files, etc, but it should be very very easy. Your call sign will be automatically appended to the output audio to keep good amateur practice :)

I'm using, as you see below, the $30 Baofeng UV-5R and a raspberry pi. All told I spent about $75 on this project :) YMMV — you might consider an audio isolation transformer on the connection between your rig and the sound interface of your computer of choice. Also, I've found that charging while having the audio connected results in triggering the VOX circuit — let me know if you find a simple solution for this...

Ok, let's get started. First, get ahold of the source for this package at:

https://github.com/troylanes/oinker.git
OR
git clone https://github.com/troylanes/oinker.git

Then proceed to install the dependencies:

Text to speech engine, audio utilities, and perl. (looks like there are plenty of other options than festival: http://elinux.org/RPi_Text_to_Speech_(Speech_Synthesis)

sudo apt-get install festival perl alsa-utils

Better quality voices for festival (optional but highly recommended — I prefer voice_cmu_us_clb_arctic_clunits )

http://ubuntuforums.org/showthread.php?t=751169

perl modules:

sudo cpan Net::IMAP::Simple::SSL
sudo cpan Email::MIME

Now, you're going to need an email account to which you'll send your SMSs. Gmail works just fine. I've hosted my own postfix instance ( you could rock this on the raspi, too!) Anyway, setup your account and note the username and password.

Next, edit oinker.pl and oink.sh to specify your email account info, SMS from address to call sign mapping, etc. Execute oinker.pl and it will fork into the background and monitor the relay account. At this point you should be ready to go. Unhook your rig and do some sanity checking on the output. Send some txt messages (emails should work, too) to the relay address you just configured and make sure that they are received and the audio output through the headphone jack is acceptable. Finally, tune your rig to desired broadcast frequency, hook things back up, and you're ready to oink!

ENJOY your SMS to ham gateway/repeater! Add your local contacts to the hash table to allow them to also use the repeater. I get a range of about 12 miles with just the HT and stock antenna at 5W. I'm planning on putting a UHF whip on the roof, soon, to cover all of Gallatin Valley.

Please send any suggestions or patches to tango romeo oscar yankee lanes@gmail.com

Sample audio:

Shot of the rig, yep, that's all there is to it!