Connect Android Bluetooth SPP with Arduino

Bluetooth SPP

SPP(Serial Port Profile) is a Bluetooth communication that enables two devices to make serial communication (like RS-232 or UART).

IOS requires a special device that is certified to use the Bluetooth SPP.

On the other hand, Android can use the Bluetooth SPP without authentication.

The most popular device for Bluetooth SPP communication in Arduino is HC-06.

Configure HC-06

In order to use HC-06 correctly, you need to set important information by using AT Command. (Device name, baud rate, etc.)

You can find a lot of information about this when you search with Arduino HC-06 AT command.

Arduino connection

You can choose one of two ways to connect HC-06 to Arduino.

1. HardwareSerial

HardwareSerial is a way to connect to the TX/RX pin of the Arduino.

You can use a higher communication speed, such as 115200bps.

In this case, Streamclass in ArdunityApp must select Serial. (See detail)

2. SoftwareSerial

SoftwareSerial is a way to use the general pins of the Arduino board for UART communication.

It is very useful when you want to connect USB and Bluetooth at the same time.

SoftwareSerial recommends communicating at 9600 bps since high communication speeds are not available.

In this case, Streamclass in ArdunityApp must select SoftwareSerial. (See detail)

Android Manifest

Applying Android manifest is required to grant certain rights to the app by Bluetooth communication.

ARDUnity already includes an Android Manifest file to make this easier.

You need to copy the Android Manifest file to a specific location in the Unity Asset folder.

For detailed instructions on how to do this, please see the following links. (See detail)