Where to buy a serial Bluetooth module
Back in the pre Android 1.6 days we had to mod our android phones to get them communicating with the great Arduino platform. You had to root it and if you were lucky someone already compiled a serial output enabled rom for your device. Otherwise you even had to get into ROM building, find the right drivers and so on. And it didn’t stop there since you still had to get the serial connection out of that micro USB port. Sparkfun used to sell (maybe they still do?) great breakout boards for that.
Today we have android 1.6 with bluetooth support and many bluetooth adapters available for the Arduino platform. You can buy yourself a nice bluetooth shield that you can just pop on or a much cheaper bluetooth serial adapter so you could connect the TX and RX channels yourself. That last option is what I’m going to explain now.
You’ll need to get yourself a bluetooth to serial adapter that is reported to work with the Arduino platform. They run very cheap from china (check ebay or goodluckbuy.com).
Setting up your serial bluetooth module
You probably want to update the settings of the module. By default it comes with a pin 1234, named Linvor and on baud rate 9600. Follow these steps to update these settings.
- Before connecting this BT adapter you’ll have to set the desired baud rate using a FTDI programmer or this CP2102 based USB to serial connector. It’s the same thing you would use to program a Arduino mini pro for instance. You can also use an Arduino board with USB for this like the Uno or Duemilanove. Connect the USB VCC and GND wires with the corresponding BT VCC and GND. For TX and RX you need to switch the channels between BT and USB.
- Now use your favorite serial port terminal to connect to (FTDI) USB. The AT commands must be copy and pasted to send to the device because it constantly polls and if you can’t type fast enough to complete a command before it reads it in.
- Send the “AT” command. BT responds with “OK”
- Send “AT+NAMENameYouWant” to change the default from Linvor.
- Send “AT+BAUD8” to change the Baud rate to 115200. Default baud rate is 9600. For android applications like the amarino project and multiwii tool baud rate has to be set to 115200 instead. The AT+BAUDx command accepts x from 1 to 8 representing baud rates from 1200 to 115200.
Serial Bluetooth module project ideas
Once we have that connection you can either communicate from a computer with bluetooth or from your Android device. For the last option a project is available making it all very easy, almost plug and play (with plug since it’s wireless :-)). Check all the details of the Amarino project here.
Another great option is to use it together with the Android MultiWiiCopter Controller App so you can fetch live data from your flying multiwiicopter!
Some things to remember when working with your Arduino:
- You’ll have to undo the RX and TX connection of the BT adapter when programming your arduino over USB. Otherwise you get errors and programming will eventually fail.
- Not all BT adapters work with Arduino, the cheapest one I could find is listed above. Google before buying something else.
- You can program other Arduino’s or the BT adapter using your Arduino UNO. Check previous posts on this blog on how to do this.
- You can also update the pin using the AT commands: execute AT+PINabcd with abcd being the new pincode you want.
- In OS X you can use the screen command to get a serial connection. Check this tutorial on how to get a serial emulator set up on OS X.
More information (use google translate) about this cheap bluetooth to serial adapter: http://item.taobao.com/item.htm?id=9812432239
Another page with all the info you need for this module: http://www.dwengo.org/bluetooth.
2 Comments on “Arduino Android bluetooth connection”
Having one of bluetooth modules like this you can control your Arduino board with ArduinoCommander app – https://market.android.com/details?id=name.antonsmirnov.android.arduinocommander
@Anton: Thanks for your feedback. Good to get some alternatives to check out.