Cov txheej txheem:
- Kauj Ruam 1: Cov Khoom & Cov Cuab Yeej Siv:
- Kauj ruam 2: Customizing Wifi Manager
- Kauj Ruam 3: Kev Ua Haujlwm Tshwj Xeeb rau Daim Ntawv Ua
- Kauj Ruam 4: Kev Sib Txuas & Txoj Haujlwm Tseem Ceeb
- Kauj Ruam 5: Tsim Web Server
- Kauj Ruam 6: Kauj Ruam Kawg !
Video: WIFI Zaub rau Kev Tswj Ntau Lawm: 6 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:27
Kuv yog Series Me me txog IOT thiab Tib lub tshuab computer.
Kuv ib txwm xav siv nws dhau Hobby & Fun Projects (Kev Tsim Khoom thiab Tsim Khoom tiag).
Cov Lus Qhia no yog hais txog Kev Tsim 4 tus lej 7-ntu WIFI zaub nrog ESP nodemcu los Qhia Cov Sijhawm Ua Haujlwm Ib Leeg. Kuv Ua Haujlwm Hauv Kev Lag Luam Hluav Taws Xob, qhov uas peb siv Kev Tsim Kho Kev Ua Haujlwm (MES) los Saib Xyuas & Tswj Kev Tsim Khoom Hauv Pem Hauv Ntej, Tawm Tawm & Txheej Txheem. Hauv qhov haujlwm no Kuv tab tom tsim chav tso saib me me uas yuav qhia txog Cov Khoom Siv Ntau Lawm raws li kab, ua haujlwm thiab teev.
Hauv kev ua haujlwm Txoj Haujlwm no zoo ib yam li Youtube Cov Neeg Siv Khoom suav suav, qhov uas peb siv API/HTTP cov lus teb los ntawm online tab sis ntawm no peb tab tom yuav tsim peb tus kheej api los cuam tshuam nrog peb cov MES hauv cheeb tsam kom tau txais cov txiaj ntsig.
Kauj Ruam 1: Cov Khoom & Cov Cuab Yeej Siv:
Cov Khoom Kho Vajtse Siv:
- ESP nodemcu
- TM1637 4 tus lej moos Zaub
- Laub hloov
- 10 k resistor
- ob peb jumper xov hlau
Cov Cuab Yeej Siv Siv:
- Arduino IDE Cov
- Xampp rau PHP/Apache web server
Arduino Library's Siv:
1. Tus saib xyuas Wifi los ntawm tzapu & kuv tau kho rau kuv li kev cai ua (wifimanager)
2. ESP_EEPROM rau khaws kuv li kev cai hauv Flash nco
3. SevenSegmentTM1637 Rau Zaub
Kauj ruam 2: Customizing Wifi Manager
Hauv Qhov Ua Ntej no kuv teeb tsa tus thawj tswj wifi thawj zaug thiab tom qab ntawd kuv theej the Wifi tus thawj tswj daim nplaub tshev thiab dhau dua hauv tib yam hauv Arduino lub tsev qiv ntawv ntawv tais ceev tseg, tom qab ntawd hloov npe ua WiFiManager_custom.
Folder Root directory Feem ntau nyiam
C: / Cov neeg siv koj lub npe computer / Documents / Arduino / libraries
Tom qab ntawd kuv qhib wifimanager_custom nplaub tshev thiab hloov npe header.cpp cov ntaub ntawv ib yam li wifimanager_custom, ntxiv tib yam hauv cov ntawv header &.cpp cov ntaub ntawv ib yam nkaus.
Thiab Ntxiv Kuv Cov Ntawv Cai & Khawm hauv kab ntawv taub hau.
hauv HTTP_PORTAL_OPTIONS PROGMEM kuv ntxiv kuv lub pob ntawv rau Ntawv Qhia zaub mov.
thiab ntxiv Daim Ntawv Tshiab rau kev nkag mus rau kab & ua haujlwm. kuv tsim daim ntawv no ua cov ntawv yooj yim.
Tom qab qhov no peb yuav tsim cov haujlwm ua haujlwm rau cov ntawv no hauv.cpp cov ntaub ntawv, rau qhov uas peb yuav tsum ua daim ntawv tshaj tawm muaj nuj nqi hauv cov ntawv header.
/ * kuv cov haujlwm tshwj xeeb */
void handleCustomForm (); void handleCustomSave ();
Kuv tshaj tawm kuv cov kev cai ua haujlwm hauv kab ntawv header. tias nws, peb txoj haujlwm hauv kab ntawv taub hau tiav peb yuav tsum mus nrog.cpp cov ntaub ntawv los tsim peb txoj haujlwm & kev nqis tes ua.
Kauj Ruam 3: Kev Ua Haujlwm Tshwj Xeeb rau Daim Ntawv Ua
Tam sim no peb qhib peb cov ntaub ntawv wifimanager_custom.cpp.
thiab peb yuav tsum ntxiv peb tus tuav tes teb http kom hu peb cov haujlwm thaum peb daim ntawv tshaj tawm.
server-> ntawm (Txoj hlua (F ("/custom_config")), std:: khi (& WiFiManager:: handleCustomForm, qhov no)); // MY custom lis
server-> ntawm (Txoj hlua (F ("/custom_save")), std:: khi (& WiFiManager:: handleCustomSave, qhov no)); // MY custom lis
cov no yuav hu rau peb cov haujlwm tshwj xeeb thaum daim ntawv raug tshaj tawm.
1.handleCustomForm ()-> yuav tsim ib nplooj ntawv nrog peb cov ntawv tshwj xeeb rau kab & hloov pauv cov tswv yim & txuag khawm.
2.handleCustomSave ()-> txoj haujlwm no yuav tau txais daim ntawv muaj txiaj ntsig & khaws hauv Flash qhov chaw nco 0 (kab) & 50 (hloov chaw).
Kauj Ruam 4: Kev Sib Txuas & Txoj Haujlwm Tseem Ceeb
Kev sib txuas yog yooj yim heev..
Kev sib txuas thiab txuas:
nodemcu TM1637 Zaub
3.3 v ---- Vcc
G ---- Gn
D2 ---- CLK
D3 ----- DIB
nodemcu- thawb hloov
- khawm khawm txuas rau tus pin D8 los ntawm +5V - 10K resistor txuas rau tus pin D8 los ntawm hauv av
peb ua tiav kev kho peb tus wifimanager. tam sim no peb yuav tsum tsim peb txoj haujlwm tseem ceeb.
1. peb tus thawj saib xyuas wifi yuav Txuas nrog lub network wifi nrog siv lub peev xwm kawg los txuas, yog tias nws ua tsis tau nws qhib AutoConnectAP wifi server.we tuaj yeem teeb tsa wifi tshiab tsis xwm yeem, kab & hloov los ntawm kev txuas mus rau lub wifi server no.
2. ces nws yuav nkag mus rau hauv lub voj loj.
Peb lub voj loj yuav muaj ob ntu. ib qho yog confi subroutine thaum peb xav tau hloov kab, hloov lossis ntxiv ib qho ntawv pov thawj wifi hu rau kev thov hom AP txhawm rau teeb tsa. qhov no yuav raug hu thaum lub laub khawm txuas nrog D8 tus pin raug nias.
void voj () {
config_loop ();
}
tsis muaj dab tsi config_loop () {Serial.println ("");
Serial.println ("Tos rau Config khawm xwm txheej …");
//display.print("Tos");
yog (digitalRead (TRIGGER_PIN) == HIGH)
{
display.print ("Conf"); // WiFiManager
// Local intialization. Thaum nws ua lag luam tiav, tsis tas yuav khaws nws ib puag ncig WiFiManager wifiManager;
// rov pib teeb tsa - rau kev sim
//wifiManager.resetSettings ();
// teeb tsa lub sijhawm kom txog thaum teeb tsa lub portal raug kaw // muaj txiaj ntsig zoo kom nws rov ua dua lossis mus pw // hauv vib nas this
//wifiManager.setTimeout (120);
// nws pib qhov nkag mus nrog lub npe tshwj xeeb
// ntawm no "AutoConnectAP" // thiab nkag mus rau qhov thaiv lub voj tos kev teeb tsa
// Tsis muaj qhov AP tsis pom los ua haujlwm nrog SDK 1.5, hloov kho kom tsawg kawg 1.5.1 //WiFi.mode(WIFI_STA);
yog (! wifiManager.startConfigPortal ("OnDemandAP")) {Serial.println ("ua tsis tau txuas thiab ntaus sijhawm"); ncua (3000); // rov pib dua thiab sim dua, lossis tej zaum muab tso rau pw tsaug zog ESP.reset (); ncua (5000); }}
//Serial.println("Button status False. Back to Main loop "); //display.print("Lub ntsiab voj"); //display.clear ();
}
Qhov thib ob yuav yog peb qhov haujlwm tseem ceeb kom tau txais HTTP cov lus teb los ntawm cov neeg rau zaub mov tshwj xeeb & Zaub cov lus tso tawm kom muaj nuj nqis hauv Zaub.
Rau Qhov Ua Ntej no peb yuav tsum tau txais peb kab & hloov pauv nthuav dav los ntawm Flash cia ntawm ESP (chaw nyob 0-> kab, 50-> ua haujlwm)
EEPROM.begin (100); // eeprom storageEEPROM.get (0, kab); // tau txais Tus Nqi los ntawm chaw nyob 0
EEPROM.get (50, hloov); // Tau Txais Tus Nqi Los ntawm qhov chaw nyob 50
tom qab ntawd peb yuav tsum hla kab no & hloov pauv cov ntsiab lus rau peb http server los ntawm kev tau txais txoj hauv kev kom tau txais tus nqi ntawm kev tawm tswv yim & tso tawm.
String Base_url = "tshem tawm"; // kuv puag urlHTTPClient http; // Lub hom phiaj ntawm chav kawm
Txoj hlua URL = Base_url+"?"+"Kab ="+kab+"& ua haujlwm ="+ua haujlwm;
Serial.println (URL);
http.begin (URL);
int httpCode = http. GET ();
Serial.println (http.getString ()); // qhov no yuav luam tawm txhua kab lus teb
yog tias koj xav tau li cas tag nrho cov ntawv ces koj txoj haujlwm tau ua tiav ntawm no nws tus kheej peb tuaj yeem tso ncaj qha nws hauv tm1637 zaub.
display.print (http.getString ());
Tab sis kuv tsis xav qhia tag nrho cov ntawv, vim nws muaj cov tswv yim, tso tawm hauv json daim ntawv & qee lwm cov ntawv dav dav hais txog nws cov database & lwm yam.
yog li thawj zaug kuv tshem tawm cov ntawv dav dav los ntawm kab lus teb los ntawm kev siv Substring () muaj nuj nqi.
kuv suav qhov ntev ntawm cov ntawv dav dav thiab txiav nws.
yog (httpCode> 0) {const size_t bufferSize = 100; // DynamicJsonDocument jsonBuffer (bufferSize); DynamicJsonDocument hauv paus (bufferSize);
// JsonObject & hauv paus = doc.parseObject (http.getString ());
Txoj hlua json_string = http.getString (). Substring (121); /* qhov no yog kuv qhov pib ntawm cov ntawv dav dav yog tias koj lub luag haujlwm tsis muaj ib yam zoo li koj tuaj yeem tshem tawm cov cai no; */
//Serial.println(json_string);
DeserializationError yuam kev = deserializeJson (hauv paus, json_string);
// JsonObject & hauv paus = jsonBuffer.parseObject (http.getString ());
yog (yuam kev)
{Serial.print (F ("deserializeJson () ua tsis tiav:"));
Serial.println (error.c_str ());
rov qab;
}
lwm tus {
const char* input = hauv paus ["input"];
const char* output = hauv paus ["tso tawm"];
Serial.print ("Cov tswv yim:");
Serial.println (cov tswv yim);
Serial.print ("Cov zis:");
Serial.println (tso tawm);
display.print (".. hauv..");
display.clear (); // tshem cov zaub
display.print (cov tswv yim); // luam tawm COUNTING DIGITS
}
qhov ntawd yog peb txoj haujlwm tseem ceeb tau ua tiav.
Kauj Ruam 5: Tsim Web Server
Kuv siv xampp raws li kuv lub vev xaib pabcuam & PHP tus lej kom tau txais cov ntaub ntawv los ntawm kuv SQL database kom tau txais pes tsawg.
Tab sis kuv tsis tuaj yeem faib tag nrho cov lej tseem ceeb ntawm nws. vim nws tsis pub leej twg paub ntawm kuv lub tuam txhab. tab sis kuv yuav qhia qhov yuav tsim ib lub web server li cas, qhia dummy zoo li qub input & output kom muaj nuj nqis.
Txog qhov no koj yuav tsum xav tau ib lub web host, kuv siv ntawm no xampp ua kuv tus tswv.
koj tuaj yeem rub xampp ntawm no.
nruab xampp… yog tias koj xav tau kev qhia paub meej koj tuaj yeem siv qhov txuas no.
Tom qab txhim kho xampp koj yuav tsum mus rau koj cov npe hauv paus.
C: / xampp / htdocs
tag nrho koj cov phiaj xwm php yuav tsum sab hauv ntawm lub hauv paus no.
Kuv tsim kuv nplooj ntawv hauv lub npe hu ua esp_api.php
Nov yog kuv tus lej php. ntawm no kuv tsuas yog tso saib qhov muaj nuj nqis zoo li qub ntawm kev nkag & tawm;
$ kab = $ _ Tau txais ['kab']; $ ua haujlwm = $ _ Tau txais ['ua haujlwm'];
ncha ("myString"); // Cov ntawv nyeem dav
yog ($ kab == 'a0401' thiab $ shift = 'dd') {$ result ['input'] = 100; $ tshwm ['tso tawm'] = 99; }
lwm {$ result ['input'] = 200; $ tshwm sim ['tso tawm'] = 199; }
$ myObj-> input = ". $ result ['input']. '';
$ myObj-> output = ". $ result ['output']. '';
$ myJSON = json_encode ($ myObj);
ncha $ myJSON;
Tam sim no peb HTTP teb API tau ua tiav.
Peb http puag url yuav zoo li
koj_ip_address/esp_api.php
koj tuaj yeem tshawb xyuas koj cov lus teb API los ntawm
localhost/esp_api.php? kab = a0401 & hloov = dd
ntawm no kuv hais kab li a0401 thiab hloov ua dd.
Kauj Ruam 6: Kauj Ruam Kawg !
Sau koj lub computer ip chaw nyob hauv Base URL
String Base_url = "tshem tawm"; // koj lub hauv paus url
thiab Tshaj Tawm rau koj li ESP nodemcu. Thaum koj ua tiav tsuas yog qhib koj lub wifi los ntawm koj lub xov tooj ntawm tes lossis laptop, koj yuav tau txais lub network hu ua AutoConnectAP. txuas nrog nws thiab nkag mus rau koj daim ntawv pov thawj & kab teeb tsa.
Tom qab ntawd rov pib dua koj lub cuab yeej & txheeb xyuas hauv koj lub network txuas nrog thaum nws txuas nrog ces txhua yam ua tiav.
Koj tuaj yeem pom cov lus qhia tawm hauv cov zaub.
yog tias koj xav hloov ib kab lossis ntawv pov thawj wifi koj tuaj yeem nias qhov hloov pauv rau ob peb feeb, tso saib qhia tau.
koj nkag mus rau qhov xav tau hom AP. koj tuaj yeem hloov & rov pib dua lub cuab yeej.
Lub ntsiab moto ntawm nws cov lus qhia los qhia koj yuav ua li cas peb tuaj yeem siv peb txoj haujlwm nyiam thiab lom zem hauv qhov tsim khoom tiag & tsim khoom hauv cheeb tsam thiab qhia
Pom zoo:
Ntau lawm ntawm Sine Wave Tswj Pawg Thawj Coj: 5 Cov Kauj Ruam
Kev tsim tawm ntawm Sine Wave Control Board: Lub sijhawm no nws yog ib theem-sine yoj tawm ntawm daim phiaj tswj hwm, ua raws los ntawm ib-theem sine wave tawm-daim phiaj tswj hwm pawg thawj coj, tom qab ntawd peb-theem sine wave tawm-daim phiaj tswj hwm, thiab thaum kawg yog peb-theem sine yoj tawm ntawm daim phiaj tswj hwm. Peb cia siab tias
Loj hlob Zaub Zaub Ntxiv Hauv Qhov Chaw Tsawg Los Yog Loj hlob Zaub Zaub Hauv Chaw, (Ntau lossis Tsawg): 10 Kauj Ruam
Loj Hlob Ntau Cov Zaub Zaub Hauv Tsawg Chaw lossis … Loj hlob Zaub Zaub Hauv Chaw, (Ntau lossis Tsawg).: Qhov no yog kev tshaj lij tshaj lij rau Kev Loj Hlob Tshaj Ntiaj Teb, Kev Tsim Khoom Sib Tw, xa los ntawm Cov Lus Qhia. Kuv tsis tuaj yeem muaj kev zoo siab dua los tsim rau thaj chaw cog qoob loo thiab tshaj tawm kuv thawj Cov Lus Qhia. Yuav pib, kev sib tw nug peb kom
D4E1: Kev nyeem ntawv-cuab yeej 2.0 (Txheej Txheem Ntau Lawm): 9 Cov Kauj Ruam
D4E1: Kev nyeem ntawv-cuab yeej 2.0 (Txheej Txheem Txheej Txheem Ntau Lawm): Cov ntaub ntawv:-Ob tus tub ntxhais kawm Muaj Cov khoom lag luam tsim khoom hauv Kortrijk (Belgium) tuaj nrog cov cuab yeej nyeem ntawv no. Peb pib raws qhov tsim qauv uas twb muaj lawm thiab tau txhim kho nws mus rau lwm qhov kev tsim. Kev nyeem ntawv-cuab yeej thaum xub thawj tau raug txhim kho rau cli & nte
Txawb Xov Tooj Infrared Cua Txias Chaw Taws Teeb Tswj DIY Ntau Lawm: 7 Cov Kauj Ruam
Txawb Xov Tooj Infrared Cua Txias Chaw Taws Teeb DIY Kev Tsim Khoom: Thaum lub caij sov, thaum koj mus tsev lossis chaw ua haujlwm, koj xav tig lub tshuab cua txias tab sis koj tsis tuaj yeem pom lub chaw taws teeb tswj ib ntus. Nws yog ib yam txaus siab heev. Hauv lub sijhawm thaum lub xov tooj ntawm tes no tsis tawm mus, koj puas tuaj yeem siv lub xov tooj ntawm tes ua lub
Kev Tswj Ntau Lawm Qualcomm: 4 Cov Kauj Ruam
Kev Tswj Ntau Lawm Qualcomm: Uma equip Hackears desenvolveu um sistema de controle / monitoramento de processos Industriais, usando uma plataforma DragonBoard 410c - Qualcomm, que tem como objetivo resolver problemas de engenharia de produ ç ã o de tal forma a garan