Cov txheej txheem:
- Khoom siv
- Kauj ruam 1: Kev sib txuas
- Kauj Ruam 2: Tsim Txoj Haujlwm
- Kauj ruam 3: Ntxiv Code
- Kauj Ruam 4: Ntxiv USART
- Kauj ruam 5: Khiav Txoj Cai
- Kauj Ruam 6: Hloov Siab Zoo
- Kauj Ruam 7: Hloov Txhua Yam Koj Nyiam
Video: Clap-on Hloov: 7 Cov Kauj Ruam (nrog Duab)
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:25
Ib tus txheeb ze nug kuv ib zaug yog tias kuv tuaj yeem tsim qhov hloov pauv uas cuam tshuam rau npuaj koj ob txhais tes. Yog li kuv tau xaj qee yam khoom los tsim ib qhov haujlwm thiab txiav txim siab los ua cov lus qhia kom txhua tus tuaj yeem muaj qhov hloov pauv zoo li ntawd.
Lub microcontroller yog lub hlwb ntawm txoj haujlwm no. Lub suab sensor txuas nrog lub microcontroller, lub sensor xa cov ntaub ntawv analog thaum pom lub suab. Lub microcontroller tau teeb tsa kom pom qhov sib txawv loj hauv lub suab. Thaum pom qhov sib txawv txaus txaus, txhais tau tias npuaj teg, lub microcontroller xa lub teeb liab mus rau qhov txuas. Lub relay hloov thiab lub teeb tig rau. Thaum npuaj teg zaum ob, lub teeb yuav kaw dua.
Khoom siv
Lub cev
- 1x ATmega328P Xplained Mini nrog cable rau kev ua haujlwm
- 1x 5v relay module 1-channel (KY-019 lossis zoo sib xws)
- 1x Suab sensor module (KY-038 lossis zoo sib xws)
- 1 x Breadboard
- 6x Txiv neej-Txiv neej jumper hlau
- 1x lub qhov (socket) nrog qaum (lossis lwm yam cuab yeej koj xav qhib)
- 1 x lub teeb
- 1x resistor* (Kuv siv 220 Ohm)
- 1 x LEDs*
Software (rub tawm):
- AtmelStudio 7.0 (https://www.microchip.com/mplab/avr-support/atmel-studio-7)
- Puab (www.putty.org)*
* Rau kev ntsuas lub hom phiaj
Kauj ruam 1: Kev sib txuas
Txuas tag nrho cov xov hlau raws li qhia hauv daim duab.
Kauj Ruam 2: Tsim Txoj Haujlwm
Kuv nyiam cov cai hauv C yog li qhov haujlwm no tau sau hauv C.
Yog tias koj tseem tsis tau rub tawm thiab teeb tsa cov software xav tau, rub tawm thiab teeb tsa nws tam sim no.
Tam sim no ua raws cov theem tom ntej no:
- Qhib AtmelStudio.
- Nyem rau "File" -> "New" -> "Project".
- Nyem rau ntawm "GCC C Txoj Haujlwm Ua Haujlwm". Muab koj lub npe lub npe thiab qhov chaw khaws cia. Nyem "Ok".
- Tshawb nrhiav ATmega328P. Nyem "ATmega328P" -> "Ok".
- Nyem rau hauv Kev Tshawb Fawb Kev Tshawb Fawb ntawm "main.c" txhawm rau qhib txoj haujlwm tseem ceeb.
Kauj ruam 3: Ntxiv Code
Rho tawm cov cai twb muaj tam sim no hauv main.c
Luam thiab paste cov cai hauv qab no hauv main.c
#define F_CPU 16000000
#include #include #include #include "usart.h" #define MINIMALVALUE 5 void InitADC (); uint16_t Nyeem ADC (uint8_t ADCchannel); ob npaug 1, nqi 2; int lub ntsiab (tsis muaj dab tsi) {// Initialise USART USART_init (9600); USART_putstr ("#USART pib / n"); // Pib ADC InitADC (); USART_putstr ("#ADC pib / n"); // PC1 tus pin ntawm PORTC cov zis, cov khoom siv ntxiv. DDRC = 0b00000010; // teeb tsa thawj qhov tseem ceeb rau PORTC qis. PORTC = 0b00000000; thaum (1) {// nyeem tus nqi potentiometer // nyeem tus nqi thiab khaws hauv val1 val1 = ReadADC (0); _delay_ms (1); // nyeem tus nqi tom ntej en khaws hauv val2 val2 = ReadADC (0); kab ntawv [10]; // the ReadADC () muab tus nqi rov qab rau hauv cov lej. Yog tias peb xav kom debug lossis pom tus nqi ntawm putty, // tus nqi yuav tsum tau hloov pauv mus rau cov cim kom USART tuaj yeem luam nws. nws (val1, str, 10); USART_putstr (str); USART_putstr ("\ n"); // yog 2 qhov tseem ceeb muaj qhov sib txawv. Lub suab tau pom thiab hloov chaw nres nkoj. // MINIMALVALUE tuaj yeem hloov pauv, nce ntxiv yuav ua rau nws tsis nkag siab. Kev txo qis yuav ua rau nws nkag siab ntau dua yog tias (val1-val2> MINIMALVALUE || val2-val1> MINIMALVALUE) {PORTC ^= 0b00000010; // LIGHT ON UC _delay_ms (200); }}} void InitADC () {// Xaiv Vref = AVcc ADMUX | = (1 << REFS0); // teeb tsa prescaller rau 128 thiab pab kom ADC ADCSRA | = (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0) | (1 << ADEN); } uint16_t ReadADC (uint8_t ADCchannel) {// xaiv ADC channel nrog daim npog ntsej muag kev nyab xeeb ADMUX = (ADMUX & 0xF0) | (ADCchannel & 0x0F); // ib hom kev hloov pauv ADCSRA | = (1 << ADSC); // tos kom ADC hloov dua siab tshiab tiav thaum (ADCSRA & (1 << ADSC)); rov qab ADC; }
Kauj Ruam 4: Ntxiv USART
USART yog cov txheej txheem kev sib txuas lus sib txuas uas tuaj yeem siv rau ntawm lub microcontroller. Kuv siv nws ntawm lub microcontroller kom pom cov ntaub ntawv analog los ntawm lub ntsuas.
USART twb tau teeb tsa kom raug, muaj lub taub hau (.h) thiab cov ntaub ntawv (.c). Rub tawm 2 cov ntawv thiab ntxiv lawv rau koj qhov program hauv AtmelStudio.
Txoj cai-nyem rau ntawm lub npe project hauv Solution Explorer. Nyem "Ntxiv" -> "Yam khoom uas muaj …" thiab xaiv 2 daim ntawv rub tawm.
Kauj ruam 5: Khiav Txoj Cai
Txuas lub microcontroller mus rau lub khoos phis tawj. Tshawb nrhiav hauv koj lub computer rau "tus thawj tswj ntaus ntawv" thiab qhib nws. Saib rau "Ports (COM & LPT)" thiab nco ntsoov COM-chaw nres nkoj microcontroller nyob.
Qhib PuTTY thiab nyem rau ntawm "Serial" ntaus COM-chaw nres nkoj koj tau pom ntawm lub microcontroller thiab nyem "Qhib". Lub davhlau ya nyob twg tshwm tuaj, tawm tam sim no.
Rov qab mus rau AtmelStudio los xaiv lub cuab yeej raug rau kev tsim lub microcontroller.
- Nyem rau ntawm lub cuab yeej rauj.
- Xaiv "mEDBG*ATML" debugger/programmer.
- Xaiv interface "debugWIRE".
- Nyem "pib yam tsis muaj debugging".
Qhov program yuav tsim thiab sau.
Thaum qhov kev zov me nyuam ua haujlwm raug koj yuav pom qhov muaj nuj nqis hauv puTTY. Siv tus ntsia hlau kuv tuaj yeem hloov tus nqi pom hauv puTTY los ntawm kev xa cov ntsia hlau rau ntawm lub ntsuas. Kuv lub ntsuas ntsuas muab qhov tseem ceeb ntawm 0 txog 1000 thaum tig cov ntsia hlau txhua txoj kev. Kuv tig cov ntsia hlau rau 100 (10%) ntawm tus nqi tag nrho. Kuv tau pom tias qhov no ua haujlwm rau kuv.
Kauj Ruam 6: Hloov Siab Zoo
Txhawm rau kho qhov kev nkag siab thaum lub teeb tig rau koj tuaj yeem siv 2 txoj kev xaiv, tab sis xaiv ib qho tsis yog ob qho:
- Hloov sensor ntsia hlau;
- Hloov tus nqi tus nqi.
Kuv siv qhov kev xaiv 2. Ua kom MINIMALVALUE wil ua rau nws tsis nkag siab, txo qis ua rau nws nkag siab ntau dua.
#Txheeb xyuas qhov tsawg kawg 5
Kauj Ruam 7: Hloov Txhua Yam Koj Nyiam
CEEB TOOM: Saib xyuas thaum hloov qhov hluav taws xob ntau dua
Thaum koj zoo siab nrog kev nkag siab ntawm lub sensor koj tuaj yeem hloov pauv hauv Circuit Court. Hloov lub Circuit Court zoo li daim duab saum toj no. Tam sim no koj tuaj yeem hloov txhua yam uas koj nyiam!
Pom zoo:
Hloov-Hloov Cov Khoom Ua Si: Cov Khoom Ua Si Cov Khoom Ua Si Ua Tau Zoo!: 7 Cov Kauj Ruam (nrog Duab)
Hloov-Hloov Cov Khoom Ua Si: Cov Khoom Siv Hluav Taws Xob Ua Tau Zoo!: Qho khoom ua si hloov pauv qhib txoj hauv kev tshiab thiab kev daws teeb meem kom tso cai rau menyuam yaus uas muaj lub cev muaj peev xwm txwv lossis kev xiam oos qhab kev loj hlob los cuam tshuam nrog cov khoom ua si ntawm nws tus kheej. Hauv ntau qhov xwm txheej, cov menyuam yaus uas xav tau cov khoom ua si hloov pauv tsis tuaj yeem nkag mus
DIY Hloov pauv Hloov Lub Rooj Hloov Kho Lub Hwj Huam "Minghe D3806" 0-38V 0-6A: 21 Cov Kauj Ruam (nrog Duab)
DIY Hloov Pauv Hloov Pauv Hloov Kho Lub Hwj Huam "Minghe D3806" 0-38V 0-6A: Ib txoj hauv kev yooj yim tshaj plaws los tsim lub Rooj Tog Zaum Lub Hwj Huam yooj yim yog siv Buck-Boost Converter. Hauv Cov Lus Qhia thiab Yeeb Yaj Kiab Kuv pib tawm nrog LTC3780. Tab sis tom qab kuaj kuv pom LM338 nws muaj nws puas lawm. Luckily kuv muaj ob peb qhov sib txawv
Hloov-Hloov Cov Khoom Ua Si: Qes Chaw Taws Teeb Tswj Cov Nab Ua Tau!: 7 Cov Kauj Ruam (nrog Duab)
Hloov-Hloov Cov Khoom Ua Si: Qes Chaw Taws Teeb Tswj Cov Nab Ua Tau Zoo!: Qho khoom ua si hloov pauv qhib txoj hauv kev tshiab thiab kev daws teeb meem kom tso cai rau menyuam yaus uas muaj lub cev muaj peev xwm txwv lossis kev xiam oos qhab kev loj hlob los cuam tshuam nrog cov khoom ua si ntawm nws tus kheej. Hauv ntau qhov xwm txheej, cov menyuam yaus uas xav tau cov khoom ua si hloov pauv tsis tuaj yeem nkag mus
Txhim Kho Cov Hloov Pauv Hloov Rau Hauv Ntse Kov Hloov Nrog Temp Monitoring: 4 Cov Kauj Ruam
Txhim Kho Qhov Hloov Pauv Hloov Mus Rau Ntse Kov Hloov Nrog Lub Sijhawm Saib Xyuas: Kuv paub txhua tus ntawm koj ntsib qhov teeb meem no tsawg kawg ib qho hauv koj lub neej lub rooj hloov pauv tau tawg los ntawm kev siv tas mus li. ntau lub sijhawm yog lub caij nplooj ntoo hlav sab hauv hloov pauv los yog m
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