Cov txheej txheem:
Video: Yuav ua li cas nyem MicroPython Firmware ntawm ESP8266 Raws li Sonoff Ntse Hloov: 3 Cov Kauj Ruam (nrog Duab)
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:30
Sonoff yog dab tsi?
Sonoff yog kab kab rau Smart Home tsim los ntawm ITEAD. Ib qho ntawm cov khoom siv hloov pauv tau tshaj plaws thiab pheej yig los ntawm kab ntawd yog Sonoff Basic thiab Sonoff Dual. Cov no yog Wi-nkaus qhib kev hloov pauv raws li lub nti zoo, ESP8266. Thaum Sonoff cov tsev tsim khoom yuav ua haujlwm tau zoo rau cov neeg siv yooj yim, lwm tus tuaj yeem xav hack rau hauv kho vajtse ntawd thiab khiav lawv tus kheej cov cai ntawm nws. Kho vajtse ntawm Sonoff Ntse Hloov yog qhov xav tsis thoob, txiav txim siab nws tus nqi qis:
- ESP8266 nrog 1MB nyem
- 220V AC integrated power adapter
- 10A Relay (lossis ob qho hauv Sonoff Dual)
- Onboard LED (lossis ob qho hauv Sonoff Dual)
- Onboard khawm
Yog tias koj xav tswj hwm tag nrho cov khoom siv no uas koj nyiam cov lus programming, cov ntawv qhia no yog rau koj.
Kauj ruam 1: Hacking Hardware
ESP8266 yog programmed ntawm qhov chaw nres nkoj txuas. Ob qho Sonoff Basic thiab Sonoff Dual muaj nws ntawm PCD.
Tej zaum koj yuav xav tau muab tus pin txuas rau ntawm PCB kom txuas tau yooj yim USB-UART adapter.
Kauj ruam 2: Npaj rau Hacking Software
Kuv nyiam Python, yog li kuv yuav siv MicroPython firmware. Koj kuj tseem tuaj yeem siv ib qho SDK txhawb. Cia peb pib ua kom pom MicroPython hloov chaw ntawm Sonoff firmware uas yog tus tswv:
Nruab qhov esptool python pob uas ua rau pom qhov ESP8266 yooj yim dua:
pip nruab esptool
Rub tawm qhov tseeb ruaj khov MicroPython firmware los ntawm MicroPython rub tawm nplooj ntawv. Txuas lub USB-UART adapter rau lub rooj tsavxwm. Rau kev nyab xeeb, nws tau pom zoo kom siv lub rooj tsavxwm los ntawm lub adapter hloov ntawm 220V AC lub qhov (socket). Nco tseg tias koj tsuas yog siv 3.3V, yog tias koj txuas ESP8266 nti mus rau 5V lub zog siv, nws yuav tuag.
Khau ESP8266 rau hauv Flash hom. Koj tuaj yeem ua nws los ntawm rub tus GPIO0 tus pin thaum txhawb lub cuab yeej ntawm:
- Ntawm Sonoff Basic, GPIO0 tsuas yog khawm xwb. Txuas lub USB-UART adapter rau koj lub PC thaum tuav lub pob thiab koj nyob hauv Hom Flash.
- Ntawm Sonoff Dual, txhua yam nyuaj me ntsis. Koj yuav tsum tau luv Circuit Court ob daim pawm ntawm PCB thaum ua lub rooj tsavxwm. Cov ntaub qhwv uas xav tau muaj nyob ntawm daim duab saum toj no. Siv tus tweezers lossis xaim hlua xaim me me ntawm lawv.
Thaum ESP8266 nyob hauv Hom Flash, lub rooj tsavxwm LED yuav tsum tsis txhob nyem.
Nco ntsoov tias koj tuaj yeem nkag mus rau qhov chaw nres nkoj txuas tau qhib los ntawm USB-UART adapter. Ntawm Linux nws yuav yog / dev / ttyUSB0, ntawm Mac koj yuav tsum tshawb nrhiav qee yam xws li "usbserial" lossis "usbmodem" hauv ls / dev / cu.* Lossis ls / dev / tty.* Hais kom ua tawm, ntawm Windows nws yuav tsum yog COM3 lossis siab dua. Nruab USB-UART adapter tsav tsheb yog tias tsim nyog.
Lwv lub flash siv lub esptool. Hloov qhov /dev /ttyUSB0 rau koj qhov chaw nres nkoj yog tias xav tau:
esptool.py --port /dev /ttyUSB0 lwv_flash
Tej zaum koj yuav tsum tau khiav esptool.py ua tus superuser nkag mus rau qhov chaw nres nkoj txuas.
Kauj ruam 3: Flashing
Yog tias kev tshem tawm tau ua tiav, txiav lub rooj tsav xwm lub zog, khau raj ESP8266 hauv Flash hom dua, thiab nyem koj lub firmware:
esptool.py --port /dev /ttyUSB0 --baud 460800 write_flash --flash_size = ntes 0 esp8266-20170823-v1.9.2.bin
Yog tias qhov ua tiav tau ua tiav, txiav lub rooj tsav xwm lub zog, txuas nws dua yam tsis tau nyem lub pob, thiab qhib qhov chaw nres nkoj hauv lub davhlau ya nyob twg. Ntawm Linux thiab Mac koj tuaj yeem siv tshuaj ntsuam /dev /ttyUSB0 115200 (hloov /dev /ttyUSB0 rau koj qhov chaw nres nkoj yog tias xav tau), ntawm Windows koj tuaj yeem siv PuTTY (tus nqi baud default yog 115200). Thaum koj txuas, nyem Enter, thiab yog tias koj pom peb lub kaum sab xis ntawm Python plhaub, dua li txhua yam ua haujlwm!
>> >>> pab () Txais tos rau MicroPython! Rau cov ntawv online thov mus ntsib https://docs.micropython.org/en/latest/esp8266/. Rau kev txheeb xyuas cov ntaub ntawv suav nrog hauv kab lus ceeb toom ua 'import port_diag'. Kev teeb tsa WiFi yooj yim: ntshuam network sta_if = network. WLAN (network. STA_IF); sta_if.active (True) sta_if.scan () # Tshawb nrhiav kom muaj cov ntsiab lus nkag tau sta_if.connect ("", "") # Txuas mus rau AP sta_if.isconnected () # Txheeb xyuas kom muaj kev sib txuas tau zoo # Hloov lub npe/tus password ntawm ESP8266's AP: ap_if = network. WLAN (network. AP_IF) ap_if.config (essid = "", authmode = network. AUTH_WPA_WPA2_PSK, password = "") Tswj cov lus txib: CTRL-A-ntawm kab dawb, nkag mus rau hom REPL nyoos CTRL- B-ntawm kab dawb paug, nkag mus rau ib txwm REPL hom CTRL-C-cuam tshuam txoj haujlwm khiav haujlwm CTRL-D-ntawm kab dawb paug, rov kho qhov muag ntawm lub rooj tsavxwm CTRL-E-ntawm kab dawb, nkag mus hom Txhawm rau pab ntxiv rau ntawm yam khoom tshwj xeeb, ntaus ntawv pab (obj) >>>
Hauv cov lus qhia tom ntej, peb yuav piav qhia yuav ua li cas cuam tshuam nrog Cloud4RPi platform ntawm MQTT raws tu qauv.
Pom zoo:
Yuav Ua Li Cas DIY Ntse Cov Menyuam Qhov Muag Nrog SONOFF Ntse Hloov?: 14 Cov Kauj Ruam
Yuav Ua Li Cas DIY Ntse Cov Menyuam Qhov Muag Nrog SONOFF Ntse Hloov?: Siv Interlock Mode hauv SONOFF ntse hloov los tig koj cov menyuam qhov muag tsis pom kev/qhov muag tsis pom mus rau qhov ntse Koj puas yuav feem ntau ntawm koj pom zoo qhov no yog txoj haujlwm uas koj rub cov menyuam qhov muag/qhov muag tsis pom thaum sawv ntxov thiab rub nws thaum yav tsaus ntuj? Txawm li cas los xij, kuv
Siv Homie Firmware los Tsav Sonoff Hloov Module (ESP8266 Raws): 5 Cov Kauj Ruam (nrog Duab)
Siv Homie Firmware los Tsav Sonoff Hloov Module (ESP8266 Raws): Nov yog cov lus qhia hauv qab no, Kuv tau sau qhov no me ntsis tom qab "Tsim Homie Devices rau IoT lossis Tsev Automation". Tom qab ntawd tau tsom mus rau kev saib xyuas yooj yim (DHT22, DS18B20, lub teeb) nyob ib puag ncig D1 Mini laug cam Lub sijhawm no, Kuv xav qhia
Yuav Ua Li Cas Tswj ESP8266 Raws Li Sonoff Basic Hloov Hloov Nrog Lub Xov Tooj: 4 Cov Kauj Ruam (nrog Duab)
Yuav Ua Li Cas Tswj ESP8266 Raws Li Sonoff Basic Smart Switch Nrog Lub Xov Tooj: 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 Cl
DIY Ntse Ua Raws Kuv Drone Nrog Lub Koob Yees Duab (Arduino Raws): 22 Cov Kauj Ruam (nrog Duab)
DIY Ntse Ua Raws Kuv Drone Nrog Lub Koob Yees Duab (Arduino Raws): Drones yog cov khoom ua si nrov heev thiab cov cuab yeej niaj hnub no. Koj tuaj yeem pom cov kws tshaj lij thiab txawm tias pib ua haujlwm drones thiab cov khoom siv ya hauv khw. Kuv muaj plaub lub drones (quadcopters thiab hexcopters), vim tias kuv nyiam txhua yam uas ya, tab sis lub davhlau 200th tsis yog
Yuav Txhais Li Cas Kev Taw Qhia ntawm Kev Hloov Los Ntawm Digital Hloov Hloov Nrog PIC: 5 Cov Kauj Ruam
Yuav Ua Li Cas Txhais Tus Cwj Pwm ntawm Kev Sib Hloov Los Ntawm Digital Rotary Hloov Nrog PIC: Lub hom phiaj rau Cov Lus Qhia no yog los piav qhia yuav ua li cas txhawm rau cuam tshuam cov digital (plaub kab cim coded) hloov pauv nrog lub microcontroller. Tsis txhob txhawj, kuv yuav piav qhia dab tsi? Quadrature coded? txhais tau rau peb. Lub interface no thiab cov software txuas nrog wilâ € ¦