{"id":2209,"date":"2017-09-01T15:54:37","date_gmt":"2017-09-01T15:54:37","guid":{"rendered":"http:\/\/www.daveakerman.com\/?p=2209"},"modified":"2017-09-18T12:02:02","modified_gmt":"2017-09-18T12:02:02","slug":"telnet-flight","status":"publish","type":"post","link":"http:\/\/www.daveakerman.com\/?p=2209","title":{"rendered":"Telnet Flight"},"content":{"rendered":"<p>This was a fun flight to provide a remote serial terminal on a Pi, between ground and a high-altitude balloon, using a bi-directional radio link.<\/p>\n<h2>LoRa Possibilities<\/h2>\n<p>Most high altitude balloon flights use a simple unidirectional data stream from the balloon to the ground, sending the telemetry (balloon position and sensor data) and sometimes images too, from balloon to the ground. \u00a0Most often this is RTTY or (in the USA APRS) but there are alternatives such as LoRa which more easily provides a means of reliably transmitting data to the balloon as well as from it. \u00a0This greatly expands the range of things we can do during a balloon flight, for example:<\/p>\n<ul>\n<li>A ground station can request re-sends down to the ground of missing data (image data or anything else) &#8211; see\u00a0http:\/\/www.daveakerman.com\/?p=2195<\/li>\n<li>A balloon can repeat data from other balloons, which might be flying or have landed &#8211; see\u00a0http:\/\/www.daveakerman.com\/?p=1850<\/li>\n<li>Uplink to request cutdowns<\/li>\n<li>Uplink to provide a guided parachute or parafoil with a new target landing position<\/li>\n<\/ul>\n<h2>You are in a maze of twisty little passages<\/h2>\n<p>Another possibility is to run a terminal session between ground (client) and balloon (host), allowing programs to be run on the balloon tracker as requested by a ground station:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-large wp-image-2211\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/pic1-1024x512.png\" alt=\"\" width=\"640\" height=\"320\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/pic1-1024x512.png 1024w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/pic1-300x150.png 300w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/pic1-768x384.png 768w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/pic1.png 1200w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>This could even be used to change the tracker program, or have that program use new configuration parameters. \u00a0Here though I&#8217;m going to use an idea provided by Philip Heron &#8211; run an old text adventure game. \u00a0And to make this a group experience, I added a web dashboard that displays the terminal window in real (ish) time. \u00a0The following diagram shows how this is achieved in software:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-large wp-image-2212\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/pic2-1024x333.png\" alt=\"\" width=\"640\" height=\"208\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/pic2-1024x333.png 1024w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/pic2-300x98.png 300w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/pic2-768x250.png 768w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/pic2.png 1128w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>The LoRa gateway is the standard release with modifications added to provide a server socket on a specified port, to which any network terminal program (e.g. putty) can connect. \u00a0In this case I have written a simple terminal program, in Delphi, that screen-scrapes the terminal window and sends the contents to a Python script, which then updates a web dashboard so that anyone with the URL can see what I see in my terminal program. \u00a0Separately (and not shown on this diagram) another Python script updates the same dashboard with the current telemetry, using data from the habitat system.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-large wp-image-2213\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/pic3-1024x593.png\" alt=\"\" width=\"640\" height=\"371\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/pic3-1024x593.png 1024w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/pic3-300x174.png 300w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/pic3-768x444.png 768w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/pic3.png 1054w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>Each time that a key is pressed in the terminal window, the key character is sent to the gateway that stores it ready for radio upload to the balloon tracker. \u00a0Normally with balloon trackers, they transmit all the time, but instead this tracker sits listening for an uplink, to which it replies immediately. \u00a0So the gateway program reads the keys sent to it from the terminal program, adds them to a custom message, and sends the result to the tracker. \u00a0Assuming the messages arrives intact, the tracker replies with an ACK; any other reply (or no reply at all) results in the message being re-sent.<\/p>\n<p>At the tracker, these messages result in those key codes being sent to the telnetd program (telnet daemon) which is an installable program on Raspbian. \u00a0That program provides a regular command interface &#8211; same as a login on a Pi using a keyboard and monitor &#8211; and any responses to those key codes are sent back from telnetd to the tracker program, where they are included in messages sent back to the ground.<\/p>\n<p>Periodically, when the tracker receives an uplink it will reply with a telemetry string so that the gateway can upload the balloon position to habitat as usual. \u00a0The string is standard except for the addition of some status information about the uplink. \u00a0There&#8217;s also a timeout so that if no uplink is received for a while, telemetry is sent anyway (useful for tracking after landing).<\/p>\n<h2>Houston, We Have Another Idea<\/h2>\n<p>As the Apollo missions of the 1970&#8217;s were a major part of my inspiration for my very first high altitude balloon launch, it seemed entirely appropriate to push the retro theme of this flight a stage further and try to replicate an Apollo mission control console. \u00a0So I grabbed a suitable photograph from the web, edited it fairly heavily, and incorporated in a new web server program that populates the screen with balloon telemetry and the terminal session. \u00a0I wrote this in Delphi, with some Python to grab the telemetry from Habitat. \u00a0I opted for a green-screen monitor though (I later noticed) the Apollo screens had white screens. \u00a0I think green looks better!<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-large wp-image-2219\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/DJsq675XUAI6PMA-1024x866.jpg\" alt=\"\" width=\"640\" height=\"541\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/DJsq675XUAI6PMA.jpg 1024w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/DJsq675XUAI6PMA-300x254.jpg 300w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/DJsq675XUAI6PMA-768x650.jpg 768w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<h2>Radio Waterfall<\/h2>\n<p>This is what it looks like in action, minus the web dashboard:<\/p>\n<p>https:\/\/youtu.be\/zq7Abui3Lds<\/p>\n<p>LoRa packets are up to 255 bytes, so long sections of text are downloaded in chunks of a bit less than that length (there&#8217;s some overhead of course), so the terminal window is updated in chunks also. \u00a0That window is screen-scraped every 1 second, and the results are pushed to the web dashboard at that rate or slower (depending on the time needed to post to the server). \u00a0The following video shows the terminal window and dashboard, for a short session that includes logging in to the tracker, running a couple of basic Linux commands, and then starting the Colossal Caves adventure game.<\/p>\n<p>https:\/\/youtu.be\/FIJEU46S5y0<\/p>\n<h2>Choice Of Frequency<\/h2>\n<p>We have a range of frequencies available to us for balloon flights, with different restrictions according to power and duty cycle. \u00a0For this flight the duty cycle (proportion of time spent transmitting) is between 50% and near 100%, so I had to choose \u00a0frequency in the band that allows that.<\/p>\n<p>It&#8217;s also important to choose a frequency that doesn&#8217;t have a lot of use from other devices. \u00a0For those receiving on the ground, they may be near ISM (Industrial Scientific and Medical) devices such as oil level senders, weather stations etc, that can be bothersome if transmitting near the receiver. \u00a0For the flight though, it can potentially hear transmitters over 100&#8217;s of miles, so about a year ago I did a test flight to scan the spectrum and report on the signal levels as received by the balloon. \u00a0The results of that test showed that some frequencies are 15dB better (which is a lot) better than others:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-large wp-image-2230\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/RSSI_Over_Frequency-1024x540.png\" alt=\"\" width=\"640\" height=\"338\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/RSSI_Over_Frequency-1024x540.png 1024w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/RSSI_Over_Frequency-300x158.png 300w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/RSSI_Over_Frequency-768x405.png 768w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/RSSI_Over_Frequency.png 1609w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>The quietest area does not allow 100% duty cycle (which is probably why it&#8217;s the quietest!) so I chose a frequency centred on the quietest area that does; namely 434.225MHz.<\/p>\n<h2>Payload<\/h2>\n<p>Normally I would use a PITS tracker, but as I didn&#8217;t need RTTY I decided to use a custom GPS+LoRa board, atop a Raspberry Pi model A+. \u00a0Power came from an AA &#8220;emergency phone charger&#8221; with 4 Energizer Ultimate Lithium cells. \u00a0The lid of this was firmly taped down with duct tape, and the cells held in place with double-sided pads, but even so the Pi rebooted when it landed. \u00a0Not an issue but a reminder that soldered cells are best!<\/p>\n<p>As usual, the lot went into a Hobbycraft polystyrene box, with GPS aerial on the top and a 1\/4 wave aerial on the bottom, made from an SMA bulkhead plug and 5 pieces of guitar wire.<\/p>\n<h2>The Launch<\/h2>\n<p>The conditions were favourable, without too much ground wind (makes it difficult to launch) or high level winds (can take the flight a long way away); I wanted the flight to stay fairly close to give the uplink the best chance of working throughout the flight.<\/p>\n<p>First step was to get all the ground-station software started (LoRa gateway, Telnet terminal client, web server (for Apollo dashboard) and Python scripts for updating the two dashboards (Apollo and thedash.com) with telemetry and terminal data. \u00a0I intended to use a gateway up on my Clark mast, for the best range, but that position is beyond the reach of my house wifi signal, and the TP-Link repeater I bought the day before completely failed to extend the signal far enough. \u00a0Soon I&#8217;ll have my shed (next to the mast) wired to the house network, and that problem will go away. \u00a0Meanwhile though, I had to go with the LoRa gateway in the house, using a short colinear aerial in the loft.<\/p>\n<p>With the software all set up, I started the tracker, checked that the 2-way communications was all working as expected, and then filled the balloon. \u00a0I chose a 350g Hwoyee, a 24&#8243; Sphereachute, and a gas fill to have the flight land south of Monmouth. \u00a0I needed to launch by about midday as after the the flight would land further east, increasing the risk of a tree landing. \u00a0The launch itself was easy, with little wind.<\/p>\n<h2>The Flight<\/h2>\n<p>As mentioned, I only had a loft aerial to communicate with the flight, but that worked very well, both for uplink and downlink; very few missing packets on the uplink, and a last position from an altitude of 390 metres.<\/p>\n<p>Once I got back to my PC after the launch, I typed a few commands into my remote terminal window, with the results then being relayed to the dashboard webb pages along with telemetry:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-2221\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/telnet1.png\" alt=\"\" width=\"998\" height=\"773\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/telnet1.png 998w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/telnet1-300x232.png 300w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/telnet1-768x595.png 768w\" sizes=\"(max-width: 998px) 100vw, 998px\" \/><\/p>\n<p>The upper section shows the latest telemetry, as received either by my gateway or by at least one of the other gateways operated by the HAB community. \u00a0The left side shows what the payload is reporting for messages it has received from the ground; the right side is basic GPS information.<\/p>\n<p>The lower section shows a copy of the terminal window from my PC. \u00a0There is some latency in the system, with screen updates relying on the approx 1400 bps downlink from the balloon, plus some delays as the terminal is polled then changes sent to the web server and distributed over the web. \u00a0It was though entirely usable.<\/p>\n<h2>XYZZY<\/h2>\n<p>Next step was to run the text adventure &#8220;Colossal Cave&#8221;, which I remember playing around 1980. \u00a0This can be installed on a pi with<\/p>\n<pre>sudo apt-get install bsdgames<\/pre>\n<p>I&#8217;d already installed it (as the payload doesn&#8217;t have internet access!), so I just needed to run it by typing &#8220;adventure&#8221; into my terminal window.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-2222\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/telnet2.png\" alt=\"\" width=\"1006\" height=\"769\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/telnet2.png 1006w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/telnet2-300x229.png 300w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/telnet2-768x587.png 768w\" sizes=\"(max-width: 1006px) 100vw, 1006px\" \/><\/p>\n<h2>ASCII ART<\/h2>\n<p>One of the other balloonists on IRC asked if I could do some ASCII art, and conveniently I&#8217;d already installed figlet which does that!<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-large wp-image-2223\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/telnet3-1024x442.png\" alt=\"\" width=\"640\" height=\"276\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/telnet3-1024x442.png 1024w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/telnet3-300x129.png 300w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/telnet3-768x331.png 768w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/telnet3.png 1140w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<h2>Rebooting<\/h2>\n<p>Another request was to reboot the Pi, so I obliged:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-2224\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/reboot2.png\" alt=\"\" width=\"739\" height=\"276\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/reboot2.png 739w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/reboot2-300x112.png 300w\" sizes=\"(max-width: 739px) 100vw, 739px\" \/><\/p>\n<p>I don&#8217;t have a screenshot from the live reboot, but I do have one from when I previously tested this on the ground:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-2225\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/reboot.png\" alt=\"\" width=\"566\" height=\"173\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/reboot.png 566w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/reboot-300x92.png 300w\" sizes=\"(max-width: 566px) 100vw, 566px\" \/><\/p>\n<h2>Chase<\/h2>\n<p>As mentioned, this flight wasn&#8217;t expected to go far, so I left the chase until shortly before the flight landed. \u00a0We had a last position at 390 metres altitude which is plenty good enough to then find a position within radio range of wherever the payload actually is. \u00a0Here&#8217;s the path that the flight took:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-2226\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/telnet6.png\" alt=\"\" width=\"929\" height=\"697\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/telnet6.png 929w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/telnet6-300x225.png 300w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/telnet6-768x576.png 768w\" sizes=\"(max-width: 929px) 100vw, 929px\" \/><\/p>\n<p>We parked up near the last position, switched on our mobile LoRa gateway, and soon received a new position with the landing spot. \u00a0This was close to the lane that we were on, so we parked opposite and took a look. \u00a0The payload was hanging from a small tree in someone&#8217;s front garden. \u00a0We rang the doorbell, several times, but nobody in so as the payload was very close we just grabbed it from the tree.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-large wp-image-2227\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/IMG_20170917_143347131-576x1024.jpg\" alt=\"\" width=\"576\" height=\"1024\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/IMG_20170917_143347131-576x1024.jpg 576w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/IMG_20170917_143347131-169x300.jpg 169w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/IMG_20170917_143347131.jpg 637w\" sizes=\"(max-width: 576px) 100vw, 576px\" \/><\/p>\n<p>and took it back to the car:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-large wp-image-2228\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/telnet7-1024x674.png\" alt=\"\" width=\"640\" height=\"421\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/telnet7-1024x674.png 1024w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/telnet7-300x197.png 300w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/telnet7-768x505.png 768w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/telnet7.png 1222w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>So, a very successful flight, and though the remote terminal and game-playing was just a bit of fun, it did show just how reliable the LoRa uplink is, and I&#8217;ll use that for other purposes in forthcoming flights.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-large wp-image-2229\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/21552116_1493961294006877_2619718251762510603_o-569x1024.jpg\" alt=\"\" width=\"569\" height=\"1024\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/21552116_1493961294006877_2619718251762510603_o-569x1024.jpg 569w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/21552116_1493961294006877_2619718251762510603_o-167x300.jpg 167w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/21552116_1493961294006877_2619718251762510603_o-768x1382.jpg 768w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2017\/09\/21552116_1493961294006877_2619718251762510603_o.jpg 800w\" sizes=\"(max-width: 569px) 100vw, 569px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This was a fun flight to provide a remote serial terminal on a Pi, between ground and a high-altitude balloon, using a bi-directional radio link. LoRa Possibilities Most high altitude balloon flights use a simple unidirectional data stream from the balloon to the ground, sending the telemetry (balloon position and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=\/wp\/v2\/posts\/2209"}],"collection":[{"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2209"}],"version-history":[{"count":7,"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=\/wp\/v2\/posts\/2209\/revisions"}],"predecessor-version":[{"id":2430,"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=\/wp\/v2\/posts\/2209\/revisions\/2430"}],"wp:attachment":[{"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2209"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}