{"id":1398,"date":"2013-10-16T21:34:47","date_gmt":"2013-10-16T21:34:47","guid":{"rendered":"http:\/\/www.daveakerman.com\/?p=1398"},"modified":"2013-10-16T21:42:23","modified_gmt":"2013-10-16T21:42:23","slug":"chase-car-raspberry-pi-computer","status":"publish","type":"post","link":"http:\/\/www.daveakerman.com\/?p=1398","title":{"rendered":"Chase Car Raspberry Pi Computer"},"content":{"rendered":"<p>Chasing balloons across the country is one of the best, and probably the most exciting, parts of high altitude ballooning, using a car kitted out with aerials, radios and at least one computer to decode the radio transmissions from the balloon and show the balloon on a map. I have a PC (home-built using a mini-ITX motherboard and a touch-screen monitor) to do this, but many of the functions could be done more simply, and more reliably, and for a *lot* less power consumption, on a Raspberry Pi. So I set out to build a Pi-based computer with these features:<\/p>\n<ul>\n<li>Run from car 12V battery<\/li>\n<li>Upload position of chase car to the map at spacenear.us<\/li>\n<li>Stream video from the car to batc.tv<\/li>\n<li>Show basic balloon telemetry<\/li>\n<li>Show a compass pointing to the balloon, with distance from car to balloon<\/li>\n<\/ul>\n<p><a href=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/carpi.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-large wp-image-1407\" alt=\"carpi\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/carpi-1024x682.jpg\" width=\"640\" height=\"426\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/carpi-1024x682.jpg 1024w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/carpi-300x200.jpg 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>To do this I needed:<\/p>\n<ul>\n<li>Model A Raspberry Pi<\/li>\n<li>UBlox GPS receiver<\/li>\n<li>Miniature monitor<\/li>\n<li>Pi Camera<\/li>\n<li>Pi Case<\/li>\n<li>12V Micro USB adapter<\/li>\n<li>2 small switches<\/li>\n<li>Wifi Adapter<\/li>\n<\/ul>\n<p>My car has a MiFi device and the Pi connects to that by WiFi.<\/p>\n<p><strong>Monitor<\/strong><\/p>\n<p>There are many tiny monitors available that are sold on ebay and elsewhere as &#8220;rear view screens&#8221; for cars. \u00a0They run on 12V at low power, and have a composite video input which the Pi can drive directly. \u00a0They usally have 2 such inputs so you could also use them with a rear-view camera for example. \u00a0I bought a 4.3&#8243; folding model which is slightly better resolution than the smaller ones:<\/p>\n<p><a href=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/LCD.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1399\" alt=\"LCD\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/LCD.jpg\" width=\"500\" height=\"500\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/LCD.jpg 500w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/LCD-150x150.jpg 150w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/LCD-300x300.jpg 300w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<p>Just supply 12V power (only about 150mA needed), connect the Pi and power that up (for a car just use a <strong>good<\/strong> car Micro USB adapter). \u00a0You may need to adjust the &#8220;overscan&#8221; settings to centre and size the picture correctly.<\/p>\n<p><strong>GPS<\/strong><\/p>\n<p>This is needed so the Pi knows where it is, so it can upload the car position and so it can calculate where the balloon is relative to the car. \u00a0I used a UBlox module but for this application any GPS receiver with a &#8220;TTL Level&#8221; serial output will do. \u00a0Connect to the GND, 3.3V and serial Rx pins on the GPIO connector.<\/p>\n<p><a href=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/gps.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1400\" alt=\"gps\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/gps.jpg\" width=\"785\" height=\"582\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/gps.jpg 785w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/gps-300x222.jpg 300w\" sizes=\"(max-width: 785px) 100vw, 785px\" \/><\/a><\/p>\n<p><strong>Camera<\/strong><\/p>\n<p>The Pi Camera is the obvious choice, as it is cheap, good quality and has very very low CPU overhead.<\/p>\n<p><a href=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/PiCam.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1401\" alt=\"PiCam\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/PiCam.jpg\" width=\"598\" height=\"512\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/PiCam.jpg 598w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/PiCam-300x256.jpg 300w\" sizes=\"(max-width: 598px) 100vw, 598px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Software<\/strong><\/p>\n<p>I split the task into several programs which share a block of memory that contains the GPS and balloon data. \u00a0The programs are:<\/p>\n<ul>\n<li>gps.c &#8211; Reads the GPS data and stores the important data (latitude, longitude etc.)<\/li>\n<li>balloon.c &#8211; Reads the balloon telemetry by connecting to dl-fldigi (running on my car PC &#8211; as yet we don&#8217;t have a Pi-based solution for that)<\/li>\n<li>chase.c &#8211; Uploads the car position to spacenear.us<\/li>\n<li>batc &#8211; bash shell script that uses ffmpeg and raspivid to stream video to batc.tv<\/li>\n<li>lcd.c &#8211; Reads the GPS and balloon data and displays the results on the monitor using the OpenVG C library<\/li>\n<\/ul>\n<p>Both batc and chase.c read switches connected to the GPIO ports to enable\/disable the batc streaming and chase car upload.<\/p>\n<p><strong>batc Streaming<\/strong><\/p>\n<p>Streaming works really well with the Pi camera &#8211; much smoother than when I did this before using a webcam.<\/p>\n<p><a href=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/batc.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1402\" alt=\"batc\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/batc.png\" width=\"334\" height=\"325\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/batc.png 334w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/batc-300x291.png 300w\" sizes=\"(max-width: 334px) 100vw, 334px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>I can stop and start the streaming using a switch. \u00a0This is tested using a small shell script which starts or kills ffmpeg and raspivid accordingly. \u00a0The status of the switch is shown on the LCD.<\/p>\n<p><strong>Chase Car Upload<\/strong><\/p>\n<p>This is pretty easy to do, using the GPS data read elsewhere. \u00a0The result is that the car position is always visible on spacenear.us (assuming an internet connection):<\/p>\n<p><a href=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/bw.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1403\" alt=\"bw\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/bw.png\" width=\"651\" height=\"502\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/bw.png 651w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/bw-300x231.png 300w\" sizes=\"(max-width: 651px) 100vw, 651px\" \/><\/a><\/p>\n<p>I can stop and start the upload using a switch, which is read by the chase.c program. \u00a0The status of the switch is shown on the LCD.<\/p>\n<p><strong>LCD<\/strong><\/p>\n<p>At present the LCD simply shows a &#8220;direction-finding&#8221; screen. \u00a0This is probably the most useful screen when chasing, as it tells you the direction to drive in and how far to go. \u00a0It&#8217;s certainly easier to use something like this when driving than a full map.<\/p>\n<p><a href=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/mon.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-large wp-image-1404\" alt=\"mon\" src=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/mon-1024x600.jpg\" width=\"640\" height=\"375\" srcset=\"http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/mon-1024x600.jpg 1024w, http:\/\/www.daveakerman.com\/wp-content\/uploads\/2013\/10\/mon-300x176.jpg 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a>The compass shows the direction to the balloon, calculated from the positions of the balloon and car, and relative to the direction that the car is headed. \u00a0The small circles show:<\/p>\n<ul>\n<li>H &#8211; Green if HAB data being received<\/li>\n<li>G &#8211; Green if GPS data being received<\/li>\n<li>C &#8211; Green if chase car data being uploaded to spacenear.us<\/li>\n<li>B &#8211; Green if video being streamed to batc.tv<\/li>\n<\/ul>\n<p>I&#8217;ve yet to package this up and install in the chase car, but that&#8217;s next.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Chasing balloons across the country is one of the best, and probably the most exciting, parts of high altitude ballooning, using a car kitted out with aerials, radios and at least one computer to decode the radio transmissions from the balloon and show the balloon on a map. I have [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5,4],"tags":[],"_links":{"self":[{"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=\/wp\/v2\/posts\/1398"}],"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=1398"}],"version-history":[{"count":5,"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=\/wp\/v2\/posts\/1398\/revisions"}],"predecessor-version":[{"id":1410,"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=\/wp\/v2\/posts\/1398\/revisions\/1410"}],"wp:attachment":[{"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1398"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1398"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.daveakerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1398"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}