Cov txheej txheem:

Raspberry Pi Motorcycle Dashboard: 9 Kauj Ruam (nrog Duab)
Raspberry Pi Motorcycle Dashboard: 9 Kauj Ruam (nrog Duab)

Video: Raspberry Pi Motorcycle Dashboard: 9 Kauj Ruam (nrog Duab)

Video: Raspberry Pi Motorcycle Dashboard: 9 Kauj Ruam (nrog Duab)
Video: Arab drift In Assetto Corsa VR - stunt sim racer girl 2024, Hlis ntuj nqeg
Anonim
Raspberry Pi Maus taus Dashboard
Raspberry Pi Maus taus Dashboard

Raws li cov tub ntxhais kawm Multimedia & Kev Sib Txuas Lus thev naus laus zis hauv Howest Kortrijk, Kuv yuav tsum ua kuv tus kheej qhov haujlwm IoT. Qhov no yuav suav tag nrho cov qauv ua raws thawj xyoo hauv ib qho haujlwm loj. Vim tias kuv caij kuv lub tsheb ntau heev hauv kuv lub sijhawm so, kuv txiav txim siab siv kuv cov txuj ci uas tau kawm ntawm MCT tu tsim qee yam rau kuv lub maus taus: Lub ntsej muag ntse.

MotoDash yog Raspberry Pi powered dashboard tsim los rau cov neeg caij tsheb kauj vab uas muaj lub peev xwm los taug qab lawv cov kev ua tau zoo.

Dab tsi yog cov yam ntxwv ntawm lub dashboard no?

  • Saib lub kaum sab xis qaij tam sim no
  • Saib kev nrawm tam sim no
  • Muaj peev xwm saib xyuas cov roj kub
  • Yeej hloov mus rau lub ntsiab lus tsaus thaum caij hauv qhov tsaus ntuj
  • Nkag mus rau cov ntaub ntawv ntawm koj caij, thiab saib koj tus kheej cov txheeb cais

Khoom siv

Chav xam xam loj:

Raspberry Pi Qhov no yog tus tswj hwm tseem ceeb ntawm cov kab ke

Electronics:

  • USB charger rau maus taus 12V-5V Lub zog tseem ceeb rau RPi
  • 4 Pin Fused Relay 12VSwitch qhib/tua lub zog hluav taws xob ntawm RPi
  • Breadboard nrog jumper xov hlau (xaiv tau) Rau kev sim thiab ua qauv
  • Ib pawg ntawm resistors

    Cov xim sib txawv ntawm 0.2 hli xaim

  • Breakout Pi ntxiv Qhov no yog pawg thawj coj saib qhov twg koj tuaj yeem muab tag nrho koj cov khoom siv. Nws tau ua kom haum ncaj qha rau sab saum toj ntawm Raspberry Pi, yog li qhov ntev ntawm txoj haujlwm tseem nyob tsawg.

Sensors thiab modules:

  • Waterproof DS18B20 1-Hlau Kub Kub sensorOil kub sensor
  • 3 Axis Gyro Accelerometer MPU6050Tilt/accel sensor
  • Lub teeb nyob ntawm tus tiv thaiv (LDR)
  • MCP3008-8-channel 10-Bit ADC nrog SPI Interface

    TFT SPI zaub (lossis lwm yam lcd zaub uas haum rau koj xav tau)

    RGB LED

Casing:

  • Lub thawv yas
  • Raspberry Pi Cov

Cov Cuab Yeej:

  • Soldering hlau thiab solder
  • 2.5mm screws thiab spacers
  • Waterproof cable txuas
  • Superglue

Kauj ruam 1: Prototyping

Prototyping
Prototyping
Prototyping
Prototyping

Ua ntej peb ua txhua yam ruaj khov, peb yuav muab qhov project tso rau ntawm daim ntawv tais. Cov kauj ruam no tuaj yeem hla yog tias koj paub tseeb tias koj yuav tsis ua yuam kev. Cov phiaj xwm hluav taws xob/daim phiaj tuaj yeem pom hauv PDF hauv qab no. Muab lub vojvoog ua ke raws nraim li tau piav qhia. Nco ntsoov tsuas yog siv tus pin 3.3V thiab tsis yog tus pin 5V ntawm RPi. Tsis tas li ua ntej koj ua lub zog raspberry Pi ob zaug xyuas koj lub Circuit Court. Nco ntsoov tias tsis muaj luv luv!

Kauj Ruam 2: Npaj Raspberry Pi

Npaj Raspberry Pi
Npaj Raspberry Pi

Ua ntej tshaj plaws, peb yuav teeb tsa Raspberry Pi. Raspberry Pi yog lub khoos phis tawj me me muaj peev xwm khiav nws tus kheej kev ua haujlwm. Rau txoj haujlwm no, nws yog lub luag haujlwm rau kev ua sensordata, ua lub vev xaib, khiav cov backend thiab database, …

1. Nruab kev cai Raspbian Duab

Cov duab tau muab twb muaj cov software pob khoom xav tau los pib qhov haujlwm no:

  • Apache rau lub vev xaib tom ntej
  • MariaDB rau lub database
  • PhpMyAdmin los tswj cov ntaub ntawv
  • Kev cai tso cai kom tsis txhob muaj teeb meem

Cov duab kev cai tuaj yeem rub tawm los ntawm no.

Kev qhia rau txhim kho cov duab tuaj yeem pom ntawm no:

Thaum cov duab raug teeb tsa, txuas Raspberry Pi mus rau koj lub pc nrog lub ethernet cable. Tam sim no koj tuaj yeem siv tus neeg siv SSH txuas rau nws ntawm IP chaw nyob 169.254.10.1

Nws yog qhov kev coj ua zoo los teeb tsa tus password tshiab tam sim siv qhov hais kom ua passwd

2. Kho lub wireless AP

Thaum txoj haujlwm tiav, peb xav kom tuaj yeem txuas rau RPi hla wifi, yog li cia tig nws mus rau hauv wireless AP. Ib qho kev qhia rau qhov no tuaj yeem pom ntawm no.

Koj tsuas yog yuav tsum ua raws cov lus qhia no kom txog rau qib 7. Kauj ruam 8 tsis tas yuav tsum tau raws li peb tsis tas yuav txuas tus txuas hauv is taws nem, tab sis tsim kev sib txuas ib leeg.

3. Pab kom muaj kev cuam tshuam

Lub taub hau rau hauv raspi-config

sudo raspi-teeb tsa

Mus rau cov kev xaiv cuam tshuam thiab pab kom 1-xaim, SPI thiab I2C thiab rov pib dua Pi

3. Teeb tsa cov tsav tsheb rau cov zaub

Initializing cov zaub

Kho cov ntaub ntawv /etc /modules

sudo nano /thiab /modules

Ntxiv 2 kab hauv qab no

spi-bcm2835fbtft_device

Tam sim no hloov /etc/modprobe.d/fbtft.conf

sudo nano /etc/modprobe.d/fbtft.conf

Ntxiv cov kab hauv qab no

xaiv fbtft_device lub npe = tm022hdh26 gpios = rov pib dua: 25, dc: 24, coj: 18 tig = 90 nrawm = 80000000 fps = 60

Reboot Pi. Yog tias koj pom lub teeb pom kev ntawm lub teeb pom kev zoo txhua yam tau mus zoo. Qhov no yuav pib ua cov zaub txhua zaus Pi Pi khau raj, txawm li cas los xij nws tsuas yog tso saib lub vijtsam dub tam sim no. Txhawm rau kom tau txais cov ntsiab lus ntawm Pi ntawm cov zaub, peb yuav tsum luam cov ntsiab lus ntawm lub vijtsam tseem ceeb mus rau LCD me me. Peb yuav siv qhov kev pabcuam hu ua 'fbcp' rau qhov no.

Txhim kho kev pabcuam fbcp

sudo apt-tau nruab cmake

git clone

cd rpi-fbcp

mkdir ua

cd tsim/

cmk ua..

ua

sudo nruab fbcp/usr/local/bin/fbcp

Tam sim no peb tau teeb tsa qhov kev pabcuam. Txawm li cas los xij, txij li peb tab tom siv Pi lub taub hau, tsis muaj lub vijtsam muaj los theej cov ntsiab lus los ntawm. Txhawm rau yuam Pi kom tso cov ntsiab lus ntawm lub vijtsam, kho /boot /config.txt

sudo nano /boot /config.txt

Nrhiav thiab tsis pom zoo lossis ntxiv kab hauv qab no rau cov ntawv no:

hdmi_force_hotplug = 1

hdmi_cvt = 640 480 60 0 0 0 0 0

display_rotate = 0

hdmi_cov = 2

hdmi_mode = 87

Rov pib RPi, thiab sim tawm qhov kev pabcuam fbcp los ntawm kev ntaus fbcp hauv lub console. Tam sim no koj yuav tsum pom cov ntsiab lus ntawm lub vijtsam ntawm LCD.

Khiav fbcp thaum pib

Kho kom raug /etc/rc.local thiab ntxiv kab hauv qab no ntawm tus IP chaw nyob thiab kab tawm

fbcp &

Tam sim no cov zaub yuav tsum tig rau txhua lub sijhawm RPi khau raj

Kauj ruam 3: Database

Database
Database

Txhawm rau nkag thiab khaws cov sensordata Kuv tau tsim kuv tus kheej cov database uas muaj 4 lub rooj. Daim duab EER tau qhia hauv daim duab saum toj no.

1. Devices

Cov lus no muaj txhua lub sensor. Nws piav qhia lub npe sensor, piav qhia thiab ntsuas ntsuas. Cov lus no muaj ib-rau-ntau txoj kev sib raug zoo nrog cov lus ua, zoo li hauv kuv qhov xwm txheej, lub ntsuas qhov ntsuas tuaj yeem ua haujlwm sib txawv.

2. Kev ua

Cov lus no khaws cov kev ua rau sib txawv sensor. Ib qho kev ua yog ib txwm txuas rau ib qho tshwj xeeb sensor. Piv txwv li: qhov kev nqis tes ua 'TEMP' txuas nrog lub cuab yeej ntsuas ntsuas kub. Qhov no yuav yog 1-xaim ntsuas kub.

3. Keeb kwm

Cov lus no suav nrog txhua lub cav ntsuas. Txhua lub cav muaj tus lej ua, tus nqi, lub sijhawm thiab caij tsheb

4. Caij tsheb

Lub rooj no khaws cov tsheb sib txawv. Txhua lub sijhawm tus neeg siv pib caij tsheb tshiab, kev nkag tshiab hauv lub rooj no tau ua

Txhawm rau kom tau txais cov ntaub ntawv no ntawm koj tus Raspberry Pi, mus rau kuv li GitHub thiab clone/rub tawm lub chaw cia khoom. Hauv qab cov ntaub ntawv koj yuav pom 2.sql cov ntaub ntawv. Khiav cov no hauv PhpMyAdmin lossis MySQL workbench. Tam sim no cov ntaub ntawv yuav tsum yog ntawm koj RPi.

Kauj ruam 4: Backend

Yog tias koj tseem tsis tau muaj, hla mus rau kuv GitHub thiab clone/rub tawm lub chaw cia khoom. Hauv qab daim nplaub tshev Backend koj yuav pom tag nrho cov backend rau txoj haujlwm.

Lub nplaub tshev muaj cov chav rau nyeem ntawv ntsuas hauv qab /pab, cov ntaub ntawv sib tham nrog cov ntaub ntawv hauv qab /chaw cia khoom, thiab daim ntawv thov tseem ceeb nyob hauv lub hauv paus hauv qab lub npe app.py.

Txhim kho Python tej pob khoom

Ua ntej peb sim ua dab tsi, peb yuav tsum teeb tsa qee pob khoom rau nab nab ua ntej. Lub taub hau rau hauv lub davhlau ya nyob twg ntawm koj RPi thiab ntaus cov lus txib hauv qab no:

pip3 nruab mysql-connector-python

pip3 nruab flask-socketio

pip3 nruab flask-cors

pip3 nruab gevent

pip3 nruab gevent-websocket

CEEB TOOM CEEB TOOM: yog tias koj tau hloov koj tus lej Mariadb/Mysql, hloov tus password hauv config.py!

Kuaj cov backend

Khiav app.py siv tus neeg txhais lus nab nab (/usr/bin/python3). Xyuas kom tsis muaj qhov yuam kev.

Khiav lub backend ntawm khau raj

Kho kom raug motoDash_backend.service thiab hloov YOURFILEPATH rau txoj hauv kev uas lub chaw khaws khoom tau txais kev cawmdim.

Tam sim no luam cov ntawv no rau/etc/systemd/system/

sudo cp motoDash_backend.service /etc/systemd/system/motoDash_backend.service.

Tam sim no tus backend yuav pib ua haujlwm txhua lub sijhawm RPi khau raj.

Kauj Ruam 5: Ua ntej

Frontend
Frontend
Frontend
Frontend

Lub taub hau rau hauv GitHub Repo. Luam cov ntsiab lus ntawm Frontend cov npe rau hauv/var/www/html.

Nov yog txhua yam koj yuav tsum ua txhawm rau ua kom lub ntsej muag ua haujlwm. Cov ntawv tais ceev tseg no muaj txhua lub vev xaib, qauv thiab cov ntawv sau rau lub vev xaib interface. Nws kuj tseem sib txuas lus nrog tus backend. Txhawm rau sim yog txhua yam ua haujlwm zoo li nws yuav tsum tau, xyuas kom koj tau txuas nrog koj RPi, thiab ntaus tus IP chaw nyob ntawm RPi hauv qhov browser. Koj yuav tsum pom lub vev xaib ntawm lub vev xaib interface.

Nco tseg: Lub vev xaib tau teb, yog li koj tuaj yeem siv nws ntawm lub xov tooj txawb zoo li ntawm lub desktop

Kauj Ruam 6: Tso Tawm Lub Dashboard ntawm Cov Zaub

Qhia tawm Dashboard ntawm Zaub
Qhia tawm Dashboard ntawm Zaub

Lub ntsej muag muaj nws tus kheej lub vev xaib zais tsuas yog siv rau cov khoom me me. Peb yuav ua Pi khau raj cia rau hauv lub vev xaib no hauv hom puv npo.

Nco ntsoov tias RPi tau teeb tsa rau desktop autologin hauv raspi-teeb tsa hauv qab kev xaiv khau raj

sudo raspi-teeb tsa

Tam sim no mus rau hauv cov ntawv zais zais zais thiab tsim cov ntawv tshiab nyob ntawd

cd.config

sudo mkdir -p lxsession/LXDE -pi

sudo nano lxsession/LXDE-pi/autostart

Ntxiv cov kab hauv qab no hauv cov ntawv no thiab txuag

@xscreensaver -no -txaws

@xset tawm

@xset -dpms

@xset s noblank

@chromium-browser -noerrors --disable-session-crashed-bubble-Disable-infobars --kiosk --incognito

Tam sim no Pi yuav tsum khau raj rau ntawm nplooj ntawv web no txhua lub sijhawm

Kauj Ruam 7: Soldering Electronics

Soldering Electronics
Soldering Electronics
Soldering Electronics
Soldering Electronics
Soldering Electronics
Soldering Electronics
Soldering Electronics
Soldering Electronics

Siv lub rooj tsav xwm tawg thiab nteg koj cov khoom ntawm nws hauv txoj hauv kev. Kuv yuav tsis tham txog kev teeb tsa ntawm yuav ua li cas kuv muab cov khoom sib txuas rau nws, vim kuv tau ua haujlwm tsis zoo nkauj rau nws. Kuv siv tus lej tus lej sib cais ntawm lub rooj tsavxwm kom kuv tsuas yog xav tau txuas lub cim thiab cov qauv rau sab xis. Nco ntsoov koj paub tus pin yog rau dab tsi!

Qee cov lus qhia thaum soldering:

  • Siv cov xov hlau thaiv thaum hla kev nyob deb dua. Qhov kawg uas koj xav tau yog luv hauv koj lub voj voog
  • Tom qab siv cov khoom siv lossis cov xaim hluav taws xob, xyuas nws qhov txuas nrog lub multimeter. Kuj xyuas tsis tu ncua rau luv Circuit Court.
  • Tsis txhob siv ntau dhau los lossis tsawg dua cov laug!
  • Yog tias koj tsis paub yuav ua li cas los xij, xyaum ua ntej ntawm lwm pawg thawj coj saib ua ntej. Ib qho kev qhia ntawm kev siv tshuaj yaj yeeb tuaj yeem pom ntawm no.

Tam sim no cov xov hlau txuas ntev txaus rau lub ntsuas cua, thiab tso qee qhov qhwv ncig lawv kom ntseeg tau tias txhua yam tsis luv thiab huv.

Thaum koj ua tiav, rov ntsuas ob zaug rau ib qho luv lossis kev sib txuas tsis zoo, thiab tshawb xyuas txhua qhov kev sib txuas nrog cov phiaj xwm hluav taws xob yog tias nws yog qhov txuas zoo. Thaum koj paub tseeb txhua yam ua tiav kom raug, mus tom ntej thiab muab lub rooj sib tsoo tawm ntawm RPi, kawg ntswj nws nruj nrog qee qhov 2.5mm ntsia hlau thiab sawv ntsug. Koj nce lub ntsuas phoo rau sab xis thiab ntsuas lawv txhua tus siv lub vev xaib.

Kauj Ruam 8: Cov Khoom Siv Hluav Taws Xob

Txhawm rau lub zog Raspberry Pi peb yuav siv 12V-5V usb adapter. Lub adapter no yuav txuas nrog lub roj teeb maus taus. Txhawm rau kom ntseeg tau tias RPi muaj zog thaum lub qhov hluav taws xob tau qhib, peb yuav siv qhov txuas mus. Kev xa tawm yuav kaw RPi lub zog hluav taws xob thaum nws kuaj pom qhov hluav taws xob los ntawm lub teeb tom qab (lub teeb ci ib txwm qhib thaum qhib qhov hluav taws xob).

Rau kev qhia ntxaws ntxaws txog qhov no, txheeb xyuas nplooj ntawv no: https://www.hondagrom.net/threads/2017-gromsf-msx125sf-wire-up-auxiliary-power-for-pcv-wb2-and-other-fuel -controllers.16921/

Kauj Ruam 9: Vaj Tsev

Vaj tse
Vaj tse
Vaj tse
Vaj tse
Vaj tse
Vaj tse

Zaub Vaj

Rau cov zaub, lob koj tus kheej lub thawv yas nyuaj los ntawm ib puag ncig ntawm cov zaub. Txiav ib lub xwmfab hauv nws loj li cov zaub, thiab sib dhos qhov rau ntsia hlau tso rau hauv. Ntawm sab xub ntiag koj xav tau laum 2 qhov ntxiv rau RGB LED thiab LDR.

Kuv tau teeb tsa lub npov no nyob saum tus tuav lub xov tooj smartphone uas siv tus ntsia liaj qhov rooj.

Kub Sensor

Txog vaj tsev qhov ntsuas kub, Kuv 3D Luam tawm cov ntsuas roj uas haum rau kuv lub maus taus.

Raspberry Pi

Mount raspberry Pi nws tus kheej ntawm qhov chaw nyab xeeb sab hauv lub maus taus, Kuv tso nws nyob hauv ib qho ntawm cov fenders siv qee cov hlua khi. Thiab tiv thaiv nws los ntawm cov khoom siv lub tsev thiab qee cov yas.

Accelerometer

Mount lub ntsuas qhov ntsuas ntawm qhov chaw nyab xeeb, dua li ntawm lub maus taus thav duab nws tus kheej.

Nco tseg:

Koj tsis tas yuav muaj lub tsev nyob zoo ib yam li kuv tau ua, koj muaj kev ywj pheej ua kom tiav txawm li cas los xij koj nyiam. Tsuas yog xyuas kom cov khoom siv hluav taws xob tiv thaiv los nag thiab hmoov av.

Pom zoo: