How to set Android Bluetooth Baud Rate to 19200 programatically?

Triki picture Triki · Apr 30, 2013 · Viewed 12.9k times · Source

I'm new to Android and im developping an application to talk with an Actuator via Bluetooth. When trying divers Codes i faced a problem with the Baudrate as the Actuator Bluetooth BaudRate is 19200 while the Android Tablet is 9600. Can anyone tell how to change the Baudrate in my Application. By the way i downloaded an Application from the Play Store named BlueTooth SPP and i tried to communicate and send packets throw it and it Worked.I really need to know the Secret behind it. Thanks

Answer

VectorVictor picture VectorVictor · Nov 29, 2016

Android does not set the baudrate, the default rate is set by the Actuator. You may need to find a way to set this on the actuator. I had a similar problem on the HC-06 where I changed the baud rate in my code (from 9600 to 115200), but this did not change the default baud rate, which meant android would only read the device at 9600.

I changed the default baud rate using the instructions here:

https://www.squirrel-labs.net/blog/hc-06-bluetooth-module-changing-baudrate-etc/#page=1

and also here:

http://www.instructables.com/id/AT-command-mode-of-HC-05-Bluetooth-module/step5/AT-commands/

Finally, if you are using an arduino and you do not have a USB-FTDI, you can use this page:

https://oscarliang.com/use-arduino-as-usb-serial-adapter-converter/