Advertisement
microrobotics

RockBLOCK Mk2 - Iridium SatComm Module

May 9th, 2023
811
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. To use the RockBLOCK Mk2 Iridium SatComm Module with Arduino, you'll need to install the IridiumSBD library. You can install the library from the Arduino Library Manager by searching for "IridiumSBD" and installing the latest version. Here's an example code to send a message using the RockBLOCK Mk2:
  3.  
  4. Before uploading the code to your Arduino, wire the RockBLOCK Mk2 module as follows:
  5.  
  6. Connect the RockBLOCK's Vin pin to the Arduino's 5V pin.
  7. Connect the RockBLOCK's GND pin to the Arduino's GND pin.
  8. Connect the RockBLOCK's TX pin to the Arduino's software serial RX pin (pin 11 in this example).
  9. Connect the RockBLOCK's RX pin to the Arduino's software serial TX pin (pin 10 in this example).
  10. Upload the code to your Arduino, and open the Serial Monitor. The Arduino will initialize the RockBLOCK Mk2 module and attempt to send the message "Hello from RockBLOCK Mk2!". If successful, it will display "Message sent successfully!" on the Serial Monitor.
  11.  
  12. Please note that using the Iridium satellite network to send messages involves airtime costs. Make sure to manage your usage according to your subscription plan to avoid unexpected charges. Also, ensure that the RockBLOCK Mk2 module has a clear view of the sky to establish a connection with the Iridium satellite network.
  13. */
  14.  
  15. #include <IridiumSBD.h>
  16. #include <SoftwareSerial.h>
  17.  
  18. // Use software serial to communicate with RockBLOCK Mk2
  19. #define IRIDIUM_TX_PIN 10
  20. #define IRIDIUM_RX_PIN 11
  21. SoftwareSerial iridiumSerial(IRIDIUM_RX_PIN, IRIDIUM_TX_PIN);
  22.  
  23. // Create an IridiumSBD instance
  24. IridiumSBD modem(iridiumSerial);
  25.  
  26. void setup() {
  27.   Serial.begin(9600); // Start serial communication with the computer
  28.   iridiumSerial.begin(19200); // Start communication with the RockBLOCK Mk2
  29.  
  30.   Serial.println("Starting satellite communication...");
  31.  
  32.   // Initialize the Iridium modem (this may take a while)
  33.   int result = modem.begin();
  34.   if (result != ISBD_SUCCESS) {
  35.     Serial.print("Modem initialization failed with error code ");
  36.     Serial.println(result);
  37.     while (1); // Halt the program if initialization fails
  38.   }
  39.  
  40.   // Send a message
  41.   String message = "Hello from RockBLOCK Mk2!";
  42.   result = modem.sendSBDText(message.c_str());
  43.   if (result != ISBD_SUCCESS) {
  44.     Serial.print("Message sending failed with error code ");
  45.     Serial.println(result);
  46.   } else {
  47.     Serial.println("Message sent successfully!");
  48.   }
  49. }
  50.  
  51. void loop() {
  52.   // Nothing to do here, as we just send one message during setup()
  53. }
  54.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement