Pages: [1]   Go Down
Author Topic: Bluetooth Nightmares  (Read 527 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've been trying to get Bluetooth up and running on my project for quite a while now. The basic idea of the project itself is essentially a differential drive R/C car controlled via Bluetooth. There are two Arduino Uno's with a Bluetooth modem (http://www.sparkfun.com/products/10269) on each. One Arduino takes analog joystick inputs, converts them to values for PWM, and sends the variables over BT. The other Arduino interprets those variables and outputs them to motor drivers.

The problems we're having:
I've looked all over at guides for the BT modems, but I can't seem to communicate with the modules. One by one, I successfully paired with the module on my netbook (green light on the module), found the COM ports, opened up hyperterminal, and tried sending "$$$", "+++", and just about every other command I could find without any response from the module. I'm going to try configuring the module with commands from the Arduino, but after that I'm out of ideas.

The problems I'm worried about:
Even if I get the BT modules communicating, I'm uncertain of how to set up the BT modules so they will pair and communicate with each other. I figure one needs to be set up as master, the other as slave, but that's close to the limit of my understanding.

I'm not sure of the most reliable way to send the data to the receiver. Before I get shut down on this one, I've searched through the forum and found a few examples, but I would like a better understanding on the logic behind the code. The most common instances I've seen have the sender constantly sending out variables followed by a null terminator, and the receiver filling up a buffer of the variables. How exactly does the receiver separate the variables out of the buffer?

Thank you in advance 
Logged

San Francisco
Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I can't help you with the BT, but I would like to see your interest in the RD-11 product announced today in this forum (by me). I wouldn't say "abandon BT" and "get RD-11", but hey, whatever works.  smiley-grin My question would be, does it look like RD-11 would be useful to implement your overall system? Would 1/10 or 1/20 sec response be fast enuf or would u need that improved before you could use it?

Thanks, Steven Swift.
Logged

Creator of RD-11 wireless data sharing, see www.swiftEnterprises.biz

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The problem isn't the response time, the problem is that I have no idea what is going on inside the module. If you made the project open source (as some suggested) it would make the product much more enticing for developers. When something is supposed to respond a certain way, handle commands a certain way-- and it doesn't, you get a roadblock that takes days to troubleshoot because you don't know what's going on inside the module.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

*bump*

Logged

Offline Offline
Full Member
***
Karma: 1
Posts: 108
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

According to the datasheet, you enter $$$ within 60 seconds of startup to enter command mode. No CR, just the three $$$ characters.

After it responds, then you use commands with CR after them.

Using the Roving Networks Wifly (Similar command mode entry) I use the Arduino IDE to use command mode. Select "no line ending" to send the $$$ then switch it to "Carriage return" to send commands.

What you're probably doing now is sending $$$ CR which will not work. There must be a short period of no characters before and after the $$$.
Logged

Linux and Arduino, two great things that go great together!
http://www.roboticcore.com

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

According to the datasheet, you enter $$$ within 60 seconds of startup to enter command mode. No CR, just the three $$$ characters.

After it responds, then you use commands with CR after them.

Using the Roving Networks Wifly (Similar command mode entry) I use the Arduino IDE to use command mode. Select "no line ending" to send the $$$ then switch it to "Carriage return" to send commands.

What you're probably doing now is sending $$$ CR which will not work. There must be a short period of no characters before and after the $$$.
How do you use the Arduino IDE to communicate with the BT module? Do I just have the Arduino idle, go into Serial Monitor and start entering data?

I tried entering command mode via the Arduino the other day, used Serial.send('$$$'); and got the BT module's light flashing faster than before. However when I expected to see the module respond "CMD" or a similar response on the serial monitor/ the LCD I had hooked up, I saw nothing on the serial monitor, and the LCD showed "67" then "33". I'm not sure if this was a problem in my message, or of the lcd code wasn't converting the data properly.
As far as communicating to the modem via the Arduino, do I need to use Serial.send(" "),Serial.print(" ") or Serial.println(" ")? What's the difference in format between ' ' and " "? I know some of these questions should be very basic, and I appreciate your patience.
Logged

Offline Offline
Full Member
***
Karma: 1
Posts: 108
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hmm. Ok, What exactly do you have the Bluetooth module connected to? If you have it connected to the Serial channel, then you can use:
delay(500);
Serial.write("$$$");
delay(500);

To get into command mode, then just Serial.writeln("Command"); there after. You use " " around text strings. Do NOT use Serial,writeln() to go into command mode, and do NOT use Serial.write() to enter commands once in command mode.

There HAS to be at least a 500ms pause before the first $ and after the last $. No CR, no spaces, nothing. It's really shy, if it detects ANY characters within that 1 second (minimum) period around the "$$$" string, it will not go into command mode.

The problem with using the Serial port to talk to the module is that you lose your only good way to debug your program... which is sending text to the IDE's monitor through the serial port. Personally, I'll jump through any hoop to keep the Serial port free so I can use it to debug.

Oh, to add for clarity. The reason it's so hard to get into command mode is because you have to be able to do it while actual data is flowing through. If it was trivially easy to get into the command mode, then it would be doing it by accident all the time.

« Last Edit: April 06, 2011, 05:25:35 pm by TeslaFan » Logged

Linux and Arduino, two great things that go great together!
http://www.roboticcore.com

Pages: [1]   Go Up
Jump to: