Cov txheej txheem:

IoT Moon Teeb: 5 Kauj Ruam
IoT Moon Teeb: 5 Kauj Ruam

Video: IoT Moon Teeb: 5 Kauj Ruam

Video: IoT Moon Teeb: 5 Kauj Ruam
Video: Plab Plab Ntswg..(Pluav Pluav Ntswg) Maiv Twm New Song 2023-2024 2024, Hlis ntuj nqeg
Anonim
IoT Moon Teeb
IoT Moon Teeb

Hauv cov lus qhia no kuv qhia yuav ua li cas hloov lub roj teeb yooj yim uas siv lub teeb ci teeb rau hauv IoT ntaus ntawv.

Txoj haujlwm no suav nrog:

  • soldering;
  • programming ESP8266 nrog Arduino IDE;
  • ua Android daim ntawv thov nrog MIT App Inventor.

Lub hom phiaj ntawm kev txaus siab yog lub hli zoo li lub teeb uas kuv yuav los ntawm gearbest. Tab sis qhov kev qhia no tiag tiag tuaj yeem hloov kho rau ib qho khoom siv hluav taws xob DC qis (AC cov cuab yeej siv hluav taws xob xav tau kev txuas ntxiv).

Khoom siv

  1. Android smartphone (Android version 7-9 kuaj).
  2. Cuab yeej cuab yeej.
  3. Prototyping PCB (protoboard).
  4. ESP-12E board (lossis lwm yam devboard nrog ESP8266 microcontroller).
  5. USB-serial converter rau lub cajmeem.
  6. Ntau qhov sib txawv qhov tseem ceeb ntawm cov khoom siv tsis sib xws (resistors thiab capacitors).

(Yeem tau. Saib ntu "Thaiv Diagram")

  1. 3.3V@500mA LDO IC.
  2. 3.3V-5V logic level converter board.
  3. 5V DC fais fab mov.

Kauj ruam 1: Tswv yim

Lub tswv yim
Lub tswv yim

Lub hli teeb tau siv los ntawm ib lub Li-ION 18650 ntawm tes thiab nws muaj 3 hom kev ua haujlwm:

  • tawm;
  • phau ntawv;
  • pib.

Hauv phau ntawv hom teeb yog tswj nrog lub laub khawm, txhua qhov kev hloov pauv LED lub teeb lub xeev (xiav rau, txiv kab ntxwv rau, ob qho tib si, tawm), lub teeb hloov pauv thaum tuav lub pob nyem. Hauv hom pib LED teeb lub xeev hloov pauv los ntawm tapping lossis tsau teeb nws tus kheej.

Kuv txiav txim siab ntxiv ESP8266 los ua tus web server uas mloog rau kev thov thiab raws li simulates khawm nias. Kuv tsis xav ua txhaum lub teeb ua haujlwm qub, tsuas yog xav kom ntxiv kev tswj hwm ntau dua WiFi, yog li kuv xaiv ESP los sim khawm nias es tsis txhob ncaj qha tswj LEDs. Tsis tas li qhov no tau tso cai rau kuv kom sib cuam tshuam tsawg tshaj nrog cov khoom siv hluav taws xob qub.

Thaum cov qauv ua tiav nws tsav ~ 80mA tas li los ntawm roj teeb hauv lub xeev (~ 400mA ntawm qhov ci tag nrho). Standby tam sim no siab vim ESP8266 ua haujlwm li server thiab ib txwm txuas nrog WiFi thiab mloog rau kev thov. Roj teeb tau ploj mus tom qab ib hnub thiab ib nrab hnub tsuas yog nyob hauv lub xeev, yog li tom qab ntawd kuv txiav txim siab siv lub teeb USB them chaw nres nkoj rau siv hluav taws xob tag nrho los ntawm sab nraud 5V fais fab mov thiab ditched roj teeb tag nrho ua ke (tab sis qhov no yog nyob ntawm yeem).

Kauj Ruam 2: Thaiv Daim Duab

Thaiv daim duab
Thaiv daim duab

Hauv daim duab thaiv koj tuaj yeem pom dab tsi yuav txuas ntxiv cov hluav taws xob thiab yuav hloov pauv li cas tam sim no. Hauv kuv qhov xwm txheej kuv tshem lub roj teeb kom tag thiab luv lub roj teeb them IC cov tswv yim nrog cov zis (dua, qhov no yog nyob ntawm yeem). Cov pob tshab pob tshab hauv daim duab qhia pom cov khoom uas tau hla dhau (txawm hais tias khawm khawm tseem ua haujlwm raws li lub hauv paus xav tau).

Raws li cov ntaub ntawv ESP8266 zam rau tsuas yog 3.3V, txawm li cas los xij muaj ntau qhov piv txwv thaum ESP8266 ua haujlwm tau zoo nrog 5V, yog li kev hloov pauv logic thiab 3.3V LDO tuaj yeem tawm mus, txawm li cas los kuv tseem nyob nrog kev coj ua zoo tshaj plaws thiab ntxiv cov khoom ntawd.

Kuv siv 3 ESP8266 I/O pins thiab ADC tus pin. Ib tus lej pin tso tawm yog rau simulating khawm nias, ob lub tswv yim digital yog txhawm rau txheeb xyuas seb cov xim LEDs nyob rau qhov twg (los ntawm qhov no peb tuaj yeem xam tawm hauv lub xeev twg MCU yog thiab lub xeev twg tom ntej tom qab khawm nias). ADC tus pin ntsuas qhov ntsuas hluav taws xob (los ntawm qhov faib hluav taws xob), yog li ntawd peb tuaj yeem saib xyuas cov roj teeb uas tseem tshuav li cas.

Raws li lub zog hluav taws xob sab nraud Kuv siv lub xov tooj qub them 5V@1A (tsis txhob siv lub nrawm).

Kauj ruam 3: Programming

Programming
Programming
Programming
Programming

Hauv qhov kev zov me nyuam ua haujlwm zoo li no (xav paub ntau ntxiv saib tus lej nws tus kheej):

ESP8266 txuas rau koj li WiFi nkag mus qhov chaw uas muaj peev xwm koj yuav tsum nkag mus thaum pib ntawm txoj cai ua ntej lub cajmeem, nws tau txais IP chaw nyob los ntawm koj tus routers DHCP server, txhawm rau nrhiav tus IP uas koj yuav xav tau tom qab, koj tuaj yeem tshawb xyuas routers web interface DHCP nqis lossis teeb tsa debugging chij hauv tus lej rau 1 thiab koj yuav pom dab tsi IP ESP tau txais hauv kev saib xyuas (koj yuav tsum khaws tus IP ntawd hauv koj lub routers teeb tsa kom ESP ib txwm yuav tau txais IP tib yam ntawm khau raj).

Thaum pib MCU ib txwm ua tib lub sijhawm tas mus li:

  1. Txheeb xyuas yog tias tseem txuas nrog AP, yog tias tsis sim txuas dua kom txog thaum ua tiav.
  2. Tos rau tus neeg siv los thov HTTP. Thaum thov tshwm sim:

    1. Txheeb xyuas qhov hluav taws xob.
    2. Txheeb xyuas seb lub xeev LEDs twg.
    3. Match HTTP thov nrog paub lub xeev LED (xiav rau, txiv kab ntxwv rau, ob leeg rau, tawm).
    4. Simulate ntau lub laub khawm nias raws li xav tau kom ua tiav lub xeev thov.

Kuv yuav piav qhia luv luv cov lus qhia ua haujlwm, yog tias nws yog koj thawj zaug kev sau ESP8266 MCU saib kom paub ntau ntxiv hauv cov lus qhia tob.

Koj yuav xav tau Arduino IDE thiab USB-serial interface hloov pauv (piv txwv li FT232RL). Txhawm rau npaj IDE ua raws cov lus qhia no.

Ua raws daim duab qhia kev txuas mus rau ESP-12E tus qauv rau kev ua haujlwm. Qee cov lus qhia:

  • siv sab nraud 3.3V@500mA fais fab mov (feem ntau USB-cov khoom siv hluav taws xob tsis txaus);
  • xyuas seb koj li USB-serial converter yog 3.3V logic qib sib xws;
  • xyuas seb USB-serial converter hloov chaw teeb tsa tau ua tiav (los ntawm windows device manager) kuj koj tuaj yeem tshawb xyuas yog tias nws ua haujlwm raug los ntawm IDE, tsuas yog luv RX thiab TX pins, dua li los ntawm IDE xaiv COM chaw nres nkoj, qhib cov ntawv txuas thiab sau ib yam, yog tias txhua yam ua haujlwm koj yuav tsum pom cov ntawv uas koj xa tuaj tshwm hauv lub console;
  • vim qee qhov kuv tuaj yeem ua haujlwm ESP nkaus xwb thaum kuv xub txuas USB-serial hloov pauv mus rau PC thiab tom qab ntawd ua haujlwm ntawm ESP los ntawm sab nraud 3.3V qhov chaw;
  • tom qab ua tiav txoj haujlwm tsis txhob hnov qab rub GPIO0 siab ntawm khau raj tom ntej.

Kauj ruam 4: Schematic thiab Soldering

Schematic thiab Soldering
Schematic thiab Soldering
Schematic thiab Soldering
Schematic thiab Soldering
Schematic thiab Soldering
Schematic thiab Soldering

Ua raws li cov txheej txheem txhawm rau txhawm rau txhuam cov khoom siv rau protoboard. Raws li tau hais ua ntej qee qhov khoom siv yog xaiv tau. Kuv siv KA78M33 3.3V LDO IC thiab lub logic qib hloov lub rooj tsavxwm los ntawm sparkfun, hloov pauv, koj tuaj yeem ua tus hloov pauv koj tus kheej raws li tau qhia hauv cov txheej txheem (koj tuaj yeem siv ib qho N-channel mosfet tsis yog BSS138). Yog tias koj siv nrog roj teeb Li-ION, +5V lub zog siv hluav taws xob yuav yog lub roj teeb zoo lub davhlau ya nyob twg. ESP8266 ADC siv qhov ntsuas hluav taws xob yog 1V, kuv xaiv qhov ntsuas qhov ntsuas qhov sib faib tso cai ntsuas ntsuas hluav taws xob kom siab li 5.7V.

Yuav tsum muaj 5 qhov txuas mus rau thawj lub teeb PCB: +5V (lossis +Roj teeb), GND, thawb khawm, PWM teeb tsa los ntawm cov teeb MCU rau kev tswj cov LED xiav thiab txiv kab ntxwv. Yog tias koj teeb lub teeb los ntawm 5V qhov chaw, zoo li kuv tau ua, koj yuav xav siv lub roj teeb luv IC IC VCC tus pin nrog OUTPUT tus pin, txoj kev ntawd txhua yam khoom siv hluav taws xob yuav tau ncaj qha los ntawm +5V thiab tsis yog los ntawm lub roj teeb charger OUTPUT.

Ua raws li daim duab thib ob rau txhua cov ntsiab lus solder koj yuav tsum ua ntawm teeb PCB.

CEEB TOOM:

  1. Yog tias koj txiav txim siab luv +5V nrog lub roj teeb them IC tso tawm, tshem lub roj teeb ua ntej ua li ntawd, koj tsis xav txuas +5V ncaj qha rau lub roj teeb.
  2. Ua tib zoo saib qhov twg khawm khawm koj txuas ESP cov zis, vim tias 2 tus pin ntawm lub laub khawm txuas nrog hauv av thiab koj tsis xav kom luv Circuit Court thaum ESP tso tawm mus siab dua, zoo dua ob zaug kos nrog multimeter.

Kauj ruam 5: Android App

Hauv App
Hauv App
Hauv App
Hauv App
Hauv App
Hauv App

Android app tau tsim nrog MIT tus tsim app, txhawm rau rub tawm ib qho app thiab/lossis clone project rau koj tus kheej, mus rau qhov txuas no (koj yuav xav tau tus lej google nkag mus rau nws).

Thaum xub pib koj yuav tsum qhib qhov chaw thiab nkag mus rau koj tus ESP8266 IP chaw nyob. Tus IP no yuav raug txais kev cawmdim yog li tsis tas yuav rov nkag nws dua tom qab qhov haujlwm rov pib dua.

App tau sim nrog ntau lub Android 9 thiab Android 7 pab kiag li lawm.

Pom zoo: