Hi, guys, I am doing my school project (GPS Tracking + Fall Detection). I tried to use software serial to connect my SIM800l with my Arduino Nano but somehow the serial monitor are not detecting my pins or something
#include <SoftwareSerial.h>
SoftwareSerial mySerial(3, 2);
void setup()
{
Serial.begin(9600);
mySerial.begin(9600);
Serial.println("Initializing...");
delay(1000);
sendATCommand("AT");
sendATCommand("AT+CMGF=1");
sendATCommand("AT+CMGS=\"+ZZxxxxxxxxxx\""); // Enter your phone number here (prefix country code)
sendATCommand("Hello from DIY Projects Lab"); // Enter your message here
mySerial.write(26);
}
void loop()
{
}
void sendATCommand(const char* command)
{
mySerial.println(command);
delay(500);
while (mySerial.available())
{
Serial.write(mySerial.read());
}
Serial.println();
}
In here, I used pin D3 and D2 as RX and TX, I also inserted the pin correctly between my SIM800l and Nano. But the Serial monitor will just prompt 'Initializing' and 4 empty row.
Then, I thought I will just try to use the hardware serial, so I connected the RX and TX of SIM800l to the TX and RX of Arduino then I change my code
void setup()
{
Serial.begin(9600);
Serial.begin(9600);
Serial.println("Initializing...");
delay(1000);
sendATCommand("AT");
sendATCommand("AT+CMGF=1");
sendATCommand("AT+CMGS=\"+ZZxxxxxxxxxx\""); // Enter your phone number here (prefix country code)
sendATCommand("Hello from DIY Projects Lab"); // Enter your message here
Serial.write(26);
}
void loop()
{
}
void sendATCommand(const char* command)
{
Serial.println(command);
delay(500);
while (Serial.available())
{
Serial.write(Serial.read());
}
Serial.println();
}
Now, the Serial monitor prompt 4 lines which is
14:50:15.957 -> Initializing...
14:50:16.934 -> AT
14:50:17.438 ->
14:50:17.438 -> AT+CMGF=1
14:50:17.949 ->
14:50:17.949 -> AT+CMGS="+ZZxxxxxxxxxx"
14:50:18.488 ->
14:50:18.488 -> Hello from DIY Projects Lab
Blockquote
I thought I am supposed to get 'OK' as reply and other print command at the bottom but no , just these.... I tried with GPS module, it is the same problem, it cannot detect any wiring when I use software serial or sometimes the inputed pin are different with physical pin but somehow work...