Intro: Add Simple Bluetooth to Arduino
Sometimes when you are first starting a new project, there is a lot of debugging going on, and with an Arduino platform, using the serial port to spit out data can be a very useful tool. Well what if there is no room to plug a USB cable into your Arduino when it is in location? Or what if you only have a short USB cable? Adding a virtual serial COM port to your Arduino projects is the solution to this problem. This is also a useful tool for remotely controlling or monitoring and Arduino's I/O without the need to internet connection or running wires back to a computer.
Step 1: Necessary Materials
The only extra piece of hardware or software for this is a serial bluetooth module. There is no special software needed, assuming that you already have Arduino installed. I like to use the cheap bluetooth modules that are found on eBay for less than $10. They are simple to use/interface and I have not had any trouble using them thus-far. You will also, of course, need an Arduino compatible MCU, I am using an Arduino UNO R3. Since these bluetooth modules have a standard serial interface, you can just as easily use them on any other MCU that has a serial port. On the software side, we will be using the standard Arduino IDE, I currently use 1.6.1 but any version should do. I will also be using the SoftwareSerial library, one that comes packaged in the Arduino install. The SoftwareSerial library is unnecessary but I prefer to use it so that I do not have to remove my bluetooth module from the Arduino serial port when I need to upload a new sketch.
Step 2: Adding SoftwareSerial to Your Sketch
The SoftwareSerial library allows you to use two digital I/O pins to act as a serial port that is controlled via the library files. The library works just like the built in Serial function of Arduino. After importing the library, which I am assuming you know how to do, it is also in the pictures, you simply initialize the library by creating an instance with a name and describing the RX and TX pin numbers. Once you have initialized the library and given this new serial port a name, using it is exactly the same as using the standard Serial.'whatever' functions.
Step 3: Expanding Bluetooth Capabilities
As far as what else can be done using bluetooth, that is all up to you! I have mentioned creating Android apps that use bluetooth in a previous Instructable, here, but I plan on creating a more universal Instructable for sending commands via bluetooth to an Arduino based system. Stay tuned and I hope you enjoyed! And please vote!