Cov txheej txheem:

Lub Teeb Ua Ntej thiab Zam Txim Neeg Hlau Raws Li Arduino: 5 Kauj Ruam
Lub Teeb Ua Ntej thiab Zam Txim Neeg Hlau Raws Li Arduino: 5 Kauj Ruam

Video: Lub Teeb Ua Ntej thiab Zam Txim Neeg Hlau Raws Li Arduino: 5 Kauj Ruam

Video: Lub Teeb Ua Ntej thiab Zam Txim Neeg Hlau Raws Li Arduino: 5 Kauj Ruam
Video: Computer Vision with Python! Resizing Images 2024, Kaum ib hlis
Anonim
Lub Teeb Ua Ntej thiab Zam Cov Neeg Hlau Raws Li Arduino
Lub Teeb Ua Ntej thiab Zam Cov Neeg Hlau Raws Li Arduino

Nov yog txoj haujlwm yooj yim uas ua raws lossis Tsis Txhob Pom.

Kuv Ua Qhov Simulation no hauv Proteus 8.6 pro. Components Required: -1) Arduino uno.

2) 3 ZPO

3) 2 Dc Gear Motors.4) One Servo.5) Peb 1k Resistors.6) ib H-Choj l290D7) Ib qho rau & Tawm Hloov [rau kev hloov pauv ntawm Txoj Haujlwm]

8) 9v thiab 5v Battry

Kauj ruam 1: Ardunio Code

Arduino Code tau hloov kho cov litte -ntsis Hnub tim 23 Lub Ob Hlis 2016]

Txoj Cai no tau tawm tswv yim zoo Kuv tsis xav piav qhia tab sis yog tias koj xav tau qee qhov kev pab poob qis hu rau kuv ntawm ([email protected])

Nco tseg: -Kuv siv ob qhov xwm txheej hauv txoj haujlwm no 1st rau Lub Teeb Tom Qab.2nd ib qho rau Kev zam lub teeb.

Raws li cov xwm txheej no txaus siab Neeg Hlau yuav Ua Raws lossis Tsis Pom Kev. [Qhov no yog Tus Nqi Yam Tsawg kawg ntawm LDR uas kuv xaiv. Hauv lub teeb pom kev nws yog 80 txog 95 tab sis raws li nws qhov Kev Siv zog nce ntxiv thiab ntau qhov hluav taws xob ua rau nws zoo li nws tau ua haujlwm ntawm Txoj Cai ntawm Voltage Divider int a = 400; // Tus Nqi Tshaj Tawm]

Kauj ruam 2: Proteus Cov Ntaub Ntawv

Rau Arduino Library rub tawm los ntawm qhov txuas ntawd

Kauj Ruam 3: Koj H-choj Ua Haujlwm Li Cas

Koj H-choj Ua Haujlwm Li Cas
Koj H-choj Ua Haujlwm Li Cas
Koj H-choj Ua Haujlwm Li Cas
Koj H-choj Ua Haujlwm Li Cas

L293NE/SN754410 yog H-choj yooj yim heev. Nws muaj ob tus choj txuas, ib sab laug ntawm lub nti thiab ib qho ntawm sab xis, thiab tuaj yeem tswj tau 2 lub cav. Nws tuaj yeem tsav mus txog 1 amp tam sim no, thiab ua haujlwm nruab nrab ntawm 4.5V thiab 36V. Lub tshuab DC me me uas koj tab tom siv hauv chav kuaj no tuaj yeem ua haujlwm tsis muaj teeb meem qis yog li H-choj no yuav ua haujlwm zoo xwb. H-choj muaj cov pins thiab cov yam ntxwv hauv qab no: Pin 1 (1, 2EN) ua rau thiab xiam oob qhab peb lub cav txawm hais tias nws tau muab HIGH lossis LOWPin 2 (1A) yog tus lej pinic rau peb lub cav (nkag mus yog HIGH lossis LOW) Pin 3 (1Y) yog rau ib qho ntawm lub tshuab txuas txuas Pin 4-5 yog rau hauv avPin 6 (2Y) yog rau lwm lub dav hlau lub cev Pin 7 (2A) yog tus lej pinic rau peb lub cav (cov tswv yim yog HIGH lossis LOW) Pin 8 (VCC2)) yog lub zog siv hluav taws xob rau peb lub cav, qhov no yuav tsum tau muab qhov ntsuas hluav taws xob ntawm koj lub cavPin 9-11 tsis txuas nrog vim koj tsuas yog siv lub cav hauv lub labPin 12-13 no rau hauv avPin 14-15 tsis txuas nrog Pin 16 (VCC1) yog txuas nrog 5V. Above yog daim duab ntawm H-choj thiab cov pins ua dab tsi hauv peb qhov piv txwv. Nrog rau daim duab yog lub rooj tseeb qhia tias lub cav yuav ua haujlwm raws li lub xeev cov logic pins (uas tau teeb tsa los ntawm peb Arduino).

Hauv Txoj Haujlwm no, qhib tus pin txuas rau tus lej digital ntawm koj Arduino yog li koj tuaj yeem xa nws yog HIGH lossis LOW thiab tig lub cav ON lossis OFF. Cov logic logic lub cev tseem txuas nrog rau tus lej digital ntawm koj Arduino yog li koj tuaj yeem xa nws HIGH thiab LOW kom lub cav tig mus rau hauv ib qho kev qhia, lossis LOW thiab HIGH kom nws tig mus rau lwm qhov kev taw qhia. Lub tshuab hluav taws xob muab hluav taws xob txuas rau qhov hluav taws xob rau lub tshuab, uas feem ntau yog lub zog hluav taws xob sab nraud. Yog tias koj lub cev muaj zog tuaj yeem ua haujlwm ntawm 5V thiab tsawg dua 500mA, koj tuaj yeem siv Arduino qhov 5V tso tawm. Cov motors feem ntau xav tau qhov hluav taws xob siab dua thiab kos tam sim no siab dua qhov no, yog li koj yuav xav tau lub zog hluav taws xob sab nraud.

Txuas lub cav mus rau H-choj Txuas lub cav mus rau H-choj raws li qhia obve hauv daim duab thib ob.

Lossis, yog tias koj siv lub zog hluav taws xob sab nraud rau Arduino, koj tuaj yeem siv Vin tus pin.

Kauj Ruam 4: LDR Ua Haujlwm Li Cas

Tam sim no thawj yam uas yuav xav tau kev piav qhia ntxiv yog kev siv Lub Teeb Pom Kev Tiv Thaiv. Lub Teeb Ntsuas Tus Kws Tiv Thaiv (lossis LDR's) yog cov tiv thaiv uas nws tus nqi hloov pauv nyob ntawm qhov pom ntawm qhov pom kev ib puag ncig, tab sis peb yuav ua li cas thiaj tuaj yeem pom qhov tsis kam nrog Arduino? Zoo koj tsis tuaj yeem tiag tiag, txawm li cas los xij koj tuaj yeem txheeb xyuas qib ntsuas hluav taws xob siv cov koob sib piv, uas tuaj yeem ntsuas (hauv kev siv yooj yim) ntawm 0-5V. Tam sim no koj yuav tau nug "Zoo li cas peb hloov pauv qhov tseem ceeb ua rau hloov pauv qhov hluav taws xob?", Nws yooj yim, peb ua qhov faib hluav taws xob. Ib qho faib hluav taws xob siv hluav taws xob thiab tom qab ntawd tso tawm ib feem ntawm qhov hluav taws xob sib piv rau qhov ntsuas hluav taws xob thiab qhov sib piv ntawm ob qhov txiaj ntsig ntawm resistors siv. Qhov sib npaug uas yog:

Voltage Output = Voltage input * (R2 / (R1 + R2)) Qhov twg R1 yog tus nqi ntawm thawj tus tiv thaiv thiab R2 yog tus nqi thib ob.

Tam sim no qhov no tseem nug cov lus nug "Tab sis dab tsi tiv thaiv qhov tseem ceeb LDR muaj?", Cov lus nug zoo. Qhov tsawg ntawm cov teeb pom kev ib puag ncig ntau dua qhov tsis kam, ntau lub teeb pom kev zoo txhais tau tias qis dua. Tam sim no rau qhov tshwj xeeb LDR Kuv tau siv lawv qhov kev tiv thaiv ntau yam los ntawm 200 - 10 kilo ohms, tab sis qhov kev hloov pauv rau qhov sib txawv yog li nco ntsoov saib qhov twg koj yuav lawv los ntawm thiab sim nrhiav cov ntawv teev tseg lossis qee yam ntawm cov khoom. Tam sim no hauv qhov no rooj plaub R1 yog qhov tseeb peb LDR, yog li cia peb rov qab ua qhov sib npaug thiab ua qee qhov lej-e-khawv koob (lej hluav taws xob ua lej). Tam sim no thawj zaug peb yuav tsum hloov pauv cov kilo ohm qhov tseem ceeb rau ohms: 200 kilo-ohms = 200, 000 ohms 10 kilo-ohms = 10, 000 ohmsSo txhawm rau nrhiav seb qhov hluav taws xob tso tawm yog thaum peb nyob hauv cov suab dub peb ntsaws cov lej hauv qab no: 5 * (10000 / (200000 + 10000)) Cov tswv yim yog 5V raws li qhov uas peb tau txais los ntawm Arduino. Qhov saum toj no muab 0.24V (sib npaug tawm). Tam sim no peb pom tias qhov hluav taws xob tso tawm yog qhov siab tshaj plaws los ntawm kev siv cov lej hauv qab no: 5 * (10000 / (10000 + 10000)) Thiab qhov no muab rau peb 2.5V raws nraim. Yog li cov no yog qhov ntsuas qhov hluav taws xob uas peb yuav nkag mus rau Arduino cov koob sib piv, tab sis cov no tsis yog qhov txiaj ntsig uas yuav pom hauv qhov program, "Tab sis vim li cas?" koj tuaj yeem nug. Arduino siv Analog rau Digital Chip uas hloov pauv qhov hluav taws xob analog rau hauv cov ntaub ntawv siv tau. Tsis zoo li cov pins digital ntawm Arduino uas tsuas tuaj yeem nyeem HIGH lossis LOW lub xeev yog 0 thiab 5V analog pins tuaj yeem nyeem ntawm 0-5V thiab hloov qhov no mus rau ntau tus lej ntawm 0-1023. Tam sim no nrog qee qhov lej ntxiv-e-khawv koob. peb tuaj yeem suav qhov tseeb qhov tseem ceeb ntawm Arduino yuav nyeem li cas.

Vim tias qhov no yuav yog txoj haujlwm tawm ncaj peb tuaj yeem siv cov qauv hauv qab no: Y = mX + C Qhov twg; Y = Digital ValueWhere; m = nqes hav, (nce / khiav), (tus nqi digital / tus nqi sib piv) Qhov twg; C = Y cuam tshuam Qhov Y cuam tshuam yog 0 yog li muab rau peb: Y = mXm = 1023 /5 = 204.6 Yog li ntawd: Tus nqi digital = 204.6 * Tus nqi sib piv Yog li hauv suab dub tus nqi digital yuav yog: 204.6 * 0.24 Uas muab kwv yees li 49. Thiab nyob rau hauv qhov ci ntsa iab nws yuav yog: 204.6 * 2.5 Uas muab kwv yees li 511. Tam sim no nrog ob qho ntawm cov teeb tsa no ntawm ob tus lej sib piv peb tuaj yeem tsim ob qhov sib piv sib txawv los khaws lawv cov txiaj ntsig ob thiab sib piv cov neeg ua haujlwm kom pom qhov twg muaj tus nqi qis tshaj, tig tus neeg hlau nyob rau hauv qhov kev taw qhia.

Pom zoo: