Cov txheej txheem:
- Kauj Ruam 1: Txuas MCP23008
- Kauj Ruam 2: Tsim Pawg Thawj Coj
- Kauj Ruam 3: Siv Lub Tsev Qiv Ntawv Qub
- Kauj Ruam 4: Kitt Tsheb Txoj Haujlwm
- Kauj Ruam 5: 7 Segment LED
- Kauj Ruam 6: Xaus
Video: NODEMCU LUA ESP8266 Nrog MCP23008 8 Bit Port Expander IC: 6 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:30
MCP23008 yog 8-Bit I/O Expander nrog Serial Interface thiab ua haujlwm nruab nrab ntawm 1.8 thiab 5.5 volts, yog li ntawd zoo tagnrho rau ESP8266, Arduino, Raspberry Pi, PIC Chips thiab ntau dua.
Yog tias koj tau pom kuv lwm Cov Lus Qhia ntawm MCP23017, koj yuav xav tsis thoob vim li cas kuv tseem tab tom ua ib qho rau MCP23008, vim nws yog qhov tseeb me me ntawm qhov qub.
Qhov laj thawj yog tias nws cov ntawv sau npe sib txawv ob qho tib si hauv lub npe thiab tus lej thiab kuv xav qhia seb yuav siv lub tsev qiv ntawv npaj ua qauv li cas. Tsis yog txhua tus muaj kev paub zoo thaum siv NodeMCU lua, yog li kuv xav qhia qhov kev ua haujlwm zoo li no thiab siv MCP23008 li cas.
Lub tsev qiv ntawv thiab cov haujlwm muaj nyob ntawm github.com.
Cov ntawv rau MCP23008 muaj los ntawm Microchip.
Kauj Ruam 1: Txuas MCP23008
MCP23008 IC yog tus qauv yooj yim thiab tsim lub rooj tsavxwm yog qhov yooj yim rau nws. Koj tseem tuaj yeem teeb tsa Circuit Court ntawm lub rooj mov ci.
Pin Txuas ntawm kuv lub rooj tsavxwm
- Pin 18 (VDD) to 3v3
- Pin 9 (VSS) to GND
- Pin 7 (NC) to GND (Tsis tsim nyog)
- Pin 1 (SCL) to ESP GPIO2
- Pin 2 (SDA) to ESP GPIO0
- Pin 5 (A0) to GND
- Pin 4 (A1) to GND
- Pin 3 (A2) to GND
- Pin 6 (RESET) rau 3v3
Txuas cov pins los nyeem rau Gnd ntawm Chaw nres nkoj A (pins 10 - 17)
Nco tseg: ntawm no txhua qhov chaw nyob txuas nrog Gnd siv MCP23008 ntawm chaw nyob 0x20 ntawm I2C chaw nyob npav.
Yog tias koj siv chaw nyob 0x21 ces A0 yuav txuas nrog 3.3V, nrog A1 & A2 txuas nrog Gnd.
Ib yam li yog siv chaw nyob 0x22 ces A1 yuav tsum txuas nrog 3.3V nrog A0 thiab A2 txuas nrog Gnd.
lwm yam …
Kauj Ruam 2: Tsim Pawg Thawj Coj
Kuv siv 25 mm x 64 mm (9 kab x 25 qhov) Vero strip board los tsim kuv lub rooj tsavxwm. Nws yog qhov nruj me ntsis, tab sis raws li feem ntau ntawm cov pins koj xav tau nyob ntawm ob sab ntawm IC, nws tsim nyog rau yam nws yuav tsum tau ua.
Kuv tau siv 8 tus pin thiab 8 lub taub hau ntsaws rau chaw nres nkoj A kom kuv tuaj yeem ntsaws rau hauv kuv cov qauv ntau yam ntxiv rau lwm txoj hlua rau cov haujlwm sib txawv. Kuv tau ntxiv Gnd ntxiv thiab 3.3V tus pin raws li kuv pom muaj ib txwm tsis txaus ntawm cov no thaum txuas cov qauv ua ke.
Kauj Ruam 3: Siv Lub Tsev Qiv Ntawv Qub
Cov tsev qiv ntawv cov qauv ib txwm muaj kev xaiv ntawm cov txheej txheem ib txwm muaj, cov haujlwm thiab cov hloov pauv uas tuaj yeem nkag mus los ntawm lwm txoj haujlwm. Qhov haujlwm nws tus kheej tsis ua haujlwm, tab sis nws lub luag haujlwm tuaj yeem nkag mus los ntawm kev hu xov tooj. Nws txhais tau tias koj tuaj yeem muaj koj cov txheej txheem ib txwm nyob hauv lub tsev qiv ntawv thiab hu lawv thaum twg koj xav tau, ua qhov program hu me me. Nws dhau los muaj txiaj ntsig ntau yog tias koj muaj ntau qhov haujlwm sib txawv uas siv tib txoj haujlwm ib txwm ua, koj tsis tas yuav suav nrog cov kev ua haujlwm niaj hnub hauv txhua qhov haujlwm.
Nco tseg: qhov program mcp23008.lua yuav tsum tau rub rau hauv ESP8266 nco zoo li lwm cov haujlwm.
Kuv tau suav nrog github.com cov haujlwm ntawm no nrog rau qhov program yooj yim (test.lua) los qhia tias lub tsev qiv ntawv ua haujlwm.
Muaj tsawg kawg 2 txoj hauv kev suav nrog lub tsev qiv ntawv hauv koj qhov program.
xav tau ("mcp23008")
mcp23008.begin (0x0, gpio2, gpio0, i2c. SLOW)
los yog
mcp = xav tau ("mcp23008")
mcp.begin (0x0, gpio2, gpio0, i2c. SLOW)
Ob qho ntawm qhov saum toj no ua tib yam nkaus, tab sis txoj kev thib ob tso cai rau koj siv koj tus kheej qhov txawv txav tsis txhob siv lub npe program.
Kauj Ruam 4: Kitt Tsheb Txoj Haujlwm
Kuv tau suav nrog KittCar23008.lua program thiab KittLib.lua uas siv lub tsev qiv ntawv los qhia qhov sib txawv ntawm kev sau cov haujlwm li cas. Ob txoj haujlwm ua tib yam nkaus.
Lub 8 LED ntsaws rau hauv yog muaj los ntawm Ebay ua cov khoom siv thiab paub tias yog 8 Channel Flowing Water Light LED DIY Kit, 99p los ntawm Tuam Tshoj. Koj yuav tsum tau solder koj tus kheej.
Nco tseg: Yog tias koj muaj teeb meem sim ua KittLib.lua program, sim txuas MCP23008 RESET tus pin rau Gnd ib ntus. Kuv paub qhov no yuav ua rau luv luv Circuit Court (raws li nws tau txuas nrog 3.3V) thiab koj yuav tsum rov pib dua txhua yam ntxiv. Nws kuj tseem ua haujlwm los ntawm kev txuas rau Gnd los ntawm 10 ohm resistor, tej zaum yog txoj hauv kev zoo dua los ua nws.
Kuv kuj pom tias KittLib.lua yuav khiav tsis muaj teeb meem tom qab khiav test.lua (Tsis txhob nug kuv vim li cas?)
Kuv tau sim ntau txoj hauv kev los daws qhov teeb meem KittLib.lua, tab sis tam sim no tsis tuaj yeem pom ib qho laj thawj vim li cas nws thiaj li tsoo. Dose leej twg muaj tswv yim?
Kuv tsis tau sau tag nrho cov program no kuv tus kheej, yog li kuv tsis tuaj yeem hais tias yog vim li cas thiaj muaj teeb meem, txawm hais tias tom qab saib cov coding, zoo li tsis muaj dab tsi pom tseeb tseeb.
Kauj Ruam 5: 7 Segment LED
Raws li nrog KittCar.lua txoj haujlwm saum toj no, Kuv tau suav nrog ib leeg thiab ib lub tsev qiv ntawv nyob rau qhov kev zov me nyuam kom tsav 7 ntu LED zaub.
Ib zaug ntxiv, ob txoj haujlwm ua tib yam nkaus, tab sis qhia ua li cas siv lub tsev qiv ntawv qauv sau los ntawm koj tus kheej lossis lwm tus.
Kauj Ruam 6: Xaus
Kuv tau sim ua kom pom tias yuav siv tus lej lej li cas hauv Lua ib puag ncig, thiab siv nws rau IC tshwj xeeb tib lub sijhawm.
Txawm hais tias kuv tau muaj teeb meem ua qhov no, Kuv xav tias muaj txaus los qhia tias cov qauv no ua haujlwm li cas thiab qhia txog kev thov lub neej tiag tiag.
Pom zoo:
Ua SAMD21-based Boards USB Port Into a Hardware Serial Port !: 3 Cov Kauj Ruam
Ua SAMD21-based Boards USB Port Into a Hardware Serial Port!: Nws yog tus txheej txheem niaj hnub no los siv Arduino (lossis lwm yam sib xws) board USB chaw nres nkoj raws li qhov chaw nyob. Qhov no muaj txiaj ntsig zoo rau kev debugging, xa thiab txais cov ntaub ntawv los ntawm peb cov laug cam uas kuv nyiam
NODEMCU Lua ESP8266 Nrog Lub Sijhawm Tiag (RTC) & EEPROM: 7 Kauj Ruam
NODEMCU Lua ESP8266 Nrog Lub Sijhawm Tiag (RTC) & EEPROM: Tau txais lub sijhawm raug yog qhov tseem ceeb yog tias koj xav khaws cov ntaub ntawv teev cia. Muaj ntau txoj hauv kev kom tau sijhawm los ntawm cov peev txheej hauv Is Taws Nem. Koj yuav nug tias vim li cas ho tsis siv ESP8266 los khaws sijhawm rau koj? Zoo koj tuaj yeem, nws muaj nws tus kheej sab hauv RTC (Lub Sijhawm Tiag
NODEMCU LUA ESP8266 Tsav M5450B7 LED Display Driver IC: 5 Cov Kauj Ruam (nrog Duab)
NODEMCU LUA ESP8266 Tsav M5450B7 LED Display Driver IC: M5450B7 yog 40 Pin DIP LED tso saib tsav tsheb IC.Nws zoo li tsiaj nyaum, tab sis nws kuj yooj yim rau kev tswj hwm thiab program.There muaj 34 tus pin pins uas tuaj yeem muaj LED txuas nrog rau txhua tus Cov cuab yeej siv tam sim no ntau dua li cov khoom siv yog li c
NODEMCU LUA ESP8266 Nrog CD4017 Decade Counter: 4 Cov Kauj Ruam (nrog Duab)
NODEMCU LUA ESP8266 Nrog CD4017 Decade Counter: CD4017 yog kaum xyoo txee / faib. Qhov no txhais tau tias thaum nws tau txais cov mem tes nws suav nws thiab xa tawm mus rau tus pin uas tsim nyog. Nws yog qhov yooj yim IC siv thiab koj tuaj yeem tsim lub Circuit Court ntawm lub rooj mov ci lossis yuav ib qho los ntawm Ebay rau
NODEMCU LUA ESP8266 Nrog MCP23017 16 Ntsis Chaw Nkoj Expander IC: 6 Kauj Ruam (nrog Duab)
NODEMCU LUA ESP8266 Nrog MCP23017 16 Qhov Chaw Nkag Tawm Tsawg IC: MCP23017 yog IC yooj yim los ua lub rooj tsav xwm vim nws muaj Chaw nres nkoj A thiab B ntawm ob sab ntawm lub nti thiab cov pins yog nyob rau hauv kev txiav txim kom zoo ib yam li I2C chaw nyob npav yog tag nrho ua ke ib yam nkaus. Muaj 2 tus pin ntawm IC no uas tsis siv li nws