Two BLUEDUINO arduino transparent COMMUNICATION


#1

Hi,
I´m trying to communicate a “number” from master to an other slave.

AT commands works fine.

Master: i do it via “serial1” on setup (and same at commands to connect specific address)
in the loop the code if-do send a “number” with serial1.write
Slave: loop with if serial.read

Thats worked with hm10 but now not works on blueduino.

Maybe this is a wrong way and there is an example or sketch more simply to send numbers to an other blueduino.

THANKS!


#2

could you please share the sketchs for Master and Slave?


#3

this is the basic code for communication (i copy some pieces)
The master is a sensor and the slave its a rgb led

MASTER

void setup()
{
  // initialize the serial communications:
  Serial1.begin(9600);
  Serial.begin(9600);
   /*  while (!Serial) {
        ; // wait for serial port to connect. Needed for Leonardo only
      }*/

    Serial.println("Hello BlueDuino!");

 delay(1000);
 Serial1.write("AT\r\n");//"AT\r\n"
 delay(1000);

 Serial1.write("AT+CONN5460099BE0FF\r\n");
 delay(2000);
}

void loop()
{
 if (analogRead(ypin) > 550 && analogRead(ypin) < 620  ) {
     {  
   Serial1.write('1');
delay(250);
   }

SLAVE

void setup()
{ 
    Serial.begin(9600);
    Serial1.begin(9600); 
    while (!Serial) {
        ; // wait for serial port to connect. Needed for Leonardo only
    }

    Serial.println("Hello BlueDuino!");

   void loop() 
{
char c=Serial1.read();
        
         if(c=='1') 
         
         {Serial.print("der");
    leds.setPixelColor(5,255, 70, 0);
}

#4

Please try the sketch hardwareSerialMonitor and check the firmware version first.

AT+VERS?

Is the firmware version v2.2.1?


#5

NO, ITs a version 2.1.7


#6

I suggest you upgrade firmware to latest v2.2.3 first. The firmware fixed many bugs.


#7

well, i was thinking on, but now, only have a MAC os.
Is there any simple way to upgrade by mac? i saw the tutorial but now don’t
have a emulator, maybe my old XP :slight_smile: :wink:

Thanks
ill write soon


#8

Please try with VituralBox and windows first. But it’s not tested yet


#9

finally i´m trying upgrade by a pc. But i don’t now if its necessary connect with FTDI cable (o UART converter) by jumpers or i can run directly with the USB and SerialBootTool. (im do it with usb only)
(with arduino connect and upload the sketches, no problem, but the serialBootT can’t connect to upload firm zero 2.2.1)

The AT+SBLUP command put the module in upgrade mode for ever? i suppose is not necessary re-upload the empty sketch or restart blueduino for try again to upgrade with serial.

only one doubt more: if i buy new ones have de latest firm? (i bought the others on Tindie.

thanks a lot!


#10

finally i´m trying upgrade by a pc. But i don’t now if its necessary connect with FTDI cable (o UART converter) by jumpers

The serial1 wired to serial port of BLE module directly. It need UART converter to communicate with BLE module.

only one doubt more: if i buy new ones have de latest firm? (i bought the others on Tindie.

Yes. new ones are coming with latest firmware


#11

upgraded to 2.2.1! or its better the latest vers?


#12

not work, i´ve to do it something else to connect? don’t need the password?

MASTER

void setup()
{
  // initialize the serial communications:
  Serial1.begin(9600);
  Serial.begin(9600);
   /*  while (!Serial) {
        ; // wait for serial port to connect. Needed for Leonardo only
      }*/

    Serial.println("Hello BlueDuino!");
  delay(1000);
 Serial1.write("AT\r\n");//"AT\r\n"
 delay(1000);

 Serial1.write("AT+CONN987BF360574E\r\n");
 delay(2000);
}

void loop()
{ Serial1.write('1');
   delay(250);
   }

SLAVE

void setup()
{ 
    Serial.begin(9600);
    Serial1.begin(9600); 
    while (!Serial) {
        ; // wait for serial port to connect. Needed for Leonardo only
    }

    Serial.println("Hello BlueDuino!");

void loop() 
{
 char c=Serial1.read();
        
         if(c=='1') 
         
         {leds.setPixelColor(5,255, 70, 0);
}

#13

Please upload the sketch hardwareSerialMonitor to Master, and type the at command manual first.

You should got OK+CONN if connected


#14


#15

Yes. You can send strings in the serial monitor. The slave should get these strings in its serial monitor.


#16

since upgrade,wen turn on, the first at message is this

,

i´ll tried to test sending and receive by serial monitor connecting by two computer.


#17

i connect the two blueduinos by two computers with serial monitors opened.

1, print to slave AT, response OK. print on master AT+CONxxxx… and response OK+CONN, after that the slave not response to at commands, i think that connection si suscessfull, both connected. all s good.

2, print on master “hello”, the slave dont print anything on the slave´s monitor.
i tried by write to send:
hello
hello\r\n
"hello\r\n"
1

nothing write on slave´s monitor

I close both monitors an open again…print on master hello…an the slave receive and print hello!!
IT WORKS!
sending by monitor it´s not necesary to write “” or \r\n and print the diferent mesages and numbers jumping to next line, thats so good. i supose that in the sketch i have to write "xxx\r\n

Now,i turn off both and turn on, open the monitors and write on slave "AT+ADDR?, on the master AT+CONNxxx…waiting some seconds…IT WORKS

is possible that the delay time after AT+CONN (2000)2sec its a short time
maybe on the slave i have to write some at commands like “AT” or AT+ADDR?

if i write on slave any at commans after connecting it response AT+LOST and disconnect, but the master continue no accept at commands

this proyect and blueduino will make me crazy…i cant understand :slight_smile:

Im triying, ill write if i have news.
thanks


#18

Thanks for reporting the issue. I’ll try to repeat it at my side.


#19

If you write command AT at both side, you will get AT+LOST. The command AT do check status and disconnect together.

We also tested other at commands such as AT+VERS? and AT+ADDR?. They works.


#20

Yeah! All works fine now, i think that the problem was the waiting code for the serial monitor and i was thinking if i reset the blueduino restart the bluetooth module too,(that’s false), now, by battery and turn on the slave before, connects with AT commands on arduino code without problems.