Go Down

Topic: Connecting Arduino to Android Phone using Bluetooth (Read 9043 times) previous topic - next topic

TobyM95

Sep 04, 2011, 01:00 am Last Edit: Sep 04, 2011, 01:02 am by TobyM95 Reason: 1
Hi,
My brother and I have made a tutorial on making an Arduino project to connect an Android phone to and Arduino using Bluetooth.

Check it out here: Connect an Android phone to and Arduino using Bluetooth.

I've rated the tutorial as intermediate, please tell me if you think this is too high!
Author: Best CPU
Co-Author: Arduino Projects

novice


Nikka93

The BT module is set at 9600 baud rate.

On the Amarino site is written: IMPORTANT!!! Please set your Bluetooth module to 57600 baud (using Putty or other Terminal programs) otherwise you will get corrupted data. Only the Arduino BT board works with 115200 baud without flaws.

How did you set the baud rate?  :smiley-sad-blue:

Nebula

Hi Nikka93,

Have a look at http://www.circuit-blog.com/how-to-change-baud-rate-of-bluetooth-modem-bluesmirf-gold-using-arduino-terminal/

This should tell you how to set the baud rate, although it may depend on your module. 57600 would be ideal, but if you can't change it try using the default baud rate and see if that works :)

TobyM95

Nikka93, the default baud rate (9600 baud) worked fine for me. I've added this to the tutorial so other people don't get confused! I will also add a note linking to the guide Nubula suggests, just in case.
Author: Best CPU
Co-Author: Arduino Projects

Nikka93


pitusso

Hi,
i'm using the same bt module:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1284987911

I 'm using that through SoftwareSerial; in this way it's possible to use the serial for debugging purpose  ;)

Code: [Select]
#include <NewSoftSerial.h>

#define rxPin 2
#define txPin 3

NewSoftSerial myBluetooth(rxPin,txPin);

void setup() 
{
  Serial.begin(9600);
  Serial.println("Let's Start with pitusso!");

  // set the data rate for the NewSoftSerial port, idem as Serial for DEBUG purpose
  myBluetooth.begin(9600);
}


and so on...

Instead of Amarino, i've used AppInventor, to build my app.

bihsan

Hi guys,

I'm having trouble with the bluetooth communication. I'm using the bluetooth mate gold from sparkfun and the arduino MEGA ADK. my code is below. Any help would be greatly appreciated. Thanks!


#include <SoftwareSerial.h>

//RX AND TX PIN ASSIGNMENTS FOR THE ARDUINO MEGA ADK
int bluetoothTx = 2; 
int bluetoothRx = 3;

SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);

void setup()
{
  //Setup usb serial connection to computer
  Serial.begin(9600);

  //Setup Bluetooth serial connection to android
  bluetooth.begin(115200);
  bluetooth.print("$$$");
  delay(100);
  bluetooth.println("U,9600,N");
  bluetooth.begin(9600);
}

void loop()
{
  //Read from bluetooth and write to usb serial
  if(bluetooth.available())
  {
    Serial.print((char)bluetooth.read());
  }

  //Read from usb serial to bluetooth
  if(Serial.available())
  {
    bluetooth.print((char)Serial.read());
  }
}

beer lover

that link is giving me a 404

I have been playing around with the jy mcu bluetooth module and have had some success. I used this instructable
http://www.instructables.com/id/Androino-Talk-with-an-Arduino-from-your-Android-d/

I had to install the sla4 android and python for android but it works pretty well. As of now I can only receive sensor data from one pin but I havent played around with the code too much to see how I can get data from more pins and send data back to the arduino which is my ultimate goal
as for the amarino project I havent had as much luck with it. I have changed my baud rate and the test event is sending data but I get nothing from my serial monitor. I really want to get this up and running.


AHartRC

The Arduino Mega 2560 board shows port 2 as a non-serial port. My mega has 0, 15,17 and 19 as rx ports, 1, 14, 16 and 18 for tx

Go Up