Wednesday, 13 November 2013

Bluetooth Programming and Testing

Hai Everybody,

This week I'm gonna research how to write programs so that my device can interface with smartphone bluetooth to send data. First of all, i'm gonna used Cytron Bluetooth Bee as shown on Figure.


As shown on Figure, there are Arduino Uno R3 that attached with Xbee Shielding, and top of it is Bluetooth Bee. There are also shows how to connect with the 16x2  LCD and connecting to the PPG circuit. The  Bluetooth  bee  is  supplied  by  3.3V  from  the  Arduino,  while  the  Arduino  is supplied by 5V from the USB port of the computer or from the 5V voltage regulator. To program the ATmega328 of the Arduino, Arduino IDE must be download, because it is the compiler of the system. Figure below shows the one of the screenshot of  the Arduino IDE compiler.


The  figure  above shows  the  Arduino  IDE  software  already  been  installed  on  the computer and it is connected to the COM3 of the computer USB port ready to be programmed.  Arduino  IDE  will  compile  the  sketch  and  upload  into  Arduino  UNO connected to your computer (if there is no error), further run the sketch on Arduino UNO. You will just have to wait until the message box say Upload Done and look at
the Arduino Uno. The red LED are always  blink at 1 second rate  when 5V is supplied to the Arduino. Figure below shows the Bluetooth Bee pin out.

To make sure the Bluetooth Bee is functioning well before proceed with the real program, i search on the Google the simple program. Just to make sure it can at least transmit any data to the smartphone. But first, i'm gonna use Bluetooth SPP.apk one of the applications that can be found on the Play Store of the Android phone. It is platform that can transmit or receive data from Bluetooth Bee. Below are the program that allow transmitting to the smartphone via bluetooth:

#include <AltSoftSerial.h>
#define rxPin 0
#define txPin 1

AltSoftSerial mySerial(rxPin, txPin);

void setup()
{
// define pin modes for tx, rx pins:
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
mySerial.begin(9600);
Serial.begin(9600);
}
void loop(){
mySerial.print("BPM");
mySerial.print(BPM);
Serial.print("BPM=");
Serial.println(BPM);
delay(1000);
}
delay(80);
}

This program is successful, but i will show on the week that i will presentation day. See all of you there..

No comments:

Post a Comment