Cov txheej txheem:

Auto-tracking Water Blaster: 9 Kauj Ruam
Auto-tracking Water Blaster: 9 Kauj Ruam

Video: Auto-tracking Water Blaster: 9 Kauj Ruam

Video: Auto-tracking Water Blaster: 9 Kauj Ruam
Video: The best way to fill up your pool 😎🔥 2024, Hlis ntuj nqeg
Anonim
Nws pib taug qab Dej Blaster
Nws pib taug qab Dej Blaster

Rose-eating mos lwj txhawb kuv los tsim lub hom phiaj-taug qab cov blaster los pab tiv thaiv cov neeg phem heev … Cov dej blaster no siv cov vis dis aus raws kev ntsuas kom pom lub hom phiaj servo thiab ua kom luv dej tawg ntawm lub hom phiaj. Nws tua tsuas yog tom qab tau txais lub hom phiaj nyob ruaj khov rau ob peb feeb (qhov ncua tuaj yeem hloov kho hauv txoj cai). Kuv tsis quav ntsej yog tias tus mos lwj tab tom taug kev los tab sis yog tias lawv nres rau khoom noj txom ncauj, sploosh!

Nov yog daim vis dis aus ntawm kuv sim cov blaster dej:

Lub tshuab blaster yog lub thawv nyob ib leeg uas tuaj yeem txuas nrog lub chaw nyob deb ntawm (ntawm wi-fi/VNC) los ntawm ib lub khoos phis tawj ntawm koj lub network txhawm rau saib xyuas nws ua dab tsi. Nws siv daim duab txhua lub sijhawm nws tau tshwm sim yog li koj tuaj yeem pom tom qab dab tsi tau tawg.

Kuv siv Raspberry Pi, NoIR cam, IR teeb pom kev zoo, tus qauv siv kab tawm, thiab lub qhov dej kom tsim hnub no/hmo ntuj, lub hom phiaj taug qab dej blaster. Cov cai tau sau ua sej thiab qiv ntau los ntawm Adrian Rosebrock's cv2 duab ua cov qauv piv txwv. Koj tuaj yeem pom nws sau ntawm:

www.pyimagesearch.com/2015/06/01/home-surv…

Txij li thaum kuv mus tom qab qhov loj, cov hom phiaj hauv av (mos lwj), kuv qhov teeb meem yog yooj yim me ntsis. Kuv tsuas xav tau lub hom phiaj kab rov tav yog li kuv tuaj yeem khiav tawm nrog siv tsuas yog ib qho servo. Tos kom tus mos lwj sawv ntsug tseem pab kuv tshem tawm ntau qhov tsis raug. Nov yog kuv qhov kev sim-0 thiab kuv tau pom ob peb yam uas kuv yuav hloov pauv yog tias kuv tsim lwm qhov. Kuv tau sau cov no hauv cov ncauj lus kom ntxaws sau hauv qab no.

Kauj ruam 1: Txoj Cai

Dej blaster siv Raspberry Pi 3 rau kev ua haujlwm. Txhawm rau ntes cov vis dis aus, NoIR Raspberry Pi cam tau siv nrog IR teeb pom kev zoo rau hmo video. Pob OpenCV/cv2 Python tau siv los ntes thiab ua cov ntaub ntawv duab thiab suav cov phiaj xwm ua haujlwm. Lub tsev qiv ntawv pigpio tau siv los tswj gpio rau kev ua haujlwm ruaj khov. Siv cov pob RPi. GPIO li niaj zaus ua rau muaj kev cuam tshuam tsis zoo. NCO TSEG: Thaum siv lub tsev qiv ntawv pigpio koj yuav tsum tau khiav lub pigpio daemon. Ntxiv qhov no rau koj Pi's /etc/rc.local startup file rau pigpio lib thiab Raspberry Pi lub koob yees duab interface:

/etc/rc.local# Teeb tsa/dev/video0 txhawm rau txuas rau Raspberry Pi ua hauv lub koob yees duab interfacemodprobe bcm2835-v4l2# Pib pigpio daemon rau Raspberry Pi IO tswj lub tsev qiv ntawvpigpiod

Saib https://pypi.python.org/pypi/pigpi kom paub meej ntxiv.

Cov peev txheej yog npe: water_blaster.py thiab txuas hauv qab no.

Kev tsis lees paub: Kuv tshiab rau Python coding yog li tsis txhob kho nws raws li ib tus qauv zoo ntawm Python coding style!

Qhov yooj yim algorithm yog raws li hauv qab no:

  • Lob tus thawj daim vis dis aus siv. Qhov no yuav raug siv los sib piv rau txhawm rau txheeb xyuas kev txav chaw.
  • Lob lwm tus ncej.
  • Hloov lub thav duab rau grey nplai, loj nws, plooj nws.
  • Xam qhov sib txawv ntawm tus ncej siv
  • Lim tawm qhov sib txawv me me, tau txais kev sib koom ntawm qhov sib txawv loj tshaj.
  • Teem sijhawm. Yog tias lub hom phiaj sib koom tes tsis hloov pauv li ob peb vib nas this, tom qab ntawd thaij ib daim duab ntawm yam peb tab tom yuav tua thiab ua rau lub qhov dej tawg rau qhov dej tawg. Cheb cov servo rov qab thiab tawm mus ob peb qib rau qhov "phom phom" tawg.
  • Yog tias peb tau txais peb qhov ua rau nrawm dhau, kaw qhov tua, ncua me ntsis, tom qab ntawd hloov kho cov kab ntawv siv raws li peb yuav tua ntawm tus duab ntxoov ntxoo lossis lub sam thiaj lub teeb uas nyuam qhuav qhib rau …
  • Txhua ob peb feeb hloov kho kab ntawv siv rau tus lej rau qhov hloov pauv qis (lub hnub nce/teeb tsa, dhau mus los, thiab lwm yam)

Kuv tsuas yog siv cov phiaj xwm phiaj xwm kab rov tav tab sis ntau lub lauj kaub/qaij servo mounts muaj nyob ntawm EBay thiab nws yuav yooj yim ntxiv lwm qhov kev pabcuam rau kev tswj hwm lub hom phiaj yog tias koj xav tau lub hom phiaj tseeb dua.

Kuv teeb tsa Raspberry Pi los ua VNC server, tom qab ntawd txuas rau nws ntawm VNC los ntawm kuv lub laptop kom pib qhov program thiab saib xyuas cov vis dis aus thiab cav. cd rau hauv cov npe uas koj khaws water_blaster.py thiab khiav nws los ntawm kev ntaus:

./python dej_blaster.py

Nws yuav qhib lub vijtsam saib lub qhov rais, pib cov ntaub ntawv npe hu ua "./log_[date]_[time], thiab tsim cov sub-dir hu ua" trigger_pictures "qhov twg-j.webp

Nov yog qee qhov sau tseg ntawm teeb tsa VNC ntawm koj li Raspberry Pi:

Thawj zaug kuv teeb tsa Raspberry Pi, Kuv siv tus saib sab nraud/keyboard/nas los teeb tsa yam. Muaj kuv tau qhib VNC server ntawm RasPi teeb tsa (Raspberry Logo / Preferences / Raspberry Pi Configuration / Interfaces / Kos VNC xaiv). Tom qab ntawd, thaum nws khau raj, nws ua rau koj txuas rau nws: 0 zaub ntawm VNC tus neeg siv khoom (w/ tib daim ntawv pov thawj raws li tus neeg siv pib "pi").

Hauv hom tsis muaj lub taub hau nws ua rau qhov kev daws teeb meem me me (raws li nws tsis pom ib qho zaub twg), kom yuam nws rau qee qhov kev daws teeb meem loj dua, koj ntxiv qhov no rau /boot/config.txt thiab rov pib dua:

# Siv yog tias koj muaj zaub# hdmi_ignore_edid = 0xa5000080hdmi_group = 2# 1400x1050 w/ 60Hz# hdmi_mode = 42# 1356x768 w/ 60Hzhdmi_mode = 39

Nov yog qee cov ntaub ntawv ntxiv:

Kauj Ruam 2: Cov Khoom Siv Hluav Taws Xob

Cov dej blaster cov khoom siv hluav taws xob xav tau tsawg kawg siv Raspberry Pi 3 gpio los tsav lub servo, dej valve thiab IR teeb pom kev zoo los ntawm kev sib cais transistor buffers (ua rau ntawm lub rooj sib tham me me). Tus qauv NoIR lub koob yees duab ntsaws ncaj qha rau hauv Raspberry Pi.

Lub npe ntawm cov txheej txheem yog: water_blaster_schematic.pdf thiab txuas hauv qab no.

Kuv siv 5v/2.5A muab khoom tshwj xeeb rau Raspberry Pi thiab 12v/1A cov khoom siv rau tsav IR lub teeb pom kev zoo thiab lub qhov dej. Cov khoom siv hluav taws xob 12v tseem tsav lub zog 5v los muab lub zog rau 5v servo. Qhov no tau ua kom lub "nrov nrov" lub zog tswj lub zog cais los ntawm Raspberry Pi 5v cov khoom. Cov khoom siv 12v/1A tau dhau los ua qhov raug ntawm nws qhov txwv (qhov tseeb me ntsis dhau ib zaug kuv ntxiv tus kiv cua). Txoj cai kaw IR lub teeb pom kev zoo ua ntej tso lub valve tso dej kom lub teeb tam sim no tsis pub dhau … Nws yuav zoo dua yog tias koj siv 1.5A cov khoom siv. Nco ntsoov txuas lub hauv paus av ntawm txhua lub zog siv ua ke.

Lub koob yees duab module yog tus qauv NoIR version uas ntsaws rau hauv Raspberry Pi ncaj qha. Nws yog Raspberry Pi cam nrog IR lim twb tau tshem tawm ua kom nws siv tau nrog IR lub teeb pom kev zoo rau kev yees duab hmo ntuj.

Cov servo siv yog tus qauv me me 5v linear servo nrog 3-4 kg-cm ntawm lub zog.

IR lub teeb pom kev yog tus nqi qis 48 coj lub nplhaib kuv pom ntawm EBay txog li $ 4. Nws tsis muaj zog heev thiab tuaj yeem ua kom pom kev tawm mus txog 15 feet xwb. Yog tias koj muaj peev nyiaj ntxiv, tau txais lub teeb pom kev zoo dua yuav yog kev txhim kho zoo.

Kuv ntxiv "debug-hloov" rau gpio23. Txoj cai tshuaj xyuas lub xeev ntawm qhov hloov pauv thiab yog tias nias yuav ua rau lub valve tso dej tawm rau kev sim tshuaj tua hluav taws. Kuv xav tias kuv yuav ua ntau dua nrog qhov hloov pauv tab sis tsis tau xaus qhov siv nws txhua. Kuv yuav tshem nws thiab cov cai uas saib rau nws …

Kauj Ruam 3: Kev Tsim Kho: Lub Koob Yees Duab thiab IR Illuminator

Kev Tsim Kho: Lub Koob Yees Duab thiab IR Illuminator
Kev Tsim Kho: Lub Koob Yees Duab thiab IR Illuminator

Kuv siv Lub Thawv Thauj Khoom Thauj Khoom Plig Yas Thawv ua lub thawv. Feem ntau kuv xav tau qee yam dej-tiv taus vim ntau cov dej tsuag/dej ntws yog qhov tsis tuaj yeem zam. Muaj ntau qhov/qhov txiav tawm tab sis lawv tau npog los ntawm lub qhov muag, cov yas ntshiab, lossis tau muab hlais hauv qab kom nqes dej. Hauv qhov pom tom qab, Kuv yuav tsum tau siv lub thawv hlau nrog lub rhaub dej kub sab hauv txuas nrog cov khoom siv hluav taws xob siab. Los ntawm kev ua qhov ntawd kuv xav tias kuv tuaj yeem zam kev ntxiv kiv cua. Lub thawv yas tau rwb thaiv tsev dhau thiab tso cai rau sab hauv kom sov ntau dhau.

Ib lub qhov rais me tau raug txiav thaum kawg rau lub koob yees duab kom pom thiab IR lub teeb pom kev zoo tau teeb tsa sab hauv cov ntaub yas yas qub uas kuv tau tso ib puag ncig.

Kauj Ruam 4: Kev Tsim Kho: Dej Yeeb Nkab

Kev Tsim Kho: Dej Kav Dej
Kev Tsim Kho: Dej Kav Dej
Kev Tsim Kho: Dej Kav Dej
Kev Tsim Kho: Dej Kav Dej

Cov dej nkag nkag rau hauv lub qhov dej 12v uas txuas nrog ¼ "ID x 3/8" OD yas yas. Qhov ntawd tau txuas nrog ¼ "barbed tubing rau ¾ plam haum PVC txuas thiab glued rau ¾" PVC dej lub hau nrog 1/16 "qhov drilled rau cov dej ntws. Kuv xav khaws cov dej-valve xa tawm ntawm huab cua yog li nws tau teeb tsa sab hauv lub thawv. Muaj qhov txaus ntshai uas kuv tuaj yeem tau txais cov dej tawm tab sis kuv tau ua qhov dej tso rau hauv qab ntawm lub thawv thiab teeb cov khoom siv hluav taws xob siab kom txo qis txoj hauv kev muaj peev xwm ua dej puas rau cov khoom siv hluav taws xob yog tias qhov ntawd tshwm sim. Qhov ua kom zoo nkauj tsawg dua, tab sis muaj kev nyab xeeb dua, phiaj xwm yuav ua kom lub pob valve nyob sab nrauv thiab ua haujlwm 12v xa xov hlau sab hauv. Cov yas yas ntshiab hla cov servo yog txoj hauv kev yooj yim rau rub lub hose-kawg thiab nws ua kom dej tsis txhob poob qis mus rau servo. Tus kiv cua tau xav txog tom qab lub thawv tau sov ntau dhau. Kuv ua lub laj kab me ntsis hla nws kom tsis txhob muaj dej ntws los.

Kauj Ruam 5: Kev Tsim Kho: Aiming Servo

Kev tsim kho: Aiming Servo
Kev tsim kho: Aiming Servo

Lub qhov raug txiav mus rau sab saum toj ntawm lub thawv thiab lub hom phiaj ua haujlwm tau teeb tsa thiab kaw nrog silicon kom tsis txhob muaj dej tawm.

Kauj Ruam 6: Kev Tsim Kho: Mounting Cov Khoom Siv Hluav Taws Xob, Ntxuam, Raspberry Pi, thiab Proto-board

Kev Tsim Kho: Mounting Cov Khoom Siv Hluav Taws Xob, Ntxuam, Raspberry Pi, thiab Proto-board
Kev Tsim Kho: Mounting Cov Khoom Siv Hluav Taws Xob, Ntxuam, Raspberry Pi, thiab Proto-board

Ob qhov khoom siv hluav taws xob (5v thiab 12v) tau txuas rau ib lub hwj huam qaum tawm ntawm ib sab ntawm lub thawv. Raspberry Pi thiab lub rooj sib tham proto tau teeb tsa nyob rau sab ntawm lub npov ze rau saum. Daim ntawv ceeb toom cov qhov dej ntws tawm hauv qab thiab cov qhov cua nkag qhov drilled raws ntug ntug. Tus kiv cua tau teeb tsa rov qab rau Raspberry Pi. Tsis muaj qhov hloov pauv/hloov pauv raws li kuv tsis xav txhawb kom kaw Raspberry Pi tawm yam tsis muaj txoj cai "sudo kaw tam sim no" hais kom ua (piv txwv li tsis xav kom lub zog tua yooj yim heev).

Kauj Ruam 7: Kev Tsim Kho: Pawg Thawj Coj Proto

Kev tsim kho: Pawg Thawj Coj Proto
Kev tsim kho: Pawg Thawj Coj Proto

Lub rooj sib tham proto muaj 5v tus tswj hwm, lim lub hau, lub zog hloov pauv (uas tsav lub servo thiab dej valve), thiab kev debug-hloov.

Kauj Ruam 8: Kev Tsim Kho: Raspberry Pi Lub Koob Yees Duab

Kev Tsim Kho: Raspberry Pi Lub Koob Yees Duab
Kev Tsim Kho: Raspberry Pi Lub Koob Yees Duab

Raspberry Pi cam txuas ncaj qha rau Raspberry Pi ntawm txoj hlua hlua thiab tau teeb tsa ntawm lub phaj yas kom npog qhov saib tawm ntawm xub ntiag ntawm lub npov.

Kauj Ruam 9: Daim Ntawv Teev Npe

Qhov haujlwm tau ua tiav raug nqi txog $ 120. Feem ntau ntawm tus nqi ntawm qhov haujlwm yog Raspberry Pi, lub koob yees duab, servo thiab cov khoom siv fais fab. Kuv pom feem ntau ntawm EBay lossis Amazon thiab cov kav dej hauv lub khw muag khoom kho vajtse hauv ib cheeb tsam.

  • Raspberry Pi 3 (Amazon) $ 38
  • NoIR Lub Koob Yees Duab (EBay) $ 30
  • 5v Analog Servo (4kg-cm torque) (EBay) $ 10
  • 5v/2.4A Cov Khoom Siv Hluav Taws Xob (EBay) $ 8
  • 12v ½”Dej Valve (EBay) $ 5
  • Tubing, Yeeb Nkab-Couplers (Osh) $ 5
  • Yas Ammo Box (Chaw Thauj Khoom) $ 5
  • 12v/1.5A Cov Khoom Siv Hluav Taws Xob (EBay) $ 5
  • IR Illuminator (EBay) $ 4
  • Lwm yam. Cheebtsam (Resistors, Hloov, Diode) $ 2
  • CPU Ntxuam (EBay) $ 2
  • Proto Board, Standoffs, Screws (EBay) $ 2
  • (2) Cov Hluav Taws Xob Hluav Taws Xob (2n5296) (EBay) $ 1
  • 5v Regulator (LM7805) (EBay) $ 1
  • Ntshiab Yas 3/32 "(Kais Plastics Misc. Bin) $ 1
  • Fais Fab Qaum (Osh) $ 1

Khw muag khoom/chaw uas kuv yuav khoom:

  • Alice1101983 EBay Site:
  • 2bevoque EBay Qhov Chaw:
  • Chaw Thauj Khoom
  • Orchard Khoom Kho Vajtse
  • Amazon
  • Kais Plastics

Pom zoo: