<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Self-Hosted on falkp.no/blog</title>
    <link>/blog/tags/self-hosted/</link>
    <description>falkp.no/blog (Self-Hosted)</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    
      

      
    

    
    <lastBuildDate>Fri, 25 May 2018 00:00:00 +0000</lastBuildDate>
    
    <atom:link href="/blog/tags/self-hosted/index.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>Car-logger - part 3</title>
      <link>/blog/posts/car_logger_part_3/</link>
      <pubDate>Fri, 25 May 2018 00:00:00 +0000</pubDate>
      
      <guid>/blog/posts/car_logger_part_3/</guid>
      <description>&lt;h2 id=&#34;overview&#34; &gt;
&lt;div&gt;
    &lt;a href=&#34;#overview&#34;&gt;
        #
    &lt;/a&gt;
    Overview
&lt;/div&gt;
&lt;/h2&gt;
&lt;p&gt;A self-hosted, real-time, inexpensive open source car tracker built with &lt;a href=&#34;https://www.raspberrypi.org/&#34;&gt;Raspberry Pi&lt;/a&gt; Zero W, &lt;a href=&#34;https://nextcloud.com/&#34;&gt;Nextcloud&lt;/a&gt;, and optionally &lt;a href=&#34;https://www.home-assistant.io/&#34;&gt;Home Assistant&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;plan.jpg&#34; alt=&#34;Plan&#34;&gt;&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve had a few earlier tries at car position logging, read those first if you&amp;rsquo;re interested: &lt;a href=&#34;https://0p.no/2014/09/29/car_logger2.html&#34;&gt;Car logger 2&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;background&#34; &gt;
&lt;div&gt;
    &lt;a href=&#34;#background&#34;&gt;
        #
    &lt;/a&gt;
    Background
&lt;/div&gt;
&lt;/h2&gt;
&lt;p&gt;Goal: logging and sharing location of my non-connected car, for practicality and fun.&lt;/p&gt;
&lt;p&gt;Earlier tries was using a phone, but that had problems. No Android phone will switch back on if it runs out of power without manual intervention.&lt;/p&gt;
&lt;h2 id=&#34;prerequisites&#34; &gt;
&lt;div&gt;
    &lt;a href=&#34;#prerequisites&#34;&gt;
        #
    &lt;/a&gt;
    Prerequisites
&lt;/div&gt;
&lt;/h2&gt;
&lt;p&gt;I needed power from the car, but want it to cut off when the ignition is off. My 12 V outlets didn&amp;rsquo;t. So I used a &lt;a href=&#34;http://www.biltema.no/no/Bil---MC/Bil-tilbehor/Bilelektrisk/Sikring/Flatsikringsholder-med-uttak-2-stk-2000035590/&#34;&gt;fuse holder with outlet&lt;/a&gt; to accomplish this. To that I attached a 12 to 5 V converter.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;fuses.jpg&#34; alt=&#34;Fuse box in car&#34;&gt;&lt;/p&gt;
&lt;p&gt;Also I chose to go without any battery or UPS, so the Pi has to deal with unclean shutdown every time. For this I run the SD card read-only using &lt;a href=&#34;https://github.com/ways/rpi-readonly&#34;&gt;rpi-readonly&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;hardware&#34; &gt;
&lt;div&gt;
    &lt;a href=&#34;#hardware&#34;&gt;
        #
    &lt;/a&gt;
    Hardware
&lt;/div&gt;
&lt;/h2&gt;
&lt;p&gt;I had little experience with Arduino at the time of start, but lots with Pi, so I used a Pi Zero. Mainly for it&amp;rsquo;s low power consumption.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;prototype01.jpg&#34; alt=&#34;Pi, usb hub, gsm modem in an old harddisk cabinet&#34;&gt;&lt;/p&gt;
&lt;p&gt;I first tried &lt;a href=&#34;https://www.amazon.com/Diymall-G-mouse-Glonass-Raspberry-Aviation/dp/B00NWEEWW8/ref=sr_1_2?ie=UTF8&amp;amp;qid=1527193287&amp;amp;sr=8-2&amp;amp;keywords=gps+dongle&amp;amp;dpID=319Yen02YIL&amp;amp;preST=_SY300_QL70_&amp;amp;dpSrc=srch&#34;&gt;Diymall-G-mouse-Glonass&lt;/a&gt; GPS dongle, but reception was very bad, so switched to &lt;a href=&#34;https://www.ebay.com/itm/BN-808-USB-GPS-Antenna-Receiver-Glonass-Dual-Module-Gmouse-For-Car-Laptop-PC-NEW/263511681859?hash=item3d5a852b43:g:vdkAAOSwbF1aRfrF&#34;&gt;BN-808-USB-GPS&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For uplink I used a cheap 3G USB modem &lt;a href=&#34;http://www.dx.com/p/Tolkien-Portable-Mini-USB-3G-WiFi-Router-Mobile-Device-Hotspot-Unlocked-Wireless-Modem-Network-Doggle-with-SIMTF-Card-Slot--usb-router-only-916496537&#34;&gt;Tolkien-Portable&lt;/a&gt; and a data-twin SIM card.&lt;/p&gt;
&lt;h2 id=&#34;backend&#34; &gt;
&lt;div&gt;
    &lt;a href=&#34;#backend&#34;&gt;
        #
    &lt;/a&gt;
    Backend
&lt;/div&gt;
&lt;/h2&gt;
&lt;p&gt;I started writing a backend in 2014, &lt;a href=&#34;https://github.com/ways/BigBrotherGPSweb&#34;&gt;BigBrotherGPSweb&lt;/a&gt;, but didn&amp;rsquo;t get very far. Fortunately someone has filled my need. &lt;a href=&#34;https://nextcloud.com/&#34;&gt;Nextcloud&lt;/a&gt;, a self-hosted dropbox alternative, has a plugin called &lt;a href=&#34;https://apps.nextcloud.com/apps/phonetrack&#34;&gt;PhoneTrack&lt;/a&gt;. It has nice features like public sharing, users, filters, etc. and use Openstreetmap. SSL for transport encryption.&lt;/p&gt;
&lt;p&gt;For home automation I use Home Assistant, so I also wanted the data there as well.&lt;/p&gt;
&lt;p&gt;Map in Nextcloud/PhoneTrack:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;map.jpg&#34; alt=&#34;Map&#34;&gt;&lt;/p&gt;
&lt;p&gt;Status in Home Assistant:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;hass.png&#34; alt=&#34;Home assistant&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;software&#34; &gt;
&lt;div&gt;
    &lt;a href=&#34;#software&#34;&gt;
        #
    &lt;/a&gt;
    Software
&lt;/div&gt;
&lt;/h2&gt;
&lt;p&gt;I found no premade solution to use &lt;a href=&#34;https://en.wikipedia.org/wiki/Wi-Fi_positioning_system&#34;&gt;wifi triangulation&lt;/a&gt; in python, so I wrote &lt;a href=&#34;https://github.com/ways/wifindme&#34;&gt;wifindme&lt;/a&gt; (available from pip, python 2 and 3). It can use Mozilla, radiocells.org or, with small changes, Google. Use what has best coverage where you need it.&lt;/p&gt;
&lt;p&gt;For the actual reporting I wrote &lt;a href=&#34;https://github.com/ways/locationreporter&#34;&gt;LocationReporter&lt;/a&gt;. It can use wifi triangulation, GPS or both. It will use wifi while the GPS is warming up, and when GPS fails. The results can be sent to both my backends.&lt;/p&gt;
&lt;h2 id=&#34;build&#34; &gt;
&lt;div&gt;
    &lt;a href=&#34;#build&#34;&gt;
        #
    &lt;/a&gt;
    Build
&lt;/div&gt;
&lt;/h2&gt;
&lt;p&gt;I&amp;rsquo;ve not yet created any kind of case. The tracker lives in a card board box in my car door.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;door.jpg&#34; alt=&#34;Car door&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;internals.jpg&#34; alt=&#34;Internals&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;problems&#34; &gt;
&lt;div&gt;
    &lt;a href=&#34;#problems&#34;&gt;
        #
    &lt;/a&gt;
    Problems
&lt;/div&gt;
&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;PhoneTrack could be easier to use on a phone.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;improvements&#34; &gt;
&lt;div&gt;
    &lt;a href=&#34;#improvements&#34;&gt;
        #
    &lt;/a&gt;
    Improvements
&lt;/div&gt;
&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;The setup should be moved to the trunk, out of sight.&lt;/li&gt;
&lt;li&gt;I really should get a case and mount the parts properly.&lt;/li&gt;
&lt;li&gt;The Pi Zero has bluetooth, so I could fetch data from OBD and upload it. Unfortunately my cars OBD doesn&amp;rsquo;t supply very interesting info (no battery voltage, fuel consumption, fuel status).&lt;/li&gt;
&lt;li&gt;Should be enough to send data to either Nextcloud or Home Assistant, not both.&lt;/li&gt;
&lt;li&gt;A switch for private mode or you-don&amp;rsquo;t-have-to-post-every-ten-seconds mode could be nice.&lt;/li&gt;
&lt;li&gt;Radiocells.org let&amp;rsquo;s you download the data set for local use. Local wifi lookup is very fast, so this would make wifi triangulation faster, and less data used and leaked.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;conclusions&#34; &gt;
&lt;div&gt;
    &lt;a href=&#34;#conclusions&#34;&gt;
        #
    &lt;/a&gt;
    Conclusions
&lt;/div&gt;
&lt;/h2&gt;
&lt;p&gt;I&amp;rsquo;m happy with the results. It&amp;rsquo;s been running for months now without problems. And it&amp;rsquo;s good sharing our position real-time on long drives.&lt;/p&gt;
</description>
    </item>
    
  </channel>
</rss>
