Cov txheej txheem:
- Kauj Ruam 1: Txuas Ntawm WebREPL
- Kauj ruam 2: Txuas rau Cloud4RPi
- Kauj Ruam 3: Teeb Chaw Tswj Vaj Huam Sib Luag
- Kauj Ruam 4: Qhov Kawg
Video: Yuav Ua Li Cas Tswj ESP8266 Raws Li Sonoff Basic Hloov Hloov Nrog Lub Xov Tooj: 4 Cov Kauj Ruam (nrog Duab)
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:28
Sonoff yog kab kab rau Smart Home tsim los ntawm ITEAD. Ib qho ntawm cov khoom siv hloov pauv tau thiab pheej yig tshaj plaws los ntawm kab ntawd yog Sonoff Basic. Nws yog Wi-nkaus qhib kev hloov pauv raws li lub nti zoo, ESP8266. Kab lus no piav qhia yuav teeb tsa Cloud4RPi kev pabcuam ntawm Sonoff Basic ntse hloov.
Hauv cov lus qhia yav dhau los, peb tau piav qhia yuav ua li cas nyem lub MicroPythonfirmware tshiab ntawm Sonoff Basic lossis Sonoff Dual ntse hloov. Hauv kab lus no, peb tab tom yuav rov kho ib feem ntawm thawj qhov Sonoff-ua haujlwm siv Cloud4RPi.
Kauj Ruam 1: Txuas Ntawm WebREPL
Ua ntej peb nkag mus rau Python REPL interface ntawm UART raws tu qauv. Txij li ESP8266 yog Wi-nkaus module, peb tuaj yeem sib tham nrog nws wirelessly. Tig koj lub Rooj Tswjhwm Saib MicroPython-qhib rau, nkag mus rau nws kab hais kom ua thiab nkag mus rau cov lus txib hauv qab no kom pab tau WebREPL:
>> ntshuam webrepl_setup
Cov lus txib no pib tus txheej txheem teeb tsa qhov twg koj tuaj yeem teeb tsa WebREPL pib-pib, teeb tus password, thiab rov pib dua thaum ua tiav.
Tom qab rov pib dua, txuas rau koj li Wi-nkaus network los ntawm kev ua cov lus txib hauv qab no (hloov Wi-Fi teeb tsa nrog koj cov ntaub ntawv):
>> los ntawm network ntshuam WLAN
>> STA = WLAN (0); STA.active (1) >>> STA.connect ('_ YOUR_WIFI_NETWORK_NAME_', '_PASSWORD_') >>> STA.ifconfig ()
Tos ob peb feeb thiab tshawb xyuas STA.isconnected () cov zis. Yog tias nws tso tawm qhov tsis raug, rov txheeb xyuas Wi-Fi daim ntawv pov thawj, rov txuas dua, thiab txheeb xyuas tias STA.isconnected () tso tawm qhov tseeb. Txhawm rau kom tau ESP8266 tus IP chaw nyob hauv koj lub network, ua raws cov lus txib hauv qab no.
>> STA.ifconfig () [0]
'192.168.1.108'
Tam sim no koj tuaj yeem txuas rau ESP8266 ntawm WebREPL (rub tawm daim ntawv HTML no thiab qhib nws nrog koj tus browser).
Ntawm sab xis ntawm WebREPL interface, koj tuaj yeem pom cov ntaub ntawv-tus thawj tswj haujlwm tso cai rau koj rub tawm thiab rub tawm cov cai cov ntaub ntawv rau ESP8266's virtual file system.
Kauj ruam 2: Txuas rau Cloud4RPi
Rub tawm cov ntawv xav tau rau koj lub khoos phis tawj:
- simple.py: MQTT Library rau MicroPython. Txuag cov ntawv no ua mqtt.py thaum rub tawm.
- cloud4rpi.py: Cloud4RPi cov tsev qiv ntawv rau MicroPython.
- main.py: Qauv code.
Qhib cov ntawv tseem ceeb.py hauv kab ntawv sau (piv txwv li, Visual Studio Code) thiab hloov cov kab hauv qab no:
- _SSID_ nrog koj lub npe Wi-nkaus network.
- _PWD_ nrog koj tus password Wi-nkaus network. Yog tias koj muaj lub network qhib, tshem tawm '_PWD_' lub ntsiab lus yam tsis tau tshem tus lej tom qab kom lub WIFI_SSID_PASSWORD sib txawv ua tus tuple nrog ib lub ntsiab lus.
- _YOUR_DEVICE_TOKEN_ nrog cov cim qhia pom nyob rau sab saum toj ntawm nplooj ntawv ntaus ntawv ntawm cloud4rpi.io. Yog tias koj tsis muaj tus cim, qhib Devices nplooj ntawv, tsim lub cuab yeej siv lub Tshuab Ntaus Tshiab nyob rau sab xis saum toj, thiab siv nws cov cim.
- Hloov LED_PIN rau 13 thiab BUTTON_PIN rau 0.
Txuag cov ntaub ntawv main.py thiab xa cov mqtt.py, cloud4rpi.py thiab main.py cov ntaub ntawv rau koj ESP8266 ntawm WebREPL txoj cai sab xis.
Koj tuaj yeem siv cov kab hais kom ua kab ntawv uploader xa nrog WebREPL txhawm rau rub cov ntawv.
Pib dua ESP8266. Koj tuaj yeem siv lub console rau qhov no:
>> import tshuab
>> machine.reset ()
Cov ntaub ntawv npe main.py tau pib txiav ntawm khau raj.
Yog tias txhua yam mus zoo, koj tuaj yeem pom lub cuab yeej nyob ntawm Cloud4RPi ntaus ntawv nplooj ntawv.
Kauj Ruam 3: Teeb Chaw Tswj Vaj Huam Sib Luag
Mus rau ntawm Control Panels nplooj ntawv thiab ntxiv cov tswj hwm vaj huam sib luag tshiab thiab ntxiv Cov Hloov widget thiab khi nws mus rau qhov sib txawv ntawm LED.
Siv LED hloov pauv ntawm lub vaj huam sib luag tswj kom tig Sonoff LED rau.
Ntxiv Cov Ntawv Text thiab khi nws rau khawm sib txawv. Kho cov xim sib txawv rau cov hlua "tseeb" thiab "tsis tseeb". Tam sim no koj tuaj yeem nias lub khawm khoos phis tawj thiab pom tias cov widget hloov pauv li cas.
Koj tuaj yeem tswj hwm Sonoff Basic relays los ntawm kev ntxiv qhov hloov pauv tshiab tau khi rau kho vajtse tus pin 12.
relay_pin = Pin (12, Pin. OUT)
def on_relay (tus nqi): relay_pin.value (tus nqi) rov relay_pin.value () #… device.declare ({'Relay': {'hom': 'bool', 'value': Tsis tseeb, 'khi': on_relay}, #…})
Kauj Ruam 4: Qhov Kawg
Peb tau txuas qhov txuas mus rau peb lub teeb duab, saib cov vis dis aus uas peb sim nws.
Pom zoo:
Yuav Ua Li Cas Hloov Lub Xov Tooj Ntawm Lub Xov Tooj Rau Hauv Lub Koob Yees Duab thiab Nws Ua Haujlwm!: 5 Kauj Ruam (nrog Duab)
Yuav Ua Li Cas Hloov Lub Xov Tooj Ntawm Lub Xov Tooj Rau Hauv Lub Koob Yees Duab thiab Nws Ua Haujlwm!: Nyob zoo txhua tus! GoPro yog qhov kev xaiv zoo tshaj plaws rau lub koob yees duab nkaus xwb, tab sis tsis yog txhua tus ntawm peb tuaj yeem them taus lub cuab yeej. Txawm hais tias qhov tseeb muaj ntau yam loj ntawm GoPro raws lub koob yees duab lossis lub koob yees duab me me (kuv muaj Innovv C2 rau kuv cov airsoft games), tsis yog txhua yam ntawm
Hloov Kho Lub Xov Tooj Ntawm Tes rau Lub Xov Tooj Ntawm Tes: 7 Kauj Ruam (nrog Duab)
Hloov Kho Tus Xov Tooj Ntawm Tes Rau Lub Xov Tooj Ntawm Tes: Los Ntawm Bill Reeve ([email protected]) Hloov kho rau cov lus qhia los ntawm Mouse ([email protected]) Tsis lees paub: Cov txheej txheem piav qhia ntawm no yuav tsis ua haujlwm rau koj - uas yog qhov kev pheej hmoo koj muaj coj. Yog tias nws tsis ua haujlwm, lossis yog tias koj tsoo qee yam, nws tsis yog
Yuav ua li cas 2.0: Ua Hnub Ci Lub Xov Tooj Ntawm Lub Xov Tooj Charger: 8 Kauj Ruam
Yuav ua li cas 2.0: Ua Hnub Ci Lub Xov Tooj Ntawm Lub Xov Tooj Charger: Los ntawm http: //www.2pointhome.com Kev siv me me yog txhua yam nws yuav siv los ua qhov txias me me thaum muaj xwm ceev ntawm lub xov tooj ntawm tes. Khaws nws hauv lub hnab looj tes ntawm koj lub tsheb, yog tias koj puas tau raug tso tseg hauv hav zoov thiab pib hnov suab paj nruag banjo! Koj yuav muaj peev xwm
Zaub Cov Duab Tawm ntawm PSP/Lub Xov Tooj Ntawm Lub Xov Tooj Ntawm Digital Duab: 3 Kauj Ruam
Zaub Cov Duab Tawm PSP/Lub Xov Tooj Ntawm Lub Xov Tooj Ntawm Tus Duab: Zoo … lub npe hais tias txhua yam tiag tiag … Qhov no yog qhov qhia tau yooj yim heev thiab nws tsis xav tau kho vajtse lossis software ntau dua li koj yuav tsum muaj ! Cov Lus Nug Qhia Rau Kuv lossis Tawm Tswv Yim! Koj tsis tas yuav hloov kho kom ua
Ryobi 18vdc Lub Teeb Nrog Ipod lossis Lub Xov Tooj Ntawm Lub Xov Tooj Ntawm Lub Xov Tooj: 5 Kauj Ruam
Ryobi 18vdc Lub Teeb Nrog Ipod lossis Lub Xov Tooj Ntawm Lub Xov Tooj Ntawm Lub Xov Tooj: Nov yog qhov hack sai uas yuav ua rau siv koj li 18vdc Ryobi teeb nyem. Kuv tau ntxiv 12vdc tso zis rau them kuv lub ipod lossis xov tooj ntawm tes hauv qhov me me. Nws siv sijhawm li ib teev thiab tsis nyuaj heev. Txheeb nws. Cov npe ntu: 1-Ryobi 18vdc Teeb nyem