You have no items in your shopping cart.



Profile Informations

Login Datas

or login

First name is required!
Last name is required!
First name is not valid!
Last name is not valid!
This is not an email address!
Email address is required!
This email is already registered!
Password is required!
Enter a valid password!
Please enter 6 or more characters!
Please enter 16 or less characters!
Passwords are not same!
Terms and Conditions are required!
Email or Password is wrong!
Captcha is required!
Captcha is wrong!

Play Bluetooth With Arduino

We have provide an inexpensive serial port Bluetooth module , it can work as a Bluetooth slave and communicate with a Bluetooth master like PC and mobile phone.

Arduino is a  very popular development platform of AVR, so we choose it to work with this Bluetooth module and this combination can generate a lot of applications.

First , put the BT shield stand on Arduino board – the BT shield has a serial port Bluetooth module (Slave) on it. The BT shield have 3 pins connect with Arduino board : State , RX and TX. With the State LED and State pin, we can get the connection status of the BT shield , when the Bluetooth serial port channel is not build , the State LED will alternating light and off , and if the serial port is opened , the State LED will be on. The State pin will be the same mode as the LED .

You can get more information about the BT Shield in the product page , or download the datasheet here.

Here we make a example how to use the Arduino with the Bluetooth module to send data to PC.

In this code , we use the interrupt to check the State pin, if the state pin level from high to low , then we consider that the module still in the standby mode, so wait for connecting. If the State pin maintain more than one second of high level, we consider that the Bluetooth channel has build and we can sent the data to serial port.

Download the code below into the Arduino:

unsigned int timeout=0;
unsigned char state=0;
ISR(TIMER2_OVF_vect)          //Timer2  Service 
  TCNT2 = 0;
  if (timeout>61)
void init_timer2(void)               
  TCCR2A |= (1 << WGM21) | (1 << WGM20);   
  TCCR2B |= 0x07;   // by clk/1024
  ASSR |= (0&lt;<as2); -="" 0:="" 1:="" arduino="" case="" clock="" enable="" external="" hellow="" in="" internal="" interrupt="" not="" overflow="" pre="" state="0;" tcnt2="0;" timeout="0;" timer2="" timsk2="" use="" used="" void=""><p>
	Reset the Arduino , we can see the PWR LED of the BT Shield is on , and the State LED is light and off , the D13 LED of Arduino board is off , that means the Bluetooth connection is not complete. Open the hardware manager , find the Bluetooth mode and connect it , the Pincode is 1234 as default . After install the driver , we can find a Bluetooth serial port in the PC , and use a serial monitor software to open it , the State LED on the BT Shield is continued on , and the D13 LED of the Arduino board will light ,too.It means the connection is build and we can communicate with PC now.</p>
	On the serial monitor on PC , we can see the data that send from Arduino.</p>
	<img alt="" src="http://blog.iteadstudio.com/wp-content/uploads/image/2010_06/play-bluetooth-with-arduino_3.jpg" style="width: 400px; height: 299px; " /></p>
	This just a opening , with this demo , we can use these module in many places . How about sending the sensor data to a software on PC or Phone.</p>
	The next step , we are going to make a Wireless Energy Monitor that base on <a href="http://iteadstudio.com/store/index.php?main_page=product_info&amp;cPath=4&amp;products_id=56" target="_blank">Non-invasive AC current sensor</a>. There is a open source <a href="http://openenergymonitor.org/emon/node/28" target="_blank">project</a> but it&rsquo;s use the USB serial port and we will use Bluetooth , and we will make a sample software to calculate the Energy.</p>