Communicate with bluetooth module from Arduino Uno – Take Two

arduinobluetoothserial

I have an Arduino Uno. Pins 2 and 3 are connected to pins UART_TX and UART_RX, respectively, on a bluetooth SMD module. I have the following sketch running on the Uno.

#include <NewSoftSerial.h>

NewSoftSerial bluetooth(2, 3);
byte b;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);   // opens serial port, sets data rate to 9600 bps
  Serial.flush();
  bluetooth.begin(9600);
  //enter command mode
  bluetooth.println("$$$");
  Serial.println("setup complete.");
}

void loop() {
  // if theres data from the bluetooth module
  if (bluetooth.available()) {
    //echo it to the serial monitor
    Serial.print("bt module said:");
    Serial.println((char)bluetooth.read(),BYTE);
  }
  //if theres data from the serial monitor
  if (Serial.available()>0) {
    b=Serial.read();
    //echo it back to the serial monitor
    Serial.print("serial said:");

    Serial.println(b,BYTE);
    //send it to the bluetooth module
    bluetooth.print(b,BYTE);
  }
}

I see the following on the serial monitor.

setup complete.

I expected to see

setup complete.
bt module said:C
bt module said:M
bt module said:D

Why am I not getting a response from the bluetooth module? Am I using NewSoftSerial incorrectly? Is the bluetooth module wired backwards? Are there examples communicating with a bluetooth module from an Arduino board?

Best Answer

Did you see in the datasheet page 5 that you need some resistors on the RX line in the note "R1, R2 required if MCU logic=5V" the maximum rating on inputs to the devide is 3.4V. It's not inconceivable you fried the receiver... the Arduino is a 5V logic device.