Wednesday, May 19, 2010
Android & Bluetooth module.
Android phone is becoming more popular, most of the android phones equipped with Bluetooth. Just wonder how we can make use of the powerful android phone to interact with MCU like Atmel AVR, PIC or even Arduino. I think that more interesting projects can be done with the bluetooth connectivity to Android:)
After some studies, I found out that in Android 2.0, Google enhanced the Bluetooth API and come with an Bluetooth Chat sample for communicating devices with RFCOMM (SPP profile). So I did a try and it really works very well!
Let's try it out! The Bluetooth module that I used is a very tiny one with PCB antenna, it can control device over 10 meters at least, good enough for small project:) It is programmed to use as RFCOMM, so it can act as a wireless UART, good fit for all the MCU! With only 4 wires, 3.3v/Gnd/Tx/Rx, no programming needed, you can directly connect the module to your MCU UART.
Here is my demonstration video:
For the bluetooth sample code, you can find it in the Android SDK or here.
Subscribe to:
Post Comments (Atom)
42 comments:
What is the name of this Bluetooth module?
I don't know, just a CSR chipset module.
I think I found it at http://www.mdfly.com/index.php?main_page=product_info&products_id=63 seems to look like it. Good to know its working with Android :-)
Thanks so much. I've been looking for an affordable bluetooth module and this looks like it will work.
One of my last projects was a 4x4 differential drone, built from scratch, remotely controlled via Bluetooth using an Android smartphone and a bluetooth module like the one in this article.
Schematics / demo video here: http://www.pocketmagic.net/?p=1398
Besides ultrasonic sensors, the robot is about to be equipped with a homemade geiger counter sensor to detect "exotic" environment parameters
like the dangerous ionizing radiation. There are quite a few possibilities since the robot has an ATmega microcontroller that can easily
support additional sensors.
The data is sent back to the Android device, via bluetooth.
Hey Radu, that's super cool!
That demo was really interesting. I think I spotted the bluetooth module at http://www.zbaus.com/products.php?id=50
Bitartist, did you change anything in BluetoothChat to get it connect to the BT module? I tried and could pair, but when trying to connect I got "couldn't connect" message.
According to the original BTChat code it requires the other part to register an SDP server with a long UUID. It would be fine if you could publish the few lines that did the conection. I have a really cool project waiting for a BT connection in my lab.
Yes, using BluetoothChat example, you may need to change the UUID in order to pair with this module. Do you take a look of the source code here:
http://www.pocketmagic.net/?p=1398
I don't have the code on my laptop now, let me know if you still need help, I can post my UUID here.
Hi again,
I got it working with only one change. In the file BluetoothChatService.java I changed from:
private static final UUID MY_UUID = UUID.fromString("fa87c0d0-afac-11de-8a39-0800200c9a66");
to:
private static final UUID MY_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
Then I connected my phone and used Run As Android Application.
Than you for telling us about this good and cheap module!
Regards,
Dag
i want to send some character from pc to android phone. do you have any source code of bluetooth chat for pc? , while android use bluetoothchatsample from android sdk
does uuid need to be changed from its original value?
right, You can check the UUID as mentioned in the comment from Dag!
do you know how to sent command from MCU to bluetooth chipset for sending or receiving data? does MCU support AT command or something?
The UUID would tell your computer that this bluetooth module is a serial UART adapter, so there is no AT command necessary to just sending/receiving data to/from MCU.
But MCU can send AT commands to control the bluetooth module, like setting the bluetooth password, bluetooth's name.
How did you find the UUID for exactly that module.
I am using a module called LM 400, and I don't know how to obtain the UUID. Hope your able to help me.
Did you try to use the UUID mention above? I think it is a common UUID for UART bluetooth adapter.
Yes I allready tried that. But there ain't any response from the module. I think I'll try with the module you mentioned. Thanks allot for the quick respone.
do you know how to connecting android to two bluetooth spp at the same tima?
@Ebbekaer Did you find a solution for LM400 UUID problem?
How I can use those bluetooth transceiver to power 2 relays with android?
Plesase help me to
jigasvicar@gmail.com
what is the name of bluetooth module?
which microcontroller you connected with bluetooth?
what is the name of bluetooth module?
which microcontroller you connected with bluetooth?
Is any software code needed for interfacing of bletooth module with microcontroller
for the MCU side, you treat the bluetooth module as modern UART interface, so no special codes needed.
WHICH BLUETOOTH MODULE WILL SUPPORT THE ARM9 MICROCONTROLLER?
can you tell the bluetooth module number?
what is CSR chipset module
Pair code is 0000 IIRC
i am using lpc3250 arm9 micro controller.which bluetooth module is suitable for this micro controller?
for sending data from bluetooth module to android any code is needed?
Help to me
which bluetooth module is suitable for android mobile?
any bluetooth with pre-build firmware operate as a UART2Bluetooth (SPP profile) will be cool, so it is very easy to interface to any micro-controller with UART. For Android side, you have to write code for paring the bluetooth devices with PIN code, and then just open a output and write bytes to the stream, really easy to do it!
which code is needed for android java or c++?.
can i use arf32 bluetooth module?
PIN Code means
Android - uses JAVA
PIN code means the Password for pairing 2 bluetooth devices, please check out the comment aboves, someone mentioned a bluetooth may work for you. Also there is android sample code.
What If...
I would Like to send a number from my uC to my android mobile phone,
Before connecting the Tx of my uC to the Rx of my Bluetooth Module
(here comes the question)
I just only have to send the number via Tx of the uC and the Bluetooth module will transmit that number
I need to send a number from my uC to an android app.
I want to know if I have to connect my uC Tx (UART TX) to the Bluetooth Module Rx,then how can I send the number (is there like an AT command?)
Please Help Me
Master Or Slave..
If need to send data from my uC to my phone the SKU is Master and when i want to receive data from my phone my SKU is Slave?..Am I Right?, is there a way to switch between master or slave by code?..
Master Or Slave..
If need to send data from my uC to my phone the SKU is Master and when i want to receive data from my phone my SKU is Slave?..Am I Right?, is there a way to switch between master or slave by code?..
Hi, Concerning the AT command, Let's check out this connection:
Android <-> Bluetooth <-> [ Bluetooth 2 Serial Module] <-> UART <-> MCU
I only control the bluetooth module in MCU side, like setting PIN password via AT command.
so you configure the Bluetooth module as a Slave?, or it doesn´t matter...My question is if the Bluetooth module can transmit a receive data only by sending a string from any side (Mobile or MCU), for example:
I send a number from the mobile via bluetooth Can I receive that string in a variable in the MCU, or I send a number from MCU (UART tx) can I receive that number in the Mobile.
Thks in advance
Yes, you can do so. You can see in the youtube, I send a character from the phone to the PC (via bluetooth module->Uart), I didn't test sending from PC, but I think it works the same.
the module name is RF-BT0417C
the module name is RF-BT0417C
Post a Comment