0

I am unable to get the output on NODEMCU serial. NODEMCU is connected with Arduino Uno, and Uno is connected with M6E Nano RFID reader. Currently I am unable to understand that am i doing any mistake. Please let me know if any other thing you require.

NodeMCU and M6E Nano RFID reader pin configuration with Arduino Uno

NodeMCU         UNO         
Vin             Vin
GND             GND         
D2              2
D3              3

Code for Arduino Uno+M6E Nano RFID Reader

#include <SoftwareSerial.h> 
SoftwareSerial softSerial(2, 3); 

#include "SparkFun_UHF_RFID_Reader.h"
RFID nano;

void setup()
{
  Serial.begin(115200);
  softSerial.begin(115200);

  while (!Serial);
  Serial.println();
  Serial.println("Initializing...");
}

void loop()
{
  byte response;
  byte myTID[20]; //TIDs are 20 bytes
  char str[sizeof(myTID) * 2 + 1]; 
  const char* hex = "0123456789ABCDEF";

  //Read unique ID of tag
  response = nano.readTID(myTID, sizeof(myTID));
  if (response == RESPONSE_SUCCESS)
  {
    for (int i = 0; i < sizeof(myTID); i++)
    {
      str[i * 2] = hex[(myTID[i] >> 4)];
      str[i * 2 + 1] = hex[(myTID[i] & 0x0F)];    
      }
    str[sizeof(str)] = 0;
    Serial.println(str);
   }
  else
    Serial.println("Failed read");
}

Code for NODEMCU

#include <ESP8266WiFi.h>
#include <SoftwareSerial.h>
SoftwareSerial NodeMCU(D3,D2);

void setup()
{
  Serial.begin(9600);
  NodeMCU.begin(4800);
  pinMode(D2,OUTPUT);
  pinMode(D3,INPUT);
}

void loop(){
  String str = 0;        // stores received byte

  if(NodeMCU.available())
  {
    // get byte from USB serial port
    str = Serial.read();
    NodeMCU.write(str);
  }
delay(30);
}

Unable to find where i am doing the mistake! Thanks in advance

1 Answer 1

0
  1. You have not the same baud rate on both ends.
  2. SoftwareSerial is not reliable at 115200. use 9600 baud
  3. SoftwareSerial on esp8266 is not reliable.

remove Uno from the project and connect the reader to NodeMcu

3
  • 1, 2 Worked on the same baud rate but still does not getting any output! 3. what should I have to do! that esp8266 don't fight for interrupts with WiFi.
    – Eza
    Nov 6, 2018 at 6:18
  • I just already tried(remove Uno from project) but still not getting any output! Any idea?
    – Eza
    Nov 6, 2018 at 6:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.