OTA serial monitor

if you need to see your serial data in OTA mode, you need Putty https://www.putty.org/ and this sketch. :wink:

Don’t forget to replace all your Serial.Print with SerialOTA.print

 /***************  Telnet *********************/
WiFiServer TelnetServer(23); // Telnet Server Declaration port 23
WiFiClient SerialOTA;     // Telnet Client Declaration 
bool haveClient = false; client detection flag


/*************** Setup *********************/
void setup()
{
//after OTA setup

timer.setInterval(1000L, UpTime);

/*************** Telnet  *********************/
  TelnetServer.begin();
  TelnetServer.setNoDelay(true);
//end setup

void loop() {
  timer.run();
  Blynk.run();
  ArduinoOTA.handle();  // For OTA

// Handle new/disconnecting clients.
  if (!haveClient) {
    // Check for new client connections.
    SerialOTA = TelnetServer.available();
    if (SerialOTA) {
      haveClient = true;
      Blynk.setProperty(Vx, "color", BLYNK_GREEN); //TELNET LED ON
    }
  } else if (!SerialOTA.connected()) {
    // The current client has been disconnected.
    SerialOTA.stop();
    SerialOTA = WiFiClient();
    haveClient = false;
    Blynk.setProperty(Vx, "color", DARK_RED);  //TELNET LED OFF
  }
}


void UpTime() { // to print something 

SerialOTA.print("time: ");
  SerialOTA.println(millis());
}

Video_00390 Video_00389

3 Likes

Hey Alexis, do you find that this works well?
I tried this approach a while ago, and didn’t find that it worked very well for me. From memory, I had to keep restarting the ESP when the PC went to sleep.

Pete.

1 Like

hey Pete,

it runs fine for me.
no need to reset my nodmcu.
I also downloaded the Android version of putty.

1 Like

Don’t use the “A” word!!!
:skull_and_crossbones: :skull_and_crossbones: :skull_and_crossbones:

Pete.

1 Like

can I use Ondroid instead ? :rofl:

1 Like

Apple :stuck_out_tongue_winking_eye:

4 Likes

What did you use for the Putty settings? I can’t see the uptime prints on putty.

I set the port to 23. I also entered the IP address of my device and selected Telnet for connection type.

Am I missing something?

Did you try starting your PuTTY session, then rebooting your ESP?
I seem to recall that this was one of the issues that I was having.

Personally, I think there’s a much better solution, which is to put a jumper across the Tx and Rx pins of your ESP then a bit of code to redirect the serial output to the Blynk terminal widget.

See this thread for more info:

It’s the Send_Serial() function that does most of the work.

Pete.

You are right Peter,
If you close the session, ESP32 stop !
Better use IDE Serial monitor.
BTW, with Telnet there is no problem at all.

Thanks Pete. I had already tried restarting the esp without success. Unfortunately that isn’t an option with my hardware setup :weary:. I’m using a esp-01 and due to the limited pins I’m forced to use RX as a digital out.

I still can’t see anything come thru on Putty. I tried disabling windows firewall. Still no luck. Do I need any special router settings to make the telnet session work?

My code is relatively long so maybe I’ll try a bare bones sketch today to see if I can get that working. I also have a WeMos D1 Mini Pro I can try it on.

Update:

I got it working with a barebones sketch on my WeMos D1 mini pro. Still no luck with the same sketch uploaded to the esp-01 :cry: