Cov txheej txheem:

Obstacle-Zam Tus Neeg Hlau Nrog Tus Cwj Pwm!: 7 Kauj Ruam (nrog Duab)
Obstacle-Zam Tus Neeg Hlau Nrog Tus Cwj Pwm!: 7 Kauj Ruam (nrog Duab)

Video: Obstacle-Zam Tus Neeg Hlau Nrog Tus Cwj Pwm!: 7 Kauj Ruam (nrog Duab)

Video: Obstacle-Zam Tus Neeg Hlau Nrog Tus Cwj Pwm!: 7 Kauj Ruam (nrog Duab)
Video: "Petus Qhov Kev Ntsib Kev Pom: Nws Qhov Kev Paub txog Kev Qhuab Ntuas thiab Kev Txiav Txim"(Ntu Ob) 2024, Hlis ntuj nqeg
Anonim
Obstacle-Zam Tus Neeg Hlau Nrog Tus Cwj Pwm!
Obstacle-Zam Tus Neeg Hlau Nrog Tus Cwj Pwm!
Obstacle-Zam Tus Neeg Hlau Nrog Tus Cwj Pwm!
Obstacle-Zam Tus Neeg Hlau Nrog Tus Cwj Pwm!
Obstacle-Zam Tus Neeg Hlau Nrog Tus Cwj Pwm!
Obstacle-Zam Tus Neeg Hlau Nrog Tus Cwj Pwm!
Obstacle-Zam Tus Neeg Hlau Nrog Tus Cwj Pwm!
Obstacle-Zam Tus Neeg Hlau Nrog Tus Cwj Pwm!

Tsis zoo li feem ntau roaming 'bots, qhov no ib tus yeej ncig hauv txoj hauv kev uas nws zoo li yog' xav '! Nrog BASIC Stamp microcontroller (Basic Atom, Parallax Basic Stamps, Coridium Stamp, thiab lwm yam), chassis ntawm qee yam, ob peb lub cim, thiab qee qhov kev paub dhau los ntawm cov lus qhia no, koj tuaj yeem tsim tus neeg hlau uas yuav ua rau kev txav txav koj ib txwm tsis muaj programed rau nws! Nov yog daim vis dis aus (nws tsis zoo, tab sis kuv tab tom ua haujlwm ntawd. (Kuv tseem tab tom sim ua haujlwm ib feem uas nws qeeb dhau lawm.)

Kauj Ruam 1: Cov Sensors

Tus (lub npe?)… Zoo, cia peb hu nws Bob. Bob muaj tsib tus cim

  • Ultrasonic Rangefinder (lub npe "sonar")
  • 2 Ntse GP2D12 IR Sensors
  • 1 Txheem IR Sib Dhos (ntau ntxiv txog qhov no tom qab)
  • 1 CdS (Cadmium Sulphide) Photocell

Ultrasonic rangefinder pab Bob pom cov teeb meem uas yog nyob rau ntawm nws xub ntiag; lawv kuj qhia nws tias yam khoom nyob deb li cas ntawm nws. Qhov no tuaj yeem tau txais los ntawm ntau qhov chaw. Koj tuaj yeem pom lawv los ntawm (Parallax; lawv hu nws "Ping)))"), Acroname, HVW thev naus laus zis, thiab ntau qhov chaw ntxiv. Tsis muaj teeb meem koj mus qhov twg los nrhiav lawv, lawv txhua tus raug nqi ib yam (~ $ 30). Ob lub IR ntsuas hluav taws xob ua los ntawm Sharp yog qhov yooj yim heev rau siv thaum siv rau qhov ntsuas pom yooj yim xws li hauv qhov no. Koj tuaj yeem tau txais lawv ntawm cov khw hauv online, xws li cov uas tau teev tseg saum toj no. Lawv pab Bob pom cov teeb meem uas ultrasonic rangefinder ua tsis tau; obstacles uas tau dhau los ze rau ob sab ntawm chasis. Lawv raug nqi kwv yees li $ 12 txog $ 15 nyob ntawm qhov koj tau txais lawv. "IR sib dhos" Kuv ua kuv tus kheej; saib cov kauj ruam 2 rau kev sib dhos. CdS Photocell (lossis lub teeb hloov pauv tau, txhua yam uas koj nyiam) yog txhawm rau txheeb xyuas qhov hloov pauv ntawm qhov pom kev ib puag ncig. Bob siv lawv los paub thaum nws nyob hauv chav tsaus lossis tsaus. Yog tias leej twg muaj kev paub dhau los nrog ib qho ntawm Sharp IR rangers, FYI, lawv tsis raug siv rau qhov ntsuas nrug deb ntawm tus neeg hlau no. Kuv tsis muaj ADC (Analog-to-Digital Converter), thiab kuv tsis paub siv lawv li ntawd. Lawv tsuas yog muab lub HIGH lossis LOW teeb liab rau BS2 microcontroller. Cov ntaub ntawv teev tseg rau Sharp IR's nrog rau Ping))) sensor tuaj yeem pom ntawm net, tab sis yog tias koj tub nkeeg zoo li kuv, koj tuaj yeem nqes me ntsis ntxiv qhov ntawd lawv yog!

Kauj Ruam 2: Khoos Phis Tawj, Lub Hlwb, thiab Lwm Yam Khoom

Khoos phis tawj, Lub paj hlwb, thiab lwm yam khoom siv
Khoos phis tawj, Lub paj hlwb, thiab lwm yam khoom siv
Khoos phis tawj, Lub paj hlwb, thiab lwm yam khoom siv
Khoos phis tawj, Lub paj hlwb, thiab lwm yam khoom siv

Ok. Txhawm rau pib tawm, kho vajtse uas tau siv rau tus neeg hlau no yog ib feem ntawm cov khoom kuv tau txais. Nws yog "Boe-Bot" cov khoom siv los ntawm Parallax (https://www. Parallax.com), tab sis qhov kev tsim qauv no yoog raws; koj tuaj yeem siv cov chassis uas koj xav tau, tsuas yog nco ntsoov tias 1) ultrasonic rangefinder nyob ntawm qhov siab tshaj plaws ntawm tus neeg hlau yog li nws tsis tsoo hauv qab ntawm txoj kev tsheb nqaj hlau, thiab lwm yam, thiab 2) IR sensors tau kaum rau hauv txoj kev lawv tseem tuaj yeem txheeb xyuas cov khoom uas nyob deb li 1 "deb ntawm tus neeg hlau. Qhov no ua rau nws tsis los tsoo cov khoom uas tuaj yeem tsoo lub log. Mounted ntawm lub chassis yog Parallax's Boe-Board uas tuaj nrog kuv cov khoom siv Boe-Bot, uas yooj yim kev txhim kho pawg thawj coj uas tuaj yeem siv nrog ib qho Stamp microcontroller nrog tib qhov kev xav tau hluav taws xob thiab tus pin teeb. Muaj ntau qhov sib txawv ntawm Stamp kev txhim kho cov laug cam hauv is taws nem. Nws yog $ 65 los ntawm Parallax. Ntawm pawg thawj coj saib xyuas kev txhim kho, raws li Bob lub hlwb, yog BS2e (BASIC Stamp 2 e), uas yog ib qho zoo ib yam li BS2, tshwj tsis yog nrog ntau lub cim xeeb (RAM thiab EEPROM). EEPROM yog rau kev khaws cia, thiab RAM yog rau khaws cov kev hloov pauv (ib ntus, tau kawg). Bob yuav tsis ua tus xav ceev tshaj hauv ntiaj teb (~ 4,000 cov lus qhia/feeb), tab sis hav, uas zoo txaus. Bob txav ntawm ob qhov kev sib hloov txuas mus tas li los ntawm Parallax uas, raws li ntau qhov kev pabcuam ua, muaj ntau lub zog. Txog cov kua txiv, nws muaj 4-cell AA roj teeb pob (rau tag nrho ntawm 6V) txuas nrog rau 5V tus tswj hwm ntawm pawg thawj coj loj, uas ua rau cov zis tsis tu ncua ntawm, koj kwv yees nws, 5V zoo li tsis kib cov khoom. Ntau yam khoom siv rau neeg hlau ua haujlwm ntawm 5V lossis 6V khoom; rau qee qhov laj thawj, nws yog tus qauv. Thiab koj tsis txhob "T xav kib cov khoom no; lawv kim heev. BS2e muaj tus tswj hwm sab hauv, tab sis tsis txhob muab nws ntau dua 9V yog tias koj tsis siv lub rooj tsav xwm txhim kho! Tsis tas li, yog tias koj tsis siv kev txhim kho pawg thawj coj (uas ib txwm muaj tus tswj hwm), tom qab ntawd Ua kom ntseeg tau siv 5V tus tswj hwm., uas twv yuav raug hu ncua lub neej.

Kauj Ruam 3: Sib dhos Lub Teeb Sensor Circuit

Sib dhos Lub Teeb Sensor Circuit
Sib dhos Lub Teeb Sensor Circuit

Lub teeb pom kev xav kom muaj hluav taws xob rau BS2e txhawm rau siv nws kom raug. Kuv tau txais txoj cai no tawm ntawm ib ntawm Parallax phau ntawv (qhov tseeb, qhov uas los nrog kuv cov khoom siv). NCO TSEG: PIN 6 YOG TUS PIN tiag 1; Qhov no YUAV TSUM MUAJ NTAWV CODE LOS YOG KOJ YUAV TSUM MUAJ DAB QHIA LWM YAM NTAWV. Ceev faj Tsis txhob hnov qab tias UP.

Kauj Ruam 4: Sib Sau Cov Ntes Dropoff

Sib dhos Cov Ntes Dropoff
Sib dhos Cov Ntes Dropoff
Sib dhos Cov Ntes Dropoff
Sib dhos Cov Ntes Dropoff

Qhov no tuaj yeem muab tso ua ke ntawm qee qhov PCB liab qab. Kuv nyuam qhuav khiav mus rau RadioShack thiab tau txais ib qho, thiab txiav lub rooj tsavxwm kom haum rau hauv Circuit Court. Qhov no yog CRUCIAL. Yog tias koj ua qhov no tsis zoo, Bob tsis zoo yuav tuag. IR ntes yog Panasonic PNA4601, tab sis koj tuaj yeem tau txais lawv los ntawm RatShack, ntxiv rau cov tiv thaiv thiab IR LED. Nws tsis muaj teeb meem loj npaum li cas IR LED koj tau txais, juts kom ntseeg tau tias nws tsis yog IR PHOTOTRANSISTOR. Qhov ntawd yog qhov sib txawv TOTALLY. Tsis tas li ntawd, koj yuav tsum siv cua sov ntsws tubing lossis qee yam quav quav (koj tuaj yeem tsuag tshuaj rau nws dub) kom nqaim nqaim ntawm IR LED, tab sis nws yuav tsum tau muab tshem tawm tag nrho (tshwj tsis yog qhov kawg ntawm LED), lossis lub ntsuas cua yuav tsis ua hauj lwm. Kuv siv cov yas yas los ntawm Parallax. Koj tuaj yeem xaj cov LED thiab cov khoom siv ntawm lawv lub vev xaib.

Hmoov tsis zoo, qhov ntau zaus ntawm IR ntsuas kuv siv tau dav heev, uas txhais tau tias nws muaj kev cuam tshuam ntau dua. Luckily, RadioShack muab ib qho tsuas yog mloog mus rau 38Khz, uas txhais tau tias Bob tsis tshua muaj peev xwm ua coj txawv txawv nyob ib puag ncig kev tswj chaw taws teeb thiab lwm yam khoom siv uas siv IR. DP2D12's yog qhov zoo vim tias lawv tsis muaj kev cuam tshuam zoo vim tias muaj kev kho qhov muag siab dua (tsom iav) thiab cov khoom siv hluav taws xob. Hauv cov phiaj xwm yav tom ntej, Kuv yuav tsis siv cov ntsuas IR ib txwm muaj. Ntse IR's yog qhov zoo dua li cov neeg txais IR yooj yim. NCO TSEG: PIN 8 YOG TUS PIN tiag tiag 10. PIN 9 YOG TSEEB

Kauj Ruam 5: Bob Xav Tau Lub Suab

Bob xav tau suab!
Bob xav tau suab!

Txuas tus neeg hais lus piezo rau tus lej 5, thiab - rau hauv av. Bob yuav tsum qhia nws tus kheej! Qhov zoo tshaj plaws ntawm piezospeaker siv yuav yog qhov saum toj ib qho. Lawv yuav luag txhua 5 volts. Txwv tsis pub, yog tias koj siv qhov ntsuas qis dua 5V, koj yuav xav tau tus tiv thaiv.

Kauj Ruam 6: Ntxiv 'Lub Teeb'

Ua kom Bob saib txias dua hauv qhov tsaus ntuj, nws tig lub teeb thaum nws nkag mus hauv chav tsaus. Ib qho dawb LED yuav ua haujlwm rau qhov no. Txij li qhov Circuit Court yog qhov yooj yim heev, kuv tsuas yog yuav qhia rau koj: tsuas yog siv 220ohm resistor los txwv qhov tam sim no. Thiab los yog chav kawm, - mus rau hauv av.

Kauj Ruam 7: Sau Bob's Brain

Nov yog tus lej rau Bob. Nws tau tawg tawm ua ntu: kev tshaj tawm (qhov hloov pauv thiab hloov pauv), kev pib ua, lub ntsiab lus "voj", thiab cov subroutines. Hom phiaj xwm uas kuv tau siv yog Subsumption-Based FSM (Finite State Machine) Architecture. Yeej, nws ua rau tus neeg hlau khiav nrawm dua, thiab teeb tsa cov cai tau zoo dua. Yog tias koj xav koom nrog hauv lub ntiaj teb uas nyuaj, nyeem PDF ntawm nplooj ntawv no. Kuv tau ntxiv cov lus pom (cov ntawv hauv ntsuab) los pab txheeb xyuas qhov sib txawv ntawm cov cai. Txhua qhov kev sib txuas rau BS2e tau teev tseg hauv qab no

  • PIN 0 - 220ohm resistor rau CdS photocell
  • PIN 5 - tus coj zoo ntawm tus hais lus piezo
  • PIN 6 - SIG (teeb liab) kab ntawm sab laug GP2D12 (sab laug thaum saib cov neeg hlau saum toj no)
  • PIN 8 - SIG kab ntawm sab xis GP2D12
  • PIN 9 - Tawm (tso tawm) kab ntawm IR ntes (poob sensor)
  • PIN 10 - 1Kohm resistor rau qhov ua tau zoo ntawm IR LED
  • PIN 15 - SIG cov hlau lead ntawm ultrasonic rangefinder

Bob tus lej tau sau nyob rau hauv txoj kev uas 1) Nws, lossis chav kawm, zam cov khoom thiab tso tawm 2) suav tus naj npawb ntawm txhua lub sijhawm ntawm ib qho ntawm cov ntsuas tau tshwm sim, thiab txiav txim siab yog tias nws nyob hauv qhov chaw uas tsis tuaj yeem ua haujlwm hauv 3) tsim pseudo- cov lej zauv rau kev txav txav 4) tig rau "taws teeb" tom qab txiav txim siab tias nws nyob hauv chav tsaus ntuj los ntawm kev siv timers thiab YOG … THEN cov nqe lus Kuv tseem tab tom ua haujlwm 'lag' ntu. Nws yuav tsum ua nrog lub sijhawm tso tawm ntawm lub capacitor rau lub teeb pom kev zoo, ntxiv rau lub nra hnyav dua BS2e.

Pom zoo: