Cov txheej txheem:

SONOFF Dual Tutorial: Tswj Koj Cov Khoom Siv Hluav Taws Xob Siv MQTT thiab Ubidots: 4 Kauj Ruam
SONOFF Dual Tutorial: Tswj Koj Cov Khoom Siv Hluav Taws Xob Siv MQTT thiab Ubidots: 4 Kauj Ruam

Video: SONOFF Dual Tutorial: Tswj Koj Cov Khoom Siv Hluav Taws Xob Siv MQTT thiab Ubidots: 4 Kauj Ruam

Video: SONOFF Dual Tutorial: Tswj Koj Cov Khoom Siv Hluav Taws Xob Siv MQTT thiab Ubidots: 4 Kauj Ruam
Video: Sonoff DualR3 Setup + Circuit Diagram | FINALLY A WAY TO MAKE A SMART 2 WAY LIGHT SWITCH 2024, Hlis ntuj nqeg
Anonim
SONOFF Dual Tutorial: Tswj Koj Cov Khoom Siv Hluav Taws Xob Siv MQTT thiab Ubidots nyob deb
SONOFF Dual Tutorial: Tswj Koj Cov Khoom Siv Hluav Taws Xob Siv MQTT thiab Ubidots nyob deb

Qhov $ 9 Wi-Fi xa tawm tuaj yeem tswj ob lub cuab yeej siv tib lub sijhawm. Kawm yuav ua li cas txuas nws mus rau Ubidots thiab nthuav tawm nws lub peev xwm tag nrho!

Hauv phau ntawv qhia no koj yuav kawm paub tswj ob peb 110V cov cuab yeej siv dhau Wi-nkaus rau $ 9, siv Itead's SONOFF Dual. Sib piv nrog cov neeg siv khoom-qib WiFi ntse ntsaws ntsaws rau hauv kev ua lag luam, SONOFF yog qhov kev xaiv zoo rau kev ua lub tsev ntse thiab txawm tias muaj cov phiaj xwm IoT ntawm qhov loj dua. Ntxiv mus, nws yog raws li qhov nrov ESP8266 Wi-Fi nti, ua rau nws sib xws nrog Arduino ib puag ncig thiab lwm yam peev txheej zoo li peb ESP cov tsev qiv ntawv ntawm Ubidots.

Kauj ruam 1: Yuav tsum tau thiab teeb tsa

Yuav tsum tau thiab teeb
Yuav tsum tau thiab teeb
Yuav tsum tau thiab teeb
Yuav tsum tau thiab teeb
Yuav tsum tau thiab teeb
Yuav tsum tau thiab teeb

Txhawm rau ua raws li Cov Lus Qhia no, koj yuav xav tau:

  • UartSBee lub cuab yeej kom tuaj yeem ua haujlwm SONOFF siv koj lub khoos phis tawj
  • Ib SONOFF Dual
  • The UbidotsESPMQTT Library
  • Ubidots tus account - lossis - STEM License

Kho vajtse teeb

Tshem tawm SONOFF Dual lub cuab yeej, qhov no yog nkag mus rau SONOFF TTL pinout, uas peb yuav xav tau los teeb tsa lub onboard ESP8266. SONOFF los tsis muaj ob ntawm nws tus pin headers, yog li koj yuav tsum tau muab lawv tso ua ntej lub phiaj xwm chav nyob.

Tom qab cov laug, txuas lub rooj tsavxwm rau UartSBee raws li cov lus no:

UartSBee - SONOFF Dual

VCC - VCC

TX - RX

TX - RX

GND - NCO

Kauj Ruam 2: Teeb Arduino IDE

Arduino IDE teeb tsa
Arduino IDE teeb tsa

Hauv Arduino IDE, nyem rau ntawm Cov Ntaub Ntawv -> Nyiam thiab sau qhov URL no rau hauv Tus Thawj Saib Xyuas Haujlwm Ntxiv URLs, txhawm rau nkag tau ESP8266 lub tsev qiv ntawv rau Arduino:

https://arduino.esp8266.com/stable/package_esp8266com_index.json

Daim teb no txhawb nqa ntau qhov URLs. Cais lawv nrog tus lej hauv qhov xwm txheej koj twb muaj lwm tus URLs ntaus.

  • Qhib Tus Thawj Saib Xyuas Haujlwm los ntawm Cov Cuab Yeej -> Cov ntawv qhia zaub mov thiab teeb tsa ESP8266 platform.
  • Tom qab teeb tsa, mus rau Cov Cuab Yeej> Cov ntawv qhia zaub mov thiab xaiv pawg thawj coj: Generic ESP8266 Module.
  • Rub tawm UbidotsESPMQTT lub tsev qiv ntawv ua ZIP cov ntaub ntawv hauv peb tus lej GitHub.
  • Rov qab rau hauv koj li Arduino IDE, nyem rau Sketch -> Xws li Lub Tsev Qiv Ntawv -> Ntxiv. ZIP Library.
  • Xaiv qhov. ZIP cov ntaub ntawv ntawm UbidotsESPMQTT thiab tom qab ntawd nyem rau "Txais" lossis "Xaiv". Kaw Arduino IDE thiab qhib nws dua.

Kauj Ruam 3: Coding Koj SONOFF Dual

Coding Koj SONOFF Dual
Coding Koj SONOFF Dual

Cov qauv piv txwv no yuav sau npe mus rau Ubidots sib txawv uas qhib lossis kaw ob qho kev xa tawm tib lub sijhawm.

Ua ntej siv txoj cai, mus rau koj tus lej Ubidots, nrhiav "Devices" tab thiab tsim Cov Khoom Siv hu ua "SONOFF Dual" thiab qhov sib txawv hauv nws hu ua "Relays". Nws yuav tsum zoo li daim duab no.

Xyuas kom tseeb tias Daim Ntawv API API yog "sonoff-dual" thiab qhov sib txawv ntawm API daim ntawv lo yog "relays". Cov no yog cov cim qhia tshwj xeeb uas siv los ntawm SONOFF kom paub tias qhov sib txawv twg los sau npe hauv MQTT broker. Koj tuaj yeem kho cov ntawv yog tias xav tau. Tam sim no koj npaj tau nyem koj lub cuab yeej nrog cov lej no!

Kauj Ruam 4: Tswj Koj Cov Khoom Siv Hauv Tsev

Tswj koj Cov Khoom Siv Hluav Taws Xob!
Tswj koj Cov Khoom Siv Hluav Taws Xob!
Tswj koj Cov Khoom Siv Hluav Taws Xob!
Tswj koj Cov Khoom Siv Hluav Taws Xob!

Tom qab flashing koj lub cuab yeej, qhib qhov ntsuas ntawm Arduino IDE, koj yuav tsum pom qee yam zoo li hauv daim duab, txhais tau tias kev txuas WiFi thiab MQTT kev ua npe tau ua tiav.

Tam sim no mus rau "Dashboards" tab thiab ntxiv Widget tshiab ntawm yam "Tswj" "Hloov". Qhov kev hloov pauv no yuav xa "1" lossis "0" mus rau "Relays" qhov sib txawv, uas yog tom qab ntawv nyeem hauv SONOFF qhov kev hu rov qab los qhib lossis tso tawm. Tam sim no koj tuaj yeem tswj hwm koj SONOFF Dual nyob deb ntawm koj lub dashboard!

Pom zoo: