Random characters transmitted from ESP8266 to Arduino Below is  the code for getting a value from Firebase and sending the received data to arduino for performing necessary action. 
The code here here sends a string "o" to arduino once

//uploaded to ESP8266
.
.
.
if (cu_st == "c")
  {
    sent = 0; 
  }
  cu_st = Firebase.getString("feeder");  
   if (cu_st == "o")
   {
    Serial.println("\t\trecd req to feed"); 
    if(sent == 0)
    {
      esp.print("o");
      sent =1; 
      cu_st = "c";    
      Serial.println("setting feeder to close in firebase");
      Firebase.setString("feeder" ,"c");

   }
.
.
.


Below is the code that gets the value, carries out necessary actions.

//uploaded to arduino 
.
.
.
void feed_cmd()
{
  while(ArduinoUno.available())
  {
    char valve = ArduinoUno.read();
    Serial.print("feeder cmd recd ");
    Serial.println(valve);
    if(valve=='o')
    {
       digitalWrite(led, HIGH);
       //feeder.write(0); //open position
       open_time = millis();
       feeder = 1 ;
       Serial.println("I am opening feeder");
    }
  }
}

void close_feed()
{

  if(feeder == 1)
  {
   close_time = millis();
   if(close_time - open_time &gt; 5000)
  {
    feeder = 0;
    digitalWrite(led , LOW);
    Serial.println("I am closing feeder") ;
  }
  }
}
.
.
.


My expectation/understanding is that:

feed_cmd() continually checks for any data 
As soon as it receives data LED turns ON and after 5 sec close_feed() turns OFF the LED.      

But what happens is that the while() in feed_cmd() continually executes showing some random data and also all of what I said above is also being carried out! (pic attached)

 



Why is there random serial data, even after sending only once and even after reading the sent data? 

Is it bad coding / hardware? 

Thanks for reading through and would really appreciate it if you can help me sort it out!!   

Edit I found this link smthg abt pin voltages  when I was looking for possible explanation for my code's behaviour, If somebody can simplify it and explain it, it'd be better !!
The baud rates, voltages, and timing all have to match up for serial communication to work right.

So, set both of your devices to the same baudrate (you specify the number in Serial.begin()), and ensure they're connected properly. (voltages match, TX to RX, and ground is connected)

You can just read/print the serial input to the arduino with something like Serial.print(softSerial.read()) in your code if you think you don't have serial wired up right.

Also in an unrelated issue; the esp32 spits out data on its main serial line at 115200 when it boots up which you can not disable. you can use the serial port afterwards though.

Here's a copy of what gets printed out on one of mine;

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac