Setting up Radiotftp Server/Client with Radiometrix UHX1

You want a simple manual to jump into packet radio networking with radiotftp? You have the Radiometrix Uhx1 devices ready at your hand with boards and everything? Just follow this guide thoroughly and you should have no problem.

What you need for both sides:

  • Any linux machine with a USB port and a Linux based operating system with FTDI USB-Uart driver. During the development we have used Alix 2d13 from PcEngines. And during development we have installed Voyage-Linux on them. But radiotftp is also tested on Bifrost OS.
  • Radiometrix UHX1 or similar devices, one for the server one for the client.
  • Interface card for Uhx1. These cards are not sold anywhere but you can build one very easily on your own. The schematic of such a card is below. If you are only planning to use the card for radiotftp you don’t need the audio components (i.e. any component/wire that is connected to the audio block). You can also download pcb designs for geda and proteus from my github repository.
  • A USB TTL UART cable that allows CTS/RTS signalling with 3.3 V or 5 V signal level. We prefer using FTDI cables for the purpose.
  • A matched antenna for 2m band (144 Mhz band). A simple and good antenna is a 2 2m long wire antenna, but you can use a 50 cm wire antenna if you want to keep it short. We have used CR8900 antenna from Yaesu.
  • You will also be needing the uhx1_programmer from my github if you want to program the uhx1 frequency and power parameters in a simple way.
  • And finally you have to clone the radiotftp software from github.
Uhx1 Uart/Soundmodem Interface Card
Uhx1 Uart/Soundmodem Interface Card
Bim2a UART Interface Card Schematic

Setup:

  • We will start the setup by first demonstrating how to program the Uhx1. First, clone the uhx1_programmer into your home directory.
git clone https://github.com/alpsayin/uhx1_programmer.git
  • Then make clean -for good practice- and make && sudo make install to install the uhx1_programmer.
cd ~/uhx1_programmer
make clean
make && sudo make install
  • Now you are ready to program you Uhx1 in a very simple way. You should note that this software doesn’t allow you to program every aspect of the Uhx1, but it suits the requirements of most users. Type in uhx1_programmer to terminal to get the help message.
uhx1_programmer device_name
device_name : i.e. /dev/ttyUSB0
Build Date: Apr 4 2013 16:16:24
  • If you see this message, you are good to go. It is a very simple menu driven software so all that is left to do is to invoke the program with the correct usb device.
uhx1_programmer /dev/ttyUSB0
[1] - Read Mode
[2] - Set Mode
[3] - Set Default Channel
[4] - Set Default Power
[5] - Jump to Channel (volatile)
[6] - Select Tx Power (volatile)
[7] - Read RSSI
[8] - Dump Eeprom Contens
[9] - Exit (or Ctrl-C)
Enter a selection [1-9]
  • When you get to the menu it us up to you to set the parameters. But you should note that both the server side and the client side MUST be programmed to the same frequency in order to communicate. Apart from that, if you USB port is a low power port, then setting the TX power to maximum is not a good idea, since trying to draw higher current than the port can handle can cause distortion, hence loss of range, QoS etc.
  • Do this settings for both (or rest) of the Uhx1s that you have.
  • Alright! You are now ready to set up the radiotftp and sensd if you are interested.
  • Assuming that you cloned the radiotftp software to your home directory, cd into the radiotftp folder.
cd ~/
git clone https://github.com/alpsayin/radiotftp.git
cd ~/radiotftp
  • You should select the ax25 build, so cd into the ax_25 build folder.
cd ax25_build/
  • It is always good practice to clean and then make. So clean and make.
make clean && make
  • If you are seeing “Finished building target: radiotftp“, you are almost good to go. Now  we are going to create symbolic links to binary files so that we access them anywhere.
sudo ln -s ~/radiotftp/ax25_build/radiotftp /usr/sbin/radiotftp
  • Go to your home directory again and try typing radiotftp, if you get the help text, then you are good to go
radiotftp sends or listens for a tftp request
legal invocations:
 radiotftp_uhf
 radiotftp_vhf
Build Date: Apr 4 2013 12:54:33
Uses ax25 link layer
radiotftp mode [-dst] [-b] [-f] terminal [command filename] 
 mode uhf or vhf -b run in background (EXPERIMENTAL, do NOT use this!)
 -f defines a different local filename for put and get
 and defines a different remote filename for append and appendline
 -dstXXX.XXX.XXX.XXX sends the request to XXX.XXX.XXX.XXX
 default is broadcast Local address settings are read from a 'radiotftp.conf' file
 Examples: 
 radiotftp uhf /dev/ttyUSB0 
 radiotftp uhf -flocalphoto.jpg /dev/ttyUSB0 get remotephoto.jpg
 radiotftp uhf -flocalmusic.mp3 /dev/ttyUSB0 put remotemusic.mp3
 radiotftp vhf -dst10.0.0.1 /dev/ttyUSB0 appendfile logfile.txt
 radiotftp vhf -fremote_sensors.dat /dev/ttyUSB0 appendline '{TELEMETRY BATTERY=3.3V}'
exiting...

Usage:

SERVER SIDE:

  • Radiotftp can send and receive files only from the directory that it is running in. It is possible to try to use relative upper directories, but it’s not advised. Unpredictable things might happen. For the purposes of hosting I create a directory in my home folder called radiotftp_host
mkdir -p ~/radiotftp_host
  • Then cd into that directory and create a file called ‘radiotftp.conf‘. This file contains the hardware address (Amateur Call Sign) and your IPv4 address in two lines. An example is below. Note that this file needs a new line at the end of file to work properly.
cd ~/radiotftp_host
nano radiotftp.conf
TA2IAS4
44.140.1.4
  • Then run the radiotftp server with suitable parameters. Since we are using radiotftp with Uhx1, we are going to invoke radiotftp with vhf parameter and assuming that your FTDI Usb Uart is mounted at /dev/ttyUSB0 we type in the command below. If you have more than 2 nodes in your network you should also specify a destination with -dst parameter or else the network is most likely to fail.
radiotftp vhf /dev/ttyUSB0
Running with UHF band 19200 baud version
AX.25 Callsign: TA2IAS4
USING AX25 LINK LAYER!!!
IPv4 Address: 44.140.1.4
hello radio world!
started listening...
transmit_length=130
  • If you can’t open the device, the most probable cause is that you dont have the right permissions for /dev/ttyUSB0. To set them right type in the command below. This command will give read+write access to every user.
sudo chmod 666 /dev/ttyUSB0
  • Your radiotftp server is up and running, now we can now set the client. But before that, many users ask how to invoke radiotftp on the background during boot. Easiest practice is to add a few lines into /etc/rc.local to cd into your home directory and run radiotftp from there.
cd ~/radiotftp_host
radiotftp vhf /dev/ttyUSB0 &
  • Add the above lines to your rc.local file and during boot radiotftp should be started with root priveleges (no permission issues). Now, you are completely ready to set up the client.

CLIENT SIDE:

  • Client side setup is not so different than the server side. For good practice, I prefer creating a folder called radiotftp_client in my home directory.
mkdir -p ~/radiotftp_client
  • Like for the server side, you again need a ‘radiotftp.conf‘ file for hardware address and IPv4 address setup. Again note that this file needs a new line at the end of the file to work properly.
cd ~/radiotftp_host
nano radiotftp.conf
TA2IAS15
44.140.1.15
  • Again for good practice it is a good idea to test connectivity by running the radiotftp as server, on the client side. If there is a connection, the simple hello world protocol should help the server side to discover the client side. If the client side is discovered, you should see a new neighbour message in server side.
New neighbour:
IP = 44.140.1.15
  •  To send a single file execute a command like below. If you don’t specify a destination address the software will automatically broadcast the requests. This works just fine if you have only 2 nodes. But if you have more than 2 nodes in your network you MUST specify a destination address or else the software will behave unstable, because logically it is irrational to make connection with broadcast IP.
radiotftp vhf /dev/ttyUSB0 put localfile.txt
radiotftp vhf -dst44.140.1.4 /dev/ttyUSB0 put localfile.txt

Client Side Stdout:

Running with UHF band 19200 baud version
AX.25 Callsign: TA2IAS15
USING AX25 LINK LAYER!!!
IPv4 Address: 44.140.1.15
put
destination = 255.255.255.255
local-filename = ''
remote-filename = 'alpsayin.txt' -> 12
filename-check = 0x02
empty local filename, copying remote filename
tftp src port = 236
remote_filename = 'alpsayin.txt'
started listening...
transmit_length=156
tftp wrq ack #0 received
sent data size = 34
transmit_length=174
tftp error received -> TRANSMISSION COMPLETE: Closing in 10 seconds
exiting...

Server Side Stdout:

filename: 'alpsayin.txt'
mode: netascii
comment: 
tftp src port = 25313
tftp WRQ connection received  12:37:23.433.952
opening alpsayin.txt
sent ack size = 4
transmit_length=114
block #1 length=34 written=30
size=34 -> EOF
transmit_length=202
connection closed
  • Great! Now, you have sent your first file over a UHF radio link. During our development we used this link to send wireless sensor network data collected by a software called sensd. Sensd software is not off-the-shelf ready to be used with radiotftp so we forked it and modified it a little to buffer some messages and relay them to the radio link when the buffer is full. The modified sensd can be cloned from here.
  • If you want to use the modified sensd with a KTH mote, you should clone sensd into your home directory and modify a few files after building it.
cd ~
git clone https://github.com/alpsayin/sensd.git
cd sensd
make
sudo make install
  • Now you have sensd ready to be invoked from wherever you want. How you use sensd is up to you, it does original job of collecting wireless sensor network data wherever or however you invoke it. But to make it relay the collected data to radio, you must put a shell script called sendItAway.sh in the same directory you invoke it. For this purpose I recommend using the radiotftp_client directory that we created earlier. And then we can copy the example sendItAway.sh file
cd ~/radiotftp_client
cp ~/sensd/sendItAway.sh ./
nano sendItAway.sh
1
2
3
#!/bin/sh                                                                                                 
radiotftp vhf -fsensors.dat -dst255.255.255.255 /dev/ttyUSB2 appendline $@
#echo $@ >> echo.txt
  • The only modifications you need to do is to change the destination address if you have more than 2 nodes, setting the correct usb uart device as in the 4th parameter and finally using vhf mode instead of uhf.
  • After that you should invoke the sensd from this directory WITHOUT any file parameter, and all is set. If you type in a file parameter with ‘-f’ option sensd will NOT relay the data to radio, but instead it will save it to that file.
  • Finally, most users prefer invoking sensd in the boot, for this purpose you can add a few lines into the previously mentioned rc.local file in /etc/rc.local.
sudo nano /etc/rc.local
cd ~/radiotftp_client
sensd &
  • Now your client setup is complete. In the boot time, sensd will be started to collect data. And when its internal buffer is full, it will relay the buffered data by invoking radiotftp for a single time.

Finally; remember that there isn’t much documentation about this on the internet. So if you have a question, ask it below and I’ll try to answer. In such way we can build up a knowledge base.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.