Serial RC Delay through bluetooth

Post Reply
JinGuZi
Posts: 3
Joined: Mon Aug 26, 2013 2:09 pm

Serial RC Delay through bluetooth

Post 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?
Last edited by JinGuZi on Fri Sep 06, 2013 2:13 am, edited 1 time in total.

crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: Serial RC Delay through bluetooth

Post 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

JinGuZi
Posts: 3
Joined: Mon Aug 26, 2013 2:09 pm

Re: Serial RC Delay through bluetooth

Post 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

crashlander
Posts: 506
Joined: Thu May 05, 2011 8:13 am
Location: Slovenia

Re: Serial RC Delay through bluetooth

Post 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

JinGuZi
Posts: 3
Joined: Mon Aug 26, 2013 2:09 pm

Re: Serial RC Delay through bluetooth

Post 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

Post Reply