Avatar for SergeP

SergeP

Member since Nov 2016 • Last active Dec 2018
  • 13 conversations
  • 50 comments

Most recent activity

  • in ESP32
    Avatar for SergeP

    Hi!
    I have reworked my simple clock to work with MQTT server. It is not so simple now :)
    It gets additional fields to display from MQTT server, while a few devices send data to the server and JS agent works on the server and converts incoming data from the sensors to data for clock.
    One of the sensors is a controller of very small greenhouse. It measures temperature, turns on and off heating and light and sends its state to MQTT server. It is ESP32 board. (I put it in place of old MSP32-based controller because the old one has no wireless communications).
    Everything works. But the controller becomes invisible to other devices on my local network in a small period after power on. I can connect to it and can ping it from MQTT server but not from any other devices.
    I've captured some packets in my network using tcpdump and have found that the controller does not answer to ARP requests. I can not check if it receives the requests.
    I have a few other ESP32 devices with the same version of Espruino (v2.00) and they are visible. One possible difference is that the controller is at longest distance (RSSI is usually about -85).
    It looks strange, while is not a problem. Why it may be?

    • 20 comments
    • 760 views
  • in Projects
    Avatar for SergeP

    @allObjects. You are right, 1 second noise at reset or power up (and even at not every reset or power up) is really not a big problem. So I wanted to kill it easy or to leave it as is. double write at startup seems to be easy enough to implement it. Sorry, the code looks strange and confusing. If you remove the double write (both of them) you will see no any changes most times even at power up/reset.
    But if you send new code to clock every minute :) in dark room :)) it may be interesting to use the writes to remove bright noise.

  • in Projects
    Avatar for SergeP

    @Robin My English is not good enough, so sometimes I am not sure I see that you write. And that is the only I mean in my previous post. (And I am also not sure I write exactly that I think because of the same reason, so I am sorry :) )
    I call neopixel.write twice only at startup. Besides that there is only one point where it called. Moreover, the code contains some trivial event aggregator to minimize number of calls.
    When I write about synchronization I mean that WS1812 may be in any state when the code starts. Particularly, it may be still in process of byte receiving. For example, if we press reset button on ESP32 module when LED is in the process. In the state LED will interpret new data incorrectly and we will see number of bright pixels on display until next write. First regular write (current time etc) will be only after about 1 second after power on or reset, and display will be ill all the time. To minimize time of the effect I call neopixel.write twice at start.

  • in ESP32
    Avatar for SergeP

    @Gordon I' ve found something to improve in MQTT module.
    In some cases call of underlying require("net").connect(...) throws exception. mqo.emit('disconnected') is not called in such case. So general reconnection algorithm (reconnect on disconnected) is not working.
    So may be it is a good idea to catch the exception in MQTT module and emit disconnected event:

          try {
            client = require("net").connect({host: mqo.server, port: mqo.port}, onConnect);
          } catch (e){
            client = false;
            this.emit('disconnected');
          }
    

    It will simplify usage of MQTT module.

  • in Projects
    Avatar for SergeP

    @Robin sorry, I am not sure I understand your question.
    I've created global buffer to use. At startup it is blank, and I send it to display twice (one to synchronize and one to blank display while startup proceed). Then I use the buffer to write time etc.
    If display is not synchronized it can show some noise after first data out, sometimes the noise is too bright.

  • in Projects
    Avatar for SergeP

    Newer clock:

    @Robin I am a dinosaur who did not use file hosting services before. So after you explain an idea it is easy to use. About to identical lines - ws2812 can be in any state at start. Sometimes (rarely) it is in the middle of byte receiving. And one write is not enough to blank display. I think it is enough to send 1 byte (or may be 3 bytes) to sync, but it was easier to send all the buffer instead.

  • in Projects
    Avatar for SergeP

    @Gordon Great!
    @Robin Thank you for explaination of image adding. Photo of my old smaller clock:

Actions