Using Thinger + Wifi together with HX711 library soft resets ESP8266 (NodeMCU)


#1

I’m trying to get my NodeMCU v1.0 board to read from a load cell connected to a HX711 amplifier and send the data through Wifi to Thinger.io. I managed to make the readings from HX711, works perfectly. I also managed to send data to Thinger.io separately (ran the example without problems). However putting these together just doesn’t work for me, the board soft resets:

[NETWORK] Starting connection...
[NETWORK] Connecting to network xxxxxxx

Soft WDT reset

ctx: cont 
sp: 3fff0c60 end: 3fff0ec0 offset: 01b0

>>>stack>>>
3fff0e10:  4021e91f 00000001 3ffefe64 3ffefd48  
3fff0e20:  3fff18dc 40203d38 3ffefe64 40203f0c  
3fff0e30:  3ffe8e7f 3ffefcd8 3ffefe64 402023fc  
3fff0e40:  3ffe8e81 00000015 3ffefe64 402051c0  
3fff0e50:  00005173 3ffefcd8 3ffefe64 402051e4  
3fff0e60:  3fffdad0 3ffefcd8 3ffefe64 3ffefe90  
3fff0e70:  3fffdad0 00000001 3ffefcd8 402034b9  
3fff0e80:  feefeffe 3ffefcd8 3ffefe88 40203768  
3fff0e90:  3fffdad0 00000000 3ffefe88 402037e0  
3fff0ea0:  feefeffe feefeffe feefeffe 40205824  
3fff0eb0:  feefeffe feefeffe 3ffefea0 40100718  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(1,6)


 ets Jan  8 2013,rst cause:4, boot mode:(1,6)

wdt reset

And if I wrap the thing.handle(); with

  ESP.wdtDisable();
  thing.handle();
  ESP.wdtEnable(0);

Then I get hard reset after few seconds.

This is minimal code where I reproduce the issue:

#define _DEBUG_

#include <HX711.h>
#include <ESP8266WiFi.h>
#include <ThingerESP8266.h>

#define USERNAME "zink"
#define DEVICE_ID "xxxxxxxx"
#define DEVICE_CREDENTIAL "xxxxxxxxx"

#define SSID "xxxxx"
#define PASSWORD "xxxxxx"

ThingerESP8266 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);

HX711 scale;

void setup() {
  // put your setup code here, to run once:
  thing.add_wifi(SSID, PASSWORD);
  scale.begin(D6, D5);
}

void loop() {
  // put your main code here, to run repeatedly:
  thing.handle();
}

While this sketch works perfectly:

#define _DEBUG_

#include <ESP8266WiFi.h>
#include <ThingerESP8266.h>

#define USERNAME "zink"
#define DEVICE_ID "xxxxxx"
#define DEVICE_CREDENTIAL "xxxxxxx"

#define SSID "xxxxxxx"
#define PASSWORD "xxxxxxx"

ThingerESP8266 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);

void setup() {
  // put your setup code here, to run once:
  thing.add_wifi(SSID, PASSWORD);
}

void loop() {
  // put your main code here, to run repeatedly:
  thing.handle();
}

And also this one:

#include <HX711.h>

HX711 scale;

void setup() {
  // put your setup code here, to run once:
  scale.begin(D6, D5);
}

void loop() {
  // put your main code here, to run repeatedly:
}

But combining them triggers a soft reset. What am I doing wrong here?