HM-10 signal delay

Hey guys I’m still fairly new to Arduino, but things are going really well. I ran into an issue and I think I know what it is, but I want opinions from folks who know more than I do.

I have my Arduino set up to connect to my iPhone over a BLE connection using an HM-10 breakout module. It works great and I can send commands from my phone (currently testing with LightBlue app).

The problem is that I have noticed a delay in the response time after I send a command. (around 1/2 sec) I really need a MUCH faster response if I am going to be able to drive a robot over Bluetooth. Also because of the delay, if I send commands too quickly they get jumbled up.
I think the delay is in the HM-10, but I’m not sure. Maybe I need to change my settings?

Also, does anyone know how to detect signal loss on the HM-10? I want to stop motors if the signal is lost, but haven’t figured that out yet.
Please let me know what you think.

I attached my HM-10 configuration code:

/*
 *  Configuration sketch for HM-10 BLE Module
 *  This sketch allows you to send AT commands to your HM-10
 * 
 *  Corey Wilkes
 *  July 2015
 * 
 *  Available commands:
 *    Command         Response              Purpose                       Parameters
 *    AT              OK                    Connection Test               None
 *    AT+BAUD?        OK+Get[0-8]           Get Baud Rate                 0=9600, 1=19200, 3=38400, 3=57600, 4=115200, 5=4800, 6=2400, 7=1200, 8=230400
 *    AT+BAUD[0-8]    OK+SET[0-8]           Set Baud Rate                 0=9600, 1=19200, 3=38400, 3=57600, 4=115200, 5=4800, 6=2400, 7=1200, 8=230400
 *    AT+CLEAR        OK+CLEAR              Clear Last Connected Device   None
 *    AT+NAME?        OK+NAME[Str]          Get Device Name               String of max length 12
 *    AT+NAME[Str]    OK+SET[Str]           Set Device Name               String of max length 12
 *    AT+PASS?        OK+GET[#]             Get Device Password           Integer 000000-999999
 *    AT+PASS[#]      OK+SET[#]             Set Device Password           Integer 000000-999999
 *    AT+POWE?        OK+GET[0-3]           Get Transmit Power            0=-23dbm, 1=-6dbm, 2=0dbm, 3=6dbm
 *    AT+POWE[0-3]    OK+SET[0-3]           Set Transmit Power            0=-23dbm, 1=-6dbm, 2=0dbm, 3=6dbm
 *    AT+PWRM?        OK+GET[0-1]           Get Sleep Mode                0=Auto Sleep, 1=Always On
 *    AT+PWRM[0-1]    OK+SET[0-1]           Set Sleep Mode                0=Auto Sleep, 1=Always On
 *    AT+RENEW        OK+RENEW              Restore Factory Setup         None
 *    AT+RESET        OK+RESET              Reset Module                  None
 *    AT+ROLE?        OK+GET[0-1]           Get Module Role               0=Slave, 1=Master
 *    AT+ROLE[0-1]    OK+SET[0-1]           Set Module Role               0=Slave, 1=Master
 *    AT+SLEEP        OK+SLEEP              Put In Sleep Mode             None
 *    AT+VERS?        [Str]                 Get Version Info              String Version Info
 *  
*/


#include <SoftwareSerial.h>

SoftwareSerial HM10(13, 12); //HM10(Transmit Pin, Receive Pin) -This assumes that the BLE TX to pin 13 and RX to pin 12. Any digital pins may be used.

void setup()
{
  Serial.begin(9600);  // Begin the Serial Monitor connection at 9600bps
  HM10.begin(9600);  // Begin the HM-10 connection at 9600bps
}

void loop()
{
  if (HM10.available()) // Read from HM-10 and send to Serial Monitor
    Serial.write(HM10.read());
  
  if (Serial.available()) // Read from Serial Monitor and send to HM-10
    HM10.write(Serial.read());
}

And my motor controller code:

/*   
 *   Control PWM motors with commands over BLE with HM-10 module
 *   
 *   Corey Wilkes
 *   July 2015
 *   
 *   Expected command syntax LeftMotorSpeed,RightMotorSpeed "90,90"
 *   Motor speeds are based on PWM servo. 0=Full Reverse, 90=Stop, 180=Full Forward
 *   
 */

#include <SoftwareSerial.h>
#include <Servo.h>

SoftwareSerial BLE(13, 12); //BLE(TxPin, RxPin)
Servo LeftMotor;
Servo RightMotor;

void setup() {
  Serial.begin(9600);   // Begin the Serial Monitor connection at 9600bps
  BLE.begin(9600);      // Begin the BLE connection at 9600bps

  LeftMotor.attach(3);    //Set Left Motor Pin
  RightMotor.attach(5);   //Set Right Motor Pin
  
  MotorSet(90,90);        //Set motors to STOP
}

void loop() {
  if (BLE.available())    // Read from HM-10 and parse motor speeds
    MotorSet(BLE.parseInt(),BLE.parseInt());

//  if (SignalLostTest??)   //Test for signal loss
//    MotorSet(90,90);      //Set motors to STOP
}

void MotorSet(int LeftMotorSpeed, int RightMotorSpeed) {
  if(LeftMotorSpeed > 86 &&  LeftMotorSpeed < 94)   //Set left motor dead zone
    LeftMotorSpeed = 90;
  if(RightMotorSpeed > 86 &&  RightMotorSpeed < 94) //Set right motor dead zone
    RightMotorSpeed = 90;
  
  Serial.print(LeftMotorSpeed);   //Print values to Serial Monitor
  Serial.print(",");
  Serial.println(RightMotorSpeed);
  
  LeftMotor.write(LeftMotorSpeed);      //Set Left speed
  RightMotor.write(RightMotorSpeed);    //Set Right speed
}

Hey folks, I'm using an HM-10 module to transfer data and I've gotten it to work, but it only sends the data once every half second. I am guessing it's something in the settings in the module. It would be nice if it would continuously stream data.

Any ideas on how to fix it?

I am guessing it's something in the settings in the module.

Or your code.

Any ideas on how to fix it?

Step 1: Identify the problem.

PaulS: Step 1: Identify the problem.

And that is the least helpful response ever.

If you think it might be my code, feel free to look it over here:

http://forum.arduino.cc/index.php?topic=337896.msg2329356#msg2329356

Again, I think there is something in the HM-10 setting such that it only passes data once every half second, but I can't find where to change it.

If you think it might be my code, feel free to look it over here:

Why have you started another thread on the same topic?

I did not get any response on my other post. I figured I needed to ask my question a different way.

All I want is to figure out why the module I have only passes the serial data once every half second.

I think it's probably something simple, but I have done numerous searches and not found anything. I am sure someone has run into this problem before.

Hello, I pick up this thread again. Did someone SOLVED this problem? :) B.R. Tommy