Cov txheej txheem:

Yuav Ua Li Cas Xa Cov Ntaub Ntawv mus rau Huab nrog Arduino Ethernet: 8 Kauj Ruam
Yuav Ua Li Cas Xa Cov Ntaub Ntawv mus rau Huab nrog Arduino Ethernet: 8 Kauj Ruam

Video: Yuav Ua Li Cas Xa Cov Ntaub Ntawv mus rau Huab nrog Arduino Ethernet: 8 Kauj Ruam

Video: Yuav Ua Li Cas Xa Cov Ntaub Ntawv mus rau Huab nrog Arduino Ethernet: 8 Kauj Ruam
Video: Computer Vision with Python! Resizing Images 2024, Kaum ib hlis
Anonim
Yuav xa cov ntaub ntawv mus rau huab nrog Arduino Ethernet li cas
Yuav xa cov ntaub ntawv mus rau huab nrog Arduino Ethernet li cas

Cov lus qhia no qhia koj yuav ua li cas tshaj tawm koj cov ntaub ntawv rau AskSensors IoT Platform siv Arduino Ethernet Shield. Ethernet Shield ua rau koj Arduino txuas nrog huab tau yooj yim, xa thiab tau txais cov ntaub ntawv nrog kev siv internet.

Peb yuav kawm dab tsi:

Peb yuav kawm paub pib ntawm kev txuas Arduino Ethernet daim thaiv rau AskSensors lub web server, thiab xa cov ntaub ntawv dag dhau HTTP thov. Thaum kawg, yuav pom cov ntaub ntawv nyob hauv cov huab AskSensors.

Vim li cas HTTP thiab tsis yog

AskSensors txhawb nqa HTTPS, txawm li cas los xij, MCUs tau teeb tsa ntawm Arduinos tsis tswj hwm HTTPS kev sib txuas. Vim li no peb yuav siv HTTP hloov chaw

Nco tseg: Yog tias koj xav tau MQTT raws tu qauv, thov mus saib nplooj ntawv no: Txuas Arduino Ethernet Kom Nug Tus Kws Tshaj Lij Tshaj MQTT

Kauj Ruam 1: Arduino Ethernet Shield

Kho vajtse nta:

  • Yuav tsum muaj Arduino board.
  • Kev siv hluav taws xob 5V, muab los ntawm Arduino Board.
  • Ethernet Controller: Wiznet Ethernet maub los W5100 nrog sab hauv 16K tsis
  • Wiznet W5100 muab lub network (IP) pawg muaj peev xwm ntawm TCP thiab UDP.
  • Kev sib txuas ceev: txog 10/100Mb

  • Kev sib txuas nrog Arduino ntawm SPI chaw nres nkoj: Nws siv ICSP header pins thiab tus pin 10 ua tus xaiv xaiv rau SPI txuas rau Ethernet tus tswj nti.
  • Qhov kho tshiab kawg ntawm Ethernet Shield suav nrog daim npav micro-SD daim npav ntawm lub rooj tsavxwm, uas tuaj yeem siv los khaws cov ntaub ntawv rau kev ua haujlwm thoob plaws lub network.
  • Ethernet Module muaj tus txheej txheem txuas RJ45, nrog cov kab hloov pauv ua ke.
  • Kev sib txuas rau lub network tau ua nrog RJ45 Ethernet cable.

Software Library:

Cov ntaub thaiv npog Ethernet tso siab rau Arduino Ethernet lub tsev qiv ntawv

Lub tsev qiv ntawv los ua ke nrog Arduino IDE

Peb yuav xav hloov qee qhov chaw teeb tsa hauv lub program kom sib haum rau peb lub network.

Cov ntaub ntawv qhia txog LEDs:

Tom qab ntawd, koj yuav tsum tau txheeb xyuas qhov xwm txheej Ethernet siv cov ntaub ntawv qhia LEDs:

  • PWR: qhia tias lub rooj tsavxwm thiab daim thaiv npog tau siv
  • LINK: qhia tias muaj kev sib txuas hauv network thiab nyem thaum daim ntaub thaiv xa tawm lossis tau txais cov ntaub ntawv
  • Puv: qhia tias kev sib txuas hauv network yog duplex
  • 100M: qhia tias muaj 100 Mb/s network sib txuas (tsis zoo li 10 Mb/s)
  • RX: flashes thaum daim ntaub thaiv tau txais cov ntaub ntawv
  • TX: flashes thaum daim ntaub thaiv xa cov ntaub ntawv
  • COLL: taws thaum pom kev sib tsoo hauv network

Kauj Ruam 2: Cov Khoom Peb Xav Tau

Cov cuab yeej xav tau rau qhov kev qhia no yog:

  1. Lub computer siv Arduino IDE software.
  2. Ib pawg Arduino xws li Arduino Uno.
  3. Arduino Ethernet ntaub thaiv npog.
  4. Ib USB cable rau kev txhawb zog thiab ua haujlwm rau Arduino.
  5. Ethernet cable, txuas rau koj lub network router.

Kauj ruam 3: Teeb AskSensors

AskSensors xav tau cov hauv qab no:

  • Tsim tus lej siv: Koj tuaj yeem tau txais ib qho dawb (https://asksensors.com)
  • Tsim lub Sensor: Lub ntsuas cua yog kev sib txuas lus nrog lub cim tshwj xeeb Api qhov twg AskSensors sau thiab khaws cov neeg siv cov ntaub ntawv.

Txhua lub Sensor muab ob peb Cov Qauv uas tus neeg siv tuaj yeem xa cov ntaub ntawv rau lawv cais. Tus neeg siv kuj tseem tuaj yeem pom cov ntaub ntawv khaws tseg ntawm txhua tus qauv hauv kab duab. AskSensors muab ntau txoj kev xaiv ntawm kab suav nrog Kab, Bar, Scatter thiab ntsuas.

Kauj ruam 4: Coding

Yog li tam sim no peb tau tuaj yeem sau npe Sensor tshiab hauv AskSensors platform, Tam sim no peb tab tom yuav sau qee cov cai hauv Arduino rau nws txuas rau lub platform. Muaj ntau pua qhov kev qhia qhia txog kev txuas Arduino rau lub vev xaib los ntawm Ethernet Shields, yog li kuv yuav tsis piav qhia qhov no.

Rub tawm qhov piv txwv Arduino kos duab los ntawm github. Txoj cai siv DHCP thiab DNS rau tus neeg rau zaub mov thiab yuav tsum ua haujlwm tam sim nrog qee qhov kev hloov pauv:

  1. Yog tias koj siv ntau dua ib daim thaiv Ethernet ntawm lub network, nco ntsoov tias txhua daim thaiv Ethernet ntawm lub network yuav tsum muaj qhov chaw nyob tshwj xeeb mac.
  2. Hloov tus IP chaw nyob hauv daim duab qhia kom phim tus IP chaw nyob ntawm koj lub network.
  3. Teeb tsa Api Key In ntawm koj lub ntsuas (muab los ntawm AskSensors hauv qib dhau los)
  4. Teem koj cov ntaub ntawv dummy.

// MAC OS

byte mac = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; // Teeb tsa tus IP chaw nyob kom siv yog DHCP ua tsis tiav IPAddress ip (192, 168, 1, 177); // ASKSENSORS teeb tsa. const char* apiKeyIn = "MTWN7AQOLWJNEIF8RGMAW5EGKQFAHN2K"; // Hloov nws nrog koj qhov API KEY IN // dummy data int dumData = 100; // teeb tsa koj cov ntaub ntawv

Kauj ruam 5: Programming

Programming
Programming
  1. Txuas Ethernet daim thaiv rau hauv Arduino Uno board.
  2. Txuas Ethernet daim thaiv rau koj lub router/network los ntawm Ethernet cable.
  3. Txuas Arduino rau lub khoos phis tawj los ntawm USB cable. Lub zog yuav muab rau ob lub laug cam ntawm USB cable.
  4. Qhib koj cov cai hauv Arduino IDE, Xaiv qhov tseeb Arduino board thiab COM chaw nres nkoj. Tom qab ntawd, xa cov cai rau koj pawg Arduino. nco ntsoov tias cov cai tau muab tso ua tiav.

Kauj Ruam 6: Khiav Txoj Cai

  • Rov Pib dua: Koj tuaj yeem siv khawm rov pib dua ntawm daim ntaub thaiv kom rov pib dua tus Ethernet Controller thiab Arduino board.
  • Khiav cov cai: Tom qab rov pib dua/qhib lub zog, qhib lub davhlau ya nyob twg, koj yuav tsum pom Arduino luam tawm cov xwm txheej txheej txheem: arduino txuas rau lub network (siv sijhawm ob peb feeb), tom qab ntawd xa cov ntaub ntawv dummy mus rau AskSensors hla HTTP tau thov.
  • Cov Lus Teb: Tom qab tau txais qhov kev thov sau cov ntaub ntawv mus rau qhov tshwj xeeb Sensor los ntawm cov neeg siv khoom, tus neeg rau zaub mov ua ntej xa HTTP cov lus teb qhia tus lej ntawm cov qauv kho tshiab ua tiav ('1' hauv peb kis).

Kauj Ruam 7: Pom Cov Ntaub Ntawv

Pom cov ntaub ntawv
Pom cov ntaub ntawv

Tam sim no koj cov ntaub ntawv tau tshaj tawm zoo rau AskSensors huab. Koj tuaj yeem pom cov ntaub ntawv no hauv kab lossis xa nws mus rau CSV cov ntaub ntawv.

Txhua lub Sensor muaj nws tus kheej lub dashboard uas tam sim no tso cai saib xyuas nws lub xeev nyob rau lub sijhawm tiag (hnub hloov tshiab zaum kawg, lub xeev sib txuas..)

Nyem koj lub Sensor los ntawm cov npe, teeb duab rau koj tus qauv (Qauv 1). Cov duab saum toj no qhia qhov piv txwv ntawm kev tso saib siv hom ntsuas kab.

Kauj ruam 8: Ua tau zoo

Ua tsaug rau koj nyeem. koj tuaj yeem pom ntau cov lus qhia ntawm no.

Yog tias koj muaj lus nug, koom nrog AskSensors zej zog!

Pom zoo: