RN-41 Bluetooth Questions

Hey guys,

I’m a bit of a newbie and have a few questions that if I knew the answer to I think would really help me out. I’ve done quite a bit of reading/research here and on the web in general and decided it was time to ask some people who know the answers.

The board I’m using is the arduino uno. I got the board and software all setup, have made/run a few programs with multiple motors/servos, LEDs, buttons, etc. and decided it was time to move on to figuring out the bluetooth connection I will need for my project.

Not knowing too much about the parts and specs, I did my best sorting through data sheets and information and settled on purchasing the RN-41 module mounted on a breakout board.

Soon I found “Wireless communication with PC and Arduino board using bluetooth” at arduino playground (http://arduino.cc/playground/Learning/Tutorial01) and followed that to get up and running. Problem is- I can’t get it to work.

The software loads onto the arduino fine. I got the control panel on the computer working after some time getting the COM port set and recognized in the program(also made sure its on SPP) and getting a ‘stable system’ message when ran. (went through a rxtx mismatch thing I found online)

My questions are:

  1. Does the RX pin have to be connected to the TX pin on the arduino for the module to work if I am only sending information for the Bluetooth to output to the arduino? (I have avoided doing this because I know the RN-41 works on a 3.3 V input and the arduino pins are at 5V which I haven’t manage to resolve yet)

  2. Is it safe to use the 3.3V output on the arduino to power the RN-41? The max output for the arduino 3.3V pin is 40mA. The RN-41 has typical rated values of 30mA connected, 35mA RX supply current and 65mA TX supply current. Obviously 65mA>40mA, but will running this setup just limit the range on the Bluetooth or actually cause damage to the arduino?

  3. The baud rate on my Bluetooth on my computer is 9600bps. The RN-41 module is default at 115,200bps and I believe the arduino is at 9600bps(??). Is this an issue or is the fact that the output signal and the receiver at the same speed sufficient?

I think those are my main questions for now. Any input would be greatly appreciated and hopefully I can pay it forward one day.

Thanks,

adictionbass

TX from arduino to RX on board and you know rest ;) To lower voltage on output from arduino you can use voltage divider or voltage regulator. Probably you can adjust of data rate on bluetooth board using specific commandds (look for it in datasheet)

Thanks for the reply max, but I made the voltage divider with some resitors and nothing changed functionally.

If anyone could anser the 3 questions above directly it would be a great help.

Thanks,

adictionbass

#1 are you sure that the datasheet for the RN-41 has an upper voltage limit < 5v? Are you sure that your breakout board doesn’t have a voltage regulator that divides your input voltage down to 3.3v?

#2 Yes this is safe, I’ve done it with a BlueSMiRF Silver at a VERY limited range so YMMV, but it does work.

#3 You can probably change the baud rate on your computer serial port… what program are you using to communicate with the module? I wrote a custom one in Java based on Serial.java in the Arduino project. That library allows me to set the baudrate when I construct a Serial object.

#3 cont’d You can change the baudrate of the Arduino by an argument to Serial.begin(). Just pass it 115200.

johnmchilton:
#1 are you sure that the datasheet for the RN-41 has an upper voltage limit < 5v? Are you sure that your breakout board doesn’t have a voltage regulator that divides your input voltage down to 3.3v?

#2 Yes this is safe, I’ve done it with a BlueSMiRF Silver at a VERY limited range so YMMV, but it does work.

#3 You can probably change the baud rate on your computer serial port… what program are you using to communicate with the module? I wrote a custom one in Java based on Serial.java in the Arduino project. That library allows me to set the baudrate when I construct a Serial object.

#3 cont’d You can change the baudrate of the Arduino by an argument to Serial.begin(). Just pass it 115200.

John,
Thanks for the reply.

#1: here is the link for the module I have (http://www.pololu.com/catalog/product/1613) and everything there leads me to believe anything over 3.6v will damage the module. I did connect the RX pin of the module to the TX of the arduino last night through a voltage divider that took a 5V signal and brought it down to 3.2 something when I tested it so that part should be fine now.

#2: Good to know. I just wasn’t sure if that would be keeping me from getting the module working.

#3: I’ve been using processing as described in “Wireless communication with PC and Arduino board using bluetooth” from arduino playground (http://arduino.cc/playground/Learning/Tutorial01). Basically it launches a small window with two buttons which send commands to the Bluetooth to turn a diode off and on. I’m going to go through the code tonight and make sure it is all doing what I need it to do.

#3 cont: Under Bluetooth properties on my computer, the baud rate is set at 9600. When I change this and hit okay, it resets it back to 9600 automatically, not really sure why. If the computer is sending out at 9600, and the arduino is running at 9600, should these interface correctly if the BT module is at 115,200?

Again, thanks for the help.
adictionbass

Got it working!!!!!

the problem was the baud rates. They all have to be equal. I used 9600bps.

I spent a while trying to figure out how to get into the bluetooth setting to change the rate so ill write a short little recap here for anyone else that comes up with this problem.

You need to use a terminal window to configure the BT module. I tried a few: putty, Indigo Terminal Emulator, hypertermainal…. before I got it to work. NOTE: when you type in the terminal window, you will not see the text you type. (this baffled me which is why I kept trying different ones.) The one I finally used was putty version 0.60. Download and launch that.

A configuration window should launch. On the first screen select the ‘Serial’ button, change your ‘serial line’ to the COM port your Bluetooth is on and set the speed (9600).

On the left side click Terminal and select the ‘Force on’ button under ‘local echo’ so you can see what you type.

On the left side click ‘Serial’ under the ‘connection’ tab. Make sure the COM line and speed lines are correct. Have Parity at ‘None’ and Flow control at ‘None’.

Click open. A black command line screen should open. Type ‘$$$’ to enter command mode. (this has to be done within 60 seconds of powering up the module). Type ‘D’ and the Bluetooth should send a list of basic settings to the display. This will let you know that you are in command mode. Be sure to exit command mode using ‘---‘ and note the commands are case sensitive. You should be able to find all the commands you need in the user manual on rovingnetworks.com. I only had to use ‘SU,9600’ then I checked to make sure of the change by sending ‘D’. Finally exited with ‘---‘.

I hope this helps someone else out because it took me quite a while.

Thanks for the input from the members above,

adictionbass

the problem was the baud rates. They all have to be equal. I used 9600bps.

Why so slow? The Arduino and bluetooth can operate at 115200.

PaulS:

the problem was the baud rates. They all have to be equal. I used 9600bps.

Why so slow? The Arduino and bluetooth can operate at 115200.

That was the default for the BT dongle as well as the rate the tutorial was written at so I just stuck with 9600. I'm just a newbie so I'm not sure on what normal rates are or what functions have what requirements etc. I did go to the port settings to try to up it a bit and it seems to keep returning to 9600 even after full restarts, unplugging the dongle, etc. Havent figured that one out yet.

You know what I did, and this may work for you, is to use an Arduino Mega (which has more than 1 UART*) as a "serial bridge" with a sketch no fancier than this (which is copy&pasted from what I use):

void setup() {
  Serial.begin(115200);
  Serial1.begin(115200);
}


void loop() {
  while(Serial.available()) {
    Serial1.write(Serial.read());
  }
  
  while(Serial1.available()) {
    Serial.write(Serial1.read());
  }
}

in order to configure the Bluetooth module. My application requires two MCUs (one of which is an Arduino)** talking to each other over BT, so it was very handy to be able to do this rather than to setup BT and struggle to find a serial communication app for my computer. The first one I tried was limited to some godawful baudrate so I said screw it and loaded that sketch.

Though it sounds like you have things under control... just thought I'd share anyway. Cheers.

  • I'm still waiting for the Arduino project to upgrade from the 328P to a chip with more than 1 UART.

** My application requires communication faster than 9600 signals per second