Good evening. I am working on this project for my bachelor's thesis, but it is quite different from what I have learnt in my degree and that is why it is being quite challenging and I am asking for help. I want to use a RockBLOCK 9603, a GPS and a OLED display to send a message showing the latitude and longitude. However, I am first learning to use the RockBLOCK 9603 modem by trying to send a simple text message without GPS or OLED. This is the code I have.
#include <SoftwareSerial.h>
SoftwareSerial rockBlockSerial(2, 3); // RX, TX (Arduino <-> RockBLOCK)
void setup() {
Serial.begin(9600); // Monitor output
rockBlockSerial.begin(19200); // RockBLOCK communication
Serial.println("Initializing RockBLOCK 9603...");
delay(2000); // Allow RockBLOCK to initialize
checkSignalStrength(); // Ensure satellite signal is available
sendMessage("Hello from Arduino Uno!"); // Send test message
}
void loop() {
// Listen for responses from RockBLOCK
while (rockBlockSerial.available()) {
Serial.write(rockBlockSerial.read()); // Print response to Serial Monitor
}
}
void checkSignalStrength() {
Serial.println("Checking signal strength...");
rockBlockSerial.println("AT+CSQ");
delay(2000);
readResponse();
}
void sendMessage(String msg) {
Serial.println("Sending message: " + msg);
// Send the command to start writing the message
rockBlockSerial.println("AT+SBDRT=" + msg); //rockBlockSerial.println("AT+SBDWB=" + String(msg.length())) this is originally, but did not work properly
delay(5000); // Give RockBLBOCK more time to respond
rockBlockSerial.println("AT+SBDIX");
delay(5000); // Give it time to transmit
// Read and print the response
while (rockBlockSerial.available()) {
Serial.write(rockBlockSerial.read());
}
// Wait for RockBLOCK to respond with "READY"
if (!waitForResponse("READY")) return;
// Send the message byte-by-byte
// for (int i = 0; i < msg.length(); i++) {
// rockBlockSerial.write(msg[i]);
// }
// // Compute the checksum and send it
// uint16_t checksum = 0;
// for (int i = 0; i < msg.length(); i++) {
// checksum += msg[i];
// }
// rockBlockSerial.write((byte)(checksum >> 8)); // High byte
// rockBlockSerial.write((byte)(checksum & 0xFF)); // Low byte
delay(5000); // Wait for RockBLOCK to process
// Wait for confirmation "OK"
if (!waitForResponse("OK")) return;
Serial.println("Message sent successfully!");
}
bool waitForResponse(String expected) { //this function waits for a specific response, called expected
unsigned long startTime = millis();
String response = ""; // Store full response
while (millis() - startTime < 5000) { // 5-second timeout
while (rockBlockSerial.available()) {
char c = rockBlockSerial.read();
response += c; // Collect response fron rockBlockserial.read
}
if (response.length() > 0) {
Serial.println("RockBLOCK response: " + response); // Debug print
if (response.indexOf(expected) != -1) return true; // Check for expected response
}
}
Serial.println("Error: '" + expected + "' not received. Got: " + response);
return false;
}
void readResponse() {
while (rockBlockSerial.available()) {
Serial.write(rockBlockSerial.read()); // Print RockBLOCK response
}
Serial.println();
}
And this is what I get in the Serial Monitor.
Initializing RockBLOCK 9603...
Checking signal strength...
AT+CSQ
+CSQ:5
OK
Sending message: Hello from Arduino Uno!
Օ(*'Y[����Arduino Uno!
+SBDRT:
ERROR
AT+SBDIX
RockBLOCK response:
RockBLOCK response:
+SBDIX: 0, 7, 0, 0, 0, 0
O
RockBLOCK response:
+SBDIX: 0, 7, 0, 0, 0, 0
OK
Regarding the specific documentation and data sheets from RockBLOCK developer guide and Ground Control Documentation and User Guides, the first 0 means "MO message, if any, transferred successfully." Nevertheless, the third number, which is 0, means "No SBD message to receive from the GSS." I get the message in RockBLOCK Admin and in my email but what I get is this (I have erased any important and irrelevant information)
IMEI: 3014340xxxxxx
MOMSN: 7
Transmit Time: 2025-02-05T13:36:09Z UTC
Iridium Latitude: xxxxxxx
Iridium Longitude: xxxxxxx
Iridium CEP: 2.0
Iridium Session Status: 0
No Data
To sum up, even though it seems that the modem communicates with the satellite, but it does not receive the proper text message from the Arduino and, therefore, can not send the text message to the satellite. At least, this is my theory, but I have never used something like this before nor used Arduino at this level in complexity. If anyone has an idea to solve this or can explain to me what is happening, please let me know.
Excuse me if I made any mistakes or did not express myself properly, English is not my native language. Also, this is my first time posting in this forum so if I made any mistake including the code or whatever, please let me know ![]()