Cov txheej txheem:

Arduino rau Nerf: Chronograph thiab Shot Counter: 28 Kauj Ruam (nrog Duab)
Arduino rau Nerf: Chronograph thiab Shot Counter: 28 Kauj Ruam (nrog Duab)

Video: Arduino rau Nerf: Chronograph thiab Shot Counter: 28 Kauj Ruam (nrog Duab)

Video: Arduino rau Nerf: Chronograph thiab Shot Counter: 28 Kauj Ruam (nrog Duab)
Video: Arduino Nerf Target Game 2024, Hlis ntuj nqeg
Anonim
Image
Image
Qhov Chaw thiab Khoom Siv
Qhov Chaw thiab Khoom Siv

Kuv Cov Lus Qhia yav dhau los tau npog cov hauv paus ntawm kev tshawb pom dart nrawm siv lub tshuab xa hluav taws xob thiab ntsuas hluav taws xob. Txoj haujlwm no siv nws ib kauj ruam ntxiv, siv lub tshuab luam ntawv Circuit Board, tso saib, thiab roj teeb los ua lub txee ammo thiab chronograph. Ib qho ntxiv, peb ntxiv qee qhov LEDs los sim ua qhov nyem nyem. Yog vim li cas, pib pib pib…

Qhov no yuav zoo li yog txoj haujlwm txaus ntshai nrog ntau cov kauj ruam, tab sis kev siv cov ntawv luam tawm Circuit board thiab cov khoom lag luam rau cov zaub thiab microcontroller ua rau nws yooj yim dua los sib sau ua txoj haujlwm uas ntseeg tau. Kuv tseem yuav muab cov lej xeem rau txhua lub hauv paus ntawm txoj haujlwm los pab ua kom koj ua tiav. Koj ua tau!

Kauj Ruam 1: Cov Khoom thiab Cov Khoom Siv

Qhov Chaw thiab Khoom Siv
Qhov Chaw thiab Khoom Siv
Qhov Chaw thiab Khoom Siv
Qhov Chaw thiab Khoom Siv

Luam Circuit Board, peb daim ntawv yuav raug nqi koj tsuas yog $ 12.40 nrog thauj dawb, yog li ua qhov no nrog phooj ywg los qhia tus nqi:

OSH Park:

Cov Khoom Siv Hluav Taws Xob

  • 1 ea., Q1 MOSFET N-CH 20V 530MA TO92-3, Microchip TN0702N3-G,
  • 5 ea., 5mm LEDs, xim uas koj xaiv

    • Dawb
    • Amber
  • 6 ea., 100 ohm 1/8W 5% tam sim no limiting resistors,
  • 2 ea., 10K 1/8W 5% resistor,
  • 1 ua ea. Photo Transistor, [Everlight PT928-6B-F] (https://www.digikey.com/short/qtrp5m)
  • 1 ua ea. IR Emitter, [Everlight IR928-6C-F] (https://www.digikey.com/short/jzr3b8)
  • 1 ua ea. 100 ohm resistor 1/8W 5%, [Stackpole CF18JT100R] (https://www.digikey.com/short/q72818)
  • 1 ea., Txiv neej-txiv neej 12 "jumper xov hlau, [Adafruit 1955], (https://www.digikey.com/short/pzhhrt)
  • 1 ea., Adafruit ItsyBitys 8Mhz 3V, [Adafruit 3675], (https://www.digikey.com/short/pzhhwj)
  • 1 ea., BATT HOLDER AAA 3 CELL 6 "LEADS,
  • 1 ea., SWITCH SLIDE SPST, E-Hloov EG1218,
  • 1 ea., SITTLE TACTILE SPST-NO 0.05A 24V, TE 1825910-6,
  • 1 ea., 7-ntu I2C zaub:

    • RED Adafruit 878
    • Blue Adafruit 881,

3D Qhov

Cov ntu 3D tau tsim feem ntau hauv TinkerCad, uas txhais tau tias lawv yooj yim hloov kho rau koj tus kheej lub hom phiaj:

  • Cap thiab Lub Cev:
  • Barrel Adapter:

Kuv kuj tseem tau luam cov STLs ntawm Thingiverse:

Cov Cuab Yeej & Lwm Yam:

  • Soldering Hlau
  • Cov hlua hlau
  • Yaug txiav cov snippers
  • Kub kua nplaum phom
  • Hlau
  • #2 xov tsim screws
  • 3/4 "AWV

Kauj ruam 2:

Duab
Duab
Duab
Duab

Peb yuav pib nrog lub rooj tsav xwm hauv Circuit Court.

  • Cais tawm ob lub rooj me me "tawg" los ntawm nruab nrab thiab tso tseg rau tom kawg siv yaug-txiav lossis los ntawm kev sib tw.
  • Txiav cov npoo ntxhib, cov ntawv lossis cov xuab zeb kom du.

Kauj ruam 3:

Duab
Duab
Duab
Duab
Duab
Duab

Kuv tsis mus sim thiab qhia koj li soldering. Nov yog ob peb ntawm kuv cov yeeb yaj kiab uas kuv nyiam tshaj plaws uas kuv ua tau:

  • Carrie Ann los ntawm Geek Girl Diaries.
  • Colin los ntawm Adafruit

Feem ntau:

  • Nrhiav qhov chaw ntawm PCB siv cov cim lo lo ntxhuav.
  • Khoov qhov tivthaiv ua kom haum rau taw taw.
  • Siv cov hlau lead.
  • Txiav cov ua

Cia peb pib nrog cov neeg tawm tsam vim tias lawv yog cov coob tshaj plaws, zaum qis tshaj, thiab yooj yim rau yaj. Lawv tiv taus cua sov ntau dua thiab yuav muab sijhawm rau koj txhuam ntawm koj cov txheej txheem. Lawv kuj tsis muaj qhov sib txawv, yog li koj tuaj yeem tso lawv rau hauv ob qho tib si.

  • 6 ea., 100-ohm resistors uas txwv tam sim no rau LEDs mus rau hauv qhov chaw cim "*R" thiab "100".
  • 2 ea., 10, 000-ohm resistors mus rau hauv qhov chaw cim "10K".

Kauj ruam 4:

Duab
Duab
Duab
Duab
Duab
Duab

Tom ntej no, cia nruab ib lub emitter / detector khub. Yog tias koj xav tau cov ntaub ntawv ntau ntxiv txog kev ua haujlwm no li cas, rov qab mus rau kuv li Kev Qhia Ua Ntej Ua Ntej.

  • IR emitter pom tseeb thiab mus rau qhov chaw cim "EMIT" nrog lub lens sib npaug taw mus rau nruab nrab.
  • IR ntes tau dub thiab mus rau qhov chaw cim "DETECT" nrog lub lens sib npaug taw mus rau IR emitter.

Kauj ruam 5:

Duab
Duab
Duab
Duab

Txij li 5 LEDs yuav kos tam sim no ntau dua li tuaj yeem muab ncaj qha los ntawm lub microcontroller, peb yuav siv lub transistor hloov los qhib thiab tua lawv. Qhov no tuaj yeem yog N-channel MOSFET me lossis ib txwm NPN transistor txij li peb tab tom cuam tshuam txog 100 mA.

N-MOSFET mus rau qhov chaw cim "Q1" nrog lub ntsej muag tiaj tus txuam nrog cov cim

Kauj Ruam 6:

Duab
Duab
Duab
Duab
Duab
Duab

LEDs muaj polarity. Cov hlau lead ntev yog qhov zoo thiab cim nrog "+" ntawm PCB. Kuj tseem muaj lub tiaj tiaj nyob ntawm ib sab uas kuv tsis tuaj yeem pom meej.

  • Txhim kho tag nrho cov LEDs ntawm sab rov qab tiv thaiv thiab MOSFET.
  • Tig lub rooj tsavxwm hla thiab muab ib qho hlau lead, thiab tsuas yog ib qho txhuas ntawm txhua LED coj los tso rau hauv.
  • Txheeb xyuas cov LEDs, txheeb xyuas cov hlau lead ntev nyob hauv lub qhov cim "+", thiab tias LED tau yaug nrog lub rooj tsavxwm.

    Rhaub qhov sib koom ua ke thaum maj mam thawb ntawm LED kom nws zaum (saib daim duab 4)

  • Muab cov hlau lead uas seem tshuav thiab luas.

Kauj ruam 7:

Duab
Duab

Kuaj kom haum lub nplhaib coj hauv 3D luam ntawv lub hau. Nws yuav tsuas haum rau ib txoj hauv kev, nrog MOSFET mus rau qhov "t-shaped" qhib.

Kauj ruam 8:

Duab
Duab
Duab
Duab
Duab
Duab

Lub sijhawm los pib thaiv!

  • Siv plaub 6 "xov hlau thiab kab txaij thiab txhuam txhua qhov kawg.
  • Cov laug rau hauv taub hau ntawm PCB:

    • Liab rau "+".
    • Dub rau "-".
    • Kev xaiv xim rau "S" uas yog "strobe", lossis lub teeb liab kom qhib lub LED.
    • Kev xaiv xim rau "G" uas yog "rooj vag", lossis lub teeb liab los ntawm IR ntes.

Kauj ruam 9:

Duab
Duab
Duab
Duab
Duab
Duab

Cia peb tau txais cov zaub npaj. Kuv nyiam Adafruit's "I2C hnab ev khoom" vim tias lawv tsuas siv ob lub cim xov hlau los ua haujlwm (ntxiv rau lub zog thiab hauv av). Koj tseem tuaj yeem txuas lawv ua ke.

Cov lus qhia Adafruit ua haujlwm yog ntawm:

  • Ua kom ntseeg tau tias koj tau txais cov lus qhia ua kom raug nrog cov lej zauv piv rau PCB cov cim.
  • Raws li hauv qib ua ntej, tin thiab strip 4 ea., 6 xov hlau:

    • Liab rau "+"
    • Dub rau "-".
    • Xaiv xim rau "SDA" thiab "SCL".

Kauj ruam 10:

Duab
Duab
Duab
Duab

Lub pob yog rau cov neeg siv tswv yim. Kuv siv nws rov pib dua lub ammo counter, tab sis nws tuaj yeem siv los qhib LEDs thiab tawm zoo li lub teeb nyem, lossis qhov uas koj lub tswv yim tau tshwm sim nrog. Nws yog koj qhov project.

  • Ntxig qhov hloov mus rau hauv lub rooj tsav xwm tawg thiab muab cov hlau txuas rau.
  • Txiav, kab, thiab tin ob 6 "xov hlau. Ib qho yuav tsum yog xim dub rau hauv av, lwm qhov yog xim txawv.
  • Muab cov xov hlau tso rau ntawm lub rooj tsav xwm tawg. Kev taw qhia tsis muaj teeb meem.

Kauj ruam 11:

Duab
Duab
Duab
Duab
Duab
Duab

Qhov swb swb yog siv los qhib lub hwj chim rau thiab tua. Tus tsim yog me ntsis tsis meej pem, tab sis pab nrog sib dhos. Cov cim ntawm lub vijtsam txhob lo lo ntxhuav qhia pom qhov hloov pauv tau ua txhaum kev sib cuag ntawm ob txoj hauv kev zoo.

  • Txiav cov hlau lead rau ntawm rooj plaub kom ntev li 2 "nyob txuas.
  • Solder tus swb hloov mus rau lub rooj sib cais.
  • Sawb thiab tin seem uas tshuav ~ 4 "ua los ntawm lub roj teeb thiab cov laug rau ib sab ntawm pawg thawj coj tawg (liab rau"+", dub rau"-").
  • Muab cov hmoov txhuas coj los tso rau ntawm lub roj teeb mus rau lwm sab ntawm lub rooj tsav xwm tawg (liab rau "+", dub rau "-").

Kauj ruam 12:

Duab
Duab
Duab
Duab
Duab
Duab

Lub sijhawm pib ua ke sib xyaw ua ke ntau yam. Peb yuav txuag lub pob rau tom kawg vim tias peb tsuas tuaj yeem haum peb kab nyob ntawm ib lub qhov.

  • Siv peb lub ntsej muag liab, txaij thiab ntswj ua ke:

    • LED nplhaib
    • 7-ntu zaub
    • Swb hloov
  • Ntxig lawv hla hauv qab ntawm "3V" ncoo ntawm ItsyBitsy thiab cov laug hauv qhov chaw.

    Yog tias koj siv lwm hom board, siv tus pin "5V"

  • Siv peb lub xov tooj cua dub hauv av los ntawm cov khoom sib xws, tshem tawm, ntswj, thiab ntxig rau hauv "G" ncoo hla ntawm "3V" ncoo.

Kauj ruam 13:

Duab
Duab
Duab
Duab

Ua kom tiav txuas lub nplhaib LED los ntawm kev txuas lub qhov rooj thiab cov xov hluav taws xob rau cov pins uas tsim nyog:

  • Txuas "G" lossis lub qhov rooj hlau mus rau ItsyBitsy tus pin A0. Qhov no yuav tso cai rau peb kom tau txais kev nyeem analog rau kev daws teeb meem.
  • Txuas tus "S" lossis strobe xaim rau tus pin 9 uas yuav tso cai rau peb rau PWM lub teeb liab yog tias peb xav tswj lub teeb ci tom qab.

Kauj ruam 14:

Duab
Duab

Ua kom tiav txuas 7-ntu zaub los ntawm txuas I2C xov hlau:

  • Txuas tus SCL ("moos") tus pin los ntawm cov zaub rau SCL tus pin ntawm ItsyBitsy.
  • Txuas SDA ("cov ntaub ntawv") tus pin los ntawm cov zaub rau SDA tus pin ntawm ItsyBitsy.

Kauj ruam 15:

Duab
Duab

Lub sij hawm ntxiv khawm:

  • Txuas cov hlau lead dub mus rau ItsyBitsy "G" tus pin rau hauv qab luv luv ntawm ntug ntawm lub rooj tsavxwm. Qhov no yog tib lub teeb liab ib yam li lwm tus "G" tus pin.
  • Txuas cov xim coj mus rau ItsyBitsy tus pin "7". Qhov no yuav tso cai rau peb siv lub khoos phis tawj cuam tshuam lub teeb liab kom rov kho lub txee.

Kauj ruam 16:

Duab
Duab
Duab
Duab

Txij ntawm no mus, nws yog lub sijhawm los sim peb cov khoom sib txawv.

Yog tias qhov no yog koj thawj zaug siv Adafruit ItsyBitsy, koj yuav tsum teeb tsa koj li Arduino IDE kom paub txog lub rooj tsavxwm.

Ua raws cov lus qhia ntawm

Yog tias qhov no yog koj thawj zaug siv Adafruit's I2C cov lus, koj yuav tau rov teeb tsa koj li Arduino IDE los siv Adafruit lub tsev qiv ntawv.

Ua raws cov lus qhia ntawm

Lub sijhawm sim nws tawm:

  • Txuas koj ItsyBitsy rau koj lub computer siv USB Micro.
  • [Cuab Yeej] -> [Pawg Thawj Coj] -> [Adafruit IstyBitsy 32U4 8MHz].
  • [Cuab Yeej] -> [Port] -> qhov chaw nres nkoj txuas nrog, feem ntau yog tus lej siab tshaj plaws.
  • [File] -> [Piv txwv] -> [Adafruit LED Backpack Library] -> [xyaseg]
  • [Sketch] -> [Upload]

Yog tias kev tshaj tawm tiav, cov zaub yuav tsum muaj lub neej thiab pib qhia cov lej ntxiv. Lub sijhawm tso tawm "whoop!" ntawm yeeb koob. Yog tsis yog, lub sijhawm tso rau lub kaus mom daws teeb meem.

Yog tias upload tsis tau tiav, ua ob zaug tshuaj xyuas ItsyBitsy teeb tsa cov lus qhia, IDE teeb tsa, thiab USB txuas txuas.

Yog tias lub teeb pom kev tsis pom kev, rov xyuas ob zaug lub hnab ntawv qhia thiab koj cov xov txuas.

Kauj ruam 17:

Lub sijhawm los ntsuas tus IR emitter / detector khub.

  • [File] -> [Piv txwv] -> [Analog] -> [AnalogReadSerial]
  • Upload rau koj pawg thawj coj saib.
  • Nyem rau "Serial Monitor" lub cim nyob rau sab xis ntawm IDE.

Nrog rau qhov muaj hmoo, koj tau pom kwj ntawm qhov muaj txiaj ntsig los rau hauv. Cov no yog 10-ntsis analog qhov tseem ceeb yog li yuav los ntawm 0 txog 1023.

  • Thaum cov duab transistor raug rau lub teeb, nws tso cai rau tam sim no kom dhau thiab lub teeb liab yuav poob ntawm 0.
  • Thaum tus yees duab transistor tsis pom IR, nws nres tam sim no tso cai rau lub teeb liab mus rau siab.

Yog tias koj tsis tau txais kev hloov pauv, ntawm no yog qee yam los tshuaj xyuas:

  • Txheeb xyuas ob txoj hlua ntawm lub nplhaib mus rau lub microcontroller.
  • Puas yog IR LED qhib?

    • Nws yuav tsum sov me ntsis rau qhov kov.
    • Lub koob yees duab xov tooj ntawm tes pheej yig yuav qhia IR lub teeb kom zoo.
    • Yog tias nws tsis nyob, nws yuav muaj kab rov qab.

Kauj ruam 18:

Lub sij hawm los ntsuas qhov strobe. Peb tsuas yog yuav siv qhov piv txwv yooj yim "Blink" thiab hloov tus lej tus lej:

  • [File] -> [Piv txwv] -> [01. Basic] -> [Blink]
  • Nyob ntawm koj li IDE version, hloov tus lej tus lej kom phim tus peb xaiv hauv qib 13 (tus lej 9).
  • Rub tawm daim duab thiab npaj kom dig muag.

Yog tias koj tsis tau txais qhov xav tau flashing, txheeb xyuas koj cov xov hlau thiab tus lej tus lej.

Kauj ruam 19:

Txhua yam uas tseem tshuav los sim yog lub laub khawm:

  • [File] -> [Piv txwv] -> [01. Basic] -> [DigitalReadSerial]
  • Hloov pushButton = 2; rau pushButton = 7;
  • Hloov pinMode (pushButton, INPUT); rau pinMode (pushButton, INPUT_PULLUP);
  • Upload.

INPUT_PULLUP txuas lub zog tsis muaj zog tiv thaiv rau 3V uas txhais tau tias digitalRead () yuav tsum rov qab "HIGH" lossis "1". Thaum lub pob nyem, nws yuav tsum rov "LOW" lossis "0".

Yog tias koj tsis tau txais qhov txiaj ntsig xav tau, rov qab mus thiab tshawb xyuas lub khawm khawm.

Kauj ruam 20:

Duab
Duab
Duab
Duab
Duab
Duab

Lub sijhawm los tso peb cov kab ke sim rau hauv kev koom ua ke. Pib los ntawm kev npaj PVC lub thoob:

  • Txiav ib ntu ntawm 3/4 "PCV 85mm ntev.
  • Kos 6mm los ntawm qhov kawg thiab laum 1/4 "lossis qhov loj dua los ntawm ob sab, raws li qhov nruab nrab ua tau.
  • Tsuag sab hauv ntawm lub thoob tiaj dub kom nqus tau pom lub teeb IR thaum lub dart hla.
  • Siv ib daim ntawv los cim qhov chaw ntawm qhov ntawm qhov kawg ntawm lub thoob.

Kauj ruam 21:

Duab
Duab
Duab
Duab
  • Ntsuas kom haum cov roj teeb thiab txiav yog tias xav tau.
  • Ntxig cov ntaub ntawv (qhov kawg ntawm qhov txuas mus rau lub zog qhib qhib).
  • Tack cov ntaub ntawv nyob rau hauv qhov chaw nrog cov kua nplaum kub (tsis ntau dhau thaum peb yuav tsum muab nws sib nrug tom qab).

Kauj ruam 22:

Duab
Duab
Duab
Duab
Duab
Duab

Ntxig lub hwj huam hloov thiab khawm mus rau hauv rooj plaub 3D thiab kho qhov chaw nrog kua nplaum kub

Kauj ruam 23:

Duab
Duab
Duab
Duab

Xaub lub ItsyBitsy rau hauv nws lub qhov thiab npaj cov thaiv kom peb muaj txoj hauv kev rau lub thoob

Kauj Ruam 24:

Duab
Duab
Duab
Duab
  • Ntxig lub nplhaib LED hauv lub hau thiab tsoo hauv qhov chaw nrog kua nplaum kub.
  • Txuas lub hau kom ItsyBitsy USB chaw nres nkoj tawm hauv qhov chaw raug.

Kauj ruam 25:

Duab
Duab
  • Ntxig koj lub thoob kom cov cim sib dhos ntawm lub thoob kawg phim lub cim cim.
  • Pom qhov muag pom tus IR emitter thiab kuaj pom thiab pom los ntawm lub qhov hauv lub thoob. Ua qhov loj yog xav tau.
  • Txuas lub USB mus rau ItsyBitsy thiab rov ua dua IR cov tshev (AnalogReadSerial kos duab).

Kauj ruam 26:

Duab
Duab
Duab
Duab
Duab
Duab

Tau txais qhov sib dhos zaum kawg yog qhov nyuaj me ntsis. Koj xav kom thauj tog rau nkoj koj txoj hauv kev raug.

  • Txuas lub hwj chim adapter rau Nerf blaster.
  • Xaub lub rooj foob rau ntawm lub adapter, txheeb xyuas tias peb lub qhov ntsia hlau ntawm lub blaster kawg kab.
  • Txheeb xyuas cov kab sib dhos ntawm sab tawm.
  • Ua tib zoo tshem tawm lub rooj sib txoos uas siv lub thoob ntim khoom.
  • Ua tib zoo xaub lub thawv ntim tawm ntawm lub adapter thaum tuav PVC nyob hauv qhov chaw nrog koj tus ntiv tes sab hauv.
  • Tack lub thoob nyob rau hauv qhov chaw nrog kub kua nplaum.
  • Reassemble, tshuaj xyuas kev noj zaub mov
  • Txuas lub hau thiab lub thoob adapter siv cov ntsia hlau. #2 xov tsim, lossis tsis siv Nerf screws yuav ua haujlwm.

Kauj ruam 27:

Duab
Duab

Lub sijhawm rau qee qhov riam phom qib firmware.

  • Rub tawm thiab tom qab ntawd rub daim duab txuas mus rau ItsyBitsy.
  • Txheeb xyuas cov zaub yog flashes dashes (kom txog rau thaum thawj zaug raug rho tawm haujlwm).
  • Muab koj tus ntiv tes tso rau hauv qhov kawg kom deb txaus txhawm rau thaiv kab teeb IR thiab tom qab ntawd tshem nws sai.
  • Txheeb xyuas koj tau txais lub teeb nyem los ntawm LEDs.
  • Txheeb xyuas koj tau txais cov lej nyeem uas yuav hloov los ntawm "1" (suav suav) thiab qee tus taw me me ib tus lej thib ob zoo li "1.5".
  • Nias lub pob nyob rau hauv qab ntawm lub thoob thiab txheeb xyuas nws rov qab mus rau qhov muag ntsais muag (rov pib suav suav).

Yog tias ib qho ntawm cov kauj ruam no ua tsis tau, yog li rov qab thiab rov ua dua ob zaug ua haujlwm siv cov ntawv xeem dhau los. Txheeb xyuas cov kab thaiv kom pom tias muaj dab tsi raug txhawb nqa thaum sib dhos.

Kauj Ruam 28: Dab Tsi Ntxiv?

Tam sim no koj paub nrawm npaum li cas koj rab phom Nerf tab tom tua, koj tuaj yeem ntsuas qhov cuam tshuam ntawm ib qho qauv uas koj ua. Txij li lub thoob yog tshem tau thiab nqa tau, koj tuaj yeem cia koj cov phooj ywg chrono lawv cov blasters.

Txav mus rau tom ntej hauv kab ntawv no, peb yuav saib xyuas kev hloov kho lub roj teeb thiab txuas rau LiPo, siv MOSFET los tswj cov yoov yoov, thiab ua haujlwm rau xaiv cov txheej txheem tua hluav taws nrog kev ua haujlwm tau zoo.

Arduino Kev Sib Tw 2019
Arduino Kev Sib Tw 2019
Arduino Kev Sib Tw 2019
Arduino Kev Sib Tw 2019

Khiav Tawm Hauv Arduino Contest 2019

Pom zoo: