Congratulations - C# Corner Q4, 2022 MVPs Announced
Why Join
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
TECHNOLOGIES
ANSWERS
LEARN
NEWS
BLOGS
VIDEOS
INTERVIEW PREP
BOOKS
EVENTS
Training
Live
JOBS
MORE
CAREER
MEMBERS
Connecting GSM With Arduino Mega 2560
Sr Karthiga
Apr 21, 2020
38.3k
0
2
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
Print
Other Artcile
In this article you will learn how to connect GSM With Arduino Mega 2560.
gsm900.zip
Introduction
In this article, I will explain about sending and receiving emergency warning messages from
Arduino
Mega 2560. It can easily send and receive messages at the time of emergency.
Parts Of List
Arduino Mega 2560
GSM
Bread Board
Jumper Wires
GSM:
GSM means Global System For Mobile, it can be used to send and receive a message in a critical area.
It can also act as the GSM modem.
It can have a PIN configuration and MIC is also attached.
Figure 1: GSM Board
Connection:
ArduinoMega 2560 To GSM Board:
Connect the RX pin of the GSM board to the 04 of the Arduino Mega 2560.
Connect the TX pin of the GSM board to the 03 of the Arduino Mega 2560.
Connect the 5V power supply to the Arduino Mega 2560.
At last, connect the 12 DC voltage to the GSM board.
LED To Arduino Mega2560:
Connect the positive pin is digital pin 11 in the Arduino Mega2560
Connect the negative pin in the GND to the Arduino Mega 2560.
Figure 2: Connection from GSM to Arduino Mega2560
Programming:
#include<SoftwareSerial.h>
SoftwareSerial firstSerial(03,04); RX/TX
int
led=11;
void
setup()
{
pinMode(led,OUTPUT);
firstSerial.begin(9600);
Serial.begin(9600);
delay(1000);
}
void
loop()
{
if
(Serial.available()>0)
digitalWrite(led,HIGH);
switch
(Serial.read());
}
void
sndmsg()
{
firstSerial.println(
"AT+CMGF=1"
);
delay(1000);
firstSerial.println(
"AT+CMGS=\"+xxxxxxxxxx\"\r"
);
//Enter Your Mobile Number instead XXXX while Testing
delay(1000);
firstSerial.println(
"sms messagers sender "
);
delay(100);
firstSerial.println((
char
)23);
delay(1000);
}
Explanation:
For sending a message it will have a mobile number in the code.
For receiving the message it will have the SIM card inside the GSM modem.
When the message is sent, the LED glows.
Output:
Figure 3: Output
Read more articles on
Arduino
:
Windows Remote Arduino - Part One
Controlling LED Using Arduino Mega 2560
Arduino
Arduino Mega 2560
Connecting GSM
IOT
Recommended Ebook
Printing in C# Made Easy
Download Now!
Similar Articles