Amazon alexa / Google Assistant BSD34 murdmine.
Võtsin ette odava nutilüliti (~8 €), PCB markeeritud BSD34 ja sellel ESP8285 moodul markeeringuga AJW-02_8285
Infot on suht vähe aga peale väikest tuhnimist avarustes siiski midagi leidsin.
Korpuse avamiseks peab veidi noa-kruvikeerajaga kangutama, ülemine kork tuleb väikse krõpsuga ära ja  siist saab juba sisuski välja tõmmata.
Erinevalt SONOFF-st (basic ja S20)  ei ole pin-ide jootmiseks mugavaid avasid ning küljepelsest surunupust flash -l abi, peab PCB pad-de kallale minema.
Leiame korpuse seest väikese lisamooduli (sinine)  markeeringuga AJW-02_8525


Nüüd teoreetiline osa läbi ja parakilise osa kallale.
(GPIO0 -le jootmine oli päris lõbus)
 

Flash -ks kasutan FTDI
FTDI   -   ESP8285
GND   -   GND
3.3V   -   3.3V
TX     -   RX
RX     -   TX

enne FTDI pingestamist ühenda GPIO0 ja GND
Arduino IDE, vali "Generic 8285 Module"

Kood, sama mis SONOFF -l vahetan scriptis ainult espCliendi nime ja topic -u siis peaks kenasti hakkama minu kodu wifi võrgus töötama.
*** Tehtud töötab! ***
Väike kõrvalmõju vaid, et küljenupp ei tööta.
/***** BSD34 espClient_a_1 *********/
/* ESP8285 , Flash size 1M(no SPIFFS) */
/* flash-ks ühenda GPI0-GND (enne FTDI pingestamist) */

#include <ESP8266WiFi.h>
#include <PubSubClient.h>

const char* ssid = "xxxxxxxxxx";
const char* pass = "??????????";
const char* mqtt_server = "xxx.xxx.xxx.xxx"; // Raspberry IP

WiFiClient espClient_a_1;
PubSubClient client(espClient_a_1);

const int pin = 12; 
const int led = 13;

// Don't change the function below. This functions connects your ESP8266 to your router
void setup_wifi() {
  delay(10);
  WiFi.begin(ssid, pass);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
  }  
}

// This functions is executed when some device publishes a message to a topic that your ESP8266 is subscribed to
// your ESP8266 is subscribed you can actually do something
void callback(String topic, byte* message, unsigned int length) {
  String messageTemp;
  for (int i = 0; i < length; i++) {
    messageTemp += (char)message[i];
  }
  if(topic=="alexa_1"){
      //Serial.print("Changing ...: ");
      if(messageTemp == "1"){
        digitalWrite(pin, HIGH);
        digitalWrite(led, LOW);
      }
      else if(messageTemp == "0"){
        digitalWrite(pin, LOW);
        digitalWrite(led, HIGH);
      }
     client.publish("alexa_1.v", String(messageTemp).c_str());
  }
}

// This functions reconnects your ESP8266 to your MQTT broker
// Change the function below if you want to subscribe to more topics with your ESP8266 
void reconnect() {
  while (!client.connected()) {   // Loop until we're reconnected
    if (client.connect("espClient_a_1")) {
      // Subscribe or resubscribe to a topic. You can subscribe to more topics
      client.subscribe("alexa_1");
    } else {
      delay(5000);
    }
  }
}

// The setup function sets your ESP GPIOs to Outputs, starts the serial communication at a baud rate of 115200
// Sets your mqtt broker and sets the callback function -receives messages and controls pins
void setup() {
  pinMode(pin, OUTPUT);
  //Serial.begin(115200);
  setup_wifi();
  client.setServer(mqtt_server, 1883);
  client.setCallback(callback);
}

// For this project, you don't need to change anything in the loop function. Basically it ensures that you ESP is connected to your broker
void loop() {
  if (!client.connected()) {
    reconnect();
  }
  if(!client.loop())
    client.connect("espClient_a_1");
} 

Comments powered by CComment