Blynk+esp32 serial monitor

hi everyone I need your help with my project.
I have esp32 connected with ORP sensor and I did the coding after I finished compiling the code and I press on the monitor serial in Arduino it shows error in this message ((Board at COM4 is not available)) also in Blynk show that the ORP sensor not online thank you

//pH and ORP variables
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#define samplingInterval 10       //sample values every 10 milliseconds
#define ORP_Pin 1                 //orp meter output,connect to Arduino controller ADC pin

#define ORP_OFFSET 98             //zero drift voltage

#define arrayLenth 40             //times of collection

char auth[] = "xxxxxxxxxxxxxxxxxxxxxxxxx";
char ssid[] = "Mashi";
char pass[] = "mashithah";

double ORP_Value;

int ORP_Array[arrayLenth];
int ORP_ArrayIndex=0;
int data_point_counter=0;

//general variables
#define voltage 3.30              //system voltage
#define printInterval 800       //write values every 800 milliseconds

//general formula returning average
double avergearray(int* arr, int number){
        int i;
        int max,min;
        double avg;
        long amount=0;
        if(number<=0) {
  printf("Error number for the array average!/n");
 return 0;
 if(number<5) { //less than 5, calculated directly statistics
 for(i=0; i<number; i++) 
 avg = amount/number;
return avg;
                if(arr[0]<arr[1]) {
                        min = arr[0]; max=arr[1];
                        min=arr[1]; max=arr[0];
                for(i=2; i<number; i++) {
                        if(arr[i]<min) {
                        }else {
 if(arr[i]>max) {
 avg = (double)amount/(number-2);
 return avg;

void setup()
  Serial.println("Connecting to ");
  WiFi.begin(ssid, pass);
  int wifi_ctr = 0;
  while (WiFi.status() != WL_CONNECTED)
 Serial.println("WiFi connected"); 
  Blynk.begin(auth, ssid, pass);

void loop()
static unsigned long GENERAL_printTime = millis();
ORP_Value=((30*(double)voltage*1000)-(75*avergearray(ORP_Array, arrayLenth)*voltage*1000/1024))/75-ORP_OFFSET;
 if(millis() - GENERAL_printTime >= printInterval) //print to serial monitor and write to file
Serial.print(" sec -- ");
 Serial.print("ORP value: ");
  Serial.print(" mV -- ");



How can you do coding after finishing compiling?

coding means writing sourcecode. Compiling means translate sourcecode into machinecode.

If you have changed the sourcecode after compiling this has no effect on the program yu have flashed into the ESP32.

But I guess that you mean something different. I guess english is not your native language. What is your native language?

It does NOT help at all if you write in short and very poor english.

Write a much more detailed description in your native language and let do google translate the translation into english.

best regards Stefan

sorry for my English
what I mean is when I translate the code to esp32 it showed it is uploaded correctly but when I press the serial monitoring button it shows that Board at COM4 is not available

as you can see from the photo the second line was after compiling.
and the third line show when I press the serial monitoring button
thank i hope it is clear now

from the IDE, under Tools->Port make sure you select the correct (COM) port. (think about it)

that's a somehow nice thing. But just saying "sorry" does not help to make it easier to understand what your problem is.

Somehow you are a lazy guy. You are the one who wants help
so make it easy to help you by helping your potential helpers.

Next time shoot the picture from a perpendicular view of the screen.
Check the picture yourself if it is easy to read. If it is not easy to read
take a new picture.

What you call "translate the code" is a two stage-process

1 stage: compiling the source-code into a binary
2 stage: transferring the binary data into the flash-memory of the ESP32

this is called upload. Please call it upload. This is the common term for it.

Click into the black part of the Arduino-IDE that shows the messages
Hard resetting via RTS pin...
Board at COM4 is not available
then press Ctrl-A, Ctrl-C to copy the complete content of the Arduino-IDE into the clipboard

change to your browser with the Arduino-Forum
click reply to start a new posting

Then click on the <|> -Symbol to create a code-section
then press Ctrl-V to insert the clipboard-content

Another try is to open the serial monitor before you start uploading
with serial monitor opened click on upload
The serial monitor will be grey during the compiling and the upload.

best regards Stefan

<Arduino: 1.8.13 (Windows 10), Board: "ESP32 Dev Module, Disabled, Default 4MB with ffat (1.2MB APP/1.5MB FATFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None"

Sketch uses 667158 bytes (50%) of program storage space. Maximum is 1310720 bytes.
Global variables use 38308 bytes (11%) of dynamic memory, leaving 289372 bytes for local variables. Maximum is 327680 bytes. v3.0-dev
Serial port COM4
Chip is ESP32-D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
WARNING: Detected crystal freq 41.01MHz is quite different to normalized freq 40MHz. Unsupported crystal in use?
Crystal is 40MHz
MAC: 9c:9c:1f:e8:d9:98
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 4096.0 kbit/s)...
Hash of data verified.
Compressed 18656 bytes to 12053...
Writing at 0x00001000... (100 %)
Wrote 18656 bytes (12053 compressed) at 0x00001000 in 0.2 seconds (effective 950.6 kbit/s)...
Hash of data verified.
Compressed 667280 bytes to 402067...
Writing at 0x00010000... (4 %)
Writing at 0x00014000... (8 %)
Writing at 0x00018000... (12 %)
Writing at 0x0001c000... (16 %)
Writing at 0x00020000... (20 %)
Writing at 0x00024000... (24 %)
Writing at 0x00028000... (28 %)
Writing at 0x0002c000... (32 %)
Writing at 0x00030000... (36 %)
Writing at 0x00034000... (40 %)
Writing at 0x00038000... (44 %)
Writing at 0x0003c000... (48 %)
Writing at 0x00040000... (52 %)
Writing at 0x00044000... (56 %)
Writing at 0x00048000... (60 %)
Writing at 0x0004c000... (64 %)
Writing at 0x00050000... (68 %)
Writing at 0x00054000... (72 %)
Writing at 0x00058000... (76 %)
Writing at 0x0005c000... (80 %)
Writing at 0x00060000... (84 %)
Writing at 0x00064000... (88 %)
Writing at 0x00068000... (92 %)
Writing at 0x0006c000... (96 %)
Writing at 0x00070000... (100 %)
Wrote 667280 bytes (402067 compressed) at 0x00010000 in 6.4 seconds (effective 835.5 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 127...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (127 compressed) at 0x00008000 in 0.0 seconds (effective 792.8 kbit/s)...
Hash of data verified.

Hard resetting via RTS pin...
Board at COM4 is not available

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.>

OK so this clears a few things. COM-Port 4 is the right comport because uploading itself works.

What is strange is the fact that the upload-tool detects a crystal with 41,01 MHz. while it should be 40,00 MHz.

Are you using some DIY ESP32-module?

Can you post a picture of the upperside and the lowerside of your ESP32-board?

Here is a demo-code that makes the onboard-LED blink and send "Hello World" once per second to the serial monitor
Can you test if your ESP32-board is able to connect to the comport if you upload this democode?

void PrintFileNameDateTime() {
  Serial.println("Code running comes from file ");
  Serial.print("  compiled ");
  Serial.print(" ");

boolean TimePeriodIsOver (unsigned long &periodStartTime, unsigned long TimePeriod) {
  unsigned long currentMillis  = millis();  
  if ( currentMillis - periodStartTime >= TimePeriod )
    periodStartTime = currentMillis; // set new expireTime
    return true;                // more time than TimePeriod) has elapsed since last time if-condition was true
  else return false;            // not expired

unsigned long MyTestTimer = 0;                   // variables MUST be of type unsigned long
const byte    OnBoard_LED = 2;

void BlinkHeartBeatLED(int IO_Pin, int BlinkPeriod) {
  static unsigned long MyBlinkTimer;
  pinMode(IO_Pin, OUTPUT);
  if ( TimePeriodIsOver(MyBlinkTimer,BlinkPeriod) ) {
    digitalWrite(IO_Pin,!digitalRead(IO_Pin) ); 

void setup() {

void loop() {

  if ( TimePeriodIsOver(MyTestTimer,1000) ) {
    Serial.println("Hello World");

If there is an LED connected to GPIO2 this LED will blink at a frequency of 5 Hz.

What happends if you unplug the ESP32-board.
Plug-it in new select tools comport 4 and then open the serial monitor?

best regards Stefan