Cov txheej txheem:
Video: Hloov LED Xim Siv POT thiab ATTINY85: 3 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:29
Hauv qhov haujlwm no peb siv lub zog ntsuas (POT) los hloov cov xim hauv LED siv ATTINY85.
Qee cov ntsiab lus -
Lub tshuab hluav taws xob yog lub cuab yeej nrog cov ntsia hlau me me / tig lub tshuab uas thaum tig tawm cov hluav taws xob sib txawv sib txawv. Koj tuaj yeem pom los ntawm cov duab piav qhia saum toj no uas POT muaj 3 tus pin, uas yog, +, -, thiab tso tawm. Lub POT tau siv los ntawm kev txuas cov + thiab - pins rau vcc thiab hauv av feem ntawm lub hwj chim. Raws li POT ntsia hlau tig, cov zis tsis kam hloov pauv thiab ua rau LED poob qis lossis nce ntxiv.. Hauv lwm lo lus, nws yog qhov sib txawv resistor. Lawv tau siv nyob rau hauv xws li cov teeb pom kev hauv tsev dimmers.
LED - Qhov no yog lub teeb me me uas pom thaum hluav taws xob hla txawm hais tias nws. Hauv qhov no, peb yuav siv ntau lub xim LED uas muaj 3 tus pin, ib qho hauv av (nruab nrab) thiab ob tus pin uas pom ntsuab thiab liab raws li thaum tshwm sim.
ATTINY85-qhov no yog tus nqi qis me me uas koj tuaj yeem ua haujlwm zoo li Arduino.
Txheej txheem cej luam - Cov txiaj ntsig los ntawm POT txuas nrog ATTINY85. Raws li POT ntsia hlau tig, qhov sib txawv tsis kam tawm yog ua tus lej nruab nrab ntawm 0 thiab 255. ATTINY tuaj yeem ntsuas qhov no thiab ua qhov sib txawv raws li tus nqi ntawm POT tsis kam. Hauv qhov no, peb tau npaj nws kom txuas rau LED raws li hauv qab no.
Yog tias tus lej ntau dua 170 hloov lub LED rau GREEN.
Yog tias tus lej tsawg dua 170 tab sis ntau dua 85 hloov LED rau RED.
yog tias tus lej tsawg dua 85 hloov ntawm LED GREEN THIAB RED uas ua rau ORANGE.
BOM
1 x 3 pin LED1 x ATTINY 85
1 x POT (B100K)
1 x breadboard thiab cables
1 fais fab mov.
Kauj ruam 1: Programming ATTINY85
Hais txog kev ua haujlwm ATTINY85, thov xa mus rau kuv cov lus qhia yav dhau los-https://www.instructables.com/id/15-Dollar-Attiny8…
Cov cai yog qhia hauv qab no. Qee cov ntsiab lus yuav tsum nco ntsoov yog ob qho ATTINY pins, PB3, tus pin lub cev 2, PB2, tus pin lub cev 7 tau txuas nrog, hauv hom digital, mus rau LED kom hloov xim. ATTINY tus pin PB4, tus pin lub cev 3, txuas nrog POT hauv hom sib piv, uas txhais tau tias nws tuaj yeem nyeem qhov tseem ceeb ntawm 0 thiab 254. Kuv tau kho tus lej uas kuv pom hauv internet yog li kuv lees paub tias ua haujlwm. -
void initADC () {// *** // *** Pinout ATtiny25/45/85: // *** PDIP/SOIC/TSSOP // *** ============= ====================================================================== ============================== // *** // *** (PCINT5/RESET/ADC0/dW) PB5 [1]* [8] VCC // *** (PCINT3/XTAL1/CLKI/OC1B/ADC3) PB3 [2] [7] PB2 (SCK/USCK/SCL/ADC1/T0/INT0/PCINT2) //* ** (PCINT4/XTAL2/CLKO/OC1B/ADC2) PB4 [3] [6] PB1 (MISO/DO/AIN1/OC0B/OC1A/PCINT1) // *** GND [4] [5] PB0 (MOSI/ DI/SDA/AIN0/OC0A/OC1A/AREF/PCINT0) // *** // pb4 - cov tswv yim rau POT // pb3 coj tus pin 1 // pb2 coj tus pin 3 // ATTINY 85 zaus teeb tsa sab hauv 8 MHz/* txoj haujlwm no pib ADC
ADC Prescaler Sau Ntawv:
ADC Prescaler yuav tsum tau teeb tsa kom ADC cov tswv yim zaus nyob nruab nrab ntawm 50 - 200kHz.
Yog xav paub ntxiv, saib cov ntawv 17.5 "ADC Prescaler Selections" hauv tshooj 17.13.2 "ADCSRA - ADC Tswj thiab xwm txheej sau npe A" (nplooj ntawv 140 thiab 141 ntawm qhov ua tiav ATtiny25/45/85 cov ntawv, Rev. 2586M – AVR – 07/ 10)
Siv prescaler qhov tseem ceeb rau ntau lub moos nrawm
Clock Muaj prescaler qhov tseem ceeb --------------------------------------- 1 MHz 8 (125kHz), 16 (62.5kHz) 4 MHz 32 (125kHz), 64 (62.5kHz) 8 MHz 64 (125kHz), 128 (62.5kHz) 16 MHz 128 (125kHz)
Hauv qab piv txwv teeb tsa prescaler rau 128 rau mcu khiav ntawm 8MHz
(txheeb xyuas cov ntaub ntawv rau qhov tsim nyog me ntsis qhov tseem ceeb los teeb tsa prescaler) */
// 8-ntsis kev daws teeb meem
// teeb tsa ADLAR rau 1 kom ua rau tshwm sim Sab laug-ua haujlwm (tsuas yog cov khoom ADC9.. ADC2 muaj) // tom qab ntawd, tsuas yog nyeem ADCH txaus rau 8-ntsis txiaj ntsig (256 qhov txiaj ntsig) DDRB | = (1 << PB3); // Tus pin tau teeb tsa ua qhov tso tawm. DDRB | = (1 << PB2); // Tus pin tau teeb tsa ua qhov tso tawm. ADMUX = (1 << ADLAR) | // sab laug ua haujlwm tshwm sim (0 << REFS1) | // Teeb tsa ref. voltage rau VCC, ntsis 1 (0 << REFS0) | // Teeb tsa ref. voltage rau VCC, ntsis 0 (0 << MUX3) | // siv ADC2 rau cov tswv yim (PB4), MUX ntsis 3 (0 << MUX2) | // siv ADC2 rau cov tswv yim (PB4), MUX ntsis 2 (1 << MUX1) | // siv ADC2 rau cov tswv yim (PB4), MUX ntsis 1 (0 << MUX0); // siv ADC2 rau cov tswv yim (PB4), MUX ntsis 0
ADCSRA =
(1 << ADEN) | // Pab kom ADC (1 << ADPS2) | // teeb tsa prescaler rau 64, ntsis 2 (1 << ADPS1) | // teeb tsa prescaler rau 64, ntsis 1 (0 << ADPS0); // teem prescaler rau 64, ntsis 0}
int main (tsis muaj dab tsi)
{initADC ();
thaum (1)
{
ADCSRA | = (1 << ADSC); // pib ntsuas ADC thaum (ADCSRA & (1 << ADSC)); // tos kom hloov pauv tiav
yog tias (ADCH> 170)
{PORTB | = (1 << PB3); // Pin teeb rau HIGH. PORTB | = (1 << PB2); // Pin teeb rau HIGH. } lwm yog (ADCH 85) {PORTB | = (1 << PB3); // Pin teeb rau HIGH. PORTB & = ~ (1 << PB2); // Pin teeb rau LOW
lwm yam {
PORTB | = (1 << PB2); // Pin teeb rau HIGH. PORTB & = ~ (1 << PB3); // Pin teeb rau LOW
}
}
rov 0;
}
Kauj ruam 2: Circuit Court
ATTINY tus pin
PB3, tus pin lub cev 2 - txuas nrog tus pin LED 1
PB4, tus pin lub cev 3, txuas nrog tus pin nruab nrab POT
GND, lub cev tus pin 4, txuas nrog txoj kev tsheb ciav hlau tsis zoo - lub zog siv
PB2, tus pin lub cev 7 - txuas nrog tus pin LED 3
VCC, tus pin lub cev 8, txuas nrog txoj kev tsheb nqaj hlau zoo - lub zog siv
POT
pos thiab neg pin txuas nrog rau txoj kab sib txuas - lub zog siv hluav taws xob.
LED
nruab nrab tus pin txuas nrog txoj kev tsheb ciav hlau tsis zoo - lub hwj chim
Kuv sim siv 3 thiab 3.3 volt fais fab mov thiab ob qho tib si ua haujlwm.
Kauj Ruam 3: Xaus
Lub peev xwm ntawm ATTINY85 txav mus los ntawm kev sib piv thiab hom digital yog qhov muaj zog heev thiab tuaj yeem siv rau hauv ntau qhov kev thov sib txawv, piv txwv li. tsav tsheb sib txawv nrawm thiab tsim cov ntawv sau nkauj. Kuv yuav tshawb qhov no hauv cov lus qhia yav tom ntej. Kuv vam tias koj tau pom qhov no muaj txiaj ntsig.
Pom zoo:
Tuchless Hloov rau Cov Khoom Siv Hauv Tsev -- Tswj Koj Cov Khoom Siv Hauv Tsev Tsis Muaj Tuch Ib qho Hloov: 4 Cov Kauj Ruam
Tuchless Hloov rau Cov Khoom Siv Hauv Tsev || Tswj Koj Cov Khoom Siv Hauv Tsev Tsis Muaj Tuch Ib qho Hloov: Nov Yog Qhov Tuchless Hloov Rau Cov Khoom Siv Hauv Tsev. Koj Siv Tau Qhov No Mus Rau Txhua Qhov Chaw Hauv Pej Xeem Kom Pab Tau Tawm Tsam Ib Yam Kab Mob. Lub Circuit Court Raws Li Tsaus Sensor Circuit Ua Los Ntawm Op-Amp Thiab LDR. Qhov Tseem Ceeb Thib Ob Ntawm Qhov Circuit Court SR Flip-Flop Nrog Sequencell
MESOMIX - Automated Xim Xim Xim Tshuab: 21 Cov Kauj Ruam (nrog Duab)
MESOMIX - Automated Xim Xim Xim Tshuab: Koj puas yog tus tsim qauv, tus kws kos duab lossis tus neeg muaj tswv yim uas nyiam tha xim rau ntawm koj daim ntaub, tab sis feem ntau nws nyuaj thaum nws los ua qhov ntxoov ntxoo uas xav tau. uas tawm tsam rau huab cua nyias. Raws li cov cuab yeej no, koj
Cov xim pleev xim ntau xim (Kov Rhuav): 8 Kauj Ruam (nrog Duab)
Cov xim pleev xim ntau xim (Kov Rhuav): Teeb duab yog cov txheej txheem thaij duab siv los tsim cov teebmeem tshwj xeeb ntawm qhov kaw qhov nrawm. Lub teeb nyem feem ntau yog siv rau "xim" cov duab. Hauv Cov Lus Qhia no, Kuv yuav qhia koj yuav ua li cas txhawm rau tsim txhua yam hauv ib tus kws pleev xim nrog kov
Arduino Neeg Hlau Nrog Kev Nyob, Kev Qhia thiab Qib Kev Sib Hloov (Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) Tswj los ntawm Lub Suab Siv Bluetooth Module thiab Kev Siv Tus Neeg Siv Hluav Taws Xob: 6 Kauj Ruam
Arduino Neeg Hlau Nrog Kev Nyob, Kev Qhia thiab Qib Kev Sib Hloov (Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) Tswj los ntawm Lub Suab Siv Bluetooth Module thiab Kev Siv Tus Neeg Siv Hluav Taws Xob: Cov lus qhia no piav qhia yuav ua li cas thiaj tsim tau Arduino Robot uas tuaj yeem txav mus raws qhov xav tau (Forward, Backward) , Sab laug, Txoj Cai, Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) xav tau Kev nrug deb hauv Centimeters siv lub suab hais kom ua. Neeg hlau kuj tseem tuaj yeem txav tau tus kheej
Cov Xim Ntau Yam Xim Stencils Nrog Cov Hloov Pauv Hloov: 12 Cov Kauj Ruam (nrog Duab)
Comprehensive Multi Color Stencils With Variable Output: Multilayer xim tiag tiag stenciling tsis yog txhua qhov sai thiab yooj yim. Tseeb, koj tuaj yeem crank ib zaug hauv ib teev, tab sis nws siv sijhawm thiab xyaum ua kom muaj peev xwm rov ua cov txheej txheem thiab paub yuav ua li cas txhawm rau nws rau txhua qhov sib txawv stencil. Hauv cov lus qhia no, Kuv yuav