BT24 MODULE TO SEND CHARACTER VALUES

Hi ,

I NEED TO SEND CHARACTER VALUES TO ANOTHER HANDHELD DEVICE OVER BLUETOOTH WHICH SHOULD BE AN AMP'ED DEVICE.

SO I AM USING BT24LT WITH ARDUINO TO SEND THE VALUES.

HERE THE PROBLEM IS THE VALUES ARE POPULATING AS SOME HEX VALUES MAY BE MEMORY VALUES LIKE EXAMPLE:- INPUT 10 OUTPUT GETTING AS "FF" INSTED OF 10

#include <SoftwareSerial.h>

SoftwareSerial bluetooth(10, 11); // RX, TX

void setup() {
// Open serial communications and wait for port to open:
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("Goodnight moon!");

// hart the data rate for the SoftwareSerial port
bluetooth.begin(115200);
bluetooth.println("Hello, world?");
}

void loop() { // run over and over
if(bluetooth.available())
{
Serial.print((char)bluetooth.read());
}

//Read from usb serial to bluetooth
if(Serial.available())
{
bluetooth.write((char)Serial.read());

}
}

WHY ARE YOU SHOUTING ? (and why are you not using code tags?)

where are you seeing the FF characters (in what program, on which platform and how is this setup)?


Please correct your post above and add code tags around your code:
[code]`` [color=blue]// your code is here[/color] ``[/code].

It should look like this:// your code is here
(Also press ctrl-T (PC) or cmd-T (Mac) in the IDE before copying to indent your code properly)

Thanks for you response
Sorry.. As I am new this forum.

I am using Blueterminal to read incoming data.There I am seeing these FF character's.

Here my question is 'whether the code I used is correct to send any characters using BT24 module'

Because I have tested with other modules it is working fine.

The problem is with this type of amp'ed modules, But I need to use these modules only.

So please help me.

#include <SoftwareSerial.h>

SoftwareSerial bluetooth(10, 11); // RX, TX

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  bluetooth.begin(115200);
 
}

void loop() { 
  if(Serial.available())
  {
    bluetooth.write((char)Serial.read());
    
  }
}

SoftwareSerial reception is unreliable at a BAUD rate over 57600

bluetooth.begin(115200);
 [/codeand although you are only transmitting you should switch to something lower (38400 is good) also i doubt if your BT-module is actually running at that BAUD-rate atm

Ensure your BT24 is configured at the right baud speed (115200 in that case) and that the Blueterminal application is set up to print ASCII and not Hex values

Thanks
I tried with different lower Baudrates too.
But it's not working.

it's not working

is not an "scientific" approach to problem solving.

you need to divide the problems in chunks and test

  • what hardware do you exactly have?
  • describe the physical connexions. Ensure GND, Power, Rx, Tx are appropriately connected (at the right voltage)
  • is the module properly configured. How do you know it's @ the right baud rate?
  • do you have another arduino (like a MEGA) to use a real Hardware Serial port to ensure strong communication?
  • how do you know it's paired?
  • How is Blueterminal configured?

I am sure it is getting paired and Rx and Tx are configured correctly.

Since While I am trying to send character values simultaneously I could get some HEX values on the terminal.

As suggested Only I need to try with other Arduino which I need to get it.

Can you please let me know weather this code is correct or I need to use how xbee communicates like defining protocol??

Yes the code is OK although 115200 for SoftwareSerial is not reliable under heavy use.

You could also check if the BT module is talking back to you

#include <SoftwareSerial.h>
SoftwareSerial BTSerial(10, 11); // RX, TX

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

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

I am sure it is getting paired and Rx and Tx are configured correctly.

care to elaborate? the module supports both SPP and Apple IAP. You want to use SPP. is that configured? Most BT modules operate at 3.3V - your arduino (which one do you use?) is likely 5V for Rx and Tx. How do you handle that? are GND joined ?

you are giving to few information... can't keep asking....

I am using Arduino UNO and BT24LT BLUETOOTH module which supports 5V.

SPP configuration?? How to do that??

sorry for basic question!!

I have one more basic query I used the Bluetooth modules HC-05 with same code and it worked.
Why not it is working with BT24??

Do we need to use Zigbee protocol to send data through BT24??

Srinu4a1:
SPP configuration?? How to do that??

Through AT commands when you configure your module (If I remember correctly it's something like AT+AB SPPConnect) - search for the AT commands in the abSerial Reference Guide

Srinu4a1:
Do we need to use Zigbee protocol to send data through BT24??

You need to read about bluetooth profiles.

Thanks a lot J-M-L
It's working

Great news :slight_smile: