Cov txheej txheem:

Skate-o-Meter: 7 Kauj Ruam (nrog Duab)
Skate-o-Meter: 7 Kauj Ruam (nrog Duab)

Video: Skate-o-Meter: 7 Kauj Ruam (nrog Duab)

Video: Skate-o-Meter: 7 Kauj Ruam (nrog Duab)
Video: Rheingold Szene mit dem Schlägerei 2024, Kaum ib hlis
Anonim
Skate-o-Meter
Skate-o-Meter

Kuv yog menyuam kawm ntawv ntawm Howest Kortrijk. Txhawm rau qhia peb cov txuj ci rau cov kws qhuab qhia peb xav tau los tsim ib qhov haujlwm, Kuv tau xaiv los tsim lub ntsuas cua thiab ntsuas cua nrawm rau kuv lub skateboard nrog lub tshuab RFID. Hauv cov lus qhia no kuv mus hais tias kuv tau ua qhov haujlwm no li cas.

Kuv tuaj nrog lub tswv yim no vim kuv nyiam skate thiab caij nkoj ncig. Thaum kuv tab tom caij nkoj nws yuav yooj yim pom tias kuv tau mus deb npaum li cas thiab pom kuv qhov nrawm.

Nco ntsoov tias qhov no yog tsab ntawv.

Kauj Ruam 1: Cheeb Tsam

Cheebtsam

Kuv siv cov hauv qab no los tsim qhov haujlwm no:

  • Skateboard
  • Potentiometer
  • LCD
  • Hall effect sensor
  • 10k Ohm Resistor (Kuj)
  • Raspberry pib
  • Arduino Nano Cov
  • Jumper hlau (Poj niam rau txiv neej)
  • Jumper xaim (Raspberry Pi)
  • Jumper hlau (Txiv neej rau txiv neej)
  • PCB
  • RFID tshuab luam ntawv
  • Daim npav RFID
  • Powerbank

Saib BillOfMaterials rau txuas thiab tus nqi

Kauj ruam 2: Kev thaiv kab

Thaiv
Thaiv

Lub tsev muaj 3 tus pin: VCC, GND thiab tso tawm. Hauv av mus rau GND. VCC mus rau 3.3V thiab cov zis hauv qhov piv txwv no mus rau GPIO 26. A 10K Ohm resistor rub cov zis siab.

Kuv siv kev sib txuas lus sib txuas hla USB ntawm raspberry pi thiab arduino nano los nyeem cov paib. Qhov no tsis nyob hauv daim duab, tab sis yuav tsum tau ua!

D9 RST (Pib dua) D10 SDA (SS) (SPI SS) D11 MOSI (SPI MOSI) D12 MISO (SPI MISO) D13 SCK (SPI SCK) GND GND3.3V 3.3V

Kauj ruam 3: Database Scheme

Database Scheme
Database Scheme

Kuv database muaj 3 cov ntxhuav:

  • Cov neeg siv
  • Sib ntsib
  • Cov ntaub ntawv

Txhua tus neeg siv tuaj yeem taug qab cov ntaub ntawv ib ntu. Kev sib ntsib muaj cov ntaub ntawv yog li koj paub nrawm npaum li cas koj tau mus rau qee cov ntsiab lus thaum qhov kev sib tham tseem tab tom mus.

Kauj Ruam 4: Kho Arduino Nano

Txhim kho Arduino Nano
Txhim kho Arduino Nano
Txhim kho Arduino Nano
Txhim kho Arduino Nano
Txhim kho Arduino Nano
Txhim kho Arduino Nano

Ua ntej tso koj lub arduino nano hauv koj lub pc ntawm usb cable. Xaiv txoj cai arduino thiab txoj cai usb chaw nres nkoj kom rub tawm.

Tom ntej no peb yuav tsum ntxiv lub tsev qiv ntawv kuv siv rau kev nyeem cov cim npe RFID. Rub 'rfid-master' thiab mus rau kos duab, suav nrog tsev qiv ntawv thiab tom qab ntawd ntxiv. ZIP tsev qiv ntawv. Mus rau tus zip koj nyuam qhuav rub tawm thiab siv qhov no, nws yuav nruab tsis siv neeg. Tom qab rub tawm kuv qhov kho 'RFID_Read.ino' nias ctrl + O ntxiv tib lub sijhawm thiab mus rau cov ntawv no thiab qhib nws.

Yog tias koj tau ua txhua cov kauj ruam saum toj no koj tuaj yeem txheeb xyuas cov ntaub ntawv. Yog tias nws yoov thawj zaug, tsuas yog sim nws ib zaug ntxiv. Yog tias qhov no ua tiav koj tuaj yeem xa nws mus rau koj arduino. Los ntawm kev siv qhov luv ctrl+ua haujlwm+m koj tuaj yeem qhib lub ntsuas saib. Koj tuaj yeem sim cov ntawv no. Yog tias qhov kev xeem ua tiav koj tuaj yeem tshem lub arduino thiab ntsaws nws hauv qhov chaw nres nkoj usb ntawm raspberry pi

Kauj Ruam 5: Kho lub Raspberry Pi

Hauv cov theem no peb yuav teeb tsa raspberry pi ua cov chaw khaws ntaub ntawv thiab cov vev xaib.

Hauv qhov piv txwv no kuv siv tus neeg siv 'kuv' yog tias koj siv lwm tus neeg siv koj xav tau hloov cov ntaub ntawv teeb tsa, khaws qhov no hauv siab!

1. Tsim tus neeg siv:

Tsim kom muaj qhov sib txawv

pieter@rpipieter: ~ $ user = kuv

Ua rau tus neeg siv sudo thiab ntxiv rau txhua pawg

pawg = $ (id pi -Gn | sed 's /^pi // g' | sed 's / /, /g') sudo useradd $ {user} -s /bin /bash -m -G $ {groups} sudo sed "s/^pi/$ {user}/" /etc/sudoers.d/010_pi-nopasswd | sudo tee "/etc/sudoers.d/011_${user}-nopasswd" sudo passwd $ {neeg siv}

Nkag mus rau tus as khauj

pieter@rpipieter: ~ $ su - kuv

Lo lus zais: kuv@kuv-rpi: ~ $

2. Txuas nrog WiFi

kuv@rpipieter: ~ $ sudo -iroot@rpipieter: ~# echo 'Password' | wpa_passphrase 'Networkname' >> /etc/wpa_supplicant/wpa_supplicant.conf paus@rpipieter: ~# wpa_cli -i wlan0 reconfigure root@rpipieter: ~# logout

Xyuas seb internet puas ua haujlwm

hauv paus@rpipieter: ~# wget google.com

3. Ua kom raspberry pi hloov kho thiab txhim kho pob khoom xav tau

kuv@kuv-rpi: ~ $ sudo apt hloov tshiab

kuv@kuv-rpi: ~ $ sudo apt hloov kho kuv@rpipieter: ~ $ sudo apt nruab -y python3-venv python3-pip python3-mysqldb mysql-server uwsgi nginx uwsgi-plugin-python3 gitme@my-rpi: ~ $ sudo reboot -h tam sim no

4. Clone kuv qhov chaw cia khoom github

kuv@rpipieter: ~ $ git clone

kuv@rpipieter: ~ $ cd skate-o-meter/skateometer/

5. Ua qhov chaw ib puag ncig virtual

Thaum ua cov lus txib no yuav raug teeb tsa ntau pob, qhov no yuav siv sijhawm me ntsis.

kuv@rpipieter: ~/skate-o-meter/skateometer $ python3 -m pip nruab-hloov kho pip setuptools log virtualenv

kuv@rpipieter: ~/skate-o-meter/skateometer $ python3 -m venv --system-site-packages env (env) kuv@rpipieter: ~/skate-o-meter/skateometer $ python -m pip nruab mysql- connector-python argon2-cffi Flask Flask-HTTPAuth Flask-MySQL mysql-connector-python passlib pyserial pyjwt RPi. GPIO

6. Tsim cov database thiab cov neeg siv

Peb siv mysql database

pieter@rpipieter: ~/skate-o-meter/skateometer $ cd

pieter@rpipieter: ~ $ sudo mysql

Tom qab ntawd luam, muab tshuaj txhuam no

GRANT SELECT, INSERT, Hloov tshiab, Rho tawm ntawm *. * TO 'som-data'@'localhost'; SET PASSWORD FOR 'som-data'@'localhost' = PASSWORD ('sensor9810'); xaiv * los ntawm mysql.user; Tsim tus neeg siv 'som-admin'@'localhost' IDENTIFIED BY 'admin9810'; Tsim tus neeg siv 'som-web'@'localhost' IDENTIFIED BY 'web9810'; Tsim tus neeg siv 'som-sensor'@'localhost' IDENTIFIED BY 'sensor9810'; Tsim DATABASE skateometerdb; ZOO TSHAJ PLAWS TSEV KAWM NTAWV ntawm skateometerdb.* Rau 'som-admin'@'localhost' NROG QHOV ZOO TSHAJ PLAWS; GRANT SELECT, INSERT, Hloov tshiab, Rho tawm ntawm skateometerdb.* TO 'som-web'@'localhost'; GRANT SELECT, INSERT, Hloov tshiab, Rho tawm ntawm skateometerdb.* TO 'som-sensor'@'localhost'; NTSEEG NTAWV QHOV TSEEB;

Tom ntej no peb yuav ntxiv cov txheej txheem database uas twb muaj lawm nrog kev sib raug zoo.

kuv@rpipieter: ~/skate-o-meter/skateometer $ sudo mysql <sql/skateometerdb_dump-withoutdata.sql

7. Kev pabcuam

Ntawm no peb luam peb cov ntaub ntawv teeb tsa thiab rov qhib lub nplaub tshev kom peb tuaj yeem pab tau cov kev pabcuam

kuv@rpipieter: ~/skate-o-meter/skateometer $ sudo cp conf/som-*. service/etc/systemd/systemme@rpipieter: ~/skate-o-meter/skateometer $ sudo systemctl daemon-reload

Tam sim no peb tab tom yuav pab cov kev pabcuam kom txhua lub sijhawm peb pib raspberry pi cov no yuav pib ua haujlwm nrog nws.

kuv@rpipieter: ~/skate-o-meter/skateometer $ sudo systemctl pab som-flask.service

Tsim symlink /etc/systemd/system/multi-user.target.wants/som-flask.service → /etc/systemd/system/som-flask.service kuv@rpipieter: ~/skate-o-meter/skateometer $ sudo systemctl pab som-data.service Tsim symlink /etc/systemd/system/multi-user.target.wants/som-data.service →/etc/systemd/ system/som-data.service. kuv@rpipieter: ~/skate-o-meter/skateometer $ sudo systemctl pib som-data.service kuv@rpipieter: ~/skate-o-meter/skateometer $ sudo systemctl pib som-flask.service

8. NGX

kuv@rpipieter: ~/skate-o-meter/skateometer $ sudo cp conf/nginx/etc/nginx/sites-available/skateometerme@rpipieter: ~/skate-o-meter/skateometer $ sudo rm/etc/nginx/sites -enabled/default kuv@rpipieter: ~/skate-o-meter/skateometer $ sudo ln -s/etc/nginx/sites-available/skateometer/etc/nginx/sites-enabled/skateometerme@rpipieter: ~/skate-o -meter/skateometer $ sudo systemctl rov pib dua nginx.service

Kauj Ruam 6: Vaj Tsev + Hall

Vaj Tsev + Hall
Vaj Tsev + Hall

Vaj tse

Ua ntej kuv ua lub qhov nyob hauv kuv lub skateboard rau LCD, lub hwj chim thiab lub buzzer. Tom qab ntawd kuv tau muab tshuaj txhuam LCD, lub hwj chim thiab lub suab nrov ntawm PCB. Tom qab ntawd kuv siv lub jumperwire rau RPI, ib qho nrog 40 tus pin. Kuv muab ib sab rau hauv raspberry pi thiab lwm qhov ib nrab uas kuv txiav, sab no peb yuav siv los ua cov laug. Hauv cov ntaub ntawv 'rpi-cable' koj tuaj yeem pom qhov twg koj xav tau los txuas cov hlau twg.

Txog qhov casing kuv siv lub thawv qub curver, Kuv muab qee qhov rau hauv nws rau ethernetcable thiab rau jumperwire tuaj hauv lub thawv.

Kuv khaws lub thawv nyob hauv qab lub skateboard nrog qee cov ntsia hlau. Sab hauv lub thawv Kuv tau npaj txhua yam, yog li nws yuav haum thiab tseem siv cov ntsia hlau thiab qee yam rub rub kom txhua yam nyob hauv qhov chaw. Qhov no ua rau tshem tawm cov khoom yooj yim dua.

RFID tau teeb tsa lub teeb ntawm lub thawv thiab muaj nyob hauv qhov chaw nrog ziptires, ib qho teeb meem kuv tau ntsib yog tias qee zaum nws tsis tau luam theej duab, tab sis nrog qee qhov kev hloov pauv kuv tau ua haujlwm.

Hall effect sensor

Ua ntej kuv drilled qhov hauv kuv lub log thiab muab cov hlau nplaum tso rau hauv.

Rau lub tsev yog siv 3 jumperwires (txiv neej rau txiv neej) Kuv tau muab lawv tso rau ntawm kuv tus PCB ib yam li ntawm chav nrog nws tus kheej. Kuv tau teeb tsa lub tsev ntsuas ntawm kuv lub tsheb nrog qee qhov ziptires. Ua kom ntseeg tau tias cov hlau nplaum thiab lub ntsuas hluav taws xob tau ua haujlwm tau zoo, txwv tsis pub nws yuav tsis tso npe tas li.

Kauj ruam 7: Pib App

Kauj ruam 1:

Plug lub raspberry thiab lub txhab nyiaj hauv txhab nyiaj.

Kauj ruam 2:

Tos kom txog thaum txoj haujlwm pib, koj tuaj yeem ua raws qhov no ntawm LCD. Koj yuav pom tus IP-chaw nyob, mus rau tus IP-chaw nyob no.

Kauj ruam 3:

Tsim tus neeg siv, koj tuaj yeem ua li ntawd los ntawm kev sau npe. Koj yuav tsum luam theej duab daim ntawv kom pom koj daim UID ntawm daim paib ntawm LCD.

Kauj ruam 4:

Yog tias koj tsim tus neeg siv koj tuaj yeem luam theej duab koj lub npe thiab ntu yuav pib.

Kauj ruam 5:

Mus ncig ncig

Kauj Ruam 6:

Luam theej npe dua kom tsis txhob sib tham

Kauj ruam 7:

Nkag mus saib koj qhov kev sib tham thiab cov ntaub ntawv ntxaws los ntawm kev sib tham

Pom zoo: