Page 1 of 1

Serial RC Delay through bluetooth

Posted: Tue Sep 03, 2013 3:55 am
by JinGuZi
Hi, guys.

I have a MWC board of atmega32U4 (PROMICRO).

The board has an USB and a serial, and I want to add an Blutooth module to serial port and control MWC through mobile phone.

In fact, I've did that, adding a bluetooth to the serial port, sending serial RC command RC MSP_SET_RAW_RC from mobile phone bluetooth, and the board responses the serial RC command, but the control delay is unacceptable,almost 90s when I send the command in 30FPS.

When decreasing the speed of sending MSP_SET_RAW_RC command, and the control delay is also decreased, the delay is about 100ms when in 3FPS that not suitable for a good flight. :(

After reading the code of MWC Serial, I realized that maybe the serial communication task is too heavy for ATMega32U4, If you send serial data too fast,
the MCU is busying in handling serial RX interrupt. But I'm still not sure, since the data stream is small(8 bytes per frame).

Does anyone have ideas about that?

Re: Serial RC Delay through bluetooth

Posted: Tue Sep 03, 2013 7:59 am
by crashlander
Hello,
delay is result of BT switching (half duplex).
There are many threads (search RCSERIAL, computer control, APC802, Shuncom, UART Radio project..) where most of us are using that feature.

Regards
Andrej

Re: Serial RC Delay through bluetooth

Posted: Wed Sep 04, 2013 12:13 pm
by JinGuZi
crashlander wrote:Hello,
delay is result of BT switching (half duplex).
There are many threads (search RCSERIAL, computer control, APC802, Shuncom, UART Radio project..) where most of us are using that feature.

Regards
Andrej


Andrej, thank you for your reply.

I think delay of BT switching is very low, and I did a test:

MWC PROMICRO(ATmega32U4)) board runs the Arduino code

Code: Select all

void setup(){
  Serial.begin(115200);
  Serial1.begin(9600);
}

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


The bluetooth module communicated with PROMICRO board through Serial1 at 9600bps, then I let mobile send data("mwcpackage%d") to the BT at 50Hz.

From Arduino IDE serial monitor, I seed that the board getted data from mobile quickly:
...
mwcpackage4398
mwcpackage4399
mwcpackage4400
mwcpackage4401
mwcpackage4402
..


And I did an another test in an Atmega328p MWC board:
Adding an Blutooth module to serial port and controlling MWC through mobile phone.

The result is the same with Atmega32u4 MWC board: the control delay is unacceptable.


Regards

JinGuZi

Re: Serial RC Delay through bluetooth

Posted: Wed Sep 04, 2013 3:19 pm
by crashlander
Proper MWII communication is calenge-response based (every MSP requests get its MSP replay) so it is duplex (your test seems to be one way only?).
And as you can see from other posts atmega 328 has no issues of handling full flight controlling (ACC+GYRO+COMPASS+BARO) plus constant MSP_SET_RAW_RC.

Regards
Andrej

Re: Serial RC Delay through bluetooth

Posted: Tue Sep 10, 2013 8:58 am
by JinGuZi
Andrej, yeah,just as your said, the delay was from BT. My last test is one way only.
After changing another BT module, the control delay was wee in 30HZ. My test is in atmega32u4 board with ACC GYRO COMPASS BARO.

Thank you.

Regards

JinGuZi