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
- Jumber Wires
GSM:
- GSM means Global System For Mobile, it can be used to send and receive message in 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 in 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");
- delay(1000);
- firstSerial.println("sms messagers sender ");
- delay(100);
- firstSerial.println((char)23);
- delay(1000);
- }
Explanation:
- For sending message it will have mobile number in the code.
- For receiving 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: