Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Basic Arduino sketch to talk to the SIM7600E-H using your Serial monitor. Enter AT commands in the Serial Monitor input and see the response from the module.
/*
* Basic sketch to talk to the SIM7600E-H using your
* Serial monitor. Enter AT commands in the Serial Monitor
* input and see the response from the module.
*
* Connect the R pin on the module to pin 10 on the Arduino
* Connect the T pin on the module to pin 11 on the Arduino
*
* Written by https://github.com/jenschr
*/
#include <SoftwareSerial.h>
#define PIN_TX 11
#define PIN_RX 10
SoftwareSerial mySerial(PIN_TX, PIN_RX);
int counter = 0;
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
// Set your Serial monitor speed to this
Serial.begin(115200);
// The SIM7600 module is using 115200 baud by default
mySerial.begin(115200);
Serial.println("Wait 8 boring seconds for the green LED to turn on");
delay(8000);
// Change speed from 115200 to 19200 to prevent errors
mySerial.println("AT+IPR=19200");
delay(1000);
mySerial.begin(19200);
delay(1000);
}
void loop()
{
/* send everything received from the SIM7600
to usb serial & vice versa */
if (Serial.available() > 0) {
Serial.print(">");
delay(100);
while ( Serial.available() ) {
char ch = Serial.read();
Serial.print(ch);
mySerial.print(ch);
}
}
if (mySerial.available() > 0) {
Serial.print(":");
delay(10);
while ( mySerial.available() ) {
char ch = mySerial.read();
if ( ch ) {
Serial.print(ch);
}
}
}
// blink the LED, just to show we are alive
if ( counter % 10000 == 0 ) {
digitalWrite( LED_BUILTIN, !digitalRead(LED_BUILTIN) );
}
counter++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment