Menu Close

ESP-32 – Communication through Serial monitor using Mobile bluetooth

This is a  tutorial of ESP32. In this tutorial of Robo India is explaining.How to communicate the serial monitor through  Mobile bluetooth.

Detailed Tutorial

1. Introduction:

ESP32 is a series of low cost, low power system on a chip microcontroller with integrated Wi-Fi & dual-mode Bluetooth. It is designed to achieve the best power and RF performance, robustness, versatility, and reliability in a wide variety of applications such as voice encoding, music streaming and MP3 decoding

ESP32 integrates Bluetooth link controller and Bluetooth baseband, which carry out the baseband protocols and other low-level link routines, such as modulation/demodulation, packets processing, bit stream processing, frequency hopping, etc.

2. Prerequisites:

You can use this Tutorial.In this tutorial the Robo India explain how to install the esp32 in Ardunio IDE

1. ESP Introduction 

3.How to connect the ESP32 with Mobile Bluetooth

 3.1) Open Arduino IDE >Go to tools > Board ESP32 Dev Module and Select port

3.2) Than copy and paste the code in Arduino IDE. Compile and upload the code

 3.3) Open the serial monitor and select the right braud which you mention in your code.

 3.4) Than open your bluetooth in mobile phone. Connect and pair the ESP32 devices

 4. Programme

You may download this code (Arduino Code) from here.


// Sketch shows how to use SimpleBLE to advertise the name of the device and change it on the press of a button
// Useful if you want to advertise some sort of message
// Button is attached between GPIO 0 and GND, and the device name changes each time the button is pressed

#include "SimpleBLE.h"
SimpleBLE ble;

void onButton(){
    String out = "Bluetooth ";
    out += String(millis() / 1000);
    Serial.println(out);
    ble.begin(out);
}

void setup() {
    Serial.begin(115200);
    Serial.setDebugOutput(true);
    pinMode(0, INPUT_PULLUP);
    Serial.print("ESP32 SDK: ");
    Serial.println(ESP.getSdkVersion());
    ble.begin("Hello world");
    Serial.println("Hello world");
}

void loop() {
    static uint8_t lastPinState = 1;
    uint8_t pinState = digitalRead(0);
    if(!pinState && lastPinState){
        onButton();
    }
    lastPinState = pinState;
    while(Serial.available()) Serial.write(Serial.read());
}

5. Output

If you have any query please write us at support@roboindia.com

Thanks and Regards
Content Development Team 
Robo India
https://roboindia.com

Leave a Reply