Cov txheej txheem:

ESP8266 ESP-01 LED Hlau Hloov: 6 Cov Kauj Ruam
ESP8266 ESP-01 LED Hlau Hloov: 6 Cov Kauj Ruam

Video: ESP8266 ESP-01 LED Hlau Hloov: 6 Cov Kauj Ruam

Video: ESP8266 ESP-01 LED Hlau Hloov: 6 Cov Kauj Ruam
Video: УРОК ПО MICROPYTHON | ЗАПУСКАЕМ ВЕБ СЕРВЕР НА ESP8266 #micropython #python #esp8266 2024, Kaum ib hlis
Anonim
ESP8266 ESP-01 LED Hlau Hloov
ESP8266 ESP-01 LED Hlau Hloov

Txoj haujlwm no tau tshwm sim thaum kuv tus hluas nkauj thiab kuv tau teeb tsa ntau lub teeb ci LED teeb pom kev zoo hauv chav rau kev zoo nkauj Christmas. Txhua lub sijhawm peb mus pw peb yuav tsum tau khiav ib ncig ntawm chav thiab kaw txhua tus xaim hluav taws xob. Lwm hnub, peb yuav tsum tig tag nrho lawv dua.

Txij li thaum kuv muaj qee qhov ESP8266 ESP-01 cov qauv nyob ib puag ncig, Kuv txiav txim siab los sib sau ua ke thiab teeb tsa tus qauv sai.

Tom qab ua tiav kev ua tiav ntawm tsab ntawv nrog cov kab hluav taws xob LED tsis zoo, Kuv txiav txim siab los ua kuv tus thawj PCB tsim thiab xaj ob peb lub laug cam.

Cov lus qhia no ua rau koj hla cov txheej txheem, thawj qhov qauv thiab PCB thiab muab koj cov cai rau kev teeb tsa ESP module nrog ob peb nyem.

TL; DR: Nov yog txoj hauv kev yooj yim los siv Wi-nkaus tswj kev hloov pauv nrog ESP8266 ESP-01.

Khoom siv:

Kho vajtse

  • ESP8266 ESP-01 tus qauv
  • AMS-1117 3.3V tus tswj hwm
  • IRLB8721 MOSFET (PCB kawg) lossis 2N2222 transistor (thawj tsab)
  • Txiv neej thiab poj niam header tuav

Software

Arduino IDE hwm V 1.6

Rau programming

Qhib SMART USB rau ESP-01 Adapter

Rau kev sim

  • LED
  • 220 Ohm tus tiv thaiv
  • Cov qhob cij
  • Jumper cables

Rau los ua ke

  • Soldering hlau
  • Cov xov hlau (tsab qauv nkaus xwb; tsis yog rau PCB)
  • Perf board (tsab ntawv nkaus xwb; tsis yog rau PCB)

Kauj ruam 1: Schematic

Schematic
Schematic

Saum toj no yog cov txheej txheem ua nrog EasyEDA. Nws tuaj yeem tawg zoo li no:

Peb coj qhov hluav taws xob nkag los ntawm USB fais fab cable nrog 5V thiab pub nws rau hauv VIN tus pin ntawm AMS1117 3.3V module.

Cov VOUT pins ntawm AMS1117 3.3V module txuas nrog tus pin tus pin ntawm IRLB8721 MOSFET thiab VIN thiab CH_PD pins ntawm ESP8266 ESP-01 module. CH_PD tus pin xav tau rub siab rau ESP8266 ESP-01 module kom ua raws txoj cai.

D2 tus pin ntawm ESP8266 ESP-01 module txuas nrog GATE tus pin ntawm IRLB8721 MOSFET. Qhov no tswj hwm qhov tam sim no yuav ntws los ntawm nws lossis tsis.

Tus pin emitter ntawm IRLB8721 MOSFET txuas nrog cov xaim LED.

Thaum kawg, txhua tus pin hauv av tau txuas ua ke.

Yog tias koj xaiv 2N2222 transistor, hloov txhua qhov tshwm sim ntawm IRLB8721 nrog 2N2222 feem thiab nco qab ob txhais ceg muaj lub ntsiab lus sib txawv ntawm ob qho khoom siv.

Kauj ruam 2: Programming

Ua ntej peb teeb tsa daim ntawv pov thawj ntawm lub khob cij, peb yuav tsum ua haujlwm ESP8266 ESP-01 tus qauv, yog li peb tuaj yeem sim cov qauv ua ntej tom qab.

Code

