A.Quarter.To.Seven

Some of Stef's Stuff

On Bluetooth, Arduino and Android

by Stefano on 2015.05.03, no comments

Want create site? Find Free WordPress Themes and plugins.

Bluetooth modules come in many flavors of size, functionality and price and they make Android’s life easier when he wants to talk Arduino.Most of the cheapest modules on the market, despite the different branding, rely on the same chipset/design but eventually implement different firmware. This usually brings large gaps in the functions available on a unit like the ability to act as a master or slave only.

Great information about HC modules can be found on Byron’s Blog. A list of some of the variants is provided further below.

Tools baseline

All the tests have been performed with

  • MacBook Pro / OS X 10.10.2
  • Eclipse 4.5 / CDT / Eclipse Arduino Plugin / Arduino 1.5.8 / Java 7
  • Arduino Uno
  • Iteadstudio Bluetooth Bee

Bluetooth and Arduino

The BT module is connected to the Arduino board to receive power and to transfer serial data. Based on the specs of the module the proper voltage level need to be provided.

Is it mandatory to adapt 5V of the Arduino data singals to the 3.3v of the BT modules? In theory yes (see the thread) but connecting the two boards directly works as well.

The following snippets are used for communication to and from Arduino and the Bluetooth module. Note the AltSoftSerial library is used in place of the standard SoftwareSerial one due to this issue.

Bluetooth and Android

Once the communication between the BT module and Arduino has been consolidated, the previous code can be extended to allow for data received by the module to be sent down via the serial channel to control/interact with Arduino. The “remote controller” on that will be paired to our BT module is in this case a mobile phone running Android OS and the app ArduDroid by TechBitar (see the Instructables)




 

List of Bluetooth modules

CSR chipset

CSR – BC4_Blue2.0_Datasheet

HC-05 ()

The module supports operation as master and slave

Byron’s Blog – HC-05 firmware

HC-0305 serail module AT commamd set 201104 revised

HC-06 (Livor 1.5)

The module supports slave operations only

42Bots / HC-06 Bluetooth module datasheet and configuration with Arduino

HC-06 Datasheet

JY-MCU

Ecno92 / JY-MCU linvor AT Commands

Getting Started with Johnny Five and JY MCU Bluetooth Serial Port Module

Bluetooth Bee

BTBee (wiki) from IteadStudio features a HC-06 BlueTooth module (slave) and a pinout compatible with the XBee socket.

ITead Studio – BTBee HC-06 – Bluetooth to Serial Port Bee Module

BTBee Pro (wiki) from IteadStudio features a HC-05 BlueTooth module (master/slave) and a pinout compatible with the XBee socket.

BTBeepro_Datasheet

 

Bluetooth Bee (wiki) from DFRobots

 

Troubleshooting

SoftwareSerial doesn’t work at high rates

The response to a simple AT command contains fancy unexpected character, instead of the OK string. This is not a problem with the hardware and can happen when the standard Arduino SoftwareSerial library is used to communicate at speed equal or greater than 115200 baud.  The issue is detailed in the Arduino GitHub repository.

The solution is either to fall back to the hardware serial port or install the library AltSoftSerial. AltSoftSerial offers a robust alternative to the standard library when timing is a concern. However note that it’s in general less flexible being tied to specific RX/TX pins that can’t be changed and consumes timers.

Did you find apk for android? You can find new Free Android Games and apps.

Leave a Reply

Your email address will not be published. Required fields are marked *