{"id":23,"date":"2013-04-04T13:02:18","date_gmt":"2013-04-04T13:02:18","guid":{"rendered":"http:\/\/alpsayin.com\/new\/?page_id=23"},"modified":"2021-03-22T21:22:09","modified_gmt":"2021-03-22T21:22:09","slug":"setting-up-radiotftp-serverclient-with-radiometrix-uhx1","status":"publish","type":"page","link":"https:\/\/alpsayin.com\/blog\/manuals\/setting-up-radiotftp-serverclient-with-radiometrix-uhx1\/","title":{"rendered":"Setting up Radiotftp Server\/Client with Radiometrix UHX1"},"content":{"rendered":"<p>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.<\/p>\n<h1>What you need for both sides:<\/h1>\n<ul>\n<li>Any linux machine with a USB port and a Linux based operating system with\u00a0<a title=\"FTDI Chip Drivers\" href=\"http:\/\/www.ftdichip.com\/Drivers\/VCP.htm\" target=\"_blank\" rel=\"noopener\">FTDI USB-Uart driver<\/a>.\u00a0During the development we have used Alix 2d13 from\u00a0<a title=\"Alix\" href=\"http:\/\/pcengines.ch\/alix.htm\" target=\"_blank\" rel=\"noopener\">PcEngines<\/a>. And during development we have installed Voyage-Linux on them. But radiotftp is also tested on\u00a0<a title=\"Bifrost OS\" href=\"http:\/\/en.wikipedia.org\/wiki\/Bifrost_(operating_system)\" target=\"_blank\" rel=\"noopener\">Bifrost OS<\/a>.<\/li>\n<li><a title=\"Radiometrix Uhx1\" href=\"http:\/\/www.radiometrix.com\/content\/uhx1\" target=\"_blank\" rel=\"noopener\">Radiometrix UHX1<\/a>\u00a0or similar devices, one for the server one for the client.<\/li>\n<li>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&#8217;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\u00a0<a title=\"Uhx1 Uart PCB\" href=\"https:\/\/github.com\/alpsayin\/uhx1_uart_pcb\" target=\"_blank\" rel=\"noopener\">my github repository<\/a>.<\/li>\n<li>A USB TTL UART cable that allows CTS\/RTS signalling with 3.3 V or 5 V signal level. We prefer using\u00a0<a title=\"FTDI TTL USB UART Cable\" href=\"http:\/\/www.ftdichip.com\/Support\/Documents\/DataSheets\/Cables\/DS_TTL-232R_CABLES.pdf\" target=\"_blank\" rel=\"noopener\">FTDI cables<\/a>\u00a0for the purpose.<\/li>\n<li>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 <a title=\"Yaesu CR8900\" href=\"http:\/\/www.yaesu.com\/indexVS.cfm?cmd=DisplayProducts&amp;ProdCatID=106&amp;encProdID=0C4855ADE6394D514EAABAE148B93F5C&amp;DivisionID=65&amp;isArchived=0\" target=\"_blank\" rel=\"noopener\">CR8900 antenna from Yaesu<\/a>.<\/li>\n<li>You will also be needing the <a title=\"Uhx1 Programmer\" href=\"https:\/\/github.com\/alpsayin\/uhx1_programmer\" target=\"_blank\" rel=\"noopener\">uhx1_programmer from my github<\/a> if you want to program the uhx1 frequency and power parameters in a simple way.<\/li>\n<li>And finally you have to clone the\u00a0<a title=\"Radiotftp\" href=\"https:\/\/github.com\/alpsayin\/radiotftp\" target=\"_blank\" rel=\"noopener\">radiotftp software from github<\/a>.<\/li>\n<\/ul>\n<div>\n<dl id=\"attachment_7\">\n<dt>\n<figure id=\"attachment_26\" aria-describedby=\"caption-attachment-26\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/alpenian.alpsayin.com\/blog\/wp-content\/uploads\/2013\/04\/Uhx1_schematic.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-26\" src=\"https:\/\/alpenian.alpsayin.com\/blog\/wp-content\/uploads\/2013\/04\/Uhx1_schematic-300x211.png\" alt=\"Uhx1 Uart\/Soundmodem Interface Card\" width=\"300\" height=\"211\" \/><\/a><figcaption id=\"caption-attachment-26\" class=\"wp-caption-text\">Uhx1 Uart\/Soundmodem Interface Card<\/figcaption><\/figure>\n<\/dt>\n<dd>Bim2a UART Interface Card Schematic<\/dd>\n<\/dl>\n<\/div>\n<h1>Setup:<\/h1>\n<ul>\n<li>We will start the setup by first demonstrating how to program the Uhx1. First, clone the <a title=\"Uhx1 Programmer\" href=\"https:\/\/github.com\/alpsayin\/uhx1_programmer\" target=\"_blank\" rel=\"noopener\">uhx1_programmer<\/a> into your home directory.<\/li>\n<\/ul>\n<pre lang=\"bash\" escaped=\"true\">git clone\u00a0https:\/\/github.com\/alpsayin\/uhx1_programmer.git<\/pre>\n<ul>\n<li>Then make clean -for good practice- and make &amp;&amp; sudo make install to install the uhx1_programmer.<\/li>\n<\/ul>\n<pre lang=\"bash\" escaped=\"true\">cd ~\/uhx1_programmer\r\nmake clean\r\nmake &amp;&amp; sudo make install<\/pre>\n<ul>\n<li>Now you are ready to program you Uhx1 in a very simple way. You should note that this software doesn&#8217;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.<\/li>\n<\/ul>\n<pre lang=\"text\" escaped=\"true\">uhx1_programmer device_name\r\ndevice_name : i.e. \/dev\/ttyUSB0\r\nBuild Date: Apr 4 2013 16:16:24<\/pre>\n<ul>\n<li>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.<\/li>\n<\/ul>\n<pre lang=\"bash\" escaped=\"true\">uhx1_programmer \/dev\/ttyUSB0<\/pre>\n<pre lang=\"text\" escaped=\"true\">[1] - Read Mode\r\n[2] - Set Mode\r\n[3] - Set Default Channel\r\n[4] - Set Default Power\r\n[5] - Jump to Channel (volatile)\r\n[6] - Select Tx Power (volatile)\r\n[7] - Read RSSI\r\n[8] - Dump Eeprom Contens\r\n[9] - Exit (or Ctrl-C)\r\nEnter a selection [1-9]<\/pre>\n<ul>\n<li>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.<\/li>\n<li>Do this settings for both (or rest) of the Uhx1s that you have.<\/li>\n<li>Alright! You are now ready to set up the radiotftp and sensd if you are interested.<\/li>\n<li>Assuming that you cloned the radiotftp software to your home directory, cd into the radiotftp folder.<\/li>\n<\/ul>\n<pre lang=\"bash\" escaped=\"true\">cd ~\/\r\ngit clone https:\/\/github.com\/alpsayin\/radiotftp.git\r\ncd ~\/radiotftp<\/pre>\n<ul>\n<li>You should select the ax25 build, so cd into the ax_25 build folder.<\/li>\n<\/ul>\n<pre lang=\"bash\" escaped=\"true\">cd ax25_build\/<\/pre>\n<ul>\n<li>It is always good practice to clean and then make. So clean and make.<\/li>\n<\/ul>\n<pre lang=\"bash\" escaped=\"true\">make clean &amp;&amp; make<\/pre>\n<ul>\n<li>If you are seeing &#8220;<em>Finished building target: radiotftp<\/em>&#8220;, you are almost good to go. Now \u00a0we are going to create symbolic links to binary files so that we access them anywhere.<\/li>\n<\/ul>\n<pre lang=\"bash\" escaped=\"true\">sudo ln -s ~\/radiotftp\/ax25_build\/radiotftp \/usr\/sbin\/radiotftp<\/pre>\n<ul>\n<li>Go to your home directory again and try typing radiotftp, if you get the help text, then you are good to go<\/li>\n<\/ul>\n<pre lang=\"bash\" escaped=\"true\">radiotftp sends or listens for a tftp request<\/pre>\n<pre lang=\"text\" escaped=\"true\">legal invocations:\r\n radiotftp_uhf\r\n radiotftp_vhf\r\nBuild Date: Apr 4 2013 12:54:33\r\nUses ax25 link layer\r\nradiotftp mode [-dst] [-b] [-f] terminal [command filename] \r\n mode uhf or vhf -b run in background (EXPERIMENTAL, do NOT use this!)\r\n -f defines a different local filename for put and get\r\n and defines a different remote filename for append and appendline\r\n -dstXXX.XXX.XXX.XXX sends the request to XXX.XXX.XXX.XXX\r\n default is broadcast Local address settings are read from a 'radiotftp.conf' file\r\n Examples: \r\n radiotftp uhf \/dev\/ttyUSB0 \r\n radiotftp uhf -flocalphoto.jpg \/dev\/ttyUSB0 get remotephoto.jpg\r\n radiotftp uhf -flocalmusic.mp3 \/dev\/ttyUSB0 put remotemusic.mp3\r\n radiotftp vhf -dst10.0.0.1 \/dev\/ttyUSB0 appendfile logfile.txt\r\n radiotftp vhf -fremote_sensors.dat \/dev\/ttyUSB0 appendline '{TELEMETRY BATTERY=3.3V}'\r\nexiting...<\/pre>\n<h1>Usage:<\/h1>\n<h3>SERVER SIDE:<\/h3>\n<ul>\n<li>Radiotftp can send and receive files\u00a0only\u00a0from the directory that it is running in. It is possible to try to use relative upper directories, but it&#8217;s not advised. Unpredictable things might happen. For the purposes of hosting I create a directory in my home folder called radiotftp_host<\/li>\n<\/ul>\n<pre lang=\"bash\" escaped=\"true\">mkdir -p ~\/radiotftp_host<\/pre>\n<ul>\n<li>Then cd into that directory and create a file called &#8216;<a title=\"Radiotftp.conf\" href=\"https:\/\/github.com\/alpsayin\/radiotftp\/blob\/master\/radiotftp.conf\" target=\"_blank\" rel=\"noopener\">radiotftp.conf<\/a>&#8216;. 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.<\/li>\n<\/ul>\n<pre lang=\"bash\" escaped=\"true\">cd ~\/radiotftp_host\r\nnano radiotftp.conf<\/pre>\n<pre lang=\"text\" escaped=\"true\">TA2IAS4\r\n44.140.1.4<\/pre>\n<ul>\n<li>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.<\/li>\n<\/ul>\n<pre lang=\"bash\" escaped=\"true\">radiotftp vhf \/dev\/ttyUSB0<\/pre>\n<pre lang=\"text\" escaped=\"true\">Running with UHF band 19200 baud version\r\nAX.25 Callsign: TA2IAS4\r\nUSING AX25 LINK LAYER!!!\r\nIPv4 Address: 44.140.1.4\r\nhello radio world!\r\nstarted listening...\r\ntransmit_length=130<\/pre>\n<ul>\n<li>If you can&#8217;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.<\/li>\n<\/ul>\n<pre lang=\"bash\" escaped=\"true\">sudo chmod 666 \/dev\/ttyUSB0<\/pre>\n<ul>\n<li>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.<\/li>\n<\/ul>\n<pre lang=\"bash\" escaped=\"true\">cd ~\/radiotftp_host\r\nradiotftp vhf \/dev\/ttyUSB0 &amp;<\/pre>\n<ul>\n<li>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.<\/li>\n<\/ul>\n<h3>CLIENT SIDE:<\/h3>\n<ul>\n<li>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.<\/li>\n<\/ul>\n<pre lang=\"bash\" escaped=\"true\">mkdir -p ~\/radiotftp_client<\/pre>\n<ul>\n<li>Like for the server side, you again need a &#8216;<a title=\"Radiotftp.conf\" href=\"https:\/\/github.com\/alpsayin\/radiotftp\/blob\/master\/radiotftp.conf\" target=\"_blank\" rel=\"noopener\">radiotftp.conf<\/a>&#8216; 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.<\/li>\n<\/ul>\n<pre lang=\"bash\" escaped=\"true\">cd ~\/radiotftp_host\r\nnano radiotftp.conf<\/pre>\n<pre lang=\"text\" escaped=\"true\">TA2IAS15\r\n44.140.1.15<\/pre>\n<ul>\n<li>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.<\/li>\n<\/ul>\n<pre lang=\"bash\" escaped=\"true\">New neighbour:\r\nIP = 44.140.1.15<\/pre>\n<ul>\n<li>\u00a0To send a single file execute a command like below. If you don&#8217;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.<\/li>\n<\/ul>\n<pre lang=\"bash\" escaped=\"true\">radiotftp vhf \/dev\/ttyUSB0 put localfile.txt<\/pre>\n<pre lang=\"bash\" escaped=\"true\">radiotftp vhf -dst44.140.1.4 \/dev\/ttyUSB0 put localfile.txt<\/pre>\n<p>Client Side Stdout:<\/p>\n<pre lang=\"text\" escaped=\"true\">Running with UHF band 19200 baud version\r\nAX.25 Callsign: TA2IAS15\r\nUSING AX25 LINK LAYER!!!\r\nIPv4 Address: 44.140.1.15\r\nput\r\ndestination = 255.255.255.255\r\nlocal-filename = ''\r\nremote-filename = 'alpsayin.txt' -&gt; 12\r\nfilename-check = 0x02\r\nempty local filename, copying remote filename\r\ntftp src port = 236\r\nremote_filename = 'alpsayin.txt'\r\nstarted listening...\r\ntransmit_length=156\r\ntftp wrq ack #0 received\r\nsent data size = 34\r\ntransmit_length=174\r\ntftp error received -&gt; TRANSMISSION COMPLETE: Closing in 10 seconds\r\nexiting...<\/pre>\n<p>Server Side Stdout:<\/p>\n<pre lang=\"text\" escaped=\"true\">filename: 'alpsayin.txt'\r\nmode: netascii\r\ncomment: \r\ntftp src port = 25313\r\ntftp WRQ connection received  12:37:23.433.952\r\nopening alpsayin.txt\r\nsent ack size = 4\r\ntransmit_length=114\r\nblock #1 length=34 written=30\r\nsize=34 -&gt; EOF\r\ntransmit_length=202\r\nconnection closed<\/pre>\n<ul>\n<li>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\u00a0<a title=\"Sensd\" href=\"https:\/\/github.com\/herjulf\/sensd\" target=\"_blank\" rel=\"noopener\">sensd<\/a>. 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\u00a0<a title=\"Modified Sensd\" href=\"https:\/\/github.com\/alpsayin\/sensd.git\" target=\"_blank\" rel=\"noopener\">sensd<\/a>\u00a0can be cloned from\u00a0<a title=\"Modified Sensd\" href=\"https:\/\/github.com\/alpsayin\/sensd.git\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/li>\n<li>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.<\/li>\n<\/ul>\n<pre lang=\"bash\" escaped=\"true\">cd ~\r\ngit clone https:\/\/github.com\/alpsayin\/sensd.git\r\ncd sensd\r\nmake\r\nsudo make install<\/pre>\n<ul>\n<li>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\u00a0<a title=\"SendItAway.sh\" href=\"https:\/\/github.com\/alpsayin\/sensd\/blob\/master\/sendItAway.sh\" target=\"_blank\" rel=\"noopener\">sendItAway.sh<\/a>\u00a0in 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\u00a0<a title=\"SendItAway.sh\" href=\"https:\/\/github.com\/alpsayin\/sensd\/blob\/master\/sendItAway.sh\" target=\"_blank\" rel=\"noopener\">sendItAway.sh<\/a>\u00a0file<\/li>\n<\/ul>\n<pre lang=\"bash\" escaped=\"true\">cd ~\/radiotftp_client\r\ncp ~\/sensd\/sendItAway.sh .\/\r\nnano sendItAway.sh<\/pre>\n<pre lang=\"bash\" escaped=\"true\" line=\"1\">#!\/bin\/sh                                                                                                 \r\nradiotftp vhf -fsensors.dat -dst255.255.255.255 \/dev\/ttyUSB2 appendline $@\r\n#echo $@ &gt;&gt; echo.txt<\/pre>\n<ul>\n<li>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.<\/li>\n<li>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 &#8216;-f&#8217; option sensd will NOT relay the data to radio, but instead it will save it to that file.<\/li>\n<li>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.<\/li>\n<\/ul>\n<pre lang=\"bash\" escaped=\"true\">sudo nano \/etc\/rc.local<\/pre>\n<pre lang=\"bash\" escaped=\"true\">cd ~\/radiotftp_client\r\nsensd &amp;<\/pre>\n<ul>\n<li>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.<\/li>\n<\/ul>\n<h2>Finally; remember that there isn&#8217;t much documentation about this on the internet. So if you have a question, ask it below and I&#8217;ll try to answer. In such way we can build up a knowledge base.<\/h2>\n<h2><\/h2>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":40,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"ngg_post_thumbnail":0,"footnotes":""},"class_list":["post-23","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/alpsayin.com\/blog\/wp-json\/wp\/v2\/pages\/23","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alpsayin.com\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/alpsayin.com\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/alpsayin.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alpsayin.com\/blog\/wp-json\/wp\/v2\/comments?post=23"}],"version-history":[{"count":3,"href":"https:\/\/alpsayin.com\/blog\/wp-json\/wp\/v2\/pages\/23\/revisions"}],"predecessor-version":[{"id":325,"href":"https:\/\/alpsayin.com\/blog\/wp-json\/wp\/v2\/pages\/23\/revisions\/325"}],"up":[{"embeddable":true,"href":"https:\/\/alpsayin.com\/blog\/wp-json\/wp\/v2\/pages\/40"}],"wp:attachment":[{"href":"https:\/\/alpsayin.com\/blog\/wp-json\/wp\/v2\/media?parent=23"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}