Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. Alexander Voronin
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Alexander Voronin

    @Alexander Voronin

    1
    Reputation
    9
    Posts
    657
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Alexander Voronin Follow

    Best posts made by Alexander Voronin

    • RE: ESP8266 WiFi settings in EEPROM

      @hek This is my first try with MySensors, so just thinking of loud:

      One way: Globally redesign internal initialization sequence and add extra EEPROM arguments. Also provide function to write new SSID/password to EEPROM and reboot. Read SSID/IP/password/etc from config in TransportXXX

      Another way: Be more Arduin-ish. All standard Arduino classes have function begin or/and class initializer. So I want to call for example mySensors.begin() for basic init, and some kind of mySensorsTransportXXXBegin(ssid, password, ip, topic, etc) for specific transport init. As an option should be flag like "already connected" or "do not reconnect" for WiFi

      As for me, the second way is preferred. If I decide to make my next sensor on MySensors instead of "pure" C/Arduino, I'll refactor at least MyMainESP8266.c:loop_wrapper by removing setup call and adding separate public _begin() alternative

      posted in Development
      Alexander Voronin
      Alexander Voronin

    Latest posts made by Alexander Voronin

    • RE: Issues dallas sensor and sketch

      Have similar issue while connect 1-wire sensors to pins 4 (power) and 5 (data) for low energy sensor.

      Looks like at least pin 5 used internally (as LED ?) by MySensors and broke 1-wire i/o.

      After moving 1-wire "data" pin to "A1" and hardwire "power" pin to "VCC" I have no issues with DS18B20. But about 3.5uA per sensor more in sleep (11-12uA instead of 4.7).

      BTW: still have issue with node registration and/or other connection issues - after approx. 2 days node whan't to send data to gateway... Will debug later.

      PS: MySensors v2.0 from Arduino Lib manager, Arduino Pro Mini 3.3V@8MHz@4.1VLiPo

      posted in Troubleshooting
      Alexander Voronin
      Alexander Voronin
    • RE: ESP8266 WiFi settings in EEPROM

      @Yveaux I have 34 of 80k RAM used for this sketch, so 128 bytes looks like "a bit more".

      You can not use progmem with ESP and mysensors now because PSTR redefined as PSTR(x) (x) so all strings are really in RAM 😞

      posted in Development
      Alexander Voronin
      Alexander Voronin
    • RE: ESP8266 WiFi settings in EEPROM

      @Yveaux Not all but enough. Hmm how do you plan to use mqtt with wifi with ATMega? 😉 IMHO it is not so good 🙂

      So this solution is for somebody, who need dynamic reconfiguration of system settings. Remember, that char[] sizes just example and may be reduced or changed to String(...).c_str(). But I don't know arduino well (prefer pure C) and can't predict memory usage/fragmentation on that way.

      BTW, as an idea - add wifi and/or mqtt settings as MyMessage to be changed via "standard" way

      posted in Development
      Alexander Voronin
      Alexander Voronin
    • RE: ESP8266 WiFi settings in EEPROM

      OK!
      All, except MY_MQTT_xxx_TOPIC_PREFIX can be used as variables:

      char ssid[32] = "MyAP";
      char pwd[32] = "MyPass";
      word mqttPort = 1883;
      char mqttHost[64] = "my.mqtt.example.com";
      
      #define MY_GATEWAY_ESP8266
      #define MY_GATEWAY_MQTT_CLIENT
      #define MY_ESP8266_SSID (ssid)
      #define MY_ESP8266_PASSWORD (pwd)
      
      #define MY_PORT (mqttPort)
      #define MY_CONTROLLER_URL_ADDRESS (mqttHost)
      #define MY_MQTT_CLIENT_ID  (String("MyS_") + String(ESP.getChipId(), HEX)).c_str()
      
      // DOES NOT SUPPORT VARS:
      #define MY_MQTT_PUBLISH_TOPIC_PREFIX "/MySe/00/out"
      #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "/MySe/00/in"
      
      #include <MySensor.h>
      
      void before() {
        // read config into local vars, e.g. from FS via json
        strncpy(ssid, "AltSSID", sizeof(ssid)); // example
      }
      
      void setup() {
      }
      
      void loop() {
      }
      

      FYI, The wifi manager from first post is not so useful here for me - on first look there is some issues with dhcp vs static ip, so I'll try to find another solution or write my own 🙂

      posted in Development
      Alexander Voronin
      Alexander Voronin
    • RE: ESP8266 WiFi settings in EEPROM

      @hek Thanks! Looks promising. I''ll try it.

      This may solve an issue with AP (compiled ok but untested char[] as MY_ESP8266_SSID) but not for MQTT transport - a lot of PSTR(MY_MQTT_XXX) "/+/+/+" code required refactoring to be used with at least const char*

      posted in Development
      Alexander Voronin
      Alexander Voronin
    • RE: ESP8266 WiFi settings in EEPROM

      @Yveaux This is slightly not my case. The ESP stores only SSID/Password, but I want to store extra config for at least MQTT broker.

      The main issue is that WiFi.begin() and awaiting for WiFi.state == WL_CONNECTED logic executed before setup() so I can not invoke web-config or change hardcoded AP name. In my previous "pure" arduino sensor (https://bitbucket.org/esp8266/sensor-v2) I use WiFiMulti to connect first available pre-configured AP's, so I need at least two AP/password settings (for example home and work wifi)

      BTW, de-facto MySensors internally "ignores" last saved AP because calls begin(SSID, PWD) in MyGatewayTransportXXX.cpp but it is good idea as for me. As an option - do not call WiFi.begin() if wifi state already "connected" but required some functionality to force reconnect to /other/ AP

      So I need 4 steps:

      1. Try connect to saved AP (may be more than one)
      2. If not success, bring up softAP and Web/Telnet configurator
      3. Reconnect to new configured AP or reboot an goto step 1
      4. Start MySensors with already connected WiFi and new SSID
      posted in Development
      Alexander Voronin
      Alexander Voronin
    • RE: ESP8266 WiFi settings in EEPROM

      @hek This is my first try with MySensors, so just thinking of loud:

      One way: Globally redesign internal initialization sequence and add extra EEPROM arguments. Also provide function to write new SSID/password to EEPROM and reboot. Read SSID/IP/password/etc from config in TransportXXX

      Another way: Be more Arduin-ish. All standard Arduino classes have function begin or/and class initializer. So I want to call for example mySensors.begin() for basic init, and some kind of mySensorsTransportXXXBegin(ssid, password, ip, topic, etc) for specific transport init. As an option should be flag like "already connected" or "do not reconnect" for WiFi

      As for me, the second way is preferred. If I decide to make my next sensor on MySensors instead of "pure" C/Arduino, I'll refactor at least MyMainESP8266.c:loop_wrapper by removing setup call and adding separate public _begin() alternative

      posted in Development
      Alexander Voronin
      Alexander Voronin
    • ESP8266 WiFi settings in EEPROM

      Hi!

      Is there a way to use WiFi SSID/password/etc. stored in EEPROM?
      As I can see all WiFi initialization hidden from "end-user".

      I want to read config from EEPROM or filesystem and use some web-based (re-)configuration (as example https://github.com/tzapu/WiFiManager) but can't because WiFi stack initialized internally with defines.

      BTW, while general wifi settings can be re-defined to local variables, MQTT Client Gateway uses "inplace" string join so can not be compiled with variables.

      posted in Development
      Alexander Voronin
      Alexander Voronin
    • RE: Can local sensors log data?

      @tbowmo What about watchdog? I used it as power-on source in my custom project (not mysensors, raw GCC and AVR) and got about 10sec power-down cycles at 3.3V (should be 8sec on 5V). Yes, it is voltage dependent, but may be used as "interval counter" if you have some logic to recalculate times from (approx. fixed) intervals.

      AFAIR, ESP8266 also has DeepSleep mode, but haven't IRQ handler for safe handling interrupt (only hardware reset on DeepSleep completion)

      posted in Hardware
      Alexander Voronin
      Alexander Voronin