Problem of Low Memory in esp32

Posted on
  • Hi All,

    i am transmitting BME680 data to my server using websocket . To doing this i am using espruino 1v99.
    I am facing issue of low memory every time and unable to write bme680 module code into esp32.
    All this things is working fine in espruino 1v96. but i cant use lower version because i have to use BLE feature too.

    My code :

    //ws.send("hello world");

    var wifi = require("Wifi");

    E.on('init',function() {
    var i2c = new I2C();

    var bme = require("BME680").connectI2C(i2c, {addr:0x77});
    var wifi = require('Wifi');

    wifi.connect("saurabh.verma", {password:"test1234"}, function(err){

    var host = "";
    var WebSocket = require("ws");
    var ws = new WebSocket(host,{
      path: '/',
      port: 8080, // default is 80
      protocol : "echo-protocol", // websocket protocol name (default is none)
      protocolVersion: 13, // websocket protocol version, default is 13
      origin: 'Espruino',
      keepAlive: 60,
      headers:{ some:'header', 'ultimate-question':42 } // websocket headers to be used e.g. for auth (default is none)
    ws.on('open', function() {
      console.log("Connected to server");
    setInterval(function() {
          var data = bme.get_sensor_data();
          var sensor = {};
          sensor.AQI = data;
       }, 100);


    Output :

    New interpreter error: LOW_MEMORY,MEMORY

    WARNING: --- gap_setScan 0
    WARNING: Scan stop failed
    WARNING: set rssi scan not implemeted yet
    WARNING: has central connection not implemented yet
    Compacting Flash...
    Calculating Size...
    Compressed 40000 bytes to 14608
    Uncaught Error: Function "connectI2C" not found!
    at line 5 col 31
    var bme = require("BME680").connectI2C(i2c, {addr:0x77});

    When i check a memory
    { "free": 2471, "usage": 29, "total": 2500, "history": 0,
    "gc": 0, "gctime": 1.799 }

    its half of previous

  • I need Ble too on same time .

  • See and try 'Save on send'.

  • Remove your last save() and turn on save on send in the ide as Gordon suggested.

    This then puts the code into flash memory, so it does not take up the ram space.

    You will then have plenty of free vars for you programme to work.

  • Thanks now its working :)

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Problem of Low Memory in esp32

Posted by Avatar for Saurabh @Saurabh