├── .gitattributes ├── .DS_Store ├── README.md ├── AT_Debug └── AT_Debug.ino ├── Auto_Call_Recording └── Auto_Call_Recording.ino ├── BlynkClient └── BlynkClient.ino ├── SendSMS └── SendSMS.ino ├── GNSS_Data └── GNSS_Data.ino ├── GSM_Location └── GSM_Location.ino ├── WebClient └── WebClient.ino ├── Recording_via_SMS └── Recording_via_SMS.ino ├── HttpClient └── HttpClient.ino └── MqttClient └── MqttClient.ino /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/techiesms/Example-Code-for-4G-Dev-Board-by-techiesms-/main/.DS_Store -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### 4G Development board by techiesms Purchase Link - https://techiesms.com/product/4g-development-b…ith-gnss-gps-ble/ 2 | ![Label-2 copy](https://github.com/techiesms/Example-Code-for-4G-Dev-Board-by-techiesms-/assets/10785352/9a23b48f-a53b-47d0-b92b-0486e606ee19) 3 | 4 | ### About: 5 | This board is based on A7672S Moudle which is a 4G module with Builtin GNSS. And we made a development board out of it to help makers and engineers wiht their 4G and location tracking based projects. This dev board is made by MAKERS and made for MAKERS and hence it is compatible with all the popular development boards in the market. 6 | 7 | ### Features: 8 | 9 | - Input Supply: 5V-12V DC 10 | - DATA Transfer LTE(Mbps): 10 Downlink / 5 Uplink 11 | - SIM Holder: Micro SIM 12 | - SIMCOM A7672S 4G LTE chip on-board 13 | - Builtin GNSS Support 14 | - Builtin BLE Support 15 | - Builtin Microphone 16 | - Supports 4G + 2G (JIO SIM supported) 17 | 18 | ### Connections with Different Microcontroller Boards 19 | ![UNO_Connections](https://github.com/techiesms/Example-Code-for-4G-Dev-Board-by-techiesms-/assets/10785352/4f1b22cb-a7fc-4f89-8217-30100ecf1e19) 20 | ![MEGA_Connections](https://github.com/techiesms/Example-Code-for-4G-Dev-Board-by-techiesms-/assets/10785352/16f2e001-99ea-42ed-99e2-bcadf1f72859) 21 | ![esp8266_Connections](https://github.com/techiesms/Example-Code-for-4G-Dev-Board-by-techiesms-/assets/10785352/d9b6b674-c8f8-462f-8c08-05abfef999f1) 22 | ![esp32_Connections](https://github.com/techiesms/Example-Code-for-4G-Dev-Board-by-techiesms-/assets/10785352/8288d296-1bbe-4a21-9a79-c0179741fc91) 23 | -------------------------------------------------------------------------------- /AT_Debug/AT_Debug.ino: -------------------------------------------------------------------------------- 1 | 2 | /************************************************************** 3 | 4 | This is a simple sketch to just send AT commands and see the 5 | repsone on the seiral monitor using 4G Development board by techiesms 6 | 7 | Libraries Used: 8 | 1. TinyGSM - https://github.com/vshymanskyy/TinyGSM (Tested with version 0.11.7) 9 | 10 | Boards Package Versions 11 | ESP32 (2.0.6) 12 | ESP8266 (3.1.2) 13 | 14 | 15 | +++++++++++++++ Connections +++++++++++++++ 16 | 17 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 18 | 4G Module | GND | PWRKEY | RX | TX 19 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 20 | ESP32 | GND | D5 | TX2 | RX2 21 | ------------------------------------------- 22 | ESP8266 | GND | D7 | D6 | D5 23 | ------------------------------------------- 24 | UNO | GND | 13 | 11 | 12 25 | ------------------------------------------- 26 | MEGA | GND | 2 | TX1 | RX1 27 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 28 | 29 | 30 | Code Tested on 15/04/2024 by team techiesms 31 | 32 | You can purchase this 4G Module and lot other Electronic 33 | Components & Projects from our website 34 | https://www.techiesms.com 35 | 36 | If you are interested in learning Electronics, IOT & Automation 37 | related projects? Well, then definitely checkout our YouTube channel 38 | Right Now!!! 39 | https://www.youtube.com/techiesms 40 | 41 | If you got helped with our code, considering supporting us on Patreon 42 | https://www.patreon.com/techiesms 43 | 44 | 45 | 46 | **************************************************************/ 47 | 48 | #define TINY_GSM_MODEM_SIM7600 49 | 50 | // Set serial for debug console (to the Serial Monitor, default speed 115200) 51 | #define SerialMon Serial 52 | 53 | // Set serial port for module based upon the board selected 54 | 55 | //For ESP8266 56 | #ifdef ESP8266 57 | #include 58 | SoftwareSerial SerialAT(D5, D6); // RX, TX 59 | #define PWR_KEY D7 60 | 61 | // For ESP32 62 | #elif defined(ESP32) 63 | #define SerialAT Serial2 64 | #define PWR_KEY 5 65 | 66 | // For Arduino MEGA 67 | #elif __AVR_ATmega2560__ 68 | #define SerialAT Serial1 69 | #define PWR_KEY 2 70 | 71 | //For Arduino UNO, NANO 72 | #elif __AVR_ATmega328P__ 73 | #include 74 | SoftwareSerial SerialAT(12, 11); // RX, TX 75 | // Power Pin of our Module 76 | #define PWR_KEY 13 77 | 78 | 79 | #else 80 | #error "Board not found" 81 | #endif 82 | 83 | #define TINY_GSM_DEBUG SerialMon 84 | 85 | #include 86 | 87 | // Module baud rate 88 | uint32_t rate = 0; // Set to 0 for Auto-Detect 89 | 90 | void setup() 91 | { 92 | // Set console baud rate 93 | SerialMon.begin(9600); 94 | pinMode(PWR_KEY, OUTPUT); 95 | 96 | // Powering Up the 4G Module 97 | SerialMon.println(""); 98 | SerialMon.println("techiesms 4G Development Board"); 99 | SerialMon.println("---------Powering Up----------"); 100 | digitalWrite(PWR_KEY, HIGH); 101 | delay(50); 102 | digitalWrite(PWR_KEY, LOW); 103 | 104 | SerialMon.println("Wait..."); 105 | SerialAT.begin(9600); // beginning Serial communication with 4G Module 106 | 107 | // Waiting.... 108 | delay(6000); 109 | } 110 | 111 | void loop() 112 | { 113 | 114 | // Access AT commands from Serial Monitor 115 | SerialMon.println(F("***********************************************************")); 116 | SerialMon.println(F(" You can now send AT commands")); 117 | SerialMon.println(F(" Enter \"AT\" (without quotes), and you should see \"OK\"")); 118 | SerialMon.println(F(" If it doesn't work, select \"Both NL & CR\" in Serial Monitor")); 119 | SerialMon.println(F("***********************************************************")); 120 | 121 | while (true) 122 | { 123 | if (SerialAT.available()) { 124 | SerialMon.write(SerialAT.read()); 125 | } 126 | if (SerialMon.available()) { 127 | SerialAT.write(SerialMon.read()); 128 | } 129 | delay(0); 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /Auto_Call_Recording/Auto_Call_Recording.ino: -------------------------------------------------------------------------------- 1 | /************************************************************** 2 | 3 | This is the code for auto call receiving and recording using our 4 | 4G Development board by techiesms 5 | 6 | 7 | Boards Package Versions 8 | ESP32 (2.0.6) 9 | ESP8266 (3.1.2) 10 | 11 | 12 | +++++++++++++++ Connections +++++++++++++++ 13 | 14 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 15 | 4G Module | GND | PWRKEY | RX | TX 16 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 17 | ESP32 | GND | D5 | TX2 | RX2 18 | ------------------------------------------- 19 | ESP8266 | GND | D7 | D6 | D5 20 | ------------------------------------------- 21 | UNO | GND | 13 | 11 | 12 22 | ------------------------------------------- 23 | MEGA | GND | 2 | TX1 | RX1 24 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 25 | 26 | 27 | Code Tested on 29/06/2024 by team techiesms 28 | 29 | You can purchase this 4G Module and lot other Electronic 30 | Components & Projects from our website 31 | https://www.techiesms.com 32 | 33 | If you are interested in learning Electronics, IOT & Automation 34 | related projects? Well, then definitely checkout our YouTube channel 35 | Right Now!!! 36 | https://www.youtube.com/techiesms 37 | 38 | If you got helped with our code, considering supporting us on Patreon 39 | https://www.patreon.com/techiesms 40 | 41 | 42 | 43 | **************************************************************/ 44 | 45 | 46 | #define TINY_GSM_MODEM_SIM7600 47 | 48 | // Set serial for debug console (to the Serial Monitor, default speed 115200) 49 | #define SerialMon Serial 50 | 51 | // Set serial port for module based upon the board selected 52 | 53 | //For ESP8266 54 | #ifdef ESP8266 55 | #include 56 | SoftwareSerial SerialAT(D5, D6); // RX, TX 57 | #define PWR_KEY D7 58 | 59 | // For ESP32 60 | #elif defined(ESP32) 61 | #define SerialAT Serial2 62 | #define PWR_KEY 5 63 | 64 | // For Arduino MEGA 65 | #elif __AVR_ATmega2560__ 66 | #define SerialAT Serial1 67 | #define PWR_KEY 2 68 | 69 | //For Arduino UNO, NANO 70 | #elif __AVR_ATmega328P__ 71 | #include 72 | SoftwareSerial SerialAT(12, 11); // RX, TX 73 | // Power Pin of our Module 74 | #define PWR_KEY 13 75 | 76 | 77 | #else 78 | #error "Board not found" 79 | #endif 80 | 81 | #define TINY_GSM_DEBUG SerialMon 82 | 83 | 84 | // Module baud rate 85 | uint32_t rate = 0; // Set to 0 for Auto-Detect 86 | 87 | String msg; 88 | String fromGSM = ""; 89 | #define rec 8 90 | #define DEBUG true 91 | 92 | void setup() { 93 | // Set console baud rate 94 | SerialMon.begin(9600); 95 | pinMode(PWR_KEY, OUTPUT); 96 | pinMode(rec, INPUT_PULLUP); 97 | 98 | // Powering Up the 4G Module 99 | SerialMon.println(""); 100 | SerialMon.println("techiesms 4G Development Board"); 101 | SerialMon.println("---------Powering Up----------"); 102 | digitalWrite(PWR_KEY, HIGH); 103 | delay(50); 104 | digitalWrite(PWR_KEY, LOW); 105 | 106 | SerialMon.println("Wait..."); 107 | SerialAT.begin(9600); // beginning Serial communication with 4G Module 108 | 109 | // Waiting.... 110 | delay(6000); 111 | // Just Checking 112 | msg = ""; 113 | msg = sendData("AT", 1000, DEBUG); 114 | while (msg.indexOf("OK") == -1) { 115 | msg = sendData("AT", 1000, DEBUG); 116 | Serial.println("Trying"); 117 | } 118 | } 119 | 120 | void loop() 121 | { 122 | // Listen from GSM Module 123 | if (SerialAT.available()) { 124 | fromGSM += (char)SerialAT.read(); 125 | 126 | 127 | // Check if the received message contains "RING" 128 | if (fromGSM.indexOf("RING") != -1) { 129 | SerialMon.println("---------ITS RINGING-------"); 130 | sendATCommand("ATA"); 131 | delay(1000); 132 | sendATCommand("AT+CREC=3,\"c:/recording1.amr\""); 133 | SerialMon.println("start recording"); 134 | 135 | // Clear the buffer after processing 136 | fromGSM = ""; 137 | } 138 | } 139 | 140 | if (SerialMon.available()) { 141 | int inByte = SerialMon.read(); 142 | SerialAT.write(inByte); 143 | } 144 | 145 | // For recording file play 146 | int stat = digitalRead(rec); 147 | if (stat == LOW) { 148 | sendATCommand("AT+CCMXPLAY=\"c:/recording1.amr\",0,0"); 149 | SerialMon.println("audio file play"); 150 | } 151 | } 152 | 153 | String sendData(String command, const int timeout, boolean debug) { 154 | String temp = ""; 155 | SerialAT.println(command); 156 | long int time = millis(); 157 | while ((time + timeout) > millis()) { 158 | while (SerialAT.available()) { 159 | char c = SerialAT.read(); 160 | temp += c; 161 | } 162 | } 163 | if (debug) { 164 | Serial.print(temp); 165 | } 166 | return temp; 167 | } 168 | 169 | void sendATCommand(const String &command) { 170 | SerialAT.println(command); 171 | delay(1000); 172 | while (SerialAT.available()) { 173 | SerialMon.write(SerialAT.read()); 174 | } 175 | } 176 | -------------------------------------------------------------------------------- /BlynkClient/BlynkClient.ino: -------------------------------------------------------------------------------- 1 | 2 | /************************************************************** 3 | 4 | This is the Blynk Client example code in which 5 | we are sending a counter data to Virtual Pin V0 & 6 | receiving data from virtual pin V1 and Controlling 7 | LED based on the data recevied using the 4G 8 | Development board by techiesms. 9 | 10 | Libraries Used: 11 | 1. TinyGSM - https://github.com/vshymanskyy/TinyGSM (Tested with version 0.11.7) 12 | 2. Blynk - https://github.com/blynkkk/blynk-library (Tested with version 1.2.0) 13 | 14 | Boards Package Versions 15 | ESP32 (2.0.6) 16 | ESP8266 (3.1.2) 17 | 18 | 19 | +++++++++++++++ Connections +++++++++++++++ 20 | 21 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 22 | 4G Module | GND | PWRKEY | RX | TX 23 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 24 | ESP32 | GND | D5 | TX2 | RX2 25 | ------------------------------------------- 26 | ESP8266 | GND | D7 | D6 | D5 27 | ------------------------------------------- 28 | UNO | GND | 13 | 11 | 12 29 | ------------------------------------------- 30 | MEGA | GND | 2 | TX1 | RX1 31 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 32 | 33 | 34 | Code Tested on 21/04/2024 by team techiesms 35 | 36 | You can purchase this 4G Module and lot other Electronic 37 | Components & Projects from our website 38 | https://www.techiesms.com 39 | 40 | If you are interested in learning Electronics, IOT & Automation 41 | related projects? Well, then definitely checkout our YouTube channel 42 | Right Now!!! 43 | https://www.youtube.com/techiesms 44 | 45 | If you got helped with our code, considering supporting us on Patreon 46 | https://www.patreon.com/techiesms 47 | 48 | 49 | **************************************************************/ 50 | 51 | 52 | #define BLYNK_PRINT Serial // Comment this out to disable prints and save space 53 | 54 | 55 | #define TINY_GSM_MODEM_SIM7600 56 | 57 | // Set serial for debug console (to the Serial Monitor, default speed 115200) 58 | #define SerialMon Serial 59 | 60 | // Set serial port for module based upon the board selected 61 | 62 | //For ESP8266 63 | #ifdef ESP8266 64 | #include 65 | SoftwareSerial SerialAT(D5, D6); // RX, TX 66 | #define PWR_KEY D7 // Power Pin of our Module 67 | 68 | // For ESP32 69 | #elif defined(ESP32) 70 | #define SerialAT Serial2 71 | #define PWR_KEY 5 // Power Pin of our Module 72 | 73 | // For Arduino MEGA 74 | #elif __AVR_ATmega2560__ 75 | #define SerialAT Serial1 76 | #define PWR_KEY 2 // Power Pin of our Module 77 | 78 | //For Arduino UNO, NANO 79 | #elif __AVR_ATmega328P__ 80 | #include 81 | SoftwareSerial SerialAT(12, 11); // RX, TX 82 | #define PWR_KEY 13 // Power Pin of our Module 83 | 84 | 85 | #else 86 | #error "Board not found" 87 | #endif 88 | 89 | #define LED_PIN 9 90 | 91 | // set GSM PIN, if any 92 | #define GSM_PIN "" 93 | 94 | // Your GPRS credentials, if any 95 | const char apn[] = ""; 96 | const char gprsUser[] = ""; 97 | const char gprsPass[] = ""; 98 | 99 | #include 100 | #include 101 | 102 | // You should get Auth Token in the Blynk App. 103 | // Go to the Project Settings (nut icon). 104 | const char auth[] = "AUTH_TOKEN"; 105 | 106 | BlynkTimer timer; 107 | 108 | TinyGsm modem(SerialAT); 109 | 110 | BLYNK_WRITE(V1) { 111 | int value = param.asInt(); 112 | Serial.print("Received Data - "); 113 | Serial.println(value); 114 | digitalWrite(LED_PIN, value); 115 | } 116 | 117 | 118 | int i = 0; 119 | void myTimerEvent() { 120 | // You can send any value at any time. 121 | // Please don't send more that 10 values per second. 122 | Blynk.virtualWrite(V0, i++); 123 | Serial.print(i); 124 | Serial.println(" Sent"); 125 | } 126 | 127 | 128 | 129 | void setup() { 130 | SerialMon.begin(9600); // beginning Serial Monitor 131 | delay(10); 132 | 133 | pinMode(PWR_KEY, OUTPUT); 134 | pinMode(LED_PIN, OUTPUT); 135 | 136 | // Powering Up the 4G Module 137 | SerialMon.println(""); 138 | SerialMon.println("techiesms 4G Development Board"); 139 | SerialMon.println("---------Powering Up----------"); 140 | digitalWrite(PWR_KEY, HIGH); 141 | delay(50); 142 | digitalWrite(PWR_KEY, LOW); 143 | 144 | SerialMon.println("Wait..."); 145 | SerialAT.begin(9600); // beginning Serial communication with 4G Module 146 | 147 | // Waiting.... 148 | delay(6000); 149 | 150 | 151 | // Restart takes quite some time 152 | // To skip it, call init() instead of restart() 153 | //modem.restart(); SerialMon.println("Resetting Modem..."); 154 | modem.init(); 155 | SerialMon.println("Initialising Modem..."); 156 | 157 | String modemInfo = modem.getModemInfo(); 158 | SerialMon.print("Modem Info: "); 159 | SerialMon.println(modemInfo); 160 | 161 | // Unlock your SIM card with a PIN 162 | //modem.simUnlock("1234"); 163 | 164 | Blynk.begin(auth, modem, apn, gprsUser, gprsPass); 165 | 166 | // Setup a function to be called every second 167 | timer.setInterval(5000L, myTimerEvent); 168 | } 169 | 170 | void loop() { 171 | Blynk.run(); 172 | timer.run(); // Initiates BlynkTimer 173 | } 174 | -------------------------------------------------------------------------------- /SendSMS/SendSMS.ino: -------------------------------------------------------------------------------- 1 | /************************************************************** 2 | 3 | This sketch is for sending SMS using 4 | 4G Development board by techiesms 5 | 6 | Libraries Used: 7 | 1. TinyGSM - https://github.com/vshymanskyy/TinyGSM (Tested with version 0.11.7) 8 | 9 | Boards Package Versions 10 | ESP32 (2.0.6) 11 | ESP8266 (3.1.2) 12 | 13 | 14 | +++++++++++++++ Connections +++++++++++++++ 15 | 16 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 17 | 4G Module | GND | PWRKEY | RX | TX 18 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 19 | ESP32 | GND | D5 | TX2 | RX2 20 | ------------------------------------------- 21 | ESP8266 | GND | D7 | D6 | D5 22 | ------------------------------------------- 23 | UNO | GND | 13 | 11 | 12 24 | ------------------------------------------- 25 | MEGA | GND | 2 | TX1 | RX1 26 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 27 | 28 | 29 | Code Tested on 16/04/2024 by team techiesms 30 | 31 | You can purchase this 4G Module and lot other Electronic 32 | Components & Projects from our website 33 | https://www.techiesms.com 34 | 35 | If you are interested in learning Electronics, IOT & Automation 36 | related projects? Well, then definitely checkout our YouTube channel 37 | Right Now!!! 38 | https://www.youtube.com/techiesms 39 | 40 | If you got helped with our code, considering supporting us on Patreon 41 | https://www.patreon.com/techiesms 42 | 43 | 44 | 45 | **************************************************************/ 46 | 47 | // Target Number on which you want to sens SMS 48 | String SMS_TARGET = "+91xxxxxxxxxx"; 49 | 50 | // Type the message you want to send 51 | String MESSAGE = "Hi, I'm 4G Development board made by techiesms"; 52 | 53 | #define TINY_GSM_MODEM_SIM7600 54 | 55 | // Set serial for debug console (to the Serial Monitor, default speed 115200) 56 | #define SerialMon Serial 57 | 58 | // Set serial port for module based upon the board selected 59 | 60 | //For ESP8266 61 | #ifdef ESP8266 62 | #include 63 | SoftwareSerial SerialAT(D5, D6); // RX, TX 64 | #define PWR_KEY D7 65 | 66 | // For ESP32 67 | #elif defined(ESP32) 68 | #define SerialAT Serial2 69 | #define PWR_KEY 5 70 | 71 | // For Arduino MEGA 72 | #elif __AVR_ATmega2560__ 73 | #define SerialAT Serial1 74 | #define PWR_KEY 2 75 | 76 | //For Arduino UNO, NANO 77 | #elif __AVR_ATmega328P__ 78 | #include 79 | SoftwareSerial SerialAT(12, 11); // RX, TX 80 | // Power Pin of our Module 81 | #define PWR_KEY 13 82 | 83 | 84 | #else 85 | #error "Board not found" 86 | #endif 87 | 88 | 89 | // Increase RX buffer to capture the entire response 90 | // Chips without internal buffering (A6/A7, ESP8266, M590) 91 | // need enough space in the buffer for the entire response 92 | // else data will be lost (and the http library will fail). 93 | #if !defined(TINY_GSM_RX_BUFFER) 94 | #define TINY_GSM_RX_BUFFER 650 95 | #endif 96 | 97 | // See all AT commands, if wanted 98 | // #define DUMP_AT_COMMANDS 99 | 100 | // Define the serial console for debug prints, if needed 101 | #define TINY_GSM_DEBUG SerialMon 102 | 103 | 104 | // Uncomment this if you want to use SSL 105 | // #define USE_SSL 106 | 107 | 108 | // set GSM PIN, if any 109 | #define GSM_PIN "" 110 | 111 | 112 | // Your GPRS credentials, if any 113 | const char apn[] = ""; 114 | const char gprsUser[] = ""; 115 | const char gprsPass[] = ""; 116 | 117 | #include 118 | 119 | TinyGsm modem(SerialAT); 120 | TinyGsmClient client(modem); 121 | 122 | 123 | 124 | void setup() { 125 | SerialMon.begin(9600); // beginning Serial Monitor 126 | delay(10); 127 | 128 | pinMode(PWR_KEY, OUTPUT); 129 | 130 | // Powering Up the 4G Module 131 | SerialMon.println(""); 132 | SerialMon.println("techiesms 4G Development Board"); 133 | SerialMon.println("---------Powering Up----------"); 134 | digitalWrite(PWR_KEY, HIGH); 135 | delay(50); 136 | digitalWrite(PWR_KEY, LOW); 137 | 138 | SerialMon.println("Wait..."); 139 | SerialAT.begin(9600); // beginning Serial communication with 4G Module 140 | 141 | // Waiting.... 142 | delay(6000); 143 | 144 | 145 | // Restart takes quite some time 146 | // To skip it, call init() instead of restart() 147 | //modem.restart(); SerialMon.println("Resetting Modem..."); 148 | modem.init();SerialMon.println("Initialising Modem..."); 149 | 150 | String modemInfo = modem.getModemInfo(); 151 | SerialMon.print("Modem Info: "); 152 | SerialMon.println(modemInfo); 153 | 154 | // Unlock your SIM card with a PIN if needed 155 | if (GSM_PIN && modem.getSimStatus() != 3) { 156 | modem.simUnlock(GSM_PIN); 157 | } 158 | 159 | SerialMon.print("Waiting for network..."); 160 | if (!modem.waitForNetwork()) { 161 | SerialMon.println(" fail"); 162 | delay(10000); 163 | return; 164 | } 165 | SerialMon.println(" success"); 166 | 167 | if (modem.isNetworkConnected()) { 168 | SerialMon.println("Network connected"); 169 | } 170 | } 171 | 172 | void loop() { 173 | 174 | // Code to Send SMS 175 | bool res = modem.sendSMS(SMS_TARGET, MESSAGE); 176 | DBG("SMS:", res ? "Sent" : "Not Sent"); 177 | 178 | 179 | // Powering Off 4G Module 180 | //SerialMon.println("Powering Off 4G Module!"); 181 | //digitalWrite(PWR_KEY, HIGH); 182 | //delay(2500); 183 | //digitalWrite(PWR_KEY, LOW); 184 | 185 | // Do nothing forevermore 186 | while (true) { 187 | delay(1000); 188 | } 189 | } 190 | -------------------------------------------------------------------------------- /GNSS_Data/GNSS_Data.ino: -------------------------------------------------------------------------------- 1 | /************************************************************** 2 | 3 | This sketch is for getting GNSS data on Serial 4 | monitor using 4G Development board by techiesms 5 | 6 | Libraries Used: 7 | 1. TinyGSM - https://github.com/vshymanskyy/TinyGSM (Tested with version 0.11.7) 8 | 9 | Boards Package Versions 10 | ESP32 (2.0.6) 11 | ESP8266 (3.1.2) 12 | 13 | 14 | +++++++++++++++ Connections +++++++++++++++ 15 | 16 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 17 | 4G Module | GND | PWRKEY | RX | TX 18 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 19 | ESP32 | GND | D5 | TX2 | RX2 20 | ------------------------------------------- 21 | ESP8266 | GND | D7 | D6 | D5 22 | ------------------------------------------- 23 | UNO | GND | 13 | 11 | 12 24 | ------------------------------------------- 25 | MEGA | GND | 2 | TX1 | RX1 26 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 27 | 28 | 29 | Code Tested on 16/04/2024 by team techiesms 30 | 31 | You can purchase this 4G Module and lot other Electronic 32 | Components & Projects from our website 33 | https://www.techiesms.com 34 | 35 | If you are interested in learning Electronics, IOT & Automation 36 | related projects? Well, then definitely checkout our YouTube channel 37 | Right Now!!! 38 | https://www.youtube.com/techiesms 39 | 40 | If you got helped with our code, considering supporting us on Patreon 41 | https://www.patreon.com/techiesms 42 | 43 | 44 | 45 | **************************************************************/ 46 | 47 | 48 | 49 | #define TINY_GSM_MODEM_SIM7600 50 | #define DEBUG 1 51 | // Set serial for debug console (to the Serial Monitor, default speed 115200) 52 | #define SerialMon Serial 53 | 54 | // Set serial port for module based upon the board selected 55 | 56 | //For ESP8266 57 | #ifdef ESP8266 58 | #include 59 | SoftwareSerial SerialAT(D5, D6); // RX, TX 60 | #define PWR_KEY D7 61 | 62 | // For ESP32 63 | #elif defined(ESP32) 64 | #define SerialAT Serial2 65 | #define PWR_KEY 5 66 | 67 | // For Arduino MEGA 68 | #elif __AVR_ATmega2560__ 69 | #define SerialAT Serial1 70 | #define PWR_KEY 2 71 | 72 | //For Arduino UNO, NANO 73 | #elif __AVR_ATmega328P__ 74 | #include 75 | SoftwareSerial SerialAT(12, 11); // RX, TX 76 | // Power Pin of our Module 77 | #define PWR_KEY 13 78 | 79 | 80 | #else 81 | #error "Board not found" 82 | #endif 83 | 84 | 85 | // Increase RX buffer to capture the entire response 86 | // Chips without internal buffering (A6/A7, ESP8266, M590) 87 | // need enough space in the buffer for the entire response 88 | // else data will be lost (and the http library will fail). 89 | #if !defined(TINY_GSM_RX_BUFFER) 90 | #define TINY_GSM_RX_BUFFER 650 91 | #endif 92 | 93 | // See all AT commands, if wanted 94 | // #define DUMP_AT_COMMANDS 95 | 96 | // Define the serial console for debug prints, if needed 97 | #define TINY_GSM_DEBUG SerialMon 98 | 99 | 100 | // Uncomment this if you want to use SSL 101 | // #define USE_SSL 102 | 103 | 104 | // set GSM PIN, if any 105 | #define GSM_PIN "" 106 | 107 | 108 | // Your GPRS credentials, if any 109 | const char apn[] = ""; 110 | const char gprsUser[] = ""; 111 | const char gprsPass[] = ""; 112 | String msg = ""; 113 | 114 | #include 115 | 116 | TinyGsm modem(SerialAT); 117 | TinyGsmClient client(modem); 118 | 119 | 120 | 121 | void setup() { 122 | SerialMon.begin(9600); // beginning Serial Monitor 123 | delay(10); 124 | 125 | pinMode(PWR_KEY, OUTPUT); 126 | 127 | // Powering Up the 4G Module 128 | SerialMon.println(""); 129 | SerialMon.println("techiesms 4G Development Board"); 130 | SerialMon.println("---------Powering Up----------"); 131 | digitalWrite(PWR_KEY, HIGH); 132 | delay(50); 133 | digitalWrite(PWR_KEY, LOW); 134 | 135 | SerialMon.println("Wait..."); 136 | SerialAT.begin(9600); // beginning Serial communication with 4G Module 137 | 138 | // Waiting.... 139 | delay(6000); 140 | 141 | 142 | // Restart takes quite some time 143 | // To skip it, call init() instead of restart() 144 | SerialMon.println("Resetting Modem..."); 145 | modem.restart(); 146 | 147 | //modem.init(); SerialMon.println("Initialising Modem..."); 148 | 149 | String modemInfo = modem.getModemInfo(); 150 | SerialMon.print("Modem Info: "); 151 | SerialMon.println(modemInfo); 152 | 153 | // Unlock your SIM card with a PIN if needed 154 | if (GSM_PIN && modem.getSimStatus() != 3) { 155 | modem.simUnlock(GSM_PIN); 156 | } 157 | 158 | SerialMon.print("Waiting for network..."); 159 | if (!modem.waitForNetwork()) { 160 | SerialMon.println(" fail"); 161 | delay(10000); 162 | return; 163 | } 164 | SerialMon.println(" success"); 165 | 166 | if (modem.isNetworkConnected()) { 167 | SerialMon.println("Network connected"); 168 | } 169 | } 170 | 171 | void loop() { 172 | 173 | sendData("AT+CGNSSPWR=1", 10000, DEBUG); 174 | sendData("AT+CGNSSPORTSWITCH=1,1", 1000, DEBUG); 175 | 176 | while (true) { 177 | //[