Cov txheej txheem:

Begging Neeg Hlau Nrog Saib Xyuas Lub Ntsej Muag thiab Tswj los ntawm Xbox Tus Tswj - Arduino: 9 Cov Kauj Ruam (nrog Duab)
Begging Neeg Hlau Nrog Saib Xyuas Lub Ntsej Muag thiab Tswj los ntawm Xbox Tus Tswj - Arduino: 9 Cov Kauj Ruam (nrog Duab)

Video: Begging Neeg Hlau Nrog Saib Xyuas Lub Ntsej Muag thiab Tswj los ntawm Xbox Tus Tswj - Arduino: 9 Cov Kauj Ruam (nrog Duab)

Video: Begging Neeg Hlau Nrog Saib Xyuas Lub Ntsej Muag thiab Tswj los ntawm Xbox Tus Tswj - Arduino: 9 Cov Kauj Ruam (nrog Duab)
Video: Nqaij Laim Txhais Tau Li Cas 2024, Kaum ib hlis
Anonim
Image
Image
Txhim kho thiab teeb tsa OpenCV thiab C ++
Txhim kho thiab teeb tsa OpenCV thiab C ++

Peb yuav ua tus thov neeg hlau. Tus neeg hlau no yuav sim ua rau khaus lossis ua rau pom kev dhau ntawm tib neeg. Nws yuav ntes lawv lub ntsej muag thiab sim tua lasers ntawm lawv. Yog tias koj muab tus neeg hlau ib npib, nws yuav hu nkauj thiab seev cev. Tus neeg hlau yuav xav tau arduino, pub nyob ntawm lub koob yees duab thiab lub khoos phis tawj kom qhib openCV rau. Tus neeg hlau tseem yuav tuaj yeem tswj tau los ntawm xBox maub los yog txuas nrog lub PC.

Kauj Ruam 1: Cov Khoom Siv

Khoos phis tawj Electronic

  • Arduino NANO lossis UNO
  • USB 2.0 Lub Koob Yees Duab
  • Jumper cables (txiv neej thiab poj niam)
  • 2 x Servo - Generic (Sub -Micro Loj)
  • 2 x LED - RGB CATHODE 5mm
  • 2 x 5 mW Lasers
  • 1 x Liab LED 5mm
  • 1 x Breadboard
  • 4 x 220Ω resistor
  • 1 x 1KΩ resistor
  • 1 x protoboard
  • 1 x Sonar sensor 4 tus pin
  • Xbox maub los

Kho vajtse analog

  • Ntoo lub thawv (15 x 15 x 7 cm)
  • Kua nplaum
  • Daim kab xev hluav taws xob

Software

  • Arduino IDE Cov
  • Nrig txog kev pom Studio 2017
  • 3Ds Max (lossis lwm yam software kho qhov muag 3d)
  • Preform 2.14.0 lossis tom qab
  • OpenCV 3.4.0 lossis tom qab

Cov cuab yeej

  • Cov cuab yeej siv cuab yeej
  • Pom thiab laum
  • Hlau txiav

Kauj ruam 2: Txhim kho thiab teeb tsa OpenCV thiab C ++

Txhim kho thiab teeb tsa OpenCV thiab C ++
Txhim kho thiab teeb tsa OpenCV thiab C ++

Kauj ruam 2.1: Tau txais software

Visual studio 2017: Rub Visual studio Comunity 2017openCV 3.4.0 Yeej pob: Mus rau official downloadpage

Kauj ruam 2.2: Txhim Kho OpenCV2.2.1: Extract zipfile rau koj lub Windows (: C) tsav tsheb. Qhov no tuaj yeem pom hauv koj li win10 nrhiav haujlwm. 2.2.2: Peb yuav tsum teeb tsa qhov hloov pauv ib puag ncig tshiab. Nrhiav "Txoj Kev" ib puag ncig thiab nias hloov kho.2.2.4: Tam sim no peb yuav tsum ntxiv qhov chaw ntawm "bin daim ntawv qhia chaw" mus rau qhov hloov pauv tshiab hauv Txoj Kev Ib puag ncig. Yog tias koj teeb tsa openCV ntawm koj C tsav, txoj hauv kev tuaj yeem mus zoo li no: C: / opencv / build / x64 / vc14 / bin Muab txoj hauv kev thiab nias "OK" ntawm txhua lub qhov rais uas koj yuav tau qhib thaum lub sijhawm no.

Kauj Ruam 2.3: teeb tsa pom duab studio C ++ 2.3.1: Ua kom pom qhov tshiab C ++ project. Ua kom nws tsis muaj dab tsi win32 Console Application project.2.3.2: Hauv qhov chaw cov ntaub ntawv tab, nyem rau sab xis thiab ntxiv C ++ cov ntaub ntawv tshiab (.cpp) thiab npe nws "main.cpp".2.3.3: Txoj cai nyem rau ntawm qhov project- lub npe nyob hauv Kev Tshawb Fawb Kev Tshawb Fawb thiab xaiv Cov Khoom. 2.3. Qhov no tuaj yeem pom nyob rau hauv C/C ++ tab nyob rau hauv dav dav. xaiv lub tab "Linker". nyob rau hauv dav dav peb yuav tsum tau ua lwm Cov Ntawv Ntxiv Libary Ntxiv. Muab tshuaj txhuam txoj hauv qab no tom qab "AID" C: / opencv / build / x64 / vc14 / lib thiab nias thov dua. Thiab nias "Ntxiv kev vam khom> hloov kho" thiab muab cov ntaub ntawv hauv qab no qhib cv_world320d.lib thiab xinput.lib (Rau tus tswj) thiab nias thov dua. Tam sim no koj cov ntaub ntawv C ++ tau npaj ua haujlwm nrog.

Kauj Ruam 3: Teeb tsa Arduino

Teeb tsa Arduino
Teeb tsa Arduino
Teeb tsa Arduino
Teeb tsa Arduino
Teeb tsa Arduino
Teeb tsa Arduino
Teeb tsa Arduino
Teeb tsa Arduino

Ntsib cov servos: Cov servos muaj peev xwm tig tau ~ 160 ° Lawv yuav tsum muaj nruab nrab ntawm 4, 8 thiab 6, 0 Volt kom ua haujlwm ib txwm. Qhov servo muaj 3 tus pin: hauv av, 4, 8 - 6, 0 volt tus pin thiab cov ntaub ntawv tus pin Rau peb txoj haujlwm peb yuav teeb tsa cov ntaub ntawv pins rau servos ntawm DigitalPin 9 thiab 10.

Ntsib lub RGB leds: RGB leds muaj 4 tus pin. Red, ntsuab, xiav thiab tus pin hauv av. Txhawm rau txuag qee qhov chaw ntawm arduino, peb tuaj yeem txuas 2 RGB leds ua ke. Yog li peb tsuas yog siv 3 tus pin. Peb tuaj yeem txuas thiab txuas lub RGB leds ntawm tus tiv thaiv ib yam li hauv daim duab. Red pin => DigitalPin 3 (PWM) Green pin => DigitalPin 4Blue pin => DigitalPin 7

Ntsib lub Piezo buzzer: Peb cov neeg hlau me me yuav ua suab nrov. Txhawm rau ua qhov no peb yuav tsum tau muab nws lub suab! Peb tuaj yeem xaiv ua kom nws nrov nrov. Lossis peb tuaj yeem tso 220Ω tus tiv thaiv ua ntej lub piezo buzzer kom nws me ntsis tsis zoo. Peb tawm hauv Piezo buzzer ntawm lub khob cij. Yog li tsis xav tau kev sib txuas Peb txuas cov ntaub ntawv tus pin (+) rau DigitalPin 2 thiab tus pin hauv av rau hauv av ntawm lub khob cij.

Ntsib Sonar: Txhawm rau tiv thaiv tus neeg hlau los ntawm kev sim tsom mus rau tus neeg uas nyob deb 10 meters. Peb tuaj yeem muab tus neeg hlau nrug deb ntawm qhov nws yuav muaj peev xwm tsom rau tib neeg. Peb ua qhov no nrog lub sonar sensor. VCC => 5 voltTrig => DigitalPin 6Echo => DigitalPin 5GND => hauv av

Ntsib tus neeg nrhiav nyiaj npib: Peb tab tom yuav ua tus ntsuas nyiaj npib. Lub tshuab ntsuas npib yuav ua haujlwm los ntawm kev tshuaj xyuas yog tias lub kaw lus kaw lossis tawg. Nws yuav luag ua haujlwm zoo li hloov pauv. Tab sis peb yuav tsum tau ceev faj. Yog tias peb ua qhov tsis raug no, nws yuav raug nqi rau peb. Tab sis nco ntsoov muab 1KΩ resistor nruab nrab ntawm nws. Second: Txuas xov hlau rau hauv av. Peb tuaj yeem muab cov xov hlau tam sim tam sim thiab tiv thaiv rau tib lub protoboard ib yam li RGB leds. Tam sim no yog tias peb kov 2 lub xov hlau toghter lub arduino yuav pom lub kaw lus kaw. Qhov no txhais tau tias muaj nyiaj npib! Sib ntsib lub lasers ntawm kev puas tsuaj. Yuav kom txuag tau qee qhov chaw, Kuv tau siv 2 lub lasers ua ke. Lawv yuav haum txig rau hauv tus ncej ntawm lub koob yees duab. Txuas lawv mus rau DigitalPin 11 thiab hauv av.

Yeem gimmick. Peb tuaj yeem tso LED liab nyob hauv qab npib nyiaj. Qhov no yuav yog kev lom zem me me gimmick rau thaum nws tsaus ntuj. Txuas ib lub xaim mus rau DigitalPin 8 thiab muab 220Ω resistor nruab nrab ntawm LED thiab xaim txhawm rau tiv thaiv nws los ntawm tshuab. Txuas tus pin luv ntawm LED rau hauv av.

Kauj Ruam 4: Tus C ++ Code

Kauj Ruam 4.1: Teeb lub main.cpp code4.1.1: Rub tawm "main.cpp" thiab luam cov cai rau koj tus kheej main.cpp.4.1.2: Ntawm kab 14 hloov "com" rau com uas arduino siv. "\. / COM (hloov qhov no)" 4.1.3: Ntawm kab 21 thiab 22 teeb tsa txoj hauv kev kom cov ntaub ntawv "haarcascade_frontalface_alt.xml" thiab "haarcascade_eye_tree_eyeglasses.xml" Yog openCV tau teeb tsa ntawm C tsav, cov ntaub ntawv no tuaj yeem nyob ntawm no: "C: / opencv / build / etc / haarcascades \" Khaws ob npaug rov qab lossis ntxiv ib qho uas tsuas muaj ib qho.

Kauj ruam 4.2: Ntxiv tserial.h thiab Tserial.cppCov ntaub ntawv 2 no yuav saib xyuas kev sib txuas lus ntawm arduino thiab PC.4.2.1: Rub tserial.h thiab Tserial.cpp.4.2.2: Muab ob daim ntawv no tso rau hauv txoj haujlwm cov npe. Hauv Kev Tshawb Fawb Tshawb xyuas txoj cai-nyem rau ntawm qhov haujlwm thiab xaiv ntxiv> cov khoom uas twb muaj lawm. Hauv qhov rai popup xaiv ob daim ntawv uas yuav muab ntxiv.

Kauj ruam 4.2: Ntxiv CXBOXController.h thiab CXBOXController.hCov ntaub ntawv no yuav siv ntawm tus tswj hwm ib feem ntawm txoj haujlwm. Nyob rau hauv lub qhov rai popup xaiv ob cov ntaub ntawv los ntxiv. C ++ cov ntaub ntawv tau teeb tsa.

Kauj Ruam 5: Arduino Code

Kauj ruam 5.1: NewPing library5.1.1: Rub tawm ArduinoCode.ino thiab qhib nws hauv arduino IDE.5.1.2: Mus rau "Sketch> Suav nrog libary> Tswj libaries".5.1.3: Tshawb hauv lub thawv lim rau "NewPing" thiab teeb tsa lub tsev qiv ntawv no.

Kauj Ruam 5.2: Pitch library5.2.1: Rub tawm pitches.txt thiab luam cov ntsiab lus ntawm pitches.txt.5.2.2: Hauv Arduino IDE nias CTRL+Shift+N kom qhib lub tab tshiab.5.2.3: Muab cov cai los ntawm pitches.txt rau hauv lub tab tshiab thiab txuag nws li "pitches.h". Qhov Arduino code hase tau teeb tsa

Kauj Ruam 6: 3D Luam Ntawv thiab Kho Kom Zoo Dua Luam

3D Luam Ntawv thiab Kho Kom Zoo Dua Luam
3D Luam Ntawv thiab Kho Kom Zoo Dua Luam
3D Luam Ntawv thiab Kho Kom Zoo Dua Luam
3D Luam Ntawv thiab Kho Kom Zoo Dua Luam

Kauj Ruam 6.1: Luam cov ntawv 3D Qhib qhov printfile.form thiab tshawb xyuas yog tias txhua yam zoo. Yog tias txhua yam zoo li ok, xa cov ntawv luam mus rau lub tshuab luam ntawv. Yog ib yam zoo li lossis koj xav hloov tus qauv. Kuv tau suav nrog 3Ds Max cov ntaub ntawv thiab cov ntaub ntawv OBJ rau koj los kho.

Kauj Ruam 6.2: Ua kom zoo dua tus qauv 6.2.1: Tom qab luam ntawv tiav ua 2 lub qauv hauv qee qhov 70% cawv kom tshem tawm cov ntawv luam tawm dua. harden tus qauv. Lossis koj tuaj yeem siv UV-teeb los ua tus qauv. Qhov no yuav tsum tau ua vim tias tus qauv yuav nplaum.

6.2.3: Tshem tawm txoj haujlwm txhawb nqa. Qhov no tuaj yeem ua tiav nrog lub tshuab txiav hlau. Los yog lwm yam cuab yeej uas tuaj yeem txiav plastics.6.2.4: Qee qhov ntawm 3D luam ntawv tseem tuaj yeem ua mos. Txawm hais tias tus qauv tau nyob hauv ntau UV-lub teeb. Qhov uas tuaj yeem ua tau mos, yog qhov uas nyob ze rau ntawm cov thav duab txhawb nqa. Tso tus qauv nyob rau hauv ntau lub hnub ntawm UV-lub teeb kom tawv tawm. Koj tuaj yeem sim ua kom haum cov servos rau hauv tus ncej. Yog tias lawv tsis haum koj tuaj yeem siv Dremel rau cov khoom siv xuab zeb. ua kom haum.

Kauj Ruam 7: Tsim Lub Thawv

Tsim Lub Thawv
Tsim Lub Thawv
Tsim Lub Thawv
Tsim Lub Thawv

Kauj Ruam 7.1: Ua lub qhov Daim phiaj xwm tsis nce mus rau qhov ntsuas, tab sis txhua qhov ntau thiab tsawg yog qhov raug. 7.1.1: Pib los ntawm khij txhua lub qhov ntawm qhov chaw raug. Qhov loj tuaj yeem ua rau me me nrog Dremel.7.1.3: Lub qhov square tuaj yeem ua kom zoo ib yam. Tab sis kom ua rau lawv sib npaug koj tuaj yeem haum Dremel nrog cov ntawv me me thiab xa tawm cov kaum ntse ntse. yog tias lawv haum, koj zoo mus! 7.1.5: Saib xyuas rau cov ntoo ntoo. Siv cov ntawv xuab zeb tshem tawm ntawm lawv.

Kauj Ruam 7.2: pleev xim 7.2.1: Pib nrog txhuam lub hau. Peb xav tau cov xim los lo. 7.2.2: Siv daim ntaub thiab muab Turpentine me ntsis los txhuam lub thawv. 7.2.3: Tam sim no koj tuaj yeem tsuag xim lub thawv xim twg koj xav tau.

Kauj ruam 8: Ua tiav

Tiav tiav
Tiav tiav
Tiav tiav
Tiav tiav
Tiav tiav
Tiav tiav

Tam sim no peb yuav tsum muab txhua yam tso rau hauv thiab tso nws ua nws qhov chaw..3: Kuaj qhov kev sib txuas nrog ib npib. Yog tias tsis muaj lub kaw lus kaw, muab cov xov hlau txuas ntxiv rau ntawm ntug. 8.2.3: Txuas tag nrho cov xov hlau los ntawm protoboard tag nrho cov arduino. Step 8.3: Sonar sensor8.3.1: Tso lub sensor rau hauv lub qhov peb tau ua rau nws. Yog tias koj muaj txiv neej rau poj niam jumpwires koj tuaj yeem hla 8.3.28.3.2: Txiav ib co txiv neej thiab poj niam nyob ib nrab thiab txuas tus poj niam thiab txiv neej cov xov hlau ua ke los ua ib txoj hlua peb tuaj yeem siv txuas lub sensor mus rau arduino.8.3.3: Txuas lub sensor mus rau arduino

Kauj Ruam 8.4: Lasers thiab lub koob yees duab 8.4.1: Kua tus ncej me me rau lub koob yees duab. Xyuas kom nws yog qhov ncaj. 8.4.2: Muab cov lasers tso rau hauv tus thav duab ib yam. Kaw lawv kom cov yeeb ncuab yuav tsis nyiag lawv!

Kauj Ruam 8.5: Qhov Kev Pabcuam thiab 3D luam ntawv 8.5.1: Muab cov servo tso rau hauv lub qhov taub ntawm lub hau 8.5.2: Muab cov ntawv xa mus rau arduino (qhov no ua rau servos sawv ntsug hauv txoj haujlwm raug) 8.5.3: Nrog rau servo tuaj me ntsis toj roob hauv pes. Muab qhov no tso rau ntawm tus neeg siv khoom hauv lub hau. 8.5.4: Muab cov ntawv luam loj 3D tso rau ntawm servo thiab toj siab thiab ntswj lawv nruj nrog cov ntsia hlau. 8.5.6: Muab lub koob yees duab tso rau hauv thiab txhua yam npaj txhij mus!

Kauj Ruam 9: Pib Txoj Haujlwm

Txhawm rau pib tus neeg hlau qhib C ++ Cov Ntaub Ntawv hauv Visual studio. Nco ntsoov tias koj nyob hauv "hom debug" Upload cov ntaub ntawv arduino rau arduino. Thaum qhov ntawd tau rub tawm nias ua si hauv qhov muag pom studio. Thiab tus neeg hlau yuav tua hluav taws thiab sau tag nrho cov nyiaj npib hauv ntiaj teb !!!

Pom zoo: