Avatar for user82278

user82278

Member since Oct 2017 • Last active Nov 2017
  • 2 conversations
  • 12 comments

form Eslass Area

Most recent activity

    • 19 comments
    • 7,892 views
    • 9 comments
    • 5,209 views
  • in ESP8266
    Avatar for user82278

    Hi Vasily,

    Glad it's working for you.
    What is the command you use to flash firmware, do you use epstool ? I'm using Mac and if I don't give options to -fs and -fm it fails. I mean the transfer seems to be ok, but once restarted I'm not able to type something in the prompt.

    Thank you

  • in ESP8266
    Avatar for user82278

    Ok it seems the problem is that the esp8266 with ESPRUINO is not able to connect to my residential wifi as it broadcasts 2.4GHz and 5GHz under the same SSID. I can split it in to ssids.
    And is not able to deal with "wpa-wpa2 personnal" security.
    I can switch to "wpa2 personnal"only.

    I still have to perform stability tests. I will keep you informed.

    Thank you

  • in ESP8266
    Avatar for user82278

    Hello,

    I'm trying to set the same project as Gordon did here :
    https://www.youtube.com/watch?time_conti­nue=247&v=-BYHwGIMKXw

    To sum up : flashing espruino on a sonoff to drive it from MQTT.

    I've succeded to flash firmware on Sonoff, I can upload code to it from IDE, but, the Sonoff is unable to connect to Wifi.

    I suspected a wifi issue, but the Sonoff/Espruino is able to list all the ssid in my environment.
    I even tried with Micropython to remove the doubt on the hardware.

    I've check ssid/password in the code and it's OK.

    I've also loaded exactly the same code on Wemos D1 mini and it's able to connect to wifi.

    Do you have any idea what could wrong ?

    Could it be something related to the warning i got when I upload the code ?

    I load firmware with a Mac : ./esptool.py --port /dev/tty.wchusbserial620 write_flash -fs 8MB -fm dout 0x0 ../espruino_1v94/espruino_1v94_esp8266_c­ombined_512.bin

    Thank you very much.

  • in ESP8266
    Avatar for user82278

    Update :
    I was able to connect to Wifi with this code loaded on a Wemos D1. SO the code is fine. The only difference is that on the Wemos it is espruino 4m running and not 512k.

    1- Can I load espruino 512k on a Wemos D1 ?

    I will try to load the firmware and the same code on an other Sonoff to try.

    Have a nice sunday.

    2 - How can I change my notverypersonnal nickname on this forum ? It fails each time when I perform the action my profile.

  • in ESP8266
    Avatar for user82278

    Hello @allObjects,

    Sorry, I didn't exposed my "project" here :

    I'm just trying to reproduce Gordon's Home automation project, so this is the code I try :
    (available here : https://www.espruino.com/Home+Automation­)

    Naturally I've changed the Wifi ssid and password.

    var WIFI_NAME = "Espruino";
    var WIFI_OPTIONS = { password : "helloworld" };
    var MQTT_HOST = "raspberrypi";
    var PATH = "/mydevice/";
    var LED = D13;
    var RELAY = D12;
    var BTN = D0;
    var mqtt;
    var wifi;
    
    function setState(v) {
      RELAY.write(v);
      LED.write(!v);
      mqtt.publish(PATH+"status", v?1:0);
    }
    
    function mqttMessage(pub) {
      console.log("MQTT=> ",pub.topic,pub.message);
    
      if (pub.topic == PATH+"set") {
        setState(pub.message!=0);
      }
      if (pub.topic == PATH+"eval") {
        try {
          mqtt.publish(PATH+"response", eval(pub.message));
        } catch(e) {
          mqtt.publish(PATH+"exception", e.toString());
        }
      }
    }
    
    function mqttConnect() {
      mqtt = require("MQTT").connect({
        host: MQTT_HOST,
      });
      mqtt.on('connected', function() {
        console.log("MQTT connected");
        setTimeout(function() {      
          mqtt.subscribe(PATH+"#");
        }, 1000);
      });
      mqtt.on('publish', mqttMessage);
    }
    
    
    function onInit() {
      console.log("Connecting WiFi");  
      setInterval(function() {
        if (!mqtt) return;
        if (!mqtt.connected) {
          console.log("MQTT disconnected... reconnecting.");
          mqtt.connect();
        }
      }, 60*1000);
    
      wifi = require("Wifi");
      wifi.on('connected',function() {
        console.log("Connected to WiFi");  
      });
      wifi.on('disconnected',function() {
        console.log("Disconnected from WiFi");  
      });
      wifi.setHostname("MYDEVICE");
      wifi.stopAP();
      wifi.connect(WIFI_NAME, WIFI_OPTIONS,
                   function(ap){ 
        console.log("Successful connect.");
      });
      // wait, and connect MQTT
      setTimeout(function() {
        console.log("MQTT connecting");
        mqttConnect();
      }, 10000);
    }
    
  • in ESP8266
    Avatar for user82278

    Hello,

    Finally succeded to install the firmware, but I had to change parameters in the esptool command line ; -fs and -fm

    ./esptool.py --port /dev/tty.SLAB_USBtoUART write_flash -fs 8MB -fm dout 0x0 ../espruino_1v93_esp8266_combined_512.bi­n 
    

    But, now I'm not able to connect to Wifi. I will double check my wifi configuration.

    Connecting WiFi
    Disconnected from WiFi
    Disconnected from WiFi
    Disconnected from WiFi
    MQTT connecting
    Uncaught InternalError: Unable to create socket
     at line 4 col 2
    c)
     ^
    in function "connect" called from line 1 col 29
    b=new f(b.host,b);b.connect();return b
                                ^
    in function "connect" called from line 35 col 4
      });
       ^
    in function "mqttConnect" called from line 72 col 17
        mqttConnect();
                    ^
    in function called from system
    

    Do you think something is missing in the code ?

  • in ESP8266
    Avatar for user82278

    Hello,

    Thank you for your advice, I was thinking of doing this but I was not sure it would work, but I gave it a try and... it still fails.
    To do so, I've plugged the main to the Sonoff and :
    Sonoff |------------| FTDI
    TX ------------ RX
    RX ------------ TX
    GND ------------ GND

    (I'm sure my wiring RX/TX is ok. If i swap it fails miserably to load the .bin)

    Here is the output of esptool :

    kiwis:esptool-master kiwis$ ./esptool.py --port /dev/tty.wchusbserial410 write_flash 0 ../espruino_1v93_esp8266_combined_512.bi­n 
    esptool.py v2.2-dev
    Connecting........_____....._____....._
    Detecting chip type... ESP8266
    Chip is ESP8266EX
    Uploading stub...
    Running stub...
    Stub running...
    Configuring flash size...
    Auto-detected Flash size: 1MB
    Flash params set to 0x0020
    Compressed 524288 bytes to 326299...
    Wrote 524288 bytes (326299 compressed) at 0x00000000 in 29.2 seconds (effective 143.5 kbit/s)...
    Hash of data verified.
    
    Leaving...
    Hard resetting...
    
    

    Moreover find attached the new output off the IDE with baudrate configured to 115200. A bit better, but not fully satisfying.

    I will investigate on the FTDI side and may be Sonoff...

    Can you confirm this is the right file I'm loading :

    espruino_1v94_esp8266_combined_512.bin

    Thank you for your help.

    Regards;

  • in ESP8266
    Avatar for user82278

    OK thank you,

    is it possible to subsitute the 3.3 FTDI with Lipo ?

Actions