MCU cannot reconnect to thingerio after restarted. (digital input issue)

Hello all,

i’m getting issue regarding device reconnect to thinger platform.
Here’s the details :

  • Module NodeMCU v2
  • Digital input for 2 sensors : motion sensor and reed switch (Connected to D3 & D6 pin)
  • Using 5VDC power supply for NodeMCU
  • Using our own thingerio VPS
  • Wifi modem is stable

Everything is looks OK when device is connected to internet and the dashboard function of thingerio works fine. When electricity is going Off and become ON again, the device is ON but cannot connected to the internet and thinger server. But when i dismantle/unwire both sensor for D3 & D6 pin and tried to restart the device (unplug and plug again the 5V adaptor), it can connected to the thinger server automatically.

This is sneak peek of the code :


void setup() {
//Set output mode for all IO pins
pinMode(output1, OUTPUT);
pinMode(output2, OUTPUT);
pinMode(reedSwitch, INPUT_PULLUP);
pinMode(switch1, INPUT);
pinMode(switch2, INPUT);
pinMode(detectPin, INPUT);
thing.add_wifi(SSID, SSID_PASSWORD);


thing[“sakelar1”]<< digitalPin(5);
thing[“sakelar2”]<< digitalPin(15);
thing[“suhu”] >> outputValue(dht.readTemperature());
thing[“kelembaban”] >> outputValue(dht.readHumidity());
// define the resource with temperature and humidity
thing[“data_suhu”] >> [](pson& out){
out[“suhu”] = dht.readTemperature();
thing[“data_kelembaban”] >> [](pson& out){
out[“kelembaban”] = dht.readHumidity();
thing[“doorStatus”] >> [](pson& out){
out=doorState==0 ? “Tertutup”:“Terbuka”;

thing[“motionDetection”]>>[](pson& out){
out=motionState==0? “Gerakan terdeteksi!”:“Aman”;

void loop() {

val = digitalRead(switch1);
if (val == HIGH && pusherIn)
digitalRead(15) ? digitalWrite(15, LOW) : digitalWrite(15, HIGH);
pusherIn=0; // need to declare this boolean variable to ensure the routine runs once
else if (val==LOW && !pusherIn)
pusherIn=1; // ready for next push

val2 = digitalRead(switch2);
if (val2 == HIGH && pusherIn)
digitalRead(5) ? digitalWrite(5, LOW) : digitalWrite(5, HIGH);
pusherIn=0; // need to declare this boolean variable to ensure the routine runs once
else if (val2==LOW && !pusherIn)
pusherIn=1; // ready for next push


void doorDetection() {
doorState = digitalRead(reedSwitch);
//door is going to close
doorState = 0;“doorStatus”);

//door is going to open
else {



void motionDetection()
motionState = digitalRead(detectPin);
motionState = 1;“motionDetection”);


Does anybody experienced the same issue?
Any help is appreciated.


I think it can be a situation with wifi library, I mean, that maybe the microcontroller can connect to wifi, but if there is no internet, it can’t reach the platform and keeps stuck in that state, something similar happened to me, but just resseting the device it gets connected and working, without dissasembling anything.

But when i didn’t connect anything on the input port, the device can be automatically reconnected to network and thinger after power restarted. This is strange behaviour.

And what does the debug say? #define _DEBUG_

Because I still believe that it can be a casualitie, I don’t believe that the thinger process depends on a particular digital pin.

Another test that you can do is to change those particular pins, maybe it is not related with a thinger bug or condition but a microcontroller itself characteristic.

Hi ega,

i can’t see anything in debug Serial Monitor, just blank screen.
When the device is working normally, it can display the thinger communication is OK.

I’ve tried to update the Wifi library and thingerio library to the latest version, and still can’t solve the issue.

That’s so weird, I haven’t read any limitation about the usage of that particular pins, Can you try another board? or try another pins?

Hi Ega,

After do some research from ESP8266 datasheet and the internet, Pin D3 on NodeMCU is associated with GPIO 0 and cannot be connected to input pull-down (GND) when the microcontroller is booting. This pin should be configured input pull-up (VCC).

Oh I see, well very cool you found the root of the issue!