Serial communication from Arduino to ESP8266 NodeMCU works, but from NodeMCU to Arduino isn't working My circuit connection is like: (I am following this tutorial)


Code uploaded to Arduino:

#include &lt;SoftwareSerial.h&gt;
#include &lt;ArduinoJson.h&gt;
SoftwareSerial s(5,6);

void setup() {
  s.begin(9600);
}

void loop() {
  StaticJsonBuffer&lt;1000&gt; jsonBuffer;
  JsonObject&amp; root = jsonBuffer.createObject();
  root["data1"] = 100;
  root["data2"] = 200;
  if(s.available()&gt;0){
    root.printTo(s);
  }
}


Code uploaded to NodeMCU:

#include &lt;SoftwareSerial.h&gt;
int D5 = 14, D6 = 12;
SoftwareSerial s(D6,D5);
#include &lt;ArduinoJson.h&gt;

void setup() {
  // Initialize Serial port
  Serial.begin(9600);
  s.begin(9600);
  while (!Serial) continue;
}

void loop() {
 StaticJsonBuffer&lt;1000&gt; jsonBuffer;
 JsonObject&amp; root = jsonBuffer.parseObject(s);
 if (root == JsonObject::invalid())
   return;

 Serial.println("JSON received and parsed");
 root.prettyPrintTo(Serial);
 Serial.print("Data 1 ");
 Serial.println("");
 int data1=root["data1"];
 Serial.print(data1);
 Serial.print("   Data 2 ");
 int data2=root["data2"];
 Serial.print(data2);
 Serial.println("");
 Serial.println("---------------------xxxxx--------------------");
}


Arduino sends JSON data and NodeMCU parses it as expected. 

--------Till this everything is fine. ---------

But my requirement is vice versa. When I create JSON object in nodeMcu and try to parse in arduino, JSON not received.

This time I wrote this code in nodeMcu:

#include &lt;SoftwareSerial.h&gt;
#include &lt;ArduinoJson.h&gt;

int D5 = 14, D6 = 12;
SoftwareSerial s(D6,D5);

void setup() {
  Serial.begin(9600);
  s.begin(9600);
  while (!Serial) continue;
}

void loop() {
 StaticJsonBuffer&lt;1000&gt; jsonBuffer;
 JsonObject&amp; root = jsonBuffer.createObject();
 root["data1"] = 100;
 root["data2"] = 200;
 if(s.available()&gt;0){
   root.printTo(s);
 } 
}


And code in Arduino:

#include &lt;SoftwareSerial.h&gt;
#include &lt;ArduinoJson.h&gt;
SoftwareSerial s(5,6);

void setup() {
  s.begin(9600);
  Serial.begin(9600);
}

void loop() {
  StaticJsonBuffer&lt;1000&gt; jsonBuffer;
  JsonObject&amp; root = jsonBuffer.parseObject(s);
  if (root == JsonObject::invalid())
    return;

  Serial.println("JSON received and parsed");
  Serial.print("Data 1 : ");
  int data1=root["data1"];
  Serial.println(data1);
  Serial.print("Data 2 : ");
  int data2=root["data2"];
  Serial.println(data2);
  Serial.println("---------------------xxxxx--------------------");
 }


This code doesn't work. I don't receive anything in serial monitor of arduino.
The circuit connection remains the same as before.

Anymore information should I provide ? What modification do I need?
The problem may stem from Arudino boards being 5v logic pins while ESP boards are 3.3v logic pins.  3.3v high might not be enough for Arduino to see the data.