logo elektroda
logo elektroda
X
logo elektroda

ESP8266 ESP12 Fails to connect to router after hanging up - power consumption

MichałS 849 14
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 18004814
    MichałS
    Level 35  
    A recorder based on an ESP12, an OLED and an INA measurement amplifier. The ESP12 runs on NODEMCU firmware and the program code was written in LUA.

    The logger worked for a few days then suddenly stopped logging (sending data to the server). After cutting the power for a while everything returned to normal, but the logger would not connect to the router. A characteristic feature was the increased current consumption. After re-uploading the same firmware and "ini.lua" file, the recorder came to life and is working correctly.

    What could have been the cause? It wasn't a software crash because logs were flying in the background indicating that there was no WiFi and a reconnect attempt and the OLED was displaying results normally. It wasn't a simple hang-up either, as voltage restarts didn't help. What else was peculiar was the power consumption was exactly as it is now when connecting to the router. Presumably there was a jamming/unprogramming of the radio part of the module ?
  • ADVERTISEMENT
  • #2 18004905
    TvWidget
    Level 38  
    Does the script in LUA write data to a file ?
  • ADVERTISEMENT
  • #3 18004911
    MichałS
    Level 35  
    Yes; energy production is recorded.
  • Helpful post
    #4 18004926
    TvWidget
    Level 38  
    It is likely that the LUA file was corrupted during the save operation. If this happens again, load the file and compare it with the original one.
    I don't know how it is in ESP8266 but a similar error occurs in ESP32. During certain operations, data cannot be written to the file.
  • Helpful post
    #5 18005265
    khoam
    Level 42  
    MichałS wrote:
    This was not a simple hang-up either, as voltage restarts did not help.
    .
    Does this mean that turning the ESP power off and on did not cause a reboot, but the module continued to hang? If so, show the circuit diagram of how this ESP-12 is connected.
  • ADVERTISEMENT
  • #6 18005745
    MichałS
    Level 35  
    Actually a bit out of character.... It wasn't a simple 'hang-up' of the program because the measurement and results display part worked correctly before and after the restart. The radio, on the other hand, did not work; it simply 'jammed something' at some point. It did not hang up despite restarting and disconnecting the power supply, but the recorder was successfully brought back to life by reprogramming the firmware + init.lua file
  • ADVERTISEMENT
  • #7 18005748
    khoam
    Level 42  
    Are you using some kind of off-the-shelf module with ESP-12 (e.g. NodeMCU), or the 'cube' itself?
  • #8 18006041
    MichałS
    Level 35  
    ESP12 module
  • #9 18572884
    MichałS
    Level 35  
    Continuing the theme;
    NodeMCU firmware provides 4 power saving modes: NONE_SLEEP - no sleep at all, 70mA current consumption; MODEM_SLEEP - saving at the expense of switching off the radio, 20mA consumption; LIGHT_SLEEP - as above + CPU load reduction, 15mA current consumption; DEEP_SLEEP - complete sleep.

    In the project the ESP8266 is counting pulses all the time so DEEP_SLEEP mode is out, and in LIGHT_SLEEP unfortunately it consumes the battery too quickly, do you have any idea how to reduce power consumption without DEEP_SLEEP?
  • Helpful post
    #10 18572926
    khoam
    Level 42  
    In Light-sleep mode, the CPU is in 'pending' mode, so:
    " During Light-sleep, the CPU is suspended and does not respond to the signals and interrupts from the peripheral hardware interfaces. ."
    Even in this mode it will not be possible to count pulses without periodic wake-up. The document "ESP8266 Low-Power Solutions" is attached.

    What is the frequency range of the counted pulses?
  • #11 18575170
    MichałS
    Level 35  
    Thank you for the attached material.
    I don't know to what extent the sleep modes described in the Espressif note coincide with those introduced in the NodeMCU firmware: https://nodemcu.readthedocs.io/en/latest/modules/wifi/#wifistasleeptype

    The fact is that MODEM_SLEEP reduces the current consumption to around 20mA, and LIGHT_SLEEP by a few more mA. However, they are not 2mA.
  • #12 18575192
    khoam
    Level 42  
    MichałS wrote:
    I do not know to what extent the sleep modes described in the Espressif note coincide with those introduced in the NodeMCU firmware:
    .
    NodeMCU only produces modules that use Espressif's ESP8266 chips. Obviously such modules will have higher power consumption in sleep modes due to the additional components on the boards. In general, NodeMCU or Wemos modules are poorly suited to solutions where we are very concerned about minimising current consumption when using battery power. There is an interesting article on how to reduce the current consumption of NodeMCUs at the link below. However, these operations require changes ('rework') to the board itself:
    https://tinker.yeoman.com.au/2016/05/29/runni...tery-esp8266-low-power-consumption-revisited/
  • #13 18575777
    MichałS
    Level 35  
    NodeMCU is also firmware for ESP modules, please see here: https://www.nodemcu.com/index_en.html Firmware can be uploaded to a module, e.g. ESP12 or ESP07, and the program can be written in Lua (ala Phyton).

    Regarding the reduced power consumption modes, I think it coincides with the Espressif description. In MODEM mode the power consumption is as in the document, unfortunately in LIGHT mode several times higher. Perhaps this is because the programme is running several timers.
  • #14 18575822
    khoam
    Level 42  
    MichałS wrote:
    NodeMCU is also firmware for ESP modules
    .
    Yes, I know :) This does not change the fact that the power consumption in sleep mode is a direct result of the hardware design of the NodeMCU and the ESP itself. So you cannot compare the two current draws i.e. the ESP8266 itself and the board that also contains the ESP8266. The document I attached earlier only applies to the ESP8266 chip.

    MichałS wrote:
    This firmware can be uploaded to a module e.g. ESP12 or ESP07 and write a program in Lua language (ala Phyton).
    .
    This firmware can be practically uploaded to any module with the ESP8266 chip on board.

    MichałS wrote:
    Maybe because the firmware runs several timers.
    .
    Only the RTC timer can run in ligh-sleep mode.
  • #15 18578096
    MichałS
    Level 35  
    So if the circuit is working and the difference between MODEM and LIGHT sleep is small then the contribution of LIGHT sleep is also small. I'll check how the module behaves with a simple program, where basically there will only be the activation of a given sleep mode, this will give an indication of what current consumption can be expected.

Topic summary

The discussion revolves around an ESP8266 ESP12-based data logger that experienced connectivity issues with a router after a period of normal operation. The device, running NodeMCU firmware and programmed in LUA, exhibited increased power consumption and failed to reconnect to WiFi despite the OLED display functioning correctly. Users speculated that the LUA file might have been corrupted, leading to the radio module's malfunction. The author confirmed that reprogramming the firmware and the init.lua file resolved the issue. Additionally, the conversation explored power-saving modes available in NodeMCU firmware, highlighting challenges in reducing power consumption while maintaining functionality, particularly in pulse counting applications.
Summary generated by the language model.
ADVERTISEMENT