Communicationg two Arduinos via bluetooth whitout using Rx/Tx pins

Hello guys,
I am working on a project which involves transfering measured data from one Arduino to anotherone. I've tried using <SoftwareSerial.h> library but the problem is this library uses Rx/Tx pins of Arduinos and I'm not able to check the values via serial terminal of my computer connected to second Arduino. Here is my question: How we can use bluetooth and serial comm at the same?
Thanks for your your time and appreciated for your help

Assume you have UNO and NANO stup.

1. Connect Serial Monitor-1 of UNO using its hardware UART port (UART Port) with PC.

2. Connect Bluetooth-1 with UNO using Softaware UART Port (SUART Port).

3. Conncet Bluetooth-2 with NANO using SUART port.

4. Connect Serial Monitor-2 of NANO using its UART Port with the same PC of Step-1.

5. The following diagram depicts a typical connection using SUART Ports.

Thanks Mostafa, this schema helps me lot. Could you tell me which library i should use in my sketch. is <SoftwareSerial.h> still usable?
Thanks again

Alidan:
I've tried using <SoftwareSerial.h> library but the problem is this library uses Rx/Tx pins of Arduinos

This is incorrect. The whole point of the SoftwareSerial library is that it allows you to create a serial port on other pins. Please see the documentation for the library:
https://www.arduino.cc/en/Reference/SoftwareSerial
and the example sketches:
https://www.arduino.cc/en/Tutorial/LibraryExamples#software-serial

Alidan:
Thanks Mostafa, this schema helps me lot. Could you tell me which library i should use in my sketch. is <SoftwareSerial.h> still usable?

Yes!

1. To create a Software UART Port (SUART Port), you just include the following lines at the appropriate places.

#include<SoftwareSerial.h>  //this is already there in your PC/IDE
SoftwareSerial SUART(2, 3);  //DPin-2 works as SRX-pin of SUART; DPin-3 = STX
SUART.begin(9600);

2. All commnads, functions/methods of UART Port are equally applicable for SUART Port except that the void serialEvent(){} handler is attached with UART Port.

3. The following diagram may help you to visualize data flow among two UART devices.
uart-9y1.png

uart-9y1.png

Thanks Mostafa. I found your other posts regarding SUART and it perfectly works. But now I have other issue ! when I try with a test prog it works well but when I add SUART sections to my main sketch, I can't see them correctly in my second terminal's serial monitor. Could you please, help me get rid of this issue?
My code for sending data:

#include <Wire.h>
#include <SoftwareSerial.h>
/-----( Declare Constants and Pin Numbers )-----/
#define SSerialRX 10
#define SSerialTX 11
#define Pin13LED 13
/-----( Declare objects )-----/
SoftwareSerial mySerial(SSerialRX, SSerialTX); // RX, TX
/-----( Declare Variables )-----/
int byteReceived;
int byteSend;
int bigNum=0;
int bigNum1=0;
byte a,b,c,d,E,F,G,H;

void setup() {
Wire.begin(); // join i2c bus (address optional for master)
Serial.begin(9600); // start serial for output
pinMode(Pin13LED, OUTPUT);
// Start the software serial port, to another device
mySerial.begin(9600); // set the data rate
}//--(end setup )---

void loop()
{
Wire.requestFrom(8,8);

a = Wire.read();
b = Wire.read();
c = Wire.read();
d = Wire.read();
E = Wire.read();
F = Wire.read();
G = Wire.read();
H = Wire.read();
bigNum = a;
bigNum = (bigNum << 8) | b;
bigNum = (bigNum << 8) | c;
bigNum = (bigNum << 8) | d;
bigNum1 = E;
bigNum1 = (bigNum1 << 8) | F;
bigNum1 = (bigNum1 << 8) | G;
bigNum1 = (bigNum1 << 8) | H;
Serial.print("Reading_scale#1: ");
Serial.print(bigNum);
Serial.print("gr");
Serial.print(" \t\t");
Serial.print("Reading_scale#2: ");
Serial.print(bigNum1);
Serial.print("gr");
Serial.print("\n");
digitalWrite(Pin13LED, HIGH); // Show activity
if (mySerial.available()) //Look for data from other Arduino
{
digitalWrite(Pin13LED, HIGH); // Show activity
mySerial.write(bigNum); // Read received byte
Serial.println("Data sending"); // Show on Serial Monitor
delay(10);
digitalWrite(Pin13LED, LOW); // Show activity
}
delay(100);
}

my code for receiving data:
/-----( Import needed libraries )-----/
#include <SoftwareSerial.h>
/-----( Declare Constants and Pin Numbers )-----/
#define SSerialRX 10
#define SSerialTX 11
#define Pin13LED 13
/-----( Declare objects )-----/
SoftwareSerial mySerial(SSerialRX, SSerialTX); // RX, TX
/-----( Declare Variables )-----/
int byteReceived;
int32_t byteSend;
void setup() /****** SETUP: RUNS ONCE ******/
{
// Start the built-in serial port, probably to Serial Monitor
Serial.begin(9600);
pinMode(Pin13LED, OUTPUT);

// Start the software serial port, to another device
mySerial.begin(9600); // set the data rate

}//--(end setup )---

void loop() /****** LOOP: RUNS CONSTANTLY ******/
{

if (mySerial.available()) //Look for data from other Arduino
{
digitalWrite(Pin13LED, HIGH); // Show activity
byteSend = mySerial.read(); // Read received byte
Serial.write(byteSend); // Show on Serial Monitor
delay(10);
digitalWrite(Pin13LED, LOW); // Show activity
}
delay(25);
}//--(end main loop )---

/-----( Declare User-written Functions )-----/

//NONE
//( THE END )**

You are mixing up two data types viz., byte and int without proper casting. Please, read this post and see how data can get lost if proper casting is not made. In the meantine, plase remember the following rules while ORing or ANDing data of different sizes:

1. You have: int bigNum anf int bigNum1

2. You have byte a, b,c, d, A, B, C, D

3. You are doing:
(1) bigNum = a; //fine a will fit into bigNum

**(2)**bigNum = bigNum << 8 | b; Are you doing right?

Say, bigNum = 0x1234 anf b= 0x67. You are shifting it (bigNum) to left by 8-bit, and you are expecting 123400; when, it is ORed with b, you expect 123467 which is 24-bit. I think that you will come up with 3467. How and why?

Remember: Assume you are using UNO
Arduino UNO uses 16-bit 'processing buffer' for data manipulation. If you get a result that comes up as greater than 16-bit after manipulation (as you have done above), the lower 16-bit of the result will be kept; all the upper bits of the result will get lost. The solution is to tell the UNO (aka casting) to expand the processing buffer size.

int32_t bigNum = (int32_t)bigNum <<8 | b; //now bigNum holds: 00123467

Hope, you have got the point!

I've read your post about converting and sizing data and I've got your point.
I tried this method. The thing is the values I received via I2C and I transferred to the the same serial terminal are good, but when I transfer them via "SoftwareSerial" (Bluetooth medium), the data are confused. I appreciate,If you take a look at the screenshot!
Thanks

@OP

Please, post your complete codes using code tags (</>). It is very very hard for me to understand anything from the screenshots that you have attached.

Sketch for Arduino UNO, Geting two int (bigNum, bigNum1) from I2C bus and send them to the second Arduino UNO by SUART (pin10, pin 11

#include <Wire.h>
#include <SoftwareSerial.h>
/*-----( Declare Constants and Pin Numbers )-----*/
#define SSerialRX 10
#define SSerialTX 11
#define Pin13LED  13

/*-----( Declare objects )-----*/
SoftwareSerial mySerial(SSerialRX, SSerialTX); // RX, TX
/*-----( Declare Variables )-----*/

 int32_t bigNum=0;
 int32_t bigNum1=0; 
 byte a,b,c,d,E,F,G,H;

void setup() {
  Wire.begin();        // join i2c bus (address optional for master)
  Serial.begin(9600);  // start serial for output
  pinMode(Pin13LED, OUTPUT);     
  // Start the software serial port, to another device
  mySerial.begin(9600);   // set the data rate 
}//--(end setup )---

void loop()
{
Wire.requestFrom(8,8);
 
a = Wire.read();
b = Wire.read();
c = Wire.read();
d = Wire.read();
E = Wire.read();
F = Wire.read();
G = Wire.read();
H = Wire.read(); 
int32_t bigNum = a;
 bigNum = (bigNum << 8) | b;
 bigNum = (bigNum << 8) | c;
 bigNum = (bigNum << 8) | d;
 int32_t bigNum1 = E;
 bigNum1 = (bigNum1 << 8) | F;
 bigNum1 = (bigNum1 << 8) | G;
 bigNum1 = (bigNum1 << 8) | H;
 Serial.print("Reading_scale#1: ");
 Serial.print(bigNum);
 Serial.print("gr");
 Serial.print(" \t\t");
 Serial.print("Reading_scale#2: ");
 Serial.print(bigNum1);
 Serial.print("gr");
 Serial.print("\n");
 digitalWrite(Pin13LED, HIGH);  // Show activity
  if (mySerial.available())  //Look for data from other Arduino
   {
    digitalWrite(Pin13LED, HIGH);  // Show activity
    Serial.println("Data sending");    // Show on Serial Monitor
    mySerial.write((int32_t)bigNum);    // Read received byte
    Serial.println((int32_t)bigNum);
        delay(10);
    digitalWrite(Pin13LED, LOW);  // Show activity   
   }
 delay(100); 
}

Sketch for second Arduino which receive only one data for now (bigNum)

/ 
*/

/*-----( Import needed libraries )-----*/
#include <SoftwareSerial.h>
/*-----( Declare Constants and Pin Numbers )-----*/
#define SSerialRX 10
#define SSerialTX 11
#define Pin13LED  13
/*-----( Declare objects )-----*/
SoftwareSerial mySerial(SSerialRX, SSerialTX); // RX, TX
/*-----( Declare Variables )-----*/
int32_t byteReceived;
int32_t byteSend;
void setup()   /****** SETUP: RUNS ONCE ******/
{
  // Start the built-in serial port, probably to Serial Monitor
  Serial.begin(9600);
  
  pinMode(Pin13LED, OUTPUT);

  // Start the software serial port, to another device
  mySerial.begin(9600);   // set the data rate 

}//--(end setup )---


void loop()   /****** LOOP: RUNS CONSTANTLY ******/
{
    
  if (mySerial.available())  //Look for data from other Arduino
   {
    
    digitalWrite(Pin13LED, HIGH);  // Show activity
   int32_t byteSend = mySerial.read();    // Read received byte
    Serial.write((int32_t)byteSend);        // Show on Serial Monitor
    delay(10);
    digitalWrite(Pin13LED, LOW);  // Show activity   
   }

}//--(end main loop )---

@Alidan

1. Look at the slight change that I have on your sender codes:

#include <Wire.h>
#include <SoftwareSerial.h>
/*-----( Declare Constants and Pin Numbers )-----*/
#define SSerialRX 10
#define SSerialTX 11
#define Pin13LED  13

/*-----( Declare objects )-----*/
SoftwareSerial mySerial(SSerialRX, SSerialTX); // RX, TX
/*-----( Declare Variables )-----*/

int32_t bigNum = 0;
int32_t bigNum1 = 0;
byte a, b, c, d, E, F, G, H;

void setup() 
{
  Wire.begin();        // join i2c bus (address optional for master)
  Serial.begin(9600);  // start serial for output
  pinMode(Pin13LED, OUTPUT);
  pinMode(Pin13LED, LOW);   //Led is OFF
  // Start the software serial port, to another device
  mySerial.begin(9600);   // set the data rate
}//--(end setup )---

void loop()
{
  Wire.requestFrom(8, 8);  //requesting b-byte from I2C Slave

  a = Wire.read();  //8-bit
  b = Wire.read();
  c = Wire.read();
  d = Wire.read();
  E = Wire.read();
  F = Wire.read();
  G = Wire.read();
  H = Wire.read();
  
  int32_t bigNum = (int32_t)a;        //ask for 32-bit 'temporary processing buffer)
  int64_t bigNum = (int64_t)(bigNum << 8) | (int64_t)b;
  bigNum = (bigNum << 8) | (int64_t)c;
  bigNum = (bigNum << 8) | (int64_t)d;
  int32_t bigNum1 = (int32_t)E;
  int64_t bigNum1 = (int64_t)(bigNum1 << 8) | (int64_t)F;
  bigNum1 = (bigNum1 << 8) | (int64_t)G;
  bigNum1 = (bigNum1 << 8) | (int64_t)H;
  Serial.print("Reading_scale#1: ");
  Serial.print(bigNum);
  Serial.print("gr");
  Serial.print(" \t\t");
  Serial.print("Reading_scale#2: ");
  Serial.print(bigNum1);
  Serial.print("gr");
  Serial.print("\n");
  digitalWrite(Pin13LED, HIGH);  // Show activity
  if (mySerial.available())  //Look for data from other Arduino
  {
    digitalWrite(Pin13LED, HIGH);  // Show activity
    Serial.println("Data sending");    // Show on Serial Monitor
    //mySerial.write((int32_t)bigNum);    // Read received byte
    //.write() method accepts 8-bit data (1-byte)
    mySerial.print(bigNum); //  8-byte
    Serial.println(bigNum);//(int32_t)bigNum);
    delay(10);
    digitalWrite(Pin13LED, LOW);  // Show activity
  }
  delay(100);
}

2. Look at the slight change that I have made on your receiver codes:

/
* /

/*-----( Import needed libraries )-----*/
#include <SoftwareSerial.h>
/*-----( Declare Constants and Pin Numbers )-----*/
#define SSerialRX 10
#define SSerialTX 11
#define Pin13LED  13
/*-----( Declare objects )-----*/
SoftwareSerial mySerial(SSerialRX, SSerialTX); // RX, TX
/*-----( Declare Variables )-----*/
int32_t byteReceived;
byte byteSend;//int32_t byteSend;
void setup()   /****** SETUP: RUNS ONCE ******/
{
  // Start the built-in serial port, probably to Serial Monitor
  Serial.begin(9600);

  pinMode(Pin13LED, OUTPUT);

  // Start the software serial port, to another device
  mySerial.begin(9600);   // set the data rate

}//--(end setup )---


void loop()   /****** LOOP: RUNS CONSTANTLY ******/
{

  if (mySerial.available())  //Look for data from other Arduino
  {

    digitalWrite(Pin13LED, HIGH);  // Show activity
    byteSend = mySerial.read();    // Read received byte
    Serial.write((char)byteSend);        // Show on Serial Monitor
    //delay(10);
    digitalWrite(Pin13LED, LOW);  // Show activity
  }

}//--(end main loop )---

3. Please, post the results.

Thanks. But skecth got stock while compiling. IDE returns couple of errors regarding the size!

sketch_mar12a.ino:42:11: error: conflicting declaration 'int64_t bigNum'
sketch_mar12a.ino:41:11: error: 'bigNum' has a previous declaration as 'int32_t bigNum'
sketch_mar12a.ino:46:11: error: conflicting declaration 'int64_t bigNum1'
sketch_mar12a.ino:45:11: error: 'bigNum1' has a previous declaration as 'int32_t bigNum1'
Error compiling.

I tried to transfer values in to termperoray variables but it gives back another issue:


D:\arduino-1.6.3\hardware\arduino\avr\cores\arduino/Print.h:78:12: note: size_t Print::println(long unsigned int, int)
     size_t println(unsigned long, int = DEC);
            ^
D:\arduino-1.6.3\hardware\arduino\avr\cores\arduino/Print.h:79:12: note: size_t Print::println(double, int)
     size_t println(double, int = 2);
            ^
Error compiling.

Thanks your attention an your helps

Please, look at the data size and the number of bits you are shifting. And accordingly, do cast to retain the useful part of the operand/result. For example:

#include <Wire.h>
#include <SoftwareSerial.h>
/*-----( Declare Constants and Pin Numbers )-----*/
#define SSerialRX 10
#define SSerialTX 11
#define Pin13LED  13

/*-----( Declare objects )-----*/
SoftwareSerial mySerial(SSerialRX, SSerialTX); // RX, TX
/*-----( Declare Variables )-----*/

int32_t bigNum = 0;
int32_t bigNum1 = 0;
byte a, b, c, d, E, F, G, H;

void setup() 
{
  Wire.begin();        // join i2c bus (address optional for master)
  Serial.begin(9600);  // start serial for output
  pinMode(Pin13LED, OUTPUT);
  pinMode(Pin13LED, LOW);   //Led is OFF
  // Start the software serial port, to another device
  mySerial.begin(9600);   // set the data rate
}//--(end setup )---

void loop()
{
  Wire.requestFrom(8, 8);  //requesting b-byte from I2C Slave

  a = Wire.read();  //8-bit
  b = Wire.read();
  c = Wire.read();
  d = Wire.read();
  E = Wire.read();
  F = Wire.read();
  G = Wire.read();
  H = Wire.read();
  
  bigNum = (int32_t)a;        //ask for 32-bit 'temporary processing buffer)
  bigNum = (int32_t)(bigNum << 8) | (int64_t)b;
  bigNum = (bigNum << 8) | (int32_t)c;
  bigNum = (bigNum << 8) | (int32_t)d;
  bigNum1 = (int32_t)E;
  bigNum1 = (int32_t)(bigNum1 << 8) | (int32_t)F;
  bigNum1 = (bigNum1 << 8) | (int32_t)G;
  bigNum1 = (bigNum1 << 8) | (int32_t)H;
  Serial.print("Reading_scale#1: ");
  Serial.print(bigNum);
  Serial.print("gr");
  Serial.print(" \t\t");
  Serial.print("Reading_scale#2: ");
  Serial.print(bigNum1);
  Serial.print("gr");
  Serial.print("\n");
  digitalWrite(Pin13LED, HIGH);  // Show activity
  if (mySerial.available())  //Look for data from other Arduino
  {
    digitalWrite(Pin13LED, HIGH);  // Show activity
    Serial.println("Data sending");    // Show on Serial Monitor
    //mySerial.write((int32_t)bigNum);    // Read received byte
    //.write() method accepts 8-bit data (1-byte)
    mySerial.print(bigNum); //  8-byte
    Serial.println(bigNum);//(int32_t)bigNum);
    delay(10);
    digitalWrite(Pin13LED, LOW);  // Show activity
  }
  delay(100);
}