Cov txheej txheem:

Kev Tsim Yooj Yim - Tswb Teeb: 4 Kauj Ruam
Kev Tsim Yooj Yim - Tswb Teeb: 4 Kauj Ruam

Video: Kev Tsim Yooj Yim - Tswb Teeb: 4 Kauj Ruam

Video: Kev Tsim Yooj Yim - Tswb Teeb: 4 Kauj Ruam
Video: TSIS POM QAB UA KOJ TUS TXIV TSEV( tub tswb vwj )nkauj tawm tshiab 2023 MV 2024, Hlis ntuj nqeg
Anonim
Tsim Yooj Yim - Tswb Teeb
Tsim Yooj Yim - Tswb Teeb

Qhov kev sim no yog qhov txaus nyiam tiag tiag - txhawm rau thov DIY phototransistor. DIY phototransistors siv qhov ci ci thiab cov duab pom ntawm LEDs - lawv yuav tsim cov dej tsis muaj zog thaum qee lub teeb ci rau ntawm nws. Thiab peb siv lub transistor txhawm rau ua kom muaj zog tam sim no, yog li Arduino Uno board tuaj yeem txheeb xyuas lawv.

Kauj Ruam 1: Cheeb Tsam

- Arduino Uno board * 1

- USB cable * 1

- Passive Buzzer *1

- Resistor (10KΩ) * 1

- LED * 1

NPN Transistor S8050 * 1

- Daim phiaj * 1

- Jumper xov hlau

Kauj ruam 2: Schematic Daim duab:

Schematic Daim duab
Schematic Daim duab

Kauj ruam 3: Txheej txheem

Nrog rau cov teeb pom kev zoo, LEDs tsim cov dej tsis muaj zog thaum raug rau lub teeb nthwv dej.

NPN muaj txheej P-doped semiconductor ("puag") nruab nrab ntawm ob txheej N-doped. Ib qho me me tam sim no nkag mus rau hauv paus tau nthuav dav los tsim cov khoom loj thiab tso tawm tam sim no. Ntawd yog, thaum muaj qhov muaj peev xwm sib txawv ntsuas los ntawm tus xa tawm ntawm NPN transistor rau nws lub hauv paus (piv txwv li, thaum lub hauv paus muaj qhov txheeb ze zoo rau tus xa tawm) nrog rau qhov muaj peev xwm zoo sib txawv ntsuas los ntawm lub hauv paus mus rau tus sau, transistor dhau los ua haujlwm. Hauv lub xeev "ntawm" no, cov dej ntws tam sim no nruab nrab ntawm tus sau thiab emitter ntawm transistor. Tus nqi ntawm A0 yuav loj dua 0. Los ntawm txoj haujlwm, peb ua lub suab nrov nrov thaum A0 loj dua 0.

Ib 10kΩ rub-down resistor txuas nrog lub transistor theem tso tawm kom tsis txhob muaj qhov chaw nres nkoj analog ncua kev cuam tshuam nrog cov cim thiab ua rau kev txiav txim siab tsis raug.

Kauj ruam 1:

Tsim lub voj voog.

Kauj ruam 2:

Rub tawm cov cai los ntawm

Kauj ruam 3:

Tshaj tawm cov duab kos rau Arduino Uno board

Nyem rau Upload icon txhawm rau upload cov cai rau pawg tswj hwm.

Yog tias "Ua tiav uploading" tshwm rau hauv qab ntawm lub qhov rais, nws txhais tau hais tias daim duab tau ua tiav tiav.

Tam sim no, ci lub teeb nyem ntawm LED thiab koj tuaj yeem hnov lub suab nrov nrov.

Kauj ruam 4: Code

// Kev Tsim Yooj Yim- Tswb Teeb

// Tam sim no, koj tuaj yeem

hnov tias lub suab nrov nrov ua suab thaum lub teeb ci LED.

// Email:

// Web site: www.primerobotics.in

void teeb tsa ()

{

Serial.begin (9600); // pib qhov chaw nres nkoj ntawm 9600 bps:

}

void lub voj ()

{

int n = analogRead (A0); // nyeem tus nqi los ntawm

pin pin AO

Serial.println (n);

yog (n> 0) // Yog tias muaj qhov hluav taws xob

{

pinMode (5, NTAWV); // teeb tsa tus lej digital 5 ua qhov tso tawm

suab (5, 10000); // Tsim cov xwm txheej yoj (10000 Hz

zaus, 50% lub voj voog ua haujlwm) ntawm tus pin 5

pinMode (5, INPUT); // teeb tus pin 5 ua tus tswv yim

}

}

Pom zoo: