Sending data from Arduino to PC using Bluetooth

Hi.

I’m new with Arduino, and right now I’m just messing around to see what I can do with it.

I’ve been given an Arduino Uno and a Bluetooth module attached to a Wireless Shield from a professor, but he didn’t tell me how exactly should I use this module. I can’t even find relevant information on the internet… all I can find is that the Wireless Shield is supposed to be used with a Xbee module, not a Bluetooth module. I can’t even find information about the Bluetooth module itself I have here!

The module is this one:
http://imgur.com/a/HkxaY (sorry for the loss of focus on the second image)

I put it on the Wireless Shield, and I put that on top of the Arduino Uno. When I connect it to the pc it appears like this:
Imgur

The TX and RX pins are not connected because the professor told me that it would cause problems (I tried connecting them and I couldn’t upload any code on the Arduino because of seemingly random errors that I couldn’t understand or resolve).

After connecting the Arduino to the computer, the Bluetooth starts working. I’m using Windows, so the first time I added the device to the known bluetooth ones, and 2 COM ports appeared with the name “Standard Serial over Bluetooth link”.

The next thing I did was testing it. I uploaded a sample code I found on the internet for testing:

#include <SoftwareSerial.h>

int counter = 0;

int rxPin = 3;
int txPin = 2;
SoftwareSerial bluetooth(rxPin, txPin);

void setup() {
  Serial.begin(9600);
  bluetooth.begin(9600); //set baud rate
}

void loop() {
  counter++;
  bluetooth.print("Arduino counter: ");
  bluetooth.println(counter);
  delay(500); // wait half a sec
}

Note that I use “random” pins for TX and RX. I’ve no idea what to use there.

Now if I use a program like Tera Term and connect it to one of the 2 COM ports for Bluetooth I mentioned above, nothing happens on the console. The board itself is a bit different, since the PWR led turns itself on like this:
http://imgur.com/W84iVQS (you can see it in upper left corner).

If I start moving the board around, random chars start appearing on the terminal, like this:
Imgur

So, what am I doing wrong? Please help a newbie!

Note that I use "random" pins for TX and RX. I've no idea what to use there.

Post a link to the shield. Typically, such shields use pins 0 and 1, 2 and 3, or 7 and 8, with some way to switch between pins 0 and 1 and the other pair.

PaulS:
Post a link to the shield. Typically, such shields use pins 0 and 1, 2 and 3, or 7 and 8, with some way to switch between pins 0 and 1 and the other pair.

The shield is this one: https://www.arduino.cc/en/Main/ArduinoWirelessShield

I think it uses pins 0 and 1, but as I said if I plug those pins I can’t upload any code on the Arduino, I don’t lnow why.

When I use those pins the errors that appear change every time I try to upload the code. For example, now it says:

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x8a

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x10
avrdude: stk500_initialize(): (a) protocol error, expect=0x14, resp=0xfc
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

avrdude: stk500_disable(): unknown response=0x04

I’ve no idea what they mean. I can’t find any solutions on google.

I think it uses pins 0 and 1, but as I said if I plug those pins I can't upload any code on the Arduino, I don't lnow why.

First, you should read the link you posted. The shield has a switch. Learn what it does.

Second, when anything is connected to pins 0 and 1, you will have a hard time uploading sketches, because those pins are involved in uploading the sketch.

PaulS: First, you should read the link you posted. The shield has a switch. Learn what it does.

Second, when anything is connected to pins 0 and 1, you will have a hard time uploading sketches, because those pins are involved in uploading the sketch.

I did read it, but it refers to the Xbee module. Besides, I've tried both options and I didn't see any difference... As I said, I'm new to this stuff. Never messed around with eletronic devices until a few days ago...

Seems like the micro option is the one I want, but as I said I didn't find any difference...

Sorry for the double post, but I think I've got it. Tell me if it's correct, because I'm not 100% sure that the Arduino is sending things using the Bluetooth or using the standard USB cable.

1) I'm connecting the TX and RX pins of the shield to the Arduino (as I said I wasn't doing this before) 2) I detach the BT module and put the shield's switch to USB 3) Upload this code:

void setup() {
  Serial.begin(115200);
}
int counter = 0;

void loop() {
  counter++;
  Serial.print("Arduino counter: ");
  Serial.println(counter);
  delay(500); // wait half a sec
}

4) Attach the BT module and switch the shield to Micro 5) Open the Tera Term and connect to the serial-to-bluetooth COM and the messages appear.

I did read it, but it refers to the Xbee module.

The information about the switch has nothing to do with the kind of module that is attached.

Besides, I've tried both options and I didn't see any difference...

Did you read the comments in the switch section? The switch only affects whether data from the Wireless module gets to the Arduino, or not.

Crappy shield, if you ask me.

Tell me if it's correct, because I'm not 100% sure that the Arduino is sending things using the Bluetooth or using the standard USB cable.

Unplug the cable. If data gets through, it went via the bluetooth device. If not, it tried to go down the wire.

PaulS: Unplug the cable. If data gets through, it went via the bluetooth device. If not, it tried to go down the wire.

I don't have any battery to power the Arduino, if I unplug the cable it turns itself off.

UPDATE: I just remembered that with the Micro setting the data is sent both via Bluetooth and USB. So I connected Tera Term to the COM port for Arduino and to the one for Bluetooth and indeed the messages appear in both terminals. So it seems to be working now.

Thanks for the help, Paul! :)

Lol, sounds like a typical Professor who hasn't a clue what they're doing!

I got fooled on eBay into buying some "XBee bluetooth modules" that aren't XBee at all, simply the same form factor and pinout compatible with the XBee sockets.

Looks like you're on the right lines with your use of SoftwareSerial. Might be worth trying swapping the Tx and Rx pin designations as there can be inconsistencies between modules whether Tx is from the Xbee or to the Xbee. If the Xbee transmit/receive are assigned to the hardware serial port (pins 0and 1) you need to use Serial not SoftwareSerial. I prefer to avoid shields if possible as if the documentation is poor you have to trace which pins are being used, rather than wiring them up yourself (as you would with an XBee breakout board).