Cov txheej txheem:

Tsav Tsheb Me Me Nrog TB6612FNG: 8 Kauj Ruam
Tsav Tsheb Me Me Nrog TB6612FNG: 8 Kauj Ruam

Video: Tsav Tsheb Me Me Nrog TB6612FNG: 8 Kauj Ruam

Video: Tsav Tsheb Me Me Nrog TB6612FNG: 8 Kauj Ruam
Video: Plab Plab Ntswg..(Pluav Pluav Ntswg) Maiv Twm New Song 2023-2024 2024, Kaum ib hlis
Anonim
Tsav Tsheb Me Me Nrog TB6612FNG
Tsav Tsheb Me Me Nrog TB6612FNG

TB6612FNG yog ob lub cav tsav IC los ntawm Toshiba. Muaj ntau ntau cov pawg sib cais tawm rau nws thiab nws yog ib qho ntawm cov neeg nyiam xaiv los tsav lub cav me me.

Muaj ntau ntau ntawm cov peev txheej hauv online ntawm kev pib nrog nws TB6612FNG tab sis kuv txiav txim siab sau qhov no los xij txhawm rau ua kom zoo dua qhov kuv tau hla.

Kuv yuav tsom mus rau qhov kev tswj hwm lub ntsiab lus thiab tseem piav qhia txog Sparkfun TB6612FNG lub cav tsav tsheb lub cav kom ntxaws hauv cov lus qhia no.

Kauj Ruam 1: Qhov Yuav Tsum Tau

Nov yog yam peb yuav siv niaj hnub no:

1) Micro Hlau motors

2) TB6612FNG tsav tsheb

3) Ib qho Arduino thiab USB cable

4) Lub zog siv hluav taws xob rau lub cav

5) Daim ntawv qhia zaub mov

6) Jumper xov hlau

Kauj Ruam 2: TB6612FNG Breakout Board

TB6612FNG Breakout Board
TB6612FNG Breakout Board

Raws li kuv tau hais ua ntej, muaj ntau qhov kev tawm tsam los ntawm cov tuam txhab sib txawv rau TB6612FNG. Txhua tus ntawm lawv muaj ntau lossis tsawg dua cov khoom sib xws ntawm lawv thiab kuj zoo ib yam pinout.

Cov Capacitors tau muab muag rau ntawm lub rooj tsavxwm kom tiv thaiv suab nrov los ntawm cov motors, yog li koj yuav tsis tau muab cov khoom siv hluav taws xob tso rau ntawm lub cav.

IC kuj tseem tuaj nrog sab hauv sab hauv los tiv thaiv rov qab EMF los ntawm lub cav. Tab sis muaj kev ntsuas kev nyab xeeb ntxiv ua rau tsis muaj leej twg ua. Kuv tsis ntxiv lawv vim tias kuv lub cav tsis loj heev thiab kuv luv luv ntawm diodes: |

Kauj ruam 3: Pin Outs

Tus Pin Outs
Tus Pin Outs

TB6612FNG pawg thawj coj tawg muaj kev ntseeg siab heev. Txhua lub cav tso tawm, tawm tswv yim thiab txuas hluav taws xob tau sib koom ua ke kom yooj yim tshaj plaws ntawm kev siv.

Kuv tau ua piv txwv ntawm tus pinouts thiab yuav ua li cas txuas lawv, Kuv vam tias nws los tau yooj yim thaum txuas tag nrho cov xov hlau:)

Kauj ruam 4: Schematics

Schematics
Schematics
Schematics
Schematics

Kuv tshiab haum rau siv Fritzing. Kuv pom cov phiaj xwm hluav taws xob los ntawm Fritzing nyuaj rau nkag siab, tab sis lub khob cij saib yog yooj yim rau Cov Lus Qhia. Xav tias yuav nug cov lus nug yog tias ib qho ntawm cov xaim txuas zoo li tsis meej pem.

Kauj Ruam 5: Txuas Nws

Txuas Nws
Txuas Nws

Hlau txhua yam raws li schematics. Muaj ntau cov xov hlau, nco ntsoov xyuas ob zaug tom qab txhua qhov txuas.

Kuv siv cov Arduino Pins hauv qab no rau cov tswv yim tsav tsheb:

Tsav Tsheb -> Tus lej Pin Arduino

1) PWMA -> 5

2) INA1 -> 2

3) INA2 -> 4

4) PWMB -> 6

5) INB1 -> 7

6) INB2 -> 8

Tej yam uas tuaj yeem mus tsis raug hauv theem no: 1) Tsis txhob thim rov qab qhov sib txawv thaum txuas Vm thiab GND los ntawm lub zog siv. Koj tuaj yeem kib koj tus tsav tsheb.

2) Nco ntsoov txuas PWMA thiab PWMB rau PWM pins ntawm arduino.

3) Nco ntsoov txuas Arduino GND thiab GND los ntawm tus tsav tsheb yog tias koj siv lub zog sib txawv rau txhua tus.

Kauj Ruam 6: Rub tawm thiab Txhim Kho Lub Tsev Qiv Ntawv

Rub tawm lub tsev qiv ntawv los ntawm Sparkfun's GitHub nplooj ntawv.

Thaum koj tau rub tawm cov ntawv zip, qhib koj li Arduino IDE.

Los ntawm Sketch> suav nrog Tsev Qiv Ntawv> Ntxiv. Zip Library, ntxiv lub tsev qiv ntawv koj rub tawm.

Thaum ua tiav kev teeb tsa, nws yuav tsum tshwm ntawm Cov Ntaub Ntawv> Piv txwv, raws li 'SparkFun TB6612FNG Lub Tsev Qiv Ntawv'

Yog tias koj muaj teeb meem rub tawm thiab teeb tsa Lub Tsev Kawm Ntawv Arduino, txheeb xyuas qib 5 ntawm cov lus qhia no.

Kauj Ruam 7: Khiav Tus Qauv Piv Txwv

Tam sim no peb muaj peb lub tsev qiv ntawv npaj txhij, peb tuaj yeem tso tus lej piv txwv los sim nws.

1) Qhib 'MotorTestRun' piv txwv los ntawm 'Sparkfun TB6612FNG Tsav Tsav Tsheb Tsav Tsheb' teev rau hauv koj lub tsev qiv ntawv.

Nco tseg: Yog tias koj tsis siv tus lej tus lej tib yam li tau hais hauv kauj ruam 5, nco ntsoov hloov tus lej tus lej txhais raws li koj teeb tsa.

2) Xaiv koj pawg thawj coj los ntawm tus thawj tswj hwm pawg thawj coj

3) Tshaj tawm koj cov cai thiab lub cav yuav tsum pib txav mus

Thaum koj rub cov motors yuav tsum pib txav mus. Yog tias lawv tsis yog, xyuas koj cov xov ntxiv.

Kauj Ruam 8: Lub Tsev Piav Qhia

Tam sim no piav qhia yuav siv lub tsev qiv ntawv rau koj tus kheej li cas.

Ua ntej pib nrog ntshuam lub tsev qiv ntawv thiab pib ua tus pin ntawm arduino

#suav nrog

#define AIN1 2 #define AIN2 4 #define PWMA 5 #define BIN1 7 #define BIN2 8 #define PWMB 6 #txhais STBY 9

Txhawm rau pib koj cov khoom siv lub cev, koj yuav tsum teeb tsa offsets rau txhua lub cav. Xav txog yog tias koj tab tom ua cov lus txib ua ntej ntawm koj lub cav, thiab nws tau tig rov qab. Koj tuaj yeem rov ua nws tus kheej, lossis koj tuaj yeem hloov pauv qhov offset los ntawm no. Nifty me ntsis QoL hack ntxiv los ntawm SparkFun. Qhov tseem ceeb ntawm cov offsets no yog 1 lossis -1.

Tom qab ntawd koj yuav tsum pib ua ntej ntawm txhua lub Motors nrog cov ntsuas hauv qab no;

Tsav = Tsav (Pin 1, Pin 2, PWM pin, offset, Standby pin)

const int offsetA = 1;

const int offsetB = 1; Motor1 = Motor (AIN1, AIN2, PWMA, offsetA, STBY);

Thiab nrog qhov no, koj tau ua tiav pib lub tsev qiv ntawv. Tsis muaj cov kauj ruam ntxiv hauv kev teeb tsa () muaj nuj nqi, peb tsuas yog siv cov cai hauv lub voj () ua haujlwm.

Txoj kev tsav tsheb muaj cov haujlwm hauv qab no. Tinker ncig los tshuaj xyuas lawv txhua tus.

1).drive (tus nqi, sijhawm)

Motor_name = lub npe ntawm koj lub cev kwv yees tus nqi = 255 txog -255; qhov tsis zoo yuav ua rau lub cav txav mus rau lub sijhawm rov qab = lub sijhawm hauv milliseconds

2).brake ()

Nres kev ua haujlwm tsis siv kev sib cav, nres lub cav.

3) nres (, <motor_name2)

Nres muaj nuj nqi siv lub cav lub npe cov npe raws li kev sib cav. Nres cov motors dhau mus rau txoj haujlwm.

4) rau pem hauv ntej (,, sijhawm) rau tom ntej (,, nrawm, sijhawm)

Kev ua haujlwm lees paub ob lub cav lub cev lub npe, xaiv tau PWM nrawm thiab sijhawm nyob rau hauv milliseconds thiab khiav lub cav rau pem hauv ntej kev taw qhia rau lub sijhawm dhau los. Yog tias tus nqi ntawm qhov nrawm tsis zoo, lub cav yuav rov qab mus. Lub nrawm nrawm tau teeb tsa rau 255.

5) rov qab (,, sijhawm) rov qab (,, nrawm, sijhawm)

Kev ua haujlwm lees paub ob lub cav lub cev lub npe, xaiv tau PWM nrawm thiab sijhawm nyob rau hauv milliseconds thiab khiav lub cav rau pem hauv ntej kev taw qhia rau lub sijhawm dhau los. Yog tias tus nqi ntawm qhov nrawm tsis zoo, lub cav yuav mus tom ntej. Lub nrawm nrawm tau teeb tsa rau 255.

6) sab laug (,, nrawm) sab xis (,, nrawm)

Kev ua haujlwm lees txais ob lub cav lub npe khoom thiab nrawm. Qhov kev txiav txim ntawm cov khoom siv lub cev dhau los ua qhov tsis tseem ceeb. Txhawm rau tsav ib lub cav, siv.drive () hloov.

Pom zoo: