Cov txheej txheem:

Tswj Arduino Wirelessly Nrog MATLAB: 11 Cov Kauj Ruam
Tswj Arduino Wirelessly Nrog MATLAB: 11 Cov Kauj Ruam

Video: Tswj Arduino Wirelessly Nrog MATLAB: 11 Cov Kauj Ruam

Video: Tswj Arduino Wirelessly Nrog MATLAB: 11 Cov Kauj Ruam
Video: Use the remote control or your numeric keypad to easily change your display 2024, Hlis ntuj nqeg
Anonim
Tswj Arduino Wirelessly Nrog MATLAB
Tswj Arduino Wirelessly Nrog MATLAB
Tswj Arduino Wirelessly Nrog MATLAB
Tswj Arduino Wirelessly Nrog MATLAB
Tswj Arduino Wirelessly Nrog MATLAB
Tswj Arduino Wirelessly Nrog MATLAB

Tau pom ob peb DIYs yuav tsim kev sib txuas lus li cas ntawm MATLAB daim ntawv thov thiab Arduino uas nyuaj rau PC. Txawm li cas los xij, Kuv tsis tau ntsib ib yam dab tsi uas tswj Arduino ntawm MATLAB wirelessly siv ENC28J60 sib xws Ethernet daim thaiv. Hauv ible ', Kuv yuav qhia txoj hauv kev yooj yim tshaj plaws los tswj Arduino siv MATLAB wirelessly. YUAV UA LI CAS? 1) Arduino - Koj xav tau tus tswj hwm. Kuv siv Arduino txij li nws tau txhawb los ntawm MATLAB. Rau qhov haujlwm no txawm li cas los xij kuv siv, Gizduino, tus tsim hauv Arduino-based tswj. 2) Ethernet Shield - Koj xav tau daim thaiv Ethernet sib xws rau koj lub rooj tsavxwm. Kuv siv ENC28J60 rau kuv pawg thawj coj. 3) Wi -nkaus Router - Txhawm rau txuas koj Arduino uas yuav yog txoj hauv kev sib txuas lus rau koj lub PC wirelessly. 4) LED - Txhua yam khoom siv los qhia kev sib txuas lus ntawm cov khoom siv. Rau qhov haujlwm no kuv siv LED. 5) Tshuab Luam Ntawv Cable - Txuas Arduino rau koj lub PC. 6) UTP Cable - Txhawm rau txuas koj daim thaiv Ethernet rau lub router.

Kauj Ruam 1: Txuas Ethernet Shield rau Arduino

Txuas Ethernet Shield rau Arduino
Txuas Ethernet Shield rau Arduino

Ua tib zoo txuas koj daim thaiv Ethernet rau koj Arduino. Tsis txhob khoov tus pin.

Kauj ruam 2: Txuas LED

Txuas LED
Txuas LED

Txuas ib yam khoom uas tuaj yeem qhia kev sib txuas lus ntawm cov khoom siv. Hauv qhov no ible Kuv tau siv LED. Yuav sim tig LED rau thiab tua hluav taws xob siv MATLAB. Kuv tau txuas kuv tus LED anode (tus pin ntev) rau Digital I/O pin 6 ntawm Ethernet daim ntaub thaiv txuas rau Arduino thiab LED's cathode (tus pin luv) rau Ethernet GND.

Kauj ruam 3: Txuas Arduino rau PC

Txuas Arduino rau PC
Txuas Arduino rau PC

Txuas lub tshuab luam ntawv cable rau koj Arduino thiab txuas rau PC.

Kauj Ruam 4: Txuas Ethernet Shield rau Router

Txuas Ethernet Shield rau Router
Txuas Ethernet Shield rau Router
Txuas Ethernet Shield rau Router
Txuas Ethernet Shield rau Router

Plug-in UTP rau koj daim thaiv thaiv Ethernet thiab ib qho ntawm LAN chaw nres nkoj ntawm koj lub router.

Kauj Ruam 5: Qhib Arduino IDE

Qhib Arduino IDE
Qhib Arduino IDE
Qhib Arduino IDE
Qhib Arduino IDE
Qhib Arduino IDE
Qhib Arduino IDE
Qhib Arduino IDE
Qhib Arduino IDE

Kuv siv Arduino 1.0 vim yog Ethernet daim ntaub thaiv tsev qiv ntawv sib xws. Tom qab qhib Arduino 1.0, rub tawm lub tsev qiv ntawv thiab luam tawm cov ntsiab lus rau hauv phau ntawv tais ceev tseg ntawm koj Arduino 1.0.

Kauj ruam 6: Upload Code rau Arduino

Upload Code rau Arduino
Upload Code rau Arduino
Upload Code rau Arduino
Upload Code rau Arduino
Upload Code rau Arduino
Upload Code rau Arduino

Ua ntej xa cov lej rau koj Arduino, nco ntsoov tias koj tau qhia lub vev xaib chaw nyob uas nyob nrog hauv DHCP server ntau. Txhawm rau kawm DHCP server ntau ntawm koj lub router, koj tuaj yeem nkag mus rau koj lub router los ntawm kev qhib lub browser thiab ntaus lub qhov rooj nkag tsis raug, 192.168.0.1. Feem ntau ntawm lub router siv qhov chaw nyob qhov rooj nkag tsis raug, txawm li cas los xij, qee lub router yuav siv qhov chaw nyob sib txawv. Txhawm rau kawm qhov chaw nyob ntawm koj lub router koj tuaj yeem nkag mus rau qhov hais kom ua, yog tias koj yog tus siv Windows, ntaus ipconfig thiab ntaus nkag. Saib rau qhov chaw nyob qhov rooj tsis raug yog tias koj txuas nrog koj lub router.

Kauj Ruam 7: Xeem Web Server

Xeem Web Server
Xeem Web Server

Tom qab xa cov cai rau Arduino, koj tuaj yeem sim yog tias koj tuaj yeem nkag mus rau lub vev xaib uas koj tau txais. Qhib tus browser thiab ntaus koj lub vev xaib chaw nyob. Kuv siv 192.168.0.15 raws li kuv qhov chaw nyob. Koj tuaj yeem nyem rau thiab tawm thiab tshawb xyuas yog tias LED txuas nrog koj daim thaiv thaiv Ethernet txuas rau Arduino tab tom teb. Thaum koj tau tsim kev sib txuas lus mus rau Ethernet daim thaiv thiab lub web server koj tuaj yeem npaj ua ke nrog MATLAB.

Kauj Ruam 8: Qhib MATLAB

Qhib MATLAB
Qhib MATLAB
Qhib MATLAB
Qhib MATLAB
Qhib MATLAB
Qhib MATLAB
Qhib MATLAB
Qhib MATLAB

Thaum tsim kom muaj kev sib txuas rau koj Arduino, Ethernet Shield thiab Web Sever koj tuaj yeem qhib koj MATLAB thiab pib nrog kev sib koom ua ke. ON Ib sab SAWV CEEB TOOM: Txawm hais tias peb yuav tsis siv MATLAB txhawb pob rau Arduino, koj tuaj yeem xaiv rub nws rau yav tom ntej siv.

Kauj ruam 9: Nyem rau GUIDE

Nyem rau ntawm GUIDE
Nyem rau ntawm GUIDE
Nyem rau ntawm GUIDE
Nyem rau ntawm GUIDE
Nyem rau ntawm GUIDE
Nyem rau ntawm GUIDE

Tom qab khiav MATLAB, nyem rau ntawm GUIDE. Qhov no yuav coj koj mus rau lwm lub qhov rais thov rau GUI cov qauv, tsuas yog nyem rau ntawm GUI dawb paug.

Kauj Ruam 10: Kos Ob Khawm

Kos Ob Lub Nroog
Kos Ob Lub Nroog
Kos Ob Lub Nroog
Kos Ob Lub Nroog
Kos ob lub pob
Kos ob lub pob

Nyem rau ntawm lub pob nyem thiab kos ob qho rau ON thiab OFF hom. Koj tuaj yeem hloov nws cov khoom raws li. Thaum ua tiav, nyem rau ntawm m-file thiab txuag.

Kauj ruam 11: Txuas Laub Khawm rau URL

Txuas Laub Khawm rau URL
Txuas Laub Khawm rau URL
Txuas Laub Khawm rau URL
Txuas Laub Khawm rau URL
Txuas Laub Khawm rau URL
Txuas Laub Khawm rau URL
Txuas Laub Khawm rau URL
Txuas Laub Khawm rau URL

Thaum ua tiav, koj tuaj yeem tso cov lej hauv qab no hauv qab lub pob nyem 1 thiab 2.

Rau thawj lub laub khawm: urlread ('https://192.168.0.15/?led=on'); Txog qhov khawm thib ob: urlread ('https://192.168.0.15/?led=off'); Yog tias koj tuaj pom, cov lej hauv qab no tsuas yog ua rau MATLAB nkag mus rau lub vev xaib chaw nyob server rau cov lus txib rau thiab tawm uas ua rau nws muaj peev xwm tswj tau cov hauv qab no tsis siv neeg. Tsuas yog nyem rau ntawm kev ua si thiab ua qhov kev sim.

Pom zoo: