General

Bluetooth Communication between Arduino Mega2560 and Android

userHead mineer3223 2012-04-05 07:18:05 14983 Views5 Replies
Hello,

I am trying to establish a communication between my Android tablet (Samsung Galaxy) and the Arduino AtMega2560 via Bluetooth. I use DF-Bluetooth V3 module (TEL0026).

I connect VCC, GND, RXD and TXD pins of the Bluetooth module to 5V, GND, Pin3(declared as transmitter) and Pin2(declared as receiver) of Arduino, respectively. I leave the rest of the pins unconnected.

I follow the following site:
http://www.instructables.com/id/Android ... /?ALLSTEPS
From the tablet, I send any message to the Arduino anytime. Arduino sends a message to Android every 30 seconds.
Instead of writing the message to an LCD screen, I programmed the Arduino to blink when it receives something.

I adjusted the baud rate of the Bluetooth module to 57.6k, as suggested. DF-Bluetooth module is in Data Mode (AT Mode is OFF).

The Bluetooth Chat application on my tablet connects to the Bluetooth device successfully. However, neither of them receives a message form each other through Bluetooth.

I would appreciate any help on how to make the data transfer and make the Bluetooth protocol work!

I also have the USB to TTL converter(TEL0010), if that can help somehow.

Thanks!!!
2012-04-13 00:10:40 Thanks Hector,

It works now.

My mistake was that I was using a wrong pin for Rx. "In Mega and Mega 2560, NewSoftSerial will only be able to receive on pins 10, 11, 12, 13, 50, 51, 52, 53, and 62, 63, 64, 65, 66, 67, 68, 69. Only these pins are able to trigger an external interrupt (PCINT). " http://www.arduino.cc/cgi-bin/yabb2/YaB ... 1287382108

For transmitting Tx can be assigned to almost any pin.

Thanks again:)
userHeadPic mineer3223
2012-04-09 18:42:55 Hi,


I am not aware that this is a problem on the MEGA. You could try using another Serial port on the MEGA. try using Serial1 that might work.
userHeadPic Hector
2012-04-07 05:43:28 I have just tried the same thing with Arduino Nano V3.0 and it works. It seems like the problem is really the Rx pin (or another thing related to Ardunio Mega). Is there a solution to fix/compensate this?

Thanks!

Mine
userHeadPic mineer3223
2012-04-07 02:58:51 Hello,

Thank you for the reply Hector!

I made the MEGA and the PC communicate serially. It works.

Also, I have made some modifications in the code. When only Arduino sends messages to Android through Bluetooth, Android receives them and I can display them on my tablet.

However, when only my tablet sends messages to Arduino, Arduino does not receive them. Nothing happens.

I just saw on the forum that Arduino UNO has Rx resistor conflict with DF-Bluetooth V3 and is not compatible with the module.

Does "AtMega 2560 based Arduino MEGA ADK" work with DF-Bluetooth V3? Is the resistor on Rx pin compatible with the bluetooth module? If not, is there a way to fix it? 

Thanks!
userHeadPic mineer3223
2012-04-06 21:48:32 Hi,


Before getting the Bluetooth working with the tablet I would make sure it is working with a PC. This way you know the Bluetooth module is connected and working properly.




So use the Mega and connect to a PC and send some info from the MEGA to a serial monitor on the PC.
userHeadPic Hector