Skip to content
This repository has been archived by the owner on Dec 3, 2022. It is now read-only.

UI component for the Nomadic Pi a Raspberry Pi based car computer. Allows interaction with MPD and GPSD backend services.

License

Notifications You must be signed in to change notification settings

anthony-mills/raspberrypi-carputer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nomadic Pi Car Computer

This repository is the UI component of the Nomadic PI Raspberry Pi based car computer. Visit the Nomadic Pi website for more information on the project and details on building your own car computer or "carputer".

A pre built image file for use with the Raspberry Pi 3 can also be downloaded here.

Prerequisites

The UI acts as a frontend for the MPD and GPSD. So to have the frontend work properly in a live environment these two daemons must be installed and configured.

But for the purposes of development and testing, a fake GPS data set can be used in place of a live GPS stream to make things easier ( see below under "No GPS" for more details ).

The system uses PHP as a gateway for getting GPS and other data from external services. So at minimum the PHP5-common, PHP5-cli and PHP5-curl packages must be installed on the system.

The car computer also uses the HTML5 Filesystem API for the local storage of album art. This HTML5 API is poorly supported so either Chromium or Chrome needs to be used with the application for otherwise the local image cache will not function correctly.

The UI was designed for use on a car computer built on the Raspberry Pi platform ( has been tested with the 2 & 3 Model B ). Combined with the official 7 inch Raspberry Pi touch screen display (800x480).

It is responsive and will run happily at other resolutions. With the majority of development and testing taking place using Chromium on a standard desktop computer.

Installation

  • Install all of the required dependencies.
  • Edit the application config file at config/config.ini and enter your Here.com API details - Required for speed limit and weather information. In order to translate the cars location from a latititude, longitude pair to a human readble address you will also need to get an API key from locationIQ.
  • Also check the GPSD daemon setting in application config file - Should work with the defaults on most setups
  • From the command line run the start.sh script to start an instance of the internal PHP webserver on port 8000.
  • Open a browser ( Chrome or Chromium recommended ) and visit localhost:8000 to see the application. Keep in mind that it has been designed with the Raspberry Pi Official touch screen in mind i.e 800x468 so if your on a desktop / laptop you may want to use developer tools to switch to a 800x468 viewport. To get get a more realistic idea of what the UI will look like when viewed on the end device.

Running with out a GPS device

GPS functionality can easily be fudged for development or testing purposes. Without an active GPS fix or even a real GPS device.

To enable the GPS testing mode change the value of the gpsd-debug option in the application config file to true.

This will force the service to read a static GPS json object from the www/php/data/gps_data.json file. By changing the location values in this file a specific location, altitude or speed can be spoofed to test functionality.

Trip Data Log

By default the system will store a data point containing information about the cars location data ( speed, location , altitutude ) every 60 seconds during a trip to a JSON object that persists using the HTML5 local storage API. This allows for the calculation of average speeds etc along with being able to map the trip using Google maps.

The data never leaves the local system but at the end of a trip you may want to delete the data associated with a trip due to privacy reasons. To achieve this simply select the "Reset Tripmeter" option on the Tripmeter page to delete the data under the trip_data key. In another use case a button has now also been added to the Trip Meter page that will download the trip_data JSON object as a file to the system for later analysis / testing / debugging.

A set of real world data set are stored in the www/php/data folder by inserting these into a local storage object under the trip_data key for development and debugging purposes.

Changing the application background

If you would like to change the image used as the application background. Simply overwrite the background.jpg file located in the www/img/ folder with a jpeg image of your choice.

Credits

This project makes the use of a number of third party Open Source libraries. You are all fantastic! Thank you for all your hardwork its much appreciated!

Immediate Roadmap

In the near future the following features are planned:

  • Ironing out issues with return trips on the trip meter. At the moment the issues seem sporadic and needs further collection of real "on road" data to debug.

  • The ability to control the screen brightness on the official Raspberry Pi Touchscreen using the display controller board v1.1 and above.

  • The ability to save a play queue to the MPD filesystem as a playlist

  • PHP script that acts as a podcast agregator finding and downloading new episodes as they are released and then making them available to the MPD daemon.

Further Reading

Screenshots

Home screen while travelling at 54kph and playing music

Browsing the music collection stored on the filesystem

Displaying the current location of a car using Google Maps

Interacting with the current music play queue

Journey Trip Log

Licence

Copyright (C) 2017 Anthony Mills

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.