Usage Example for Arduino-Android Communication

Last revision 2026/01/12

This guide offers a comprehensive example of establishing communication between an Arduino UNO and an Android device using a Bluetooth module, complete with hardware and software setup instructions, Bluetooth configuration, and sample code for transmitting and receiving data.

Hardware Preparation

Software Preparation

Note: If you cannot install, please click to check if your phone is on the list. If not, then sorry you cannot use this APP.You can directly install Google Play Store on your phone, then search this APP in it.

Bluetooth Module Configuration

  1. Both module and mobile phone can be used as master or slave.
  2. Set the baud rate of the module to 115200.
  3. Connection Mode: if the module cannnot be searched/connected by/with adapter or PC, this parameter needs to be configured:AT+CMODE=1.

Hardware Connection

  1. Mount the Bluetooth module on the IO shield → plug into UNO.
  2. Connect UNO to the PC via USB.

Connection Diagram 2

Operation Steps

  1. Install the Bluetooth Terminal app on the phone.

    Bluetooth Terminal Interface

  2. Pair the phone with the module:

    • Open phone Bluetooth settings → pair with the module (passkey: "1234").

    Pairing

    • In the app: "Connect a device-Secure" → select "Bluetooth_V3" (LINK-LED stays on if successful).

    Connecting

    Connection Done

  3. Burn test code to UNO (follow shield-specific instructions).

Note:

  • When burning the program to UNO, please select the serial port number of UNO instead of Bluetooth. The baud rate setting in the program should be consistent with that of your Bluetooth module.
  • If you are using the new I/O shield, please dial to prog before downloading codes, and then dial back to run when finished.
  • If you are using the old I/O shield, then please unplug the Bluetooth module when downloading codes. Replug it after the codes burning is done.
  • If the connection is lost during code downloading, please reconnect and try.

Sample Code

UNO as Transmitting End

void setup()
  {
    Serial.begin(115200);             //Init serial port and set baud rate to 115200
  }
  void loop()
  {
    Serial.print("Hello!");           //Serial port send out string 
     Serial.println(" DFRobot");      //Serial port send out string with carriage return
    delay(1000);                  //delay
  }

UNO as Receiving End

void setup(){
  Serial.begin(115200);   //Init serial port and set baud rate to 115200
}

void loop(){
  char val;
  val = Serial.read();     //Read serial port 
  if(val!=-1){
  Serial.print(val);  //Send out the received data again via serial port
  }
}

Running Results

  • Transmitting UNO → Receiving Phone: The app displays "Hello! DFRobot" periodically.
  • Transmitting Phone → Receiving UNO: Input text in the app → view received data in the Arduino serial monitor.

Result

Arduino serial monitor

Was this article helpful?

TOP