This circuit integrates an Arduino Nano with a GPS NEO 6M module and a SIM800c GSM module to read GPS data and send it via GSM. The circuit is powered by a 3.7V battery connected through a TP4056 charging module, ensuring a stable power supply for the components. The Arduino Nano serves as the central processing unit, interfacing with the GPS module for location data and the GSM module for cellular communication.
/*
* Arduino Nano GPS and GSM Module Interface
*
* This code reads GPS data from the NEO 6M module and sends it via the
* SIM800c GSM module. The GPS module is connected to pins D2 (TX) and D3 (RX)
* of the Arduino Nano. The GSM module is connected to pins D4 (TXD) and D5 (RXD).
*/
#include <SoftwareSerial.h>
// GPS module connections
#define GPS_TX_PIN 2
#define GPS_RX_PIN 3
// GSM module connections
#define GSM_TX_PIN 4
#define GSM_RX_PIN 5
SoftwareSerial gpsSerial(GPS_TX_PIN, GPS_RX_PIN); // RX, TX
SoftwareSerial gsmSerial(GSM_TX_PIN, GSM_RX_PIN); // RX, TX
void setup() {
// Initialize serial communication
Serial.begin(9600);
gpsSerial.begin(9600);
gsmSerial.begin(9600);
// Wait for GSM module to initialize
delay(1000);
Serial.println("GSM Module Initialized");
}
void loop() {
// Read data from GPS module
if (gpsSerial.available()) {
String gpsData = gpsSerial.readString();
Serial.println("GPS Data: " + gpsData);
// Send GPS data via GSM module
gsmSerial.println(gpsData);
Serial.println("Data sent via GSM");
}
// Small delay to avoid flooding
delay(1000);
}
This code is designed to be uploaded to the Arduino Nano. It initializes two software serial ports for communication with the GPS and GSM modules, reads data from the GPS module, and sends it through the GSM module. The code includes a setup routine that initializes the serial ports and a loop that continuously reads and sends GPS data.