Difference between revisions of "Bluetooth Shield for Arduino"
(→Host-Slave mode: Communication between two different Bluetooth shields) |
(→Host-Slave mode: Communication between two different Bluetooth shields) |
||
Line 71: | Line 71: | ||
[[File:Bluetoothshield host slave 1.jpg]] | [[File:Bluetoothshield host slave 1.jpg]] | ||
+ | |||
+ | *Install Bluetooth shield on the Arduino Uno, copy and paste the following sample code and download to Arduino: | ||
+ | |||
+ | <pre> | ||
+ | |||
+ | #include <SoftwareSerial.h> | ||
+ | #define RxD 7 | ||
+ | #define TxD 6 | ||
+ | SoftwareSerial BlueToothSerial(RxD,TxD); | ||
+ | void setup() | ||
+ | { | ||
+ | Serial.begin(38400); | ||
+ | BlueToothSerial.begin(38400); | ||
+ | delay(500); | ||
+ | } | ||
+ | void loop() | ||
+ | { | ||
+ | if(BlueToothSerial.available()) | ||
+ | { | ||
+ | Serial.print(char(BlueToothSerial.read())); | ||
+ | } | ||
+ | if(Serial.available()) | ||
+ | { | ||
+ | BlueToothSerial.print(char(Serial.read())); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | </pre> |
Revision as of 21:22, 25 May 2013
Contents
Introduction
The Bluetooth Shield integrates a Serial Bluetooth module. It can be easily used with Arduino for transparent wireless serial communication. You can choose two pins from Arduino D0 to D7 as Software Serial Ports to communicate with Bluetooth Shield (D0 and D1 is Hardware Serial Port). The shield also has two Grove connectors (one is Digital, the other is Analog) for you to install Grove modules.
Note: The Shield may not be compatible with some Bluetooth capable devices, like some HTC mobile phone (G7 with Android 2.33) and Apple devices with special profile on Bluetooth function.
Features
- Arduino compatible
- Up to 10m communication distance for line-of-sight communication
- UART interface (TTL) with programmable baud rate (SPP firmware installed)
- Default Baud rate: 38400, Data bits: 8, Stop bit: 1, Parity: No parity
- Default PINCODE:”0000”
- A full set of configuration commands
- On board PCB Antenna
Specification
Item | Min | Typical | Max | Unit |
---|---|---|---|---|
Voltage | 2.8 | 3.3 | 3.5 | VDC |
Current | 3 | / | 100 | mA |
Communication Distance(in house) | / | / | 10 | m |
Protocol | Bluetooth V2.0 with SPP firmware | / | ||
Interface | Uart Serial Port(TTL) | / | ||
Supported Baudrate | 9600, 19200, 38400, 57600, 115200, 230400, 460800 | bps | ||
Dimension | 57.4x45.3x19.4 | mm | ||
Net Weight | 10±2 | g |
Quick Test
Host-Slave mode: Communication between two different Bluetooth shields
- Select the Bluetooth shield communication port using jumpers: BT_RX is connected to D6 of Digital-6, BT_TX is connected to Digital-7. Move the mode selection switch to lower position so that Bluetooth module will enter into AT command mode.
- Install Bluetooth shield on the Arduino Uno, copy and paste the following sample code and download to Arduino:
#include <SoftwareSerial.h> #define RxD 7 #define TxD 6 SoftwareSerial BlueToothSerial(RxD,TxD); void setup() { Serial.begin(38400); BlueToothSerial.begin(38400); delay(500); } void loop() { if(BlueToothSerial.available()) { Serial.print(char(BlueToothSerial.read())); } if(Serial.available()) { BlueToothSerial.print(char(Serial.read())); } }