SONOFF: iswitshi esikude ukucima okanye ukuvula izixhobo

unyana

Ucinga layita okanye ucime into ekude? Ungavula ukufudumeza, okanye ucime ukuba ushiye ngempazamo, unokuvula okanye uvale iimfama ukuba unazo ezizenzekelayo, okanye wenze indlu yakho kubushushu obufanelekileyo ngokusebenza kwimo yezulu naphi na. Ewe, yile nto a SONOFF.

Umzekelo, enye yeefayile ze- Unokufumana kwintengiso yi-Itead Sonoff. Sisixhobo esisekwe kwimodyuli ye-ESP8266, eya kuthi ngokuqinisekileyo izwakale iqhelekile ukuba ungumenzi kwaye wenze iiprojekthi ze-DIY ngeArduino. Yimodyuli eyaziwayo kakhulu ye-WiFi esele sinikele ngayo Inqaku elikhethekileyo eHwlibre. Ukuya kuloo nto Imodyuli yongeze ukuhanjiswa ukwenza izixhobo ezixhumeneyo kwaye ukwazi ukucima izinto okanye ukuvula i-WiFi.

Yintoni i-sonoff?

Un I-Sonoff siswitshi smart seWiFi ukubanakho ukuvula nokucima kude isixhobo sombane. Esi sixhobo sikuvumela ukuba uqhagamshelwe kwi-Intanethi nge-WiFi router ekhayeni lakho okanye eofisini. Ukusuka kuso nasiphi na isixhobo esixhumeke kwinethiwekhi nakweyiphi na indawo, unokusebenzisana nayo ukulawula izixhobo zakho.

Uninzi lwee-sonoffs zorhwebo zinazo usetyenziso lwakho lwe-Android okanye i-iOS evumela ulawulo olulula. Umzekelo, iSonoff Basic ine-app eWeLink. Ukongeza, kuninzi lweziapp ziyakuvumela ukuba uqwalasele ixesha ukuze zisebenze ngexesha elithile. Umzekelo.

Ukongeza, ezinye ii-Sonoffs zorhwebo ziyaphumeza imisebenzi ukuze ukwazi ukudibanisa neenzwa kunye nokuba izixhobo zivulwe okanye zicime ngokuxhomekeke kubushushu, isandi, ubukho boluvo, ukufuma, njl. Oku kunokuba luncedo kwinkqubo yokunkcenkceshela igadi, ukulungiselela imeko yomoya kakuhle endlwini, njl. Nokuba iimodeli ezithile zenzelwe izindlu ezilawulwayo ziyahambelana neAmazon Alexa / Echo, Ikhaya likaGoogle, njl.

Ezinye izongezo

Ukongeza kwi-sonoff, kukho ezinye izixhobo Unokuba nomdla njengomphelelisi, njengeziseko zeWiFi, iziseko zebhalbhu zeWiFi, iiwitshi zeWiFi, isango leWiFi-RF, isikhululo se-SC-WiFi, njl njl.

Yenza eyakho Sonoff ngeArduino kunye nemodyuli ye-ESP8266 (Elula)

Ngaphandle kokuba sisixhobo esilula kwaye sitshiphu, awunakuhlala unomdla wokuthenga enye. Ukuba ungumenzi kwaye uyathanda ukwenza iiprojekthi zakho ze-DIY, endaweni yokuthenga i-sonoff yentengiso, ungazenzela ngokwakho. Oko kuyakwenzeka ngokusebenzisa imodyuli yokudlulisa iArduino kunye nemodyuli yeWiFi. Ngale ndlela uya kuba neprojekthi yakho edityanisiweyo kwaye ilungele ukusebenza kwi-relay eya kuthi ilawule ukuphazamisa okanye ukudibanisa isixhobo esinezixhobo zombane ophezulu.

Enye into enokwenzeka Ukuqhekeza uSonoff sele kwenziwe ukuzisa ukusebenza okutsha. Kule nto, olona khetho unokukhetha Ufundile uSonoff. Umzekelo Akukho mveliso ifunyenweyo, Isixhobo esivela kwinkampani yaseTshayina ejolise kumenzi. Esi sixhobo sibhalwe kakuhle kwaye yiyo loo nto kunokugqobhoza ngokulula ukusiguqula kwaye silungelelanise iiprojekthi zakho. Ngokusekwa kwi-ESP8266 yonke into iya kuba lula, kwaye ibandakanya eyayo inkqubo yolawulo yezixhobo eziphathwayo.

Yenza i-Sonoff elula eneArduino

Mhlawumbi kuya kuba lula kuwe Yenza i-Sonoff yakho ngeArduino kufuneka uguqule i-firmware ye-Itead. Sebenzisa i-Itead kunye nezinye izixhobo esele zilungile kulula kakhulu, kodwa ukusuka nje uzisebenzise ukulungisa i-firmware kukho umahluko omkhulu. Ke mhlawumbi unomdla kwindlela elula yokuba ne-Sonoff eyenziwe nguwe.

Yintoni oyifunayo

Ixesha ledinga elingagqibekanga into oyifunayo kule projekthi yile:

  • Arduino UNO, okanye iya kufaneleka enye ipleyiti.
  • Isonka okanye i-PCB ukuba uza kuthengisa.
  • Imodyuli ye-ESP8266
  • Imodyuli edlulisiweyo
  • Iingcingo zonxibelelwano
  • I-PC eneArduino IDE kunye nentambo yenkqubo
  • Isixhobo sombane ofuna ukusilawula ngeWiFi

Ukwakhiwa kwamanyathelo ngamanyathelo

Unxibelelwano lweArduino kunye ne-ESP8266 kunye noDluliso

Ukuqala Yakha i-Sonoff yakho eyenziwe ekhaya landela oku Isikhokelo senyathelo ngenyathelo:

  1. Nje ukuba unazo zonke izinto, kufuneka qhagamshela iskimu ngokufanelekileyo njengoko kubonakala emfanekisweni. Khumbula ukuba apho ndibeke khona "Icebo" kulapho ofuna ukuyilawula iya kuthi idityaniswe khona: isitovu, ifeni, iTV, ibhalbhu yokukhanyisa, ... kwaye iplagi kufuneka itye isixhobo esitshoyo. Njengoko ubona, okwenziweyo kukuphazamisa enye yeentambo eziqhubayo eziya kwisixhobo kwaye zingenise ukuhanjiswa ukuba kwenziwe njengokutshintsha. Ukuba unemibuzo malunga nonxibelelwano, unokujonga kwiincwadana zethu:
    1. Ukudibanisa njani i-ESP8266 ukuya kwiArduino?
    2. Uyisebenzisa kanjani i-relay kunye neArduino?
  2. Ngoku oku kulandelayo Inkqubo kwiArduino IDE ukuyenza isebenze ngokufanelekileyo. Ukuba usaqala unako Khuphela iPDF yencwadana yethu yenkqubo yeArduino. Umzekelo wekhowudi olula ukulawula i-relay kunye ne-LED ebomvu, eluhlaza kunye nohlaza okwesibhakabhaka iya kuba:
#include <SoftwareSerial.h>

#define DEBUG true

SoftwareSerial esp8266(2,3); 
void setup()
{
  SSSerial.begin(19200);
  esp8266.begin(19200);
  
  pinMode(10,OUTPUT);
  digitalWrite(10,LOW);
  
  pinMode(11,OUTPUT);
  digitalWrite(11,LOW);
  
  pinMode(12,OUTPUT);
  digitalWrite(12,LOW);
  
  pinMode(13,OUTPUT);
  digitalWrite(13,LOW);
   
  sendData("AT+RSTrn",2000,DEBUG); 
  sendData("AT+CWMODE=2rn",1000,DEBUG); 
  sendData("AT+CIFSRrn",1000,DEBUG); 
  sendData("AT+CIPMUX=1rn",1000,DEBUG);
  sendData("AT+CIPSERVER=1,80rn",1000,DEBUG); 
}

void loop()
{
  if(esp8266.available())
  {

    
    if(esp8266.find("+IPD,"))
    {
     delay(1000); 
     int connectionId = esp8266.read()-48; 
          
     esp8266.find("pin="); 
     
     int pinNumber = (esp8266.read()-48)*10;
     pinNumber += (esp8266.read()-48);
     
     digitalWrite(pinNumber, !digitalRead(pinNumber));  
     
     String closeCommand = "AT+CIPCLOSE="; 
     closeCommand+=connectionId;
     closeCommand+="rn";
     
     sendData(closeCommand,1000,DEBUG); 
    }
  }
}
String sendData(String command, const int timeout, boolean debug)
{
    String response = "";
    
    esp8266.print(command); 
    
    long int time = millis();
    
    while( (time+timeout) > millis())
    {
      while(esp8266.available())
      {
        
        char c = esp8266.read(); 
        response+=c;
      }  
    }
    
    if(debug)
    {
      Serial.print(response);
    }
    
    return response;
}

Nje ukuba ungene kwi-ID yeArduino kwaye ucwangciswe kwizibuko le-serial, yonke into kufuneka isebenze kakuhle. Nangona ungasebenzisa iliso le-serial, kuya kufaneleka ukuba wenza i-web interface elula okanye i-app encinci ye-iOS okanye i-Android. Kwindaba ye Ikhowudi ye-HTML Kulula kwaye inokuba yinto enje, ngaloo ndlela, ukusuka kwisikhangeli sakho unokulawula ukuvala nokucima ii-LEDs kunye nesixhobo esixhunywe kulayini:

<html>
<head>
<title>Control con Sonoff</title>
</head>
<body>
<button id="10" class="led">A</button>
<button id="11" class="led">LED AZUL</button>
<button id="12" class="led">LED VERDE</button>
<button id="13" class="led">LED ROJO</button>
<script src="jquery.min.js">
</script>
<script type="text/javascript">
$(document).ready(function(){
$(".led").click(function(){ var p =
$(this).attr('id');
$.get("http://XXX.XXX.X.X:80/", {pin:p});
});
});
</script>
</body>
</html>

Ungayibhala nakuwuphi na umhleli wokubhaliweyo, kwaye ugcine ngegama ulawulo.html. Khumbula ukuba ukuze usebenze kakuhle, kufuneka ubeke endaweni http: //XXX.XXX.XX: 80 nge i-IP efanelekileyo kwimeko yakhoOko kukuthi, lowo wabelwe i-ESP8266 ngaphakathi kwenethiwekhi yakho yeWiFi ... Kwelinye icala, ukuba ufuna ukubuyisela ilebheli yesixhobo A enegama lesixhobo osisebenzisayo kwaye wenze ukuba inomdla ngakumbi, zive ukhululekile ukwenza njalo ...

Ulawulo lwenethiwekhi yeWebhu

Ngoku ukuba uvula olu lawulo.html nge Nawuphi na umkhangeli webhu unokuphatha iSonoff yakho. Ngokucofa kumaqhosha uza kubona ukuba isekethe yakho isebenza njani.

Guqula i-firmware yeSonoff (ePhucukileyo)

Olunye umsebenzi onokuwenza, nangona kungacetyiswanga kubasebenzisi abaninzi ngenxa yokuntsonkotha kwawo, kukuguqula Itead isonoff firmware. Kuyenzeka, kodwa kubandakanya amanyathelo amaninzi kwaye kunzima ukuba awazi kakuhle into oyenzayo. Ukukunika umbono ndikushiya into oya kuyidinga kunye namanyathelo abalulekileyo, kunye nokunxibelelana ne-firmware kunye nezikhokelo ezigqibeleleyo xa unokulinga emva kokufunda amanyathelo abalulekileyo ...

Sebenzisa i-ESPurna

Yintoni oyifunayo

Sebenzisa i-Itead Sonoff kunye nenkqubo yayo, Uya kudinga ezi zinto zilandelayo:

  • Itead Sonoff WiFi Esisiseko
  • I-FTDI okanye i-adapter ye-TTL kunye nentambo (i-USB / izikhonkwane zothotho)
  • Iscrewdriver
  • Ezinye izinto eziyimfuneko kwiprojekthi yakho
  • Ikhompyuter yenkqubo

Guqula i-Itead Sonoff WiFi firmware esisiseko (amanyathelo asisiseko)

Itead isonoff yesekethe

Ukuguqula i-Itead Sonoff kufuneka uthenge enye kwaye landela amanyathelo alandelayo:

Ngaphambi kokuba uphathe isixhobo, qiniseka ukuba sikhutshiwe. Akucetyiswa ukuba usebenzise i-relay okanye isekethe xa ixhunyiwe kwinethiwekhi, kuba uya kusebenza ne-AC kwi-220v kwaye ayisiyongozi ye-DC eyingozi esebenza kwimigangatho ephantsi ...

  1. Susa isiciko seplastiki kwiSonoff ukuze ukwazi ukufikelela kwisekethe yangaphakathi. Ungasebenzisa i-screwdriver ukususa amacala amacala kuqala kwaye emva koko udibanise indibaniselwano edibanisa iinxalenye ezimbini zecala eliphambili de ube unako ukulisusa.
  2. Ukuba ujonga isekethe ephambi kwakho zinokwahlulwa kakuhle iinxalenye zemodyuli ye-ESP8266:
    1. Izinto zombane ezijikeleze udluliso zivela kwisiguquli se-AC / DC.
    2. Icandelo lesikwere elimnyama kukuhanjiswa okusebenza kwi-5v (icandelo lolawulo) kunye ne-220v (imveliso).
    3. Kwiziko unezikhonkwane zonxibelelwano oludibeneyo. Ungazisebenzisa ukwenza inkqubo yolawulo oluncinci okanye ukudibanisa izinto ezingaphezulu. Kwi-GPIO14 ungaqhagamshela ii-actuator okanye ii-sensors.
    4. Uya kubona iqhosha lokutyhala ecaleni kwezikhonkwane. Ungayicofa ukuba utshintshe iindlela onokuthi uzibeke.
    5. I-LED ebonisa ukusebenza kunye nemowudi okanye imeko ekuyo.
    6. Kwaye izihlanganisi ezibini eziluhlaza kwisiphelo ngasinye se-PBC. Enye yazo igalelo kwaye enye imveliso. Eyona ndawo ikufutshane nokudluliswa ligalelo le-AC, Oko kukuthi, apho isixhobo sidityaniswe kwinethiwekhi yombane. Enye indawo yokuphuma apho unganxibelelana khona nesixhobo ofuna ukusicima okanye ukusivula. Khumbula ukuba ixhasa ukuya kuthi ga kwi-10A, oko kukuthi, ukusetyenziswa kwe-2,2kW ye-220v.
  3. Ngoku uya kusebenza kunye nezikhonkwane zonxibelelwano ukulayisha inkqubo yakho. Yenzela Yean Uya kuyidinga i-FTDI okanye i-TTL, Ukuvumela ukuba udibanise ezi zikhonkwane kwi-USB kwikhompyuter yakho. Kodwa ngaphaya kokuyixhuma, kufuneka ukhumbule ukuba i-microcontroller edibeneyo ineendlela ezimbini zokusebenza, imowudi ye-UART kunye ne-FLASH enye. Imowudi ye-UART ikuvumela ukuba ulayishe inkqubo kunye ne-FLASH ukuyiphumeza. Ukuya kwimowudi ye-UART ukuze ubhale inkqubo kufuneka ubeke i-GPIO0 (LOW) kunye ne-GPIO2 (HIGH) izikhonkwane kwiindawo ezithile. Inkqubo iya kulayishwa ngezikhonkwane ezibhalwe i-RX ne-TX. Ewe kuya kufuneka usebenzise izikhonkwane zamandla ze-3v3 kunye ne-GND, kunye ne-GPIO0 pushbutton, i-LED okanye i-GPIO13 kunye nokudluliselwa kwi-GPIO12.
  4. Nje ukuba wenze uxhulumaniso ngokufanelekileyo kwaye unayo intambo ye-USB ukuze uyixhume kwiPC, ungaqala ngenkqubo ngokwayo. Khumbula ukuba nini I-FTDI kufuneka uwele unxibelelwano lwe-RX kunye ne-TXOko kukuthi, i-RX ukusuka kwi-Itead ukuya kwi-TX evela kwi-FTDI kwaye ngokuchaseneyo.
  5. Emva kwexesha, iya kuba ngumcimbi wokusebenzisa I-Arduino IDE ukwenza ikhowudi eyimfuneko kulawulo ofuna ukulwenza (kuya kufuneka ukhethe ibhodi ye-ESP8266 njengesixhobo se-microcontroller sokurekhoda). Inokukunceda nawe i-firmware eyenziwe nguXose Pérez. Ibizwa ngokuba yi-ESPurna kwaye icacile kwi-Sonoff WiFi. Ngepaneli yolawulo unokulawula iiparitha zenethiwekhi kunye nezokhuseleko.
  6. Ekugqibeleni, xa sele unayo, ungazibuyisela izikhonkwane I-GPIO0 kunye ne-GPIO2 ukuya kumazwe aphakamileyo ngokwahlukeneyo ukubuyela kwimowudi yeFLASH kwaye usebenzise inkqubo yakho.
  7. Nje ukuba ugqibile, unako yenza unxibelelwano olufanelekileyo kwi-Sonoff yakho ukudibanisa izixhobo ozifunayo kwaye uzinike amandla. Ukusuka kwi-app unokulawula yonke into ...

Iinkcukacha ezithe xaxe - Inkqubo elula

Sebenzisa iTasmota

Ukwenza ngeTasmota endaweni ye-ESPurna, i amanyathelo aqhelekileyo ukwenza njalo baya kuba:

  1. Kuya kufuneka uqale uvule ityala le-Itead Sonoff njengakwimeko yangaphambili.
  2. Emva koko kuya kufuneka uchithe iintambo okanye izikhonkwane ukuze ukwazi ukwenza unxibelelwano lwamandla kunye ne-USB kwi-UART TTL iadaptha.
  3. Yiya kwiArduino IDE nakwizixhobo kufuneka ukhethe ibhodi ye-ESP8266 endaweni ye Arduino UNO okanye le unayo unayo. Ufakela ibhodi entsha.
  4. Ngoku khuphela iTasmota kwaye uyifake ngokufanelekileyo ukudibanisa neArduino IDE.
  5. Lixesha lokuba wenze inkqubo kwaye uqwalasele iprojekthi njengoko ufuna kwaye uyigcine kwibhodi yomama… Nje ukuba ugqibile ungaqhagamshela izinto kwi-sonoff njengakwimeko ye-ESPurna.

Iinkcukacha ezithe xaxe - Ukuzenzekelayo ekhaya


Izimvo ezi-7, shiya ezakho

Shiya uluvo lwakho

Idilesi yakho ye email aziyi kupapashwa. ezidingekayo ziphawulwe *

*

*

  1. Uxanduva lwedatha: UMiguel Ángel Gatón
  2. Injongo yedatha: Ulawulo lwe-SPAM, ulawulo lwezimvo.
  3. Umthetho: Imvume yakho
  4. Unxibelelwano lwedatha: Idatha ayizukuhanjiswa kubantu besithathu ngaphandle koxanduva lomthetho.
  5. Ukugcinwa kweenkcukacha
  6. Amalungelo: Ngalo naliphi na ixesha unganciphisa, uphinde uphinde ucime ulwazi lwakho.

  1.   UJuan M. sitsho

    Umncedisi wewebhu akasebenzi, awulayishi kwisikhangeli.

    1.    UIsake sitsho

      Molo John,
      Uthetha xa ubeka i-IP kwisikhangeli sakho sewebhu? Uqinisekisile ukuba usete i-IP echanekileyo ngaphakathi kwenethiwekhi yendawo? I-IP yoluntu ayisebenzi. Kufuneka ibengulowo wabelwe i-sonoff. Ukongeza kwikhowudi ye-html kuya kufuneka ubeke endaweni ye-X nge-IP efanelekileyo.
      Nibuliso!

      1.    juan sitsho

        Ngapha koko, ndizenzile zombini, kodwa umzuzu wokulayisha i-IP kwisikhangeli, indinika unxibelelwano olungaphumelelanga. Kwakhona xa ndisebenzisa iseva yewebhu, ayilayishwanga ngohlobo lwamaqhosha, kodwa kwisicatshulwa.

        1.    UIsake sitsho

          Molo John,
          Iyandisebenzela ngokuchanekileyo, andiqondi ukuba kutheni le nto isenzeka kuwe ...
          Ndizakuphanda kwaye ukuba ndiyifumene ingxaki ndizokwazisa.
          Umbuliso kunye nombulelo wokufunda

  2.   joan sitsho

    Sawubona,
    Andiqondi ukuba kwiilayibrari esinazo, usebenzisa iikhowudi ze-AT….

    Andikuboni usebenzisa imowudi ye-WIFI ye-ESP8266 ejolise kweli nqaku.

    Beka umzekelo ococekileyo kwaye ucace gca kwaye uya kubona ukuba iprojekthi iya kuqonda.

    A ubingelele.

    1.    joan sitsho

      Ndilibele,
      Ukuba into oyifunayo kukudlulisa, i-ESP8266 iyilawula ngokwayo, sebenzisa iArduino ukuba ufuna ukulayisha i-firmware.

      Omnye umbuliso.

  3.   ANDRES REBERTO GUZMAN GALVAN sitsho

    Ndilandele onke amanyathelo akho kwaye ayisebenzi kum, ukuba uyazi njani i-IP enikwe i-ESP8266 yam