Cov txheej txheem:

TripComputer - GPS Trip Computer & Huab Cua Module rau Koj Lub Tsheb: 11 Kauj Ruam (nrog Duab)
TripComputer - GPS Trip Computer & Huab Cua Module rau Koj Lub Tsheb: 11 Kauj Ruam (nrog Duab)

Video: TripComputer - GPS Trip Computer & Huab Cua Module rau Koj Lub Tsheb: 11 Kauj Ruam (nrog Duab)

Video: TripComputer - GPS Trip Computer & Huab Cua Module rau Koj Lub Tsheb: 11 Kauj Ruam (nrog Duab)
Video: Speed Tracker:GPS Speedometer 2024, Kaum ib hlis
Anonim
TripComputer - GPS Trip Computer & Huab Cua Module rau Koj Lub Tsheb
TripComputer - GPS Trip Computer & Huab Cua Module rau Koj Lub Tsheb
TripComputer - GPS Trip Computer & Huab Cua Module rau Koj Lub Tsheb
TripComputer - GPS Trip Computer & Huab Cua Module rau Koj Lub Tsheb
TripComputer - GPS Trip Computer & Huab Cua Module rau Koj Lub Tsheb
TripComputer - GPS Trip Computer & Huab Cua Module rau Koj Lub Tsheb

Qhov txias raspberry pi qhov haujlwm uas siv GPS qhov kev tawm tsam thiab 2 Digole me me qhia kom muaj lub khoos phis tawj siv ntawm koj lub dash.

Kauj Ruam 1: Flashing RaspberriPi Hard Disk / Install Required Software (Siv Ubuntu Linux)

Download "RASPBIAN JESSIE LITE VERSION"

Tsim koj lub hard disk tshiab rau DashboardPI

Ntxig lub microSD rau koj lub khoos phis tawj ntawm USB adapter thiab tsim cov duab disk siv cov lus txib dd

Nrhiav koj daim npav microSD tso ntawm df -h hais kom ua, unmount nws thiab tsim cov duab disk nrog daim disk theej daim ntawv dd

$ df -h/dev/sdb1 7.4G 32K 7.4G 1%/media/XXX/1234-5678

$ umount /dev /sdb1

Ceev faj: nco ntsoov tias cov lus txib yog qhov tseeb, koj tuaj yeem ua rau lwm lub disks puas tsuaj nrog cov lus txib no

yog = qhov chaw RASPBIAN JESSIE FULL VERSION duab cov ntaub ntawv ntawm = qhov chaw ntawm koj daim npav microSD

$ sudo dd bs = 4M yog =/path/to/raspbian-jessie-lite.img ntawm =/dev/sdb (ceeb toom: qhov no, nws yog/dev/sdb,/dev/sdb1 yog lub koomhaum uas twb muaj lawm muab faib rau ntawm microSD)

Teeb koj li RaspberriPi

Ntxig koj daim npav microSD tshiab rau raspberrypi thiab siv nws nrog lub ntsuas saib txuas nrog rau HDMI chaw nres nkoj

ID nkag mus

neeg siv: pi pass: raspberry

Hloov koj tus lej password rau kev nyab xeeb (los ntawm lub davhlau ya nyob twg)

sudo passwd pib

Pab kom RaspberriPi Advanced Options (los ntawm davhlau ya nyob twg)

sudo raspi-teeb tsa

Xaiv: 1 Nthuav Cov Ntaub Ntawv System

9 Advanced Options

A2 Hostname hloov nws mus rau "TripComputer"

A4 SSH Pab kom SSH Server

A7 I2C Pab kom i2c interface

Pab kom Askiv/Asmeskas Keyboard

sudo nano/etc/default/keyboard

Hloov cov kab hauv qab no: XKBLAYOUT = "peb"

Rov pib dua PI rau Keyboard hloov pauv / cov txheej txheem txheej txheem hloov pauv kom muaj txiaj ntsig

$ sudo kaw -r tam sim no

Auto-Txuas rau koj li WiFi

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Ntxiv cov kab hauv qab no kom muaj koj cov raspberrypi txuas nrog koj lub WiFi hauv tsev (yog tias koj lub wireless network npe "linksys" piv txwv, piv txwv li hauv qab no)

network = {ssid = "linksys" psk = "WIRELESS PASSWORD HERE"} Rov pib PI txuas rau WiFi network

$ sudo kaw -r tam sim no

Tam sim no tias koj tus PI yog qhov kawg ntawm lub network hauv zej zog, koj tuaj yeem nkag mus rau nws deb ntawm SSH. Tab sis ua ntej koj yuav tsum tau txais tus IP chaw nws tam sim no muaj.

$ ifconfig Saib rau "inet addr: 192.168. XXX. XXX" hauv cov lus txib hauv qab no tso tawm rau koj tus PI IP Chaw Nyob

Mus rau lwm lub tshuab thiab nkag mus rau koj li raspberrypi ntawm ssh

$ ssh [email protected]. XXX. XXX

Pib Txhim Kho cov pob khoom xav tau

$ sudo apt-tau hloov tshiab && sudo apt-tau hloov tshiab

$ sudo apt-get install build-essential git gpsd gpsd-clients i2c-tools libi2c-dev python3 python3-pip python-dev python-gps python-imaging python-pip python-smbus rpi.gpio vim python-psutil

$ sudo pip nruab RPi. GPIO

Hloov kho thaj chaw sijhawm hauv cheeb tsam

$ sudo dpkg-reconfigure tzdata

xaiv koj lub sijhawm siv lub interface

Teeb cov npe yooj yim l hais kom ua [xaiv tau]

vi ~/.bashrc

ntxiv cov kab hauv qab no:

alias l = 'ls -lh'

qhov chaw ~/.bashrc

Txhim kho VIM default syntax highlighting [yeem]

sudo vi/etc/vim/vimrc

tsis pom zoo cov kab hauv qab no:

syntax yog

Kauj Ruam 2: Xav Tau

Muab Xav Tau
Muab Xav Tau
Muab Xav Tau
Muab Xav Tau
Muab Xav Tau
Muab Xav Tau

2 320x240 TFT LCD Digole Display (x2)

DHT11 Humidistat

RaspberriPi Xoom

Adafruit GPS Breakout

52mm 2in Gauges - siv rau iav / thiab tshuaj ntsuam ib puag ncig

2 Ntsuas ntsuas lub thawv

Kauj Ruam 3: Luam daim ntawv kaw

Hauv "3DPrint/" nplaub tshev ntawm txoj haujlwm no, luam tawm cov ntawv ntsuas qhov kawg.stl uas yuav tsim cov Digole zaub ib puag ncig xav tau los teeb tsa 2 cov ntxaij vab tshaus hauv lub thawv ntsuas lub thawv.

Kauj Ruam 4: Tsim Lub Computer Trip

Tsim lub Computer Trip
Tsim lub Computer Trip

Txuas cov cuab yeej hauv qab no cov pins ntawm Pi Zero

Digole (txhua tus): 3v / GND / SDA / SCL

DHT11: 5v / GPIO 16 (36) / GND

Txuas lub GPS USB Module rau RaspberriPi ntawm HW UART kev sib txuas Siv HW UART rau GPS module xav tau cov hauv qab no kom tso UART kev sib txuas dawb ntawm koj tus Pi.

"Hla" -Connect TX thiab RX pins los ntawm GPS module mus rau RPi TX (GPIO 14/8 tus pin) thiab RX (GPIO 15/10 tus pin)-[TX mus rau RX ntawm lub cuab yeej thiab hloov pauv.] Txuas RPi 5V rau VIN tus pin thiab GPS module GND tus pin rau qhov muaj RPi GND tus pin.

Kauj Ruam 5: Rooj Sib Tham Kawg

Los Ua Ke Kawg
Los Ua Ke Kawg
Los Ua Ke Kawg
Los Ua Ke Kawg

Txiav ib daim ntoo rau hauv qab kom tuav cov khoom sib dhos sab hauv qhov ntsuas qhov ntsuas.

Nqa 2 52mm 2in Gauges thiab txiav lub hau tawm, peb tsuas yog siv lub iav thiab puag ncig los teeb tsa peb tus kheej cov lus, Digole qhia. Muab lawv tso rau hauv qhov chaw nrog cov kua nplaum kub.

Kauj Ruam 6: Rooj Sib Tham zaum kawg (txuas ntxiv…)

Rooj Sib Tham Kawg (txuas…)
Rooj Sib Tham Kawg (txuas…)
Rooj Sib Tham Kawg (txuas…)
Rooj Sib Tham Kawg (txuas…)

Siv cov txheej txheem saum toj no xaim ua ke nrog cov khoom siv sib txuas ua kom txhua yam muaj zog thiab ruaj khov.

Mount cov khoom siv sab hauv ob sab ntsuas lub ntsuas, siv 3D luam tawm ib puag ncig kom muaj lub xwmfab zoo li Digole qhia kom haum rau lub qhov rooj ntsuas qhov ntsuas.

Kauj Ruam 7: Kev teeb tsa software / teeb tsa

Kho koj tus Pi kom siv GPS Module ntawm UART

sudo vi /boot /cmdline.txt

hloov:

dwc_otg.lpm_enable = 0 console = ttyAMA0, 115200 kgdboc = ttyAMA0, 115200 console = tty1 root =/dev/mmcblk0p2 rootfstype = ext4 elevator = hnub tim rootwait

rau:

dwc_otg.lpm_enable = 0 console = tty1 paus =/dev/mmcblk0p2 rootfstype = ext4 of elevator = hnub tim rootwait

(piv txwv li, tshem tawm console = ttyAMA0, 115200 thiab yog tias muaj, kgdboc = ttyAMA0, 115200)

Nco tseg koj yuav pom console = serial0, 115200 lossis console = ttyS0, 115200 thiab yuav tsum tshem cov seem ntawm kab yog tias muaj tam sim no.

Khiav cov lus txib hauv qab no:

sudo systemctl nres [email protected]

sudo systemctl lov tes taw [email protected]

GPS Module Install Rau kev sim yuam koj lub cuab yeej USB txuas rau gpsd

sudo gpsd/dev/ttyS0 -F /var/run/gpsd.sock

sudo systemctl nres gpsd.socket

sudo killall gpsd

sudo dpkg-reconfigure gpsd

sudo vi/etc/default/gpsd

# Kev teeb tsa tsis raug rau gpsd. START_DAEMON = "tseeb" GPSD_OPTIONS = "-n" DEVICES = "/dev/ttyS0" USBAUTO = "tsis tseeb" GPSD_SOCKET = "/var/run/gpsd.sock"

Xyuas kom cov lus txib ua haujlwm

cgps ua

DHT11 Nruab cd ~

git clone

cd Adafruit_Python_DHT/

sudo python setup.py nruab

sudo nab hab sej ez_setup.py

cd piv txwv/

koj simpletest.py

Hloov cov kab hauv qab no:

sensor = Adafruit_DHT. DHT11

Tawm tswv yim kab tawm

pin = 'P8_11'

Tsis suav nrog kab thiab hloov tus lej tus lej rau 16

pin = 16

Khiav qhov kev xeem

nab hab sej simpletest.py

Koj yuav tsum pom qhov ntsuas ntsuas ntawm Temp thiab Vaum pom ntawm kab hais kom ua.

Teeb thiab Khiav cov ntawv sau cd ~

git clone

Kauj Ruam 8: Txhim Kho Cov Cuab Yeej Saib Xyuas Tsav Tsheb & DB Logging

sudo apt-tau nruab ifstat memcached sej-memcache postgresql postgresql-pab txhawb sej-psycopg2

sudo vi /etc/postgresql/9.4/main/pg_hba.conf

Ntxiv cov kab hauv qab no mus rau qhov kawg ntawm cov ntawv:

local txhua tus pi password

sudo -i -u postgres

psql ua

tsim lub luag haujlwm pi lo lus zais 'tus lej zais ntawm no';

hloov lub luag haujlwm pi tus ID nkag mus;

hloov lub luag haujlwm pi superuser;

du ib

(koj yuav tsum pom koj tus neeg siv PI nrog rau kev tso cai tso cai)

tsim database driving_statistics;

q ua

tawm

psql -d tsav_statistics

Khiav cov lus nug hauv qab no:

Tsim TABLE tsav tsheb_stats (tus lej xov tooj, lub sijhawm timestamp yam tsis muaj lub sijhawm TSIS YOG NULL, tshiab_trip_start lub sijhawm tsis muaj lub sijhawm NULL, gps_latitude ob qhov tseeb, gps_longitude qhov tseeb, gps_altitude tiag, gps_climb tiag, gps_track tiag, locale_address, cov ntawv hauv cheeb tsam, cov ntawv hauv cheeb tsam, cov ntawv hauv cheeb tsam, cov ntawv hauv cheeb tsam, hauv qab_temp tiag, hauv_hmidty tiag tiag, huab cua_ sijhawm timestamp, huab cua_sum ntawv, weather_icon ntawv, weather_apparentTemperature tiag, weather_precipIntensity tiag, weather_precipProbability tiag, weather_w;

CREATE UNIQUE INDEX time_idx ON driving_stats (sijhawm);

Hack yuav tsum tau txais GPSD ua haujlwm nrog UART kev txuas ntawm reboot sudo su

crontab -e

@reboot /bin /pw tsaug zog 5; lus gpsd

@reboot /bin /pw tsaug zog 10; /usr/sbin/gpsd/dev/ttyS0 -F /var/run/gpsd.sock

Tsim cov ntawv tais ceev tseg rau cov ntaub ntawv kom tau txais kev cawmdim mkdir/home/pi/TripComputer/computer/cav

Kauj Ruam 9: Pib Crontab Scripts - Pi & Root

Teeb cov ntawv sau kom khiav ntawm khau raj

crontab -e

Ntxiv cov kab hauv qab no

@reboot /bin /pw tsaug zog 15; nohup nab hab sej /home/pi/TripComputer/computer/mtk3339.py> /home/pi/TripComputer/computer/mtk3339.log 2> & 1

@reboot /bin /pw tsaug zog 18; nohup nab hab sej /home/pi/TripComputer/computer/driving.py> /home/pi/TripComputer/computer/driving.log 2> & 1

@reboot /bin /pw tsaug zog 19; nohup nab hab sej /home/pi/TripComputer/computer/address.py> /home/pi/TripComputer/computer/address.log 2> & 1

@reboot /bin /pw 30; nohup nab hab sej /home/pi/TripComputer/computer/gauges.py> /home/pi/TripComputer/computer/gauges.log 2> & 1

@reboot /bin /pw 21; nohup nab hab sej /home/pi/TripComputer/computer/locale.py> /home/pi/TripComputer/computer/locale.log 2> & 1

@reboot /bin /pw 22; nohup nab hab sej /home/pi/TripComputer/computer/notification.py> /home/pi/TripComputer/computer/notification.log 2> & 1

@reboot /bin /pw 24; nohup nab hab sej /home/pi/TripComputer/computer/temperature.py> /home/pi/TripComputer/computer/temperature.log 2> & 1

@reboot /bin /pw 25; nohup nab hab sej /home/pi/TripComputer/computer/upload.py> /home/pi/TripComputer/computer/upload.log 2> & 1

@reboot /bin /pw 26; nohup nab hab sej /home/pi/TripComputer/computer/weather.py> /home/pi/TripComputer/computer/weather.log 2> & 1

@reboot /bin /pw 30; nohup nab hab sej /home/pi/TripComputer/computer/stats.py> /home/pi/TripComputer/computer/stats.log 2> & 1

Teeb lub hauv paus neeg siv crontab kom paub tseeb tias GPS module txuas kom raug

sudo ua

crontab -e

Ntxiv cov kab hauv qab no

@reboot /bin /pw tsaug zog 5; systemctl nres gpsd.socket

@reboot /bin /pw tsaug zog 8; lus gpsd

@reboot /bin /pw tsaug zog 12; /usr/sbin/gpsd/dev/ttyS0 -F /var/run/gpsd.sock

Kauj ruam 10: Kho kom txuas mus rau Huab Cua thiab Dashboard (xaiv tau)

Thaum kawg tsim cov chaw hauv cheeb tsam xav tau los khiav lub computer mus ncig

Nrhiav cov ntawv /computer/includes/settings.shadow.py

Tsim koj tus kheej ntawm cov ntawv teeb tsa npe yooj yim settings.py

forecast.io API qhov tseem ceeb rau xov xwm huab cua hauv zos weatherAPIURL = 'https://api.forecast.io/forecast/'

weatherAPIKey = 'API KEY HERE'

yog tias koj muaj lub cuab yeej hub ua haujlwm (https://github.com/khinds10/DeviceHub) devicesServer = 'https://my.server.com'

yog tias koj muaj lub xov tooj ntawm tes haujlwm ua haujlwm (https://github.com/khinds10/RetroDashboard) dashboardServer = 'https://my.server.com'

Kauj Ruam 11: Mount ntawm Dash / Mount Humidistat thiab Ua tiav

Mount ntawm Dash / Mount Humidistat thiab Ua tiav!
Mount ntawm Dash / Mount Humidistat thiab Ua tiav!
Mount ntawm Dash / Mount Humidistat thiab Ua tiav!
Mount ntawm Dash / Mount Humidistat thiab Ua tiav!

Mount rau Dash

Mount Humidistat deb ntawm lub hnub ncaj qha

Reboot koj RPi thiab koj yuav tsum npaj mus!

Pom zoo: