Cov txheej txheem:
- Khoom siv
- Kauj ruam 1: Teeb
- Kauj Ruam 2: Ntxiv Txoj Cai rau Av Sensor
- Kauj Ruam 3: Neopixel Library
- Kauj Ruam 4: Teeb Neopixel Code
- Kauj Ruam 5: Teeb Meem
- Kauj Ruam 6: Void Loop
- Kauj ruam 7: Txheeb xyuas
Video: Av Moister Nrog Node: 7 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
Hauv phau ntawv qhia no kuv yuav qhia koj yuav ua li cas txhawm rau ntsuas lub homade av rau kev saib xyuas kev noj qab haus huv hauv vaj. Kuv yuav qhia koj yam koj xav tau, muab qee qhov piv txwv piv txwv thiab yuav siv cov cai li cas.
Qhov kawg ntawm cov lus qhia koj xav paub yuav hloov pauv cov hlua coj cov xim li cas thaum cov av ntub, ntub me ntsis lossis qhuav.
Hauv phau ntawv no kuv yuav siv:
- Arduino version 1.8.9
- Lub tsev qiv ntawv Adafruit_NeoPixel.h
Khoom siv
Koj xav tau:
- NodeMCU 1.0 (ESP-12E module)
- 1 poj niam rau poj niam cable
- Ib txoj hlua LED
- (Tsis teb los tau) Homade av sensor (Saib cov vis dis aus saum toj no txog 00:36)
Kauj ruam 1: Teeb
- Coj koj lub node thiab koj cov av sensor.
- Txuas lub ntsuas av mus rau A0. (Duab 1) (hloov pauv tus poj niam txuas hlua thiab txuas nws mus rau A0 (Duab 3)
Coj koj cov hlua LED thiab muab GND hauv G, 5V ntawm 3V thiab kab nruab nrab hauv D5. (Duab 2)
Tam sim no nws yuav zoo ib yam li daim duab kawg.
Kauj Ruam 2: Ntxiv Txoj Cai rau Av Sensor
- Ua qhov haujlwm tshiab hauv arduino IDE
- Yav dhau los hauv cov cai hauv qab no:
/* Cov tswv yim analog, cov zis analog, cov lej tso tawm
Nyeem tus lej nkag sib piv, qhia cov txiaj ntsig rau thaj tsam ntawm 0 txog 255 thiab siv qhov txiaj ntsig los teeb tsa qhov ntsuas qhov dav ntawm tes taws los piav (PWM) ntawm tus pin tso tawm. Kuj luam tawm cov txiaj ntsig mus rau Serial Monitor.
Lub Circuit Court: - potentiometer txuas nrog tus pin analog 0. Tus pin nruab nrab ntawm cov potentiometer mus rau tus pin analog. sab pins ntawm lub zog ntsuas mus rau +5V thiab hauv av - LED txuas los ntawm tus lej pin 9 rau hauv av
tsim 29 Kaum Ob Hlis 2008 hloov kho 9 Plaub Hlis 2012 los ntawm Tom Igoe
Tus lej piv txwv no nyob hauv zej tsoom.
www.arduino.cc/en/Tutorial/AnalogInOutSeri… *
/ Cov lej no yuav tsis hloov. Lawv tau siv los muab cov npe rau tus pin siv: const int analogInPin = A0; // Analog input tus pin uas tus potentiometer txuas nrog const int analogOutPin = D5; // Tus pin tso tawm analog uas lub LED txuas rau
int sensorValue = 0; // tus nqi nyeem los ntawm lub lauj kaub
teeb tsa tsis muaj dab tsi () {// pib ua kev sib txuas lus ntawm 9600 bps: Serial.begin (9600); }
void loop () {// nyeem cov analog hauv tus nqi: sensorValue = analogRead (analogInPin);
// luam cov txiaj ntsig mus rau Serial Monitor: Serial.print ("sensor ="); Serial.print (sensorValue); Serial.print ("\ n"); // Serial.println (outputValue);
// tos 1 milliseconds ua ntej lub voj tom ntej rau cov analog-rau-digital // hloov pauv kom khom tom qab nyeem kawg: ncua (1000); }
Tam sim no koj tuaj yeem tshawb xyuas yog tias koj lub sensor tau muab tus nqi.
Kov qhov kawg ntawm cov ntsia hlau lossis cov hlua thiab koj yuav pom qee yam zoo li daim duab 1
Yog tias nws tsis ua haujlwm xyuas koj cov kab. Lawv puas raug txuas nrog?
Kauj Ruam 3: Neopixel Library
-
Rub tawm lub tsev qiv ntawv adafruit_neopixel (Yog tias koj tsis tau ua dua).
- Mus rau cov cuab yeej> tswj cov tsev qiv ntawv
- nrhiav adafruit neopixel yees duab 1
- Nruab version 1.2.5
Kauj Ruam 4: Teeb Neopixel Code
-
Ntxiv cov hauv qab no rau saum koj qhov project
- #suav nrog
- #suav nrog
- #suav nrog "Adafruit_NeoPixel.h"
- Hauv qab no:
char ssid = "SSID"; // koj lub network SSID (lub npe)
char password = "password"; // koj tus password network
Thiab hauv qab ntawd
#define PIXEL_PIN D5#txhais PIXEL_COUNT 30 // hloov pauv li cas maney coj tus nyob ntawm koj lub pluaj
#define PIXEL_TYPE NEO_GRB + NEO_KHZ800
Adafruit_NeoPixel pixels = Adafruit_NeoPixel (PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);
Kauj Ruam 5: Teeb Meem
Muab cov cai hauv qab no tso rau hauv voide teeb ()
pixels.begin (); // INITIALIZE NeoPixel strip object (REQUIRED) pixels.show (); // Kaw tag nrho cov pixels ASAP
pixels.setBrightness (50); // yuav tsum yog nruab nrab ntawm 0 thiab 255 yog tias koj xav kom cov hlua coj kom ci dua koj tuaj yeem nce tus lej
Kauj Ruam 6: Void Loop
Hauv lub voj void () thiab qis dua qhov ncua (1000); sau cov cai hauv qab no
yog (sensorValue == 0 || sensorValue <= 200) {
rau (int i = 0; i
pixels.setPixelColor (i, 255, 0, 0);
pixels.show ();
}
} lwm yog (sensorValue> 200 || sensorValue <= 500) {
rau (int i = 0; i
pixels.setPixelColor (i, 0, 255, 0);
pixels.show ();
}
} lwm yog (sensorValue> 500) {
rau (int i = 0; i
pixels.setPixelColor (i, 0, 0, 255);
pixels.show ();
}
}
}
Kauj ruam 7: Txheeb xyuas
Nrog koj zoo siab! Koj tsuas yog tsim cov kab ke uas tuaj yeem qhia tau yog tias av ntub lossis qhuav.
Tam sim no thaum koj tso lub ntsuas cua rau hauv cov av ntub dej LED yuav tig ntsuab thiab thaum nws nyob hauv cov av qhuav nws yuav tig liab. Like li cov duab saum toj no.
Pom zoo:
Tsev Automation Kauj Ruam ntawm Kauj Ruam Siv Wemos D1 Mini Nrog PCB Tsim: 4 Kauj Ruam
Tsev Automation Kauj Ruam Ib Leeg Siv Wemos D1 Mini Nrog PCB Tsim: Tsev Automation Kauj Ruam los ntawm Kauj Ruam siv Wemos D1 Mini nrog PCB Tsim cov tub ntxhais kawm ntawv qib siab. Tom qab ntawd ib tus ntawm peb cov tswv cuab tuaj
Yuav Ua Li Cas Thiaj Li Tshem Tawm Lub Computer Nrog Cov Kauj Ruam Yooj Yim thiab Duab: 13 Kauj Ruam (nrog Duab)
Yuav Tsum Tshem Tawm Lub Khoos Phis Tawj Li Cas Nrog Cov Kauj Ruam Yooj Yim thiab Duab: Nov yog cov lus qhia txog yuav ua li cas tshem lub PC. Feem ntau ntawm cov khoom siv yooj yim yog hloov pauv thiab tshem tawm tau yooj yim. Txawm li cas los xij nws yog ib qho tseem ceeb uas koj tau koom nrog nws. Qhov no yuav pab tiv thaiv koj kom tsis txhob poob ib feem, thiab tseem ua rau kev rov ua dua tshiab
Ntse LED Nrog Node Mcu thiab Tasker: 9 Kauj Ruam (nrog Duab)
Ntse LED Nrog Node Mcu thiab Tasker: rub tus neeg ua haujlwm
Ntsuas DC Voltage Nrog Arduino thiab Node-RED: 8 Kauj Ruam (nrog Duab)
Ntsuas DC Voltage Nrog Arduino thiab Node-RED: Muaj ntau qhov qhia ntau qhov ntsuas DC qhov ntsuas hluav taws xob nrog Arduino, qhov xwm txheej no kuv pom kev qhia uas kuv xav txog txoj hauv kev zoo tshaj los ntsuas DC yam tsis xav tau cov txiaj ntsig kev tawm tsam, tsuas yog xav tau qee qhov kev tawm tsam thiab multimeter
Tsheb kauj vab taug qab System nrog Tuag Tus Txiv Neej Alert Nrog Sigfox: 7 Cov Kauj Ruam (nrog Duab)
Tsheb kauj vab taug qab System Nrog Tuag Tus Txiv Neej Alert Nrog Sigfox: Kev ruaj ntseg rau cov neeg caij tsheb kauj vab nrog taug qab thiab xa cov yam ntxwv ceeb toom. Thaum muaj xwm txheej ceeb toom raug xa nrog GPS txoj haujlwm.Kev ruaj ntseg rau cov neeg caij tsheb kauj vab yog qhov yuav tsum tau, nrog kev tsheb kauj vab lossis tsheb kauj vab roob sib tsoo tshwm sim thiab sai li sai tau thaum muaj xwm txheej ceev