Java – How to use serial communication (port) via Android Bluetooth to send data

androidarduinobluetoothjavaserial-port

How can I use serial communication (port) via Bluetooth to send data?

I need to send serial data through an Android device to a Bluetooth model (BlueSMiRF Silver) (that is connected to an Arduino board).

I was literally sitting for three day trying to understand how to do that…

Best Answer

Would be nice to have more details about what you tried and where you are stuck.

On the Android side the first step is to pair with the BlueSMiRF module. You should be able to discover the BlueSMiRF and pair from the "Bluetooth Settings" on android. You might have to put the BlueSMiRF module in discoverable mode (and you can set the a pin code for it).

Once paired, to be able to send and receive data you need to connect using a Bluetooth socket. To communicate with the BlueSMiRF module you need to use the Serial Port Profile (SPP) and create and RFCOMM socket. For an example you can have a look at this post.

Related Topic