Unable to send data with Quectel BC660 + Arduino: aways empty response

I am trying to send data using Quectel and Arduino together. When trying the same commands just with the BC660 module and QCOM I get the OK responses and I can send the data. But when trying to use it with Arduino, the response is always empty and the data never sent.

The connections are:

  • Arduino pin 7 to MCU_TX
  • Arduino pin 8 to MCU_RX
  • GNDs

And the code is:
`
#include <SoftwareSerial.h>

#define DEBUG true

// Define software serial pins
SoftwareSerial lteSerial(7, 8); // RX, TX

const int flowSensorPin = 5;
volatile int flowPulseCount;

unsigned long previousMillis = 0; // will store last time data was sent
const long interval = 5000; // interval at which to send data (milliseconds)

// ThingSpeak Settings
const String apiKey = “…”;

void setup() {

lteSerial.begin(9600);
Serial.begin(9600);

sendData(“AT\r\n”, 1000, DEBUG);
sendData(“AT+QCFG="logbaudrate",9600\r”, 1000, DEBUG);
sendData(“AT+CFUN=0\r”, 1000, DEBUG);
sendData(“AT+CEREG=2\r”, 1000, DEBUG);
sendData(“AT+QBAND=3,3,8,20\r”, 1000, DEBUG);
sendData(“AT+QCGDEFCONT=1,"IP","…"\r”, 1000, DEBUG);
sendData(“AT+CFUN=1\r”, 1000, DEBUG);

delay(5000);

sendData(“AT+QHTTPCFG="contextid",0\r”, 1000, DEBUG);
sendData(“AT+QHTTPURL=32,80\r”, 1000, DEBUG);
sendData(“http://api.thingspeak.com/update\r”, 1000, DEBUG);
sendData(“AT+QHTTPPOST=34,80,80\r”, 1000, DEBUG);
sendData(“api_key=…&field1=15\r”, 1000, DEBUG);
}

void loop() {

}

String sendData(String command, const int timeout, boolean debug) {
String response = “”;

if (debug) {
    Serial.print("Start sending: ");
    Serial.println(command);
}

// Clear any previous data in the buffer
while (lteSerial.available()) {
    lteSerial.read();
}

lteSerial.print(command); // Send command to LTE module

unsigned long startMillis = millis(); // Record the start time

while (millis() - startMillis < timeout) { // Check if timeout has occurred
    if (lteSerial.available()) { // Check if data is available to read
        char c = lteSerial.read(); // Read a character from the serial
        response += c; // Append the character to the response string
    }
}

if (debug) {
    Serial.print("Received: ");
    if (response.length() > 0) {
        Serial.println(response);
    } else {
        Serial.println("No response");
    }
}

return response;

}

float calculateFlow() {
flowPulseCount = 5;
Serial.println(“flow measured”);
return flowPulseCount;
}
`

Just with the first AT command I already get an empty response, so I guess I need to set up the code in a different way. Anyone knows what can be happening?

Check that the voltage and baud rate of the Arduino match the tx/rx of the BC660K module

Thank you for your answer @herbert.pan-Q . The baud rate should be the same, as I have lteSerial.begin(9600); Serial.begin(9600); in the code.

But I’m not sure about the voltage. Now I have both Arduino and BC660K connected to my computer with a different USB cable each. Is this enough or would I need an adapter?

The default baud rate of the BC660K is 115200

Yes, but that is too high for Arduino. I was assuming that BC660K can also work with 9600, is this the case?

The module cannot auto-detect and negotiate the data rate at the serial port. It runs at a fixed rate.

If the default rate is 115200 baud, you have to use AT command to change it to 9600 baud. The problem is that you need to send the command at 115200 baud which is not possible with your setup.

How can I change the steup then @hobby_a ?

Use another MCU with hardware serial or a MCU which can support 115200 software serial.

Or you can first use the Arduino IDE app to configure the baud rate via AT commands. You need to use a USB-serial converter to connect the PC USB port and the module serial port.

Connect the module back to Arduino hardware after the configuration.