Can I send serial monitor data over bluetooth with ESP32?

I'm using an ESP32 mounted in an inconvenient location to push the boot loader button every time I upload new code. I tried this approach: [SOLVED] Failed to connect to ESP32: Timed out waiting for packet header | Random Nerd Tutorials
Although it worked, it also causes boot problems.

I can upload OTA but still need the serial monitor for debugging. Is it possible to use the Bluetooth built into the ESP32 to send serial data to my computer? I'm running a Mac so I have all kinds of unix tools available.

You cannot use WiFi and native Bluetooth at the same time on an ESP32. You could use an external Bluetooth module as you would on an AVR based Arduino

For Mac or linux users (don't know about windows), I found a better solution for uploading code and reading serial data for microcontrollers that are difficult to access but you have USB connectivity.

  1. In the Arduino app, select the WiFi port. This disables the serial connection.
  2. With your USB cable connected, open the terminal app.
  3. Type: ls /dev/tty.*
  4. Look for a usbserial entry something like: /dev/tty.usbserial-0001
  5. Type: screen /dev/tty.usbserial-0001 115200
    The last parameter must match your Serial.begin() speed.
  6. To exit, ctl-a, ctl-k

It seems you can use Bluetooth and WiFi at the same time,
where did you learn you can not use "native" Bluetooth, and what does that native mean?

I am not sure where I gleaned this information from and I may well be remembering it wrongly and/or conflating it with the fact that you cannot use ESP-Now and WiFi at the same time

If I get a chance I will try it

To me "native" Bluetooth means using the Bluetooth capability of the ESP32 itself rather than an external Bluetooth device

Wifi STA combined with internal Bluetooth was one of the power consumption test in the linked video.
I have never really worked with Bluetooth and used only quite basic stuff with the ESP32.

For completeness I have tested concurrent use of WiFi and Bluetooth on the ESP32 and it works

An example sketch

#include <WiFi.h>
#include <WiFiClient.h>
#include <WebServer.h>
#include <BluetoothSerial.h>
BluetoothSerial SerialBT;

const char *ssid = "PLUSNET_Moonraker";
const char *password = "WIBBLE999";

WebServer server(80);

void handleRoot()
{
  static byte count = 0;
  char temp[200];
  //  int sec = millis() / 1000;
  //  int min = sec / 60;
  //  int hr = min / 60;
  int size = snprintf(temp, 400, "<html>\
  <head>\
  <meta http-equiv='refresh' content='5'/> <title>ESP32 WiFi & Bluetooth</title>\
  </head>\
  <body>\
  <p>Count : %04d</p>\
  </body>\
</html>", count);
  Serial.println(size);
  server.send(200, "text/html", temp);

  SerialBT.println(count);
  count++;
}

void setup(void)
{
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(F("."));
  }
  Serial.println("");
  Serial.print(F("Connected to "));
  Serial.println(ssid);
  Serial.print(F("IP address: "));
  Serial.println(WiFi.localIP());
  server.on("/", handleRoot);
  server.begin();
  Serial.println("HTTP server started");
  SerialBT.begin("Web and BT test");
}

void loop(void)
{
  server.handleClient();
}

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.