Kuv tus lej hnyav raws li Random Nerd Tutorial cov lus qhia rau HTTP server yooj yim. Kuv tau tshem lub pob thib ob tab sis, txij li peb tsuas xav tau tswj ib tus pin (D2). Txawm li cas los xij, koj tsuas tuaj yeem siv lawv cov lej ib yam nkaus thiab hloov koj li ntawv pov thawj WiFi.

Nyem rau ESP8266 ESP-01

Yog tias koj tau txais koj tus kheej OPEN-SMART USB rau ESP-01 Adapter koj tuaj yeem ntsaws koj tus ESP8266 ESP-01 module rau hauv nws thiab teeb tsa hloov mus rau PROG. Tom qab ntawd, ntsaws txhua yam rau hauv USB chaw nres nkoj dawb hauv koj lub computer thiab tua Arduino IDE.

Luam thiab muab cov cai los ntawm Kev Qhia Ua Nerd Tsis Txaus Siab, hloov koj li ntawv pov thawj WiFi thiab xa nws mus rau ESP8266 ESP-01 module.

Tom qab ntawd, tshem tawm ESP8266 ESP-01 module los ntawm OPEN-SMART adapter, teeb tsa hloov mus rau UART thiab rov tso nws dua.

Kuaj cov cai

Qhib Serial Console hauv Arduino IDE thiab tos kom txog thaum tus qauv txuas nrog WiFi.

Tom qab ntawd, qhib koj tus browser thiab mus rau tus IP chaw nyob hauv Serial Console. Nco tseg: Koj yuav tsum nyob hauv tib lub network aka WiFi. Lwm qhov koj yuav tsis tuaj yeem nkag mus rau ESP8266 ESP-01!

Yog tias txhua yam ua haujlwm, koj pom lub vev xaib nrog ob lub khawm. Txuas lub LED nrog 220 Ohm resistor rau D2 tus pin ntawm ESP8266 ESP-01 module thiab nws yuav tsum teeb thiab tua thaum koj nyem lub pob kom raug ntawm lub vev xaib.

Yog tias koj ntsib teeb meem, thov ua raws cov ntawv qhia ntxaws thiab ntxaws txuas rau saum toj no.

Kauj ruam 3: Prototyping

Prototyping
Prototyping
Prototyping
Prototyping

Teeb tsa lub khob cij nrog txhua yam xav tau cov khoom siv thiab cov xov hlau raws li qhia hauv kab lus saum toj no thiab ntsuas nws nrog qhov program ESP8266 ESP-01 module.

Yog tias txhua yam ua haujlwm, koj muaj ob txoj kev xaiv.

Kev Xaiv A: Muab nws tso rau ntawm daim txiag ntoo

Qhov Xaiv B: Ua PCB

Kuv xaiv qhov kev xaiv Ua ntej thiab tom qab txiav txim siab kom kuv txhais tes qias neeg nrog kuv thawj qhov haujlwm PCB.

Hauv cov duab koj pom kuv tus kheej tus kheej daim qauv. Raws li ib txwm muaj, kev sib txuas yog ib qho tsis meej thiab kuv tau siv qee lub raj me me los tiv thaiv kev sib tshooj sib txuas los ntawm kev luv luv. Tsis tas li, kuv siv 2N2222 transistor hloov ntawm IRLB8721 MOSFET, vim tias kuv muaj ntau ntawm lawv dag ib ncig thiab kuv paub tias nws tsis txhais tau tias yuav nyob.

Cov laug siv kuv li ib teev thiab nws tsis lom zem hlo li. Yog tias koj yog tus kws tshaj lij muag khoom tej zaum koj txaus siab rau cov txheej txheem, tab sis rau kuv Kuv xav tau qee yam yooj yim dua.

Kauj Ruam 4: PCB

PCB
PCB
PCB
PCB

Kuv tau ntshai PCBs vim tias kuv xav tias kuv yuav tsum tsim lawv nrog SMD cov khoom thiab kuv tsis tuaj yeem nrhiav tau yooj yim ua ESP lossis Arduino cov qauv kev txhim kho kom ntxig rau hauv cov txheej txheem lossis txheej txheem PCB.

Txog qhov haujlwm no kuv txiav txim siab los txiav txim siab yooj yim ESP8266-01 thiab AMS1117 3.3. V modules raws li yam khoom kuv yuav xav tau rau ntawm lub rooj tsav khoom kom siv tau: raws li poj niam header pins.

Qhov no ua rau kuv lub neej yooj yim dua thiab txheej txheej PCB tau ua tiav hauv ob teev. Koj tuaj yeem pom ob qhov hloov pauv hauv cov duab.

Version 1 muaj qee qhov kev ceeb toom me:

1. Cov taub hau taub hau yog nqaim dhau. Kuv tsis tau coj mus rau hauv tus account lawv yuav tsum yog 2.54mm sib nrug los ntawm ib leeg thiab tsuas yog rub thawj tus pin los ntawm lub tsev qiv ntawv. 2. Kuv messed daim ntawv lo rau VIN: VCC thiab GND cov ntawv raug pauv. 3. AMS1117 3.3V module yog qhov dav dua qhov kuv xav thiab nthuav dav hla ntug ntawm PCB.

Tau kawg, Kuv pom cov lus ceeb toom tom qab xaj thiab sim lawv hauv lub neej tiag. Lawv tsis yog game breaker, tab sis kuv tsim qhov tshiab uas kuv tau txhim kho cov ntsiab lus hais los saum no. Tsis tas li, kuv tso ESP8266 ESP-01 tus qauv hauv txoj hauv kev uas nws yuav tsis sib tshooj AMS1117 3.3V module.

Koj tuaj yeem pom txoj haujlwm EasyEDA ntawm no:

Kauj ruam 5: Ua ntej

Yog li ntawm no peb nyob nrog qhov yooj yim kom dhos PCB. Dab tsi ntxiv?

Casing

Nws yuav yog qhov zoo tshaj kom muaj cov ntawv luam tawm 3D uas zais cov khoom siv hluav taws xob thiab ua rau kev tsim kho muaj zog dua. Qhov zoo tshaj nws yuav muaj cov cua sov sib xyaw ua ke rau IRLB8721 (txawm hais tias thaum lub sijhawm kuv sim nrog 10m ntev LED xaim nws yeej tsis ua kom sov dua li chav sov).

Txuas

Tsis tas li, Kuv xav ntxiv USB txuas rau VIN aka USB cable thiab JST txuas rau VOUT aka lub xov tooj LED. Tam sim no, Kuv siv txiv neej lub taub hau ntawm lub rooj tsavxwm thiab poj niam lub taub hau txuas rau lub xov hlau LED thiab (txiav tawm) USB cable txuas nws. Tab sis qhov no tsis yog pov thawj yav tom ntej kev sib txuas thiab tsis saib thiab xav tias zoo heev.

Ua ke nrog rooj plaub qhov no yuav ua rau muaj kev zoo nkauj zoo nkauj ntxiv thiab tseem suav nrog kev paub dhau los (uas yog qhov tseem ceeb yog tias koj sim siv lub tsev ntse hauv ib puag ncig ib puag ncig thiab tsis yog hauv koj tus kheej chav lossis lab).

Ntse Tsev koom ua ke

Tam sim no, txhua ESP8266 ESP-01 yog HTTP-Server nrog lub vev xaib uas tswj hwm nws lub xeev. Kuv xav ua kuv thawj kauj ruam mus rau Lub Tsev Ntse thiab siv NodeRED thiab MQTT los sib sau ua ke rau hauv lub hauv paus Lub Tsev Automation system yog li kuv tuaj yeem tswj hwm tag nrho kuv cov hloov pauv los ntawm ib qho UI.

Tau kawg kuv tuaj yeem yooj yim tsim lub vev xaib uas xa kev thov mus rau qhov sib txawv ESP8266 ESP-01 cov qauv tab sis ntxiv, uas tsis yog qhov zoo nkauj, tus qauv lossis kev daws teeb meem txuas ntxiv.

Kauj Ruam 6: Kev thuam

Yog tias koj ua kom txog thaum no, ua tsaug ntau rau kev nyeem!

Nov yog kuv thawj kab lus ntawm no thiab kuv vam tias koj tuaj yeem tshem qee yam. Kuv tsis tau dhia mus rau ntau yam ncauj lus hais, vim kuv xav tias muaj ntau qhov kev qhia zoo ntawm cov ncauj lus sib txawv twb tau ua lawm. Yog tias koj xav tau cov ntaub ntawv ntxiv lossis xav kom kuv piav qhia qee cov kauj ruam kom ntxaws, thov tawm lus tawm.

Yog tias koj nyiam qhov koj nyeem, thov tawm lus tawm, ib yam thiab tej zaum zoo li tsab xov xwm. Nws yuav txhais ntau heev:)

Pom zoo: