SoftwareSerial help

So I’ve decided for my project I need two bluetooth modules to be used.

1: Receive data from another Arduino board
2: Broadcast Ardunio Board 1’s data and Arduino Board 2’s data together.

I found SoftwareSerial and it seemed like the solution but I can’t get it to work for me at all.

I have 3 HC-06 modules but atm I’m just trying to use 1 and get data from it.

Using this example

#include <SoftwareSerial.h>



SoftwareSerial mySerial(2, 3); // RX, TX

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


  Serial.println("Goodnight moon!");

  // set the data rate for the SoftwareSerial port
  mySerial.begin(4800);
  mySerial.println("Hello, world?");
}

void loop() { // run over and over
  if (mySerial.available()) {
    Serial.write(mySerial.read());
  }
  if (Serial.available()) {
    mySerial.write(Serial.read());
  }
}

I have +5 Going to my VCC, GND going to GND, Digital 02 = RXD, Digital 03 = TXD.

Even in my Serial Monitor via Arduino I can’t see “Hello, world?” it comes out as gibberish “ÿÿÿþ” is what I see when I run Serial Monitor on baud rate 4800. If I use the 57600 BAUD rate I can see the “Goodnight Moon!” text.

Thanks for the help!

Well your Serial line is connected through USB to your PC and the arduino serial console. So as you do
  Serial.begin(57600); this is what you need to set your arduino console to and that’s why you see the result of your Serial.print() there at that baud rate

Your software serial port is trying to data to the BT module. The BT module needs to be paired with another BT element (a master). Once they are paired if you open a serial terminal emulation (Putty) on the Bluetooth port this is where you will see your Bluetooth communication (when that will work because you have another bug possibly)

You state

Digital 02 = RXD, Digital 03 = TXD

When you do SoftwareSerial mySerial (rxPin, txPin);, rxPin is the pin on which to receive serial data (so connect to the TX of the module) and txPin is the pin on which to transmit serial data (so connected to the RX pin of the module)
→ Can you clarify if you mean you connected pin2 of the arduino to the RX pin of your HC-06? that would be wrong

Have you checked if your module is 5V compatible? many BT module are only 3.3V logic levels. sending 5V into the Rx pin of the module might damage it

For your longer term project, HC-06 can only be a BT slave. where will the master be?

Yes, Digital 2 = RX on the HC-06.

Now when you say it can only be slave, what do you mean?

Because I've used this module on the Digital 0/1 (TX/RX) pins and could grab that data on my phone through Putty via Serial.

I guess I'll explain what is going on..

Arduino 01 = Slave (As far as my imagination see its)

A0 = DHT11 Sensor (I grab Temp/Humidity from it) D10, D11, D12, D13 = BME280 Sensor (I grab Barometric Pressure from it) D01, D02 = HC-06

Arduino 01 sends its data out 24/7 to Arduino 2 via Bluetooth (Haven't gotten that far yet, but doable I imagine)

Arduino 02 = Master

A0 = DHT11 Sensor (I grab Temp/Humidity from it) D10, D11, D12, D13 = BME280 Sensor (I grab Barometric Pressure from it) D02, D03 = HC-06 (Is going to be setup as the receiver only, getting data from Arduino 01) D06, D07 = HC-06 (Transmitter to phone/Putty)

Hope that helps!

But all I'm doing right now is this:

Arduino 03

A0 = DHT11 Sensor (Unused in example) D02, D03 = HC-06

And I want to just send a "I am alive" type of text out 24/7 through that HC-06 that I can capture in Putty.

Read again my post above I was editing when you typed

Arduino 01 sends its data out 24/7 to Arduino 2 via Bluetooth (Haven't gotten that far yet, but doable I imagine)

--> no because you need a master and HC-06 can't be a master, just a slave.

And I can't programatically tell Arduino 01's HC-06 to pair to Arduni 02's D02, D03 HC-06?

No because one need to be the master for pairing. You can't pair 2 slaves. You need an HC-05 (as they can do both slave and masterP