Accident Detection System using Arduino

Hello everyone, Welcome to our new project. Our new project plays a very important role in our daily life as it is directly connected to our lives. In this project, we are going to design an Accident Detection module. Accidents are the most common thing we hear about in the news, and in social media. Everyone here or there has seen accidents or has been with one. So when any such incidents happen, we inform respective stations or hospitals in that emergency situation. But what about the accidents that happen at night, or in places where there is very less crowd or you are alone. So, to address this issue and provide a potential solution for that, we are going to learn how to detect an accident automatically and inform nearby aid/help stations.

We can use this useful project for an engineering project’s showcase for electronics, electrical engineering students, and can be used in real-life situations where it can help people in disastrous situations.

According to WHO, research says that in the current scenario, 1.3 million people are the victims of road traffic crashes, and 40% of these accidents of all fatal accidents occur at night. In most cases, the accidents are not reported immediately, or the injured doesn’t receive any help during that time. The time between the accident and the arrival of medical help for the injured can sometimes make the difference between his life or death. In the future, we can interface with the vehicle airbag system. This will optimize the proposed technology to the maximum extent and result in the finest accident detection system possible. In this Modern era, everything is being automated and with this project, we are going to automate this process with some electronic components and Arduino. So Let’s dive in. Here's the video demonstration of this project:

Where To Buy?
No.ComponentsDistributorLink To Buy
1NEO-6MAmazonBuy Now
2SIM900AmazonBuy Now
3Arduino UnoAmazonBuy Now

Software to Install:

Instead of using real components, we will design this project using Proteus Simulation. Working with simulation before attempting to make it with real components is also a smart practice. We can figure out the issue that may arise while working on real components and avoid any kind of damage to our components by simulating it.

Proteus is a very fascinating tool that allows us to simulate and create electronic circuits. Despite the fact that Proteus software contains a large library of electronics components, it still lacks pre-installed modules such as Arduino boards, GPS or GSM modules, and so on.

Let’s install the required libraries which, we are going to use in this project:

You can download this whole project for example Proteus Simulation and Arduino Code, by tapping the below button

Accident Detection System using Arduino

Project Overview:

These are required components for Accident Detection, which are as follows:

  • Arduino Uno: Arduino Uno is a development board from the Arduino family, which is the main component of this project. The Microcontroller i.e., Arduino is responsible for the decisions that are going to be processed in the project.
  • Accelerometer: An accelerometer is a device that measures acceleration, which is the change in speed (velocity) per unit time. By measuring acceleration we can get information like object inclination and vibration which helps in detecting unusual activities/ accidents.
  • GSM: A GSM/GPRS Module is a device that is actually responsible for the wireless communication with the GSM Network, in this case, it is responsible for sending the appropriate information to rescue stations.

Components Needed:

  1. Arduino Uno
  2. GPRS Module
  3. Accelerometer
  4. GSM Module
  5. Bread Board
  6. Jumper Wires

Component details:

Arduino Uno:

  • The Arduino UNO is one of the Arduino family's programmable, open-source microcontroller boards.
  • It includes an Atmel Microchip ATMega328P microcontroller with an 8-bit RISC processing core and 32 KB flash memory from Atmel.
  • It has 14 digital I/O pins, including 6 PWM pins and 6 analog I/O pins with a resolution of 10 bits (0-1024).
  • It comes with one hardware UART, one I2C, and one SPI peripheral.
  • We can use the Arduino UNO with a voltage range of 7-12 volts, but not more than 9 volts is recommended because it may damage the Arduino board
  • To power the Arduino UNO we can use a USB-B cable (the same cable that we use to upload the sketch to Arduino UNO), a DC power jack, or the Vin pin on the board.

GPS Module:

  • The Global Positioning System (GPS) is a space-based global navigation satellite system that gives accurate location and timing in all weather and at all times around the world.
  • It sendLongitude, latitude, height, and time are the four variables that a GPS receiver determines.
  • Data determined by the module will be sent to the microcontroller (Arduino Uno) through the UART protocol.
  • With a USB interface, the GPS module is simple to operate. It operates on a 3.2 to 5V supply range, allowing it to interface with both 3.3V and 5V microcontrollers.
  • It has a default baud rate of 9600 and can be modified as per our requirement.
  • We have used this to get the current location of the user.

Accelerometer:

  • Accelerometer sensors are integrated circuits (ICs) that are used to measure acceleration, inclination, and various parameters regarding the x,y,z axes. It is the main component to detect the accident.
  • Here we used the MEMS (Microelectromechanical Systems) accelerometer. These types of accelerometers are used where we have to measure the vibration or shock without any fixed reference.
  • It monitors changes in the capacitance and converts that value to analog output voltage.
  • Gyro Range of the Accelerometer sensor is ± 250, 500, 1000, 2000 °/s (may vary depending upon the sensor).
  • Accelerometer Range of the sensor module is ± 2 ± 4 ± 8 ± 16 g (may vary depending upon the sensor).

GSM module:

  • This module is used to send the notification to the rescue station or the emergency numbers.
  • It communicates with the Arduino UNO using the UART protocol.
  • It works in a voltage range of 3.5 - 5 volts.
  • There are different types of GSM modules available but in this project, we have used the SIM900D module.
  • We operate them using the AT commands. As there are hundreds of AT commands but we will use some basic only just to send the message.

Proteus Simulation of Accident Detection Circuit:

Now, it is time to start designing the main circuit of Accident detection in Proteus Simulation software.

  • Most importantly, ensure that Proteus is installed on your PC/Laptop and download all the required libraries for Proteus ahead of starting the designing steps.
  • For this project, we are going to use libraries for Arduino Uno, GPRS Module, GSM module.
  • To add the libraries in the Proteus suite we have to go to the C drive then LabCenter Electronics >> Proteus 8 professional >> Data >> Library and paste the downloaded library files here.
  • The download links of all the libraries have been provided to you in the above sections, please go check them out.
  • Let’s start the making of a new project, open the new project in Proteus.
  • After that enter the name of your new project.
  • Now our working area will be open here we will import all the required components which we are going to use.
  • The following components need to be selected from the Proteus component library. We’ll connect the components and make the circuit complete.
  • Now we have imported all the required components for this project, after this, we will start connecting them.

Circuit Diagram and Working:

  • There are two modules GPRS and GSM modules, both communicate using the UART protocol but in the Arduino UNO there is only one hardware UART’s provision. Now, you may have doubts about how we are going to connect them. No worries, we will handle that on the coding side by declaring the different pins as UART pins.
  • We can use different pins for UART using the SoftSerial library of Arduino, which will be discussed in the code.
  • We will use the digital pins for UART connections, digital pins 2 and 3 for communication of the GSM module, which means connecting the Rx and Tx of the GSM module with the D2 and D3 pins of Arduino UNO respectively.
  • Connect the Rx and Tx of the GPRS module with the D10 and D11 pins of Arduino UNO respectively.
  • As modules are connected, now we will connect the accelerometer. As it will not be possible to simulate the accelerometer in Proteus so we have used the potentiometers to change the value of the X-axis, Y-axis and Z-axis.
  • You may have doubts about how we can replace the accelerometer with potentiometers. As we will use the MEMS accelerometer, which sends the analog voltages for each axis, so we can simulate that using the potentiometer because we will receive the same type of data.
  • We need three potentiometers, one for each axis. Potentiometers of the X-axis, Y-axis and Z-axis will be connected to A1, A2 and A3 pins of Arduino respectively.
  • We will connect a serial terminal for debugging purposes.

Arduino code for Accident Detection System

Before going to start the coding, it would be easy if you understood the circuit diagram connections.

  • When we start writing the code(called a sketch in Arduino IDE), we will first include all of the necessary libraries for this project.
  • So, if the essential libraries aren't already installed in the Arduino IDE, our first step would be to get them.
  • Here we use mainly two libraries, one for serial communication and parsing data from the GPS module.
  • By heading to 'Sketch > Include Library > Manage Library' in the Arduino IDE, we can install libraries related to Arduino. We can now search for our essential libraries in the library manager. We can also use zip files to install the libraries.
  • As we've installed all the specified libraries. Let’s include them in our sketch.
  • Now, we are declaring D2 and D3 pins for serial communication with GPRS modules and declaring GPS objects as well, which will pretty much do all the grunt work with the NMEA data.
  • After that, we will declare variables to store the GPS module data.
  • Now, we are declaring pins and variables for the accelerometer which we will use in our project. Here, we are using Analog Pins because we are reading the analog voltages from the potentiometer.
  • We need to declare two threshold values for change in acceleration when an accident is detected.
  • The min and max values can vary. So, it is highly recommended to measure the values by accelerometer for devices using.

Void Setup():

  • It is one of the most important functions which will execute only once in the whole process.
  • As we are using a GPS module in our project, We should first start serial communication between the components and Monitor them through “Serial Monitor” in the Arduino IDE.
  • “Serial.begin” is used to set up the serial configuration for the device which is connected to the Serial Port of the Arduino. Here, we will set the baud rate for that device i.e 9600 in our case.
  • “serial_connection.begin(9600)” is used to set up the UART configuration for the GPS module. As the GPS module communicates to the Arduino at the baud rate of 9600.
  • We are using an Accelerometer in the circuit and it was clearly explained in detail that it will sense the x,y,z coordinates of the device and send them to Arduino.
  • Here, we have initialized a for loop to collect the sample data for x, y, and z coordinates of the device in the ideal state.
  • Afterward, the sample coordinates have been successfully measured by the Accelerometer sensor, but we need an average value for smoothing the sample coordinate values. So here, we will calculate the average of each coordinate and print them in the serial monitor.
  • After the setup, we will write our main application code in the Void loop function.

Void loop():

  • It is the second most important function of Arduino code. It will come to action after the execution of “void setup()”
  • We'll write the code required to run in a continuous loop in this part. So this is where we'll write our primary application code.
  • As a result, when the code gets to the void loop portion, We firstly take the NMEA data from the GPS module and print it in the serial monitor.
  • Wait a minute, NMEA??, I can understand all the questions in your mind. Let us give you a simple explanation regarding NMEA and its applications.
  • The word NMEA stands for the National Marine Electronics Association, which is a mode of communication that existed before inventing GPS. NMEA-format GPS data can be accessed with a wide variety of GPS receivers, instead of creating a new custom interface every time. Thus, it makes our lives easier using the GPS Module.
  • When we are printing the NMEA data into the serial monitor, it will be printed in a specific structure. This NMEA data was output from a GPS receiver:

“$GPGGA,191605.00,4521.7785210,N,07331.7656561,W,2,19,1.00,674.354,M,19.900,M,0.90,0000*60”

  • All NMEA signals start with the ‘ $ ’ character and for every data field such as coordinates, and various parameters are separated by a comma. The data further includes Timestamp, Latitude, Longitude, Quality indicator, Number of satellites involved, Altitude, etc., which is not necessary to remember. Make sure to get the data from the GPS module. If we have succeeded in this step and get the data on the serial monitor, then we are good to go for further processing.
  • The “if” statement is to process the NMEA data and separate the data into the required format if there is any location updated to the GPS receiver.
  • As we have already received NMEA data in the previous step, the data will be separated into Latitude, Longitude and Altitude.
  • In the Loop function, the values of GPS and accelerometer will be continuously tracked.
  • Here, the analog values of x,y,z coordinates are being measured and printed in the serial monitor.
  • These are not the values we measured in the void setup, those were the values to take the readings in the ideal state of the device.
  • But in the loop, the values are the present x,y and z coordinates measured by the accelerometer.
  • This is the condition for accident detection, we have already discussed before that in the void loop the x,y,z coordinate values are continuously extracted and the “if” statement here compares the recent values with fixed min and max values of the coordinates.
  • If the recent values are indistinct or do not match with threshold values i.e., max value and min value, then it indicates that an accident has been detected.
  • When the accident detection condition is satisfied, the GPRS module will be activated and will call to rescue stations for aid/help and their home.
  • Here, we have programmed to give a call 5 times to the appropriate numbers in the “for” loop.
  • And the process also includes a messaging feature along with calling to rescue stations.
  • When the same accident condition is satisfied, the messaging feature will be activated and we are going to send the alerting message including the Location, Latitude, Longitude, and Google map location link by appending latitude and longitude values the to respective numbers.

Results / Working:

We have successfully completed our Accident detection project and it’s ready to test!
  • Before going to start the simulation, we need to import the hex files of Arduino code in the Proteus, to do so click on the Arduino and browse to the hex file of the code and select.
  • Now we need to add the program files for the GPS and GPRS modules.
  • Here we should note that we only need to upload the program files for the modules while we are working in simulation. In the real modules, they come up with pre-installed codes.

Now we have done all the prerequisites of simulation.

  • Let’s power the circuit and start the simulation, firstly the void setup function will run and it will initialize all the required pins and variables and will read the ideal state values of the potentiometer.
  • Now to simulate the accident case, we will change the values from the potentiometer, so when the potentiometer’s value changes and the falls in the Min and Max value range the if condition will be stratified.
  • After this GSM module will call the stored number 5 times and send the GPS location with Google maps link in that.
  • We have used some serial monitors for debug purposes, you can see the current state of the project using them.

I hope you have a good understanding of how our Accident Detection project works and that you have liked it. Although I believe we have covered almost everything, please let us know if you have any questions or suggestions in the comments section.

Thank you very much for reading this project. All the best for your projects!

Smart Home Security System using Arduino

Security systems are widely suggested for homes as well as other locations. Everybody wants to take necessary steps to prevent infiltration at home, thus this security is necessary. Intruders nowadays may take advantage of almost any illegal activity and wreak havoc on a property's security. The security of one's home is a critical concern that everyone faces in the current day.

While there are certain devices on the market that may considerably help protect your house, some of them are excessively costly and need constant maintenance. Many devices regarding smart home security systems are available in the market but these are not user friendly according to the budget, the device we designed provides the user with a better interface with the help of LCD. We have used enough sensors that make sure the security protocol.

So in this way, we designed a reasonable security system that has the features of gas and flame detection with the help of MQ-2 Gas Sensor and flame sensor respectively and also have installed a Motion detector sensor known as PIR sensor to detect the intruder's motion. For a better user interface an LCD and Alarm are installed to alert the user. The whole system is programmed using Arduino UNO. A proteus circuit is designed for this project as shown below:

  • You can download the complete project i.e. Proteus Simulation and Arduino Code by clicking the below button:
Smart Home Security System using Arduino
Where To Buy?
No.ComponentsDistributorLink To Buy
1LCD 20x4AmazonBuy Now
2SIM900AmazonBuy Now
3Flame SensorsAmazonBuy Now
4MQ-2AmazonBuy Now
5PIR SensorAmazonBuy Now
6Arduino UnoAmazonBuy Now

Components Required

For the home security system, we have used 3 sensors which are briefly explained as follows:

Flame Sensor

  • The flame sensor is used to detect the fire, it has 3 pins (Ground, VCC, OUTPUT) with operational voltages ranging from 3.3V to 5V.
  • This sensor may be constructed using an electrical circuit and a receiver similar to that used for electromagnetic radiation.
  • This sensor employs the infrared flame flash technology, which enables it to operate through a layer of oil, dust, water vapor etc.
  • There are several wavelengths of flame sensors normally in the range of 700 to 1100 nm from the source.
  • Normally flame sensors have an operating temperature ranging from -25? ~ 85? with several features like adjustable sensitivity, fast response time and ease to use.
  • Proteus doesn't have a Flame Sensor in its database, so you need to download this Flame Sensor Library for Proteus.

PIR Sensor

  • PIR Sensor is used to detect the intruder’s motion.
  • There are mainly two kinds of infrared sensors one is active and the other is passive.
  • The active infrared sensor emits as well as absorbs the infrared radiations whereas the passive infrared sensor simply absorbs not emit.
  • When an object enters or escapes the sensor's range, a passive infrared sensor is employed to detect it.
  • For adjusting the sensitivity and delay time, there are two trim pots supplied. You may alter them to meet your requirements.
  • The sensor produces a HIGH output when it senses movement within its range; otherwise, it generates a LOW output.
  • PIR also has 3 pins like a Flame sensor.
  • It has operating voltages of range 5V - 20V with output voltage generation of 0V-3V when the object is detected in the sensing range that is 7 meters.
  • Proteus doesn't have a PIR Sensor in its database, so you need to download this PIR Sensor Library for Proteus.

MQ-2 Gas Sensor

  • MQ2 gas sensors detect the presence of gases such as LPG, methane, ethanol and carbon monoxide in the air ranging up to 10000 ppm using electricity.
  • It is also known as chemiresistor for the MQ2 gas sensor.
  • The resistance of the sensing material changes depending on the amount of gas present.
  • When it comes to detecting gas, sensors use variations in resistance value that generates the output voltage.
  • When a sensor material is heated to a high temperature in the air, oxygen is adsorbed on the surface.
  • Because current can flow via the sensor, its analog voltage values may now be read.
  • The voltage values reported here may be used to compute the concentration of a gas. When the gas concentration is high, the voltage values are greater.
  • Proteus doesn't have a Gass Sensor in its database, so you need to download this Gas Sensor Library for Proteus.
 

Arduino UNO

  • Atmel's ATMega328 is used in the Arduino Uno, an open-source single-board microcontroller.
  • Either an external power source or a 5V USB connection may be used to power the device.
  • In all, there are 14 digital input/output pins on the board, with 6 of them serving as PWM outputs.
  • On the board, you'll find a reset button and six analog input pins. The Arduino software is used to program the board, which is written in C language.
  • When it came to controlling the home security system, the Arduino Uno's capabilities were found to be sufficient.
  • Arduino Boards are not present in Proteus, so we need to use this Arduino Library for Proteus.

Circuit Designing

  • This whole project is designed to provide a security system for the home in which multiple safety sensors can be installed with a Buzzer and LCD for a better user interface.
  • We won't design this project in real, instead, we are going to design its Proteus simulation.
  • If you are working on an electronics/embedded project, then it's always a best practice to design its simulation first.
  • In simulations, it's easy to debug your code and thus you can program quickly.
  • Once you are satisfied with your project's working, you can move forward to hardware designing.

So, let's design our Proteus Simulation for Smart Home Security System:

Proteus Simulation

  • These are the components, which we are going to use for designing our Proteus Simulation:
  • So, select these components from Proteus Components Library and place them in your workspace, as shown in the below figure:
  • Next, we need to connect these components' pins to complete our circuit, as shown in the below figure:
  • As you can see in the above simulation, we have used three sensors in total, which we have discussed above.

So, now we are going to design the Arduino Code for this simulation:

Arduino Programming Code

We have designed the circuit in our Proteus Simulation and next, we need to design its Arduino Code, in order to make it work.

LCD Initialization Code

  • First of all, we are going to interface LCD with Arduino UNO and will display the Project's name on the screen.
  • The code is shown in the below figure:
  • As you can see in the above figure, we have first initialized the variables.
  • Arduino board is programmed using Arduino IDE software which has mainly 2 sections void setup and void loop.
  • Before void setup, we have to declare the pins of sensors and actuators that we are using in our project.
  • Depending on the nature of sensors (analog or digital) the pins of sensors are connected to Arduino UNO accordingly.
  • #define is used to declare the pins of Gas, PIR, FIRE and BUZZER.
  • Initially, all the sensors have zero value that is stored by an integer variable.
  • In the void setup section, input and output sensors are defined.
  • GAS, PIR, and FIRE sensors are employed as input sensors to detect and activate the BUZZER, which is an output component.
  • LCD 20×4 is used and lcd.begin is used to initiate the LCD.
  • lcd.setCursor is used to cursor position on LCD and the name of the project is displayed on LCD Screen using lcd.print command.
  • Now, let's run our simulation to check the results, shown in the figure below:

Sensors Interfacing with Arduino

  • In Arduino IDE code execution, void setup runs once while the void loop executes again and again.
  • analogRead and digitalRead commands are used to read the value of analog and digital sensors respectively, while analogWrite and digitalWrite commands are used for sending commands or data.
  • As shown in the above figure, first, we have read the sensors' data and if all sensors are in LOW state, then have displayed the message "You are safe".
  • Let's run the code to check the output:
  • As you can see in the above figure, all sensors are at a LOW state and thus LCD is displaying the safe message.
  • Next, we have added the if loop for the case where all sensors are giving HIGH value:
  • The rest of the code has similar if loops for various conditions of sensors.
  • You can download the complete code and Proteus Simulation from the link, given at the start of this tutorial.
  • Now, let's run our final simulation and test the sensors and if everything goes fine, you will get results as shown in the below figure:

Future Recommendations

It deters the crime and notifies the user about the gas or fire problem. Home security systems are mostly utilized for safety reasons in residences, businesses, and educational facilities. Another option is to use a mobile device or the internet to send data to a remote location. Other modules, such as a wind sensor or a fire sensor, might be added to the system in the future. Voice alarm modules may also alert you to an intruder or a gas leak if you use them. We can increase the number of sensors to make it better. We can use the latest technology of the Internet of Things that makes our system wireless. A growing number of devices and goods are being connected to the Internet, which is referred to as the Internet of Things by the phrase. We can use the Internet of Things to produce a low-cost security system for residential and industrial applications that is especially useful for home security. When the door is opened or an unauthorized entry is detected, the system will send an alert to the owner. The user may take action after getting the notification. ESP8266 Wi-Fi module will connect to and interact with the Internet, while an Arduino Uno microcontroller keeps track of the system's status, as well as a magnetic Reed sensor for sounding the alarm. The principal advantages of this system are ease of installation, low costs, and low maintenance requirements.

So, that was all for today. I hope you have enjoyed today's project. If you have any questions, ask in the comments. Thanks for reading. Take care !!! :)

Real Time Security Control System using XBee and GSM

Hello everyone, I hope you all are doing great. In today's post, I am going to share a Final Year Project in detail, named as Real Time Security Control System using XBee and GSM. I will give you all the details so that you can easily design it on your own. I've given the Proteus Simulation to download below. In that zip file, you will get both the Arduino codes and Proteus Simulations.

I have divided this whole project design into four parts. If you got into any trouble in your project, then ask in comments and I will try my best to resolve them. So, today we are gonna have a look at the basics of this Security project. There are a lot of systems introduced in the market these days that are used to transfer sensor data from one node to another either wirelessly or through some wired connection. The proposed technique also works on this same principle. But a lot of modifications are intended to introduce in order to enhance this technique.

Where To Buy?
No.ComponentsDistributorLink To Buy
1LCD 20x4AmazonBuy Now
2NEO-6MAmazonBuy Now
3SIM900AmazonBuy Now
4DS18B20AmazonBuy Now
5Flame SensorsAmazonBuy Now
6MQ-2AmazonBuy Now
7Arduino UnoAmazonBuy Now

Real Time Security Control System

  • You can download this Project by clicking the below button:
Real Time Security Control System using XBee and GSM Now let's have a look at the project description:

Project Description

In this project, I have designed a real-time security system, which consists of two wireless nodes named as
  • Sensor Node
  • Base Node.
So, first of all, let's have a look at these two nodes one by one. First, I am going to discuss Sensor Node:

Sensor Node

The sensor node is placed in that building which is needed to be secured. Sensor node consists of three different sensors and two modules used for security purposes named as:
  • Sensors:
    • Smoke Sensor: To detect Smoke.
    • Flame Sensor: Used for Fire Detection.
    • Temperature Sensor: Measuring Temperature of surroundings.
  • Modules:
    • GSM module: is used to deliver the notification message if any fault occurs in the system.
    • GPS module: is used to locate the exact position of the fault that occurred.
Below two modules are used for controlling purposes:
  • Modules:
    • Arduino UNO: All these Sensors and modules are connected to Arduino UNO.
    • XBee Module: To send sensors' data & GPS Location to Base Node.
Block Diagram for the Sensor Unit of Real Time Security Control System using XBee and GSM is shown in below figure: Now let's have a look at the Base Unit of Real Time Security Control System using XBee and GSM.
Base Unit:
  • The base node will be placed in the Control Department. It could be your security guard's room or the nearby police station.
  • This node will receive the data from the sensor node via XBee module.
  • So, in total it will have three modules on it which are:
    • XBee Module: It is used to maintain wireless communication between the sensor node and base node.
    • LCD 20x4: It is used to display real-time conditions like sensors' values & GPS Location.
    • Arduino Mega 2560: It is used to control both of these modules.
  • Here's the block diagram of Base Unit for Real Time Security Control System using XBee and GSM:

Components Selected

In the previous section, we have had a look at the basic Introduction of our Real Time Security Control System using XBee and GSM. This section will elaborate on the selection of the components which is the most important factor before designing any project/product. This is basically a simulation based project so there is no hardware involved in this project. The proposed technique is designed in Proteus ISIS. All of the components are taken from the Proteus library.

Flame Sensor

  • The flame sensor is an electronic device usually used for fire detection purposes.
  • It can be used in homes, industries, offices, schools etc.
  • A certain threshold is adjusted while designing the algorithm.
  • When the fire flames cross that particular threshold, the flame sensor will send a signal to Arduino which will send that signal through Xbee to Base Unit immediately.
  • As soon as the signal will be received on the Base Unit, the alarm will turn ON and hence guards will come to know that this area has become dangerous now.
  • Immediate precautions must be taken in this case.
  • Flame Sensor is not available in Proteus so we have designed its library.
  • You should download this Flame Sensor Library for Proteus.

Smoke Sensor

  • A smoke sensor is used to detect a certain level of smoke within the desired region.
  • It is usually used in homes and organizations for the detection of fire or internal burns.
  • It is a low-cost and very sensitive sensor that also beeps if someone is smoking in its coverage area.
  • This Smoke Sensor will detect any smoke in the area then it will warn the Arduino board which will, in turn, send a signal via XBee to Base Unit.
  • Proteus software doesn't have a smoke sensor in it so you should download this Smoke Sensor Library for Proteus.

Temperature Sensor

  • The temperature sensor is an electronic sensor used to estimate the temperature in the surroundings.
  • The temperature range can be adjusted while designing its algorithm.
  • When the temperature in the surroundings reaches the adjusted threshold, it generates a notification.
  • Most of the time an alarm is attached to the temperature sensor. The alarm starts to beep when the desired temperature is reached. It can be used in homes, offices and organizations to maintain the temperature of a certain area according to the desired requirements.
  • But in our project we want to send a signal to the base unit, so that's why this sensor will send a signal to the base unit.

XBee Module

  • XBee is selected as a wireless module. The proposed technique consists of two XBee modules.
  • One is attached to the base unit and the other is attached to the sensor unit.
  • The data is transmitted by the sensor unit via XBee module.
  • And the XBee module attached to the base unit receives that data from the sensor unit and sends it to the microcontroller to manipulate it.
  • There are many wireless modules available in the market these days e.g. Radio Frequency (RF) module.
  • Some of them are not used commonly due to their shorter ranges e.g. Bluetooth module.
  • XBee module is far better as compared to the Bluetooth module and provides a larger coverage area in comparison to similar wireless modules.
  • So, XBee is used in this project. XBee module is not available in Proteus so that's why you should download XBee Library for Proteus.

Arduino UNO

  • The microcontroller plays a vital role in any project and is like a backbone of a particular project.
  • Arduino UNO and Mega 2560 both are selected as a microcontroller.
  • Arduino UNO is attached to the sensor unit and Arduino Mega 2560 is attached to the base unit.
  • Arduino is an open-source device. Students can take online help in almost every task. Online source codes are also available for different tasks.
  • So, a student can easily perform them with a proper understanding.
  • Arduino boards are also not available in Proteus so you should download this Arduino Library for Proteus.

GPS Module

  • GPS module is used to locate the exact location of the fault.
  • GPS module will be attached to Sensor Unit, so if anything goes wrong then we can also get the GPS location via SMS.
  • It will provide us the longitude and latitude of the fault that occurred on the sensor unit.
  • So, now if any of these sensors goes wrong then you can easily get the location of your sensor node via SMS.
  • Proteus doesn't have GPS Module in it so you should download this GPS Library for Proteus.

GSM Module

  • GSM module is used for security purposes.
  • If a fault occurs at any position within the network, a notification message will be generated and sent towards the base unit from the sensor unit.
  • We can also generate a call using this GSM which will be a much better way.
  • This GSM module will also send the location via SMS. We have received this location from GPS in the form of longitude and latitude.
  • Proteus doesn't have GSM Module in it so you should download this GSM Library for Proteus.
So, these are all the components/modules, which I have used in this project. So, in the first part, have seen the basic Introduction of the project and then in the second section, we have had a detailed overview of all the modules used. So, now in the next section which is the third part I am gonna show you How to design these Proteus Simulations.

Proteus Simulation of Security Control System

In this section, we are gonna have a look at how to design these Proteus Simulations for Real Time Security Control System using XBee and GSM. As you know, I have used Arduino so we also need to discuss the code in order to run these simulations. So, first, we will design the proteus simulations and then we will write its code.

Proteus Simulations

  • I have designed two simulations for this project.
  • First of all, what you need to do is to download all those above Proteus Libraries and add them properly.
  • I have given detailed instructions in each post about How to use them.
  • After adding all these Libraries, now restart your Proteus software and design a circuit for the Sensor Unit.
  • Proteus Simulation of Sensor Unit is shown in the below figure:
  • As you can see in the above figure, the Sensor unit consists of three different sensor modules, which are:
    • Temperature sensor.
    • Smoke sensor.
    • Flame sensor.
  • In this unit, Arduino UNO is used as a microcontroller to get data from all the sensors and this data will be transmitted wirelessly towards the base unit for proper monitoring.
  • XBee module is used for wireless communication between the sensor unit and the base unit.
  • GPS module is interfaced in order to locate the exact position of the fault that occurred in the system.
  • Now we are gonna design our second simulation for the Base Unit.
  • The Proteus Simulation of Base Unit is shown in the below figure:
  • The base unit is basically a monitoring end of the system.
  • All the data obtained from the sensors is transmitted by the sensor unit towards the base unit.
  • The base unit has an Arduino Mega 2560 as a micro-processing unit.
  • Just like the sensor unit, an XBee module is also attached to the base unit in order to receive the data wirelessly sent by the base unit.
  • There is an LCD on the base unit. It is used to visualize the obtained results. It displays different messages e.g. fault detection, sensors data etc.
  • GSM module is used in the base unit to send the notification if a fault occurs in the system or the system is showing some abnormal behavior even for an instance.
  • This GSM module will also send the location in SMS. You have to enter the number of recipients in the programming code.

Arduino Code of Security Control System

  • When you download this project, you will get a .rar file and within that file, you will find two folders.
  • One of them will have the Arduino Codes and the other one will have Proteus Simulations.
  • I have already added all the hex files so you just need to run these simulations.
  • If you got into any trouble then use our Contact Form and our team will help you out.
  • You should also need to read How to Get the hex file from your Arduino Software.

Proteus Simulation Results

  • Now coming towards the last section of this project, now I am gonna show you the results of these simulations.
  • So, I have run both of these Simulations and here's the first look at Base Unit:
  • The LCD on the base unit is displaying the title of our project.
  • Virtual Terminal is connected with Arduino so that we could also have a look at incoming or outgoing data.
  • After that first of all, Arduino will communicate with the GSM module and will set its settings, as shown in the below figure:
  • Now our GSM module has configured, so the next screen of the base unit is shown below:
  • As you can see in the above figure that LCD is displaying the values of all three sensors and because all are normal that's why the Alarm is OFF.
  • The temp value is 0 because we haven't yet received the data from the sensor unit.
  • Now let's run our Sensor Unit and make our Fire Sensor HIGH, then you will get results as shown in the below figure:
  • The alarm is also ON in the above figure and SMS has also been sent which is shown in Virtual Terminal.
  • In case, when both fire and smoke are detected, LCD will display smoke as well as fire detection messages.
  • SMS will also be sent as you can see in the Virtual Terminal. GSM has sent the message indicating Fire Detected and GPS Location.
  • Base Unit Proteus Simulation is shown in the below figure:
  • So, whenever you change any of these sensors' values in the Sensor Unit then the respective value will change in the Base Unit.
So, that was all about Real Time Security Control System using XBee and GSM. If you got into any trouble then ask in the comments and I will help you out. Thanks for reading, take care and have fun !!! :)

GSM Based Home Security System

Hello friends, I hope you all are fine and having fun with your lives. Today, I am going to share a complete project named as GSM Based Home Security System. I have designed its complete working simulation in Proteus and have used different libraries which you can also download from our blog. In the previous post, I have posted Home Automation Project using XBee & Arduino and today we are gonna work on Home Security System.

We have designed this simulation after a lot of efforts that's why we have placed a very small amount of $50 on it so that engineering students can download it and get knowledge from it. Moreover, as its a complex project so when you buy it then there's a chance that you can't run it by yourself so we also offer a free service. If you got into any trouble while running this simulation then use our Contact Form we will help you out personally within 24 hours.

GSM based Home Security System

  • You can buy this complete project by clicking the below button:

Buy This Project

  • When you will click the above button, you will be taken to the sale page for this project and you can buy this project using PayPal.
  • When you buy it you will get the complete code along with working Proteus simulation.
  • So, let's have an overview of this GSM Based Home Security System.
  • This GSM based Home Security System contains seven sensors which will be installed theoretically in your home. :)
  • These seven sensors are:
    1. PIR Sensor: For Motion Detection.
    2. Smoke Sensor: For Smoke Detection.
    3. Flame Sensor: For Fire Detection.
    4. Vibration Sensor for Window: For Detection of vibrations on Window.
    5. Vibration Sensor for Door: For Detection of vibrations on Door.
    6. Ultrasonic Sensor for Window: For intruder Detection on Window.
    7. Ultrasonic Sensor for Door: For intruder Detection on Door.
  • When we are talking about security then we have to take care of door and windows.
  • That's why I have placed two sensors on each of them. If someone tries to break the window then the vibration sensor will sense it and if someone tries to open the window then ultrasonic sensor will detect it.
  • The same will happen for the door.
  • So, whenever any of these seven sensors will get activated then the buzzer will go on and at the same time the user will receive a warning message.
  • Moreover, I have also placed an LCD which will display the sensors' condition.
  • Here's the Proteus Simulation for this GSM based Home Security System:
  • You can see in the above figure that I have used all these seven sensors mentioned above.
  • Moreover, I have used the GSM module, you can read more about it on GSM Library for Proteus.
  • Moreover, we have the Power circuit and the Buzzer Driver Circuit at the bottom.
  • Arduino UNO acting as the brain of this GSM Based Home Security System.
  • Now, let's run this simulation and if everything goes fine then you will get something as shown in below figure:
  • First of all, the system will configure the GSM module and then it will display two screens on LCD side by side.
  • First LCD screen is shown in below figure:
  • The first screen will show the status of first three sensors.
  • Now here's the screenshot of second screen showing the status for next four sensors:
  • That's how this project is working, now when any of these sensors got HIGH then buzzer will go ON and a message will be sent to the given number:
  • Now, you can see when I click the Smoke Sensor HIGH, it got detected immediately and a warning message is sent to my number.
  • I have explained this GSM based Home Security System in detail in the below video:
So, that's all for today. I hope you guys have enjoyed this awesome project. Before buying it, you must read it completely and also watch the video so that you are sure about what you are buying.

Send SMS with SIM900D in Proteus ISIS

Hello friends, hope you all are fine and having fun with your lives. Today, I am going to share a new exciting post on Send SMS with SIM900D in Proteus ISIS. In my previous post, I have shared the new GSM Library for Proteus, which is the first ever designed library for Proteus, and I am quite excited while sharing its features. So, today, we will use this GSM Lirbary for Proteus and we are gonna send sms with Sim900D module available in that library. We are gonna design this whole project in Proteus ISIS.

If you wanna implement it on hardware then you must have a look at Send SMS with SIM900D module with Arduino which is designed in real hardware but today we are gonna just do the simulation part. Iam not gonna use any Microcontroller today. Instead I will just send the AT commands through virtual Terminal and we will make it work.So, let's get started with Send SMSM with Sim900D in Proteus ISIS.

Send SMS with SIM900D in Proteus ISIS

  • First of all, I assume that you have already installed the GSM Library for Proteus. If you haven't then first intall it because without this library you can't use GSM module in Proteus ISIS.
  • Next thing you need to do is to design a circuit as shown in the below figure:
  • Now we need to run the simulation, so run it and in your virtual terminal, send these commands as shown in below figure:
  • The first AT command is for testing our GSM module and as it has given OK in reply so it means its working correctly.
  • The second command AT+CMGF=1 is for converting our GSM module to text messages, which it has accepted correctly and has given us OK in reply.
  • Now we are ready to send our SMS.
  • So, in order to do that we have to send it the command, as shown in below figure:
  • Now you can see, when I have given it the command which is AT+CMGS="+923326062060" , it has accepted it and replied back with this sign ">" , now the GSM module is actually asking for the message body.
  • So, let me write some text and then when I enter the Cntrl+Z command then it will send the message as shown in below figure:
  • So, I have given it the text of my blog link and then when I entered Cntrl+Z then it has sent the SMS and replied me back with +CMGS: 01 means its the first SMS sent from this GSM module.
  • So, that's how you can send any nmber of messages as you want from this module.
  • AS its a simulation, so obviously you are not gonna get the actual message on your mobile number but you can use it for testing your codes.
  • In the next post, I am gonna hopefully implement it using Arduino board or PIC Microcontroller.
So, that's all for today, I hope you have enjoyed the Send SMS with Sim900D in Proteus ISIS software. Till next tutorial, take care and have fun!!! :)

GSM Library for Proteus

Hello friends, hope you all are fine and having fun with your lives. In today's post, I am going to share GSM Library for Proteus. Yeah you have read absolutely fine, today I am gonna share the most awaited and most demanded Proteus Library. :) Till now, I have received hundreds of suggestions and requests about this Library and I have always told them that its under designing process and I will post it real soon. So finally the wait is over and we have our new GSM Library for Proteus, ready to download and simulate in Proteus. Using this GSM library for Proteus, now you can easily simulate your GSM module in Proteus and can test your code. :)

As its the first version of our GSM Library so its not complete or perfect. It is really the basic model of GSM Library and rite now it will only support some commands, which I will post below. I am still working on it and I will soon update these files and will add more commands in it but till then you have to use these commands only. Moreover, this Library contains only one module in it which is SIM900D module. I will add more soon like SIM900A and Sim300 etc. real soon. I will also interface it with different Microcontrollers like Arduino or PIC Microcontroller etc. and will share their tutorials. So. let's get started with GSM Library for Proteus:

Note: Other Proteus Libraries are as follows:

GSM Library for Proteus

  • First of all, download the GSM Library for Proteus by clicking the below button:
GSM Library for Proteus

  • When you download it, you will get three files in it which are:
    • GSMLibraryTEP.IDX
    • GSMLibraryTEP.LIB
    • GSMLibraryTEP.HEX
  • Place all these files in the Libraries folder of your Proteus software.
Note:
  • Now, open your Proteus software or restart it if its already open and in components list search for SIM900D and you will get three results for it.
  • Place all of them in your Proteus workspace and they will look like as shown in below figure:
  • Now, you can see in the above figure that we have three GSM Modules in our Proteus software.
  • These three GSM modules are exactly same in functionality as you can see they all have two pins on them which are TX and RX and they are only differ in color but they all work on Serial Port.
  • One is in light blue color which is kind of our theme color, next one is in green color while the last one is in red color.
  • So, now let's have a look at how you can use it in your Proteus simulations.
  • Double click any of them and in the program file section, browse to the GSMLibraryTEP.HEX file and upload it in SIM900D module as shown in below figure:
  • AS you can see in the above figure that I have uploaded the GSMLibraryTEP.HEX file in the Program file section.
  • Now click OK and interface a Virtual Terminal with SIM900D, as shown in below figure:
  • Now, I am gonna run my simulation and will send it AT commands we will check the response of this GSM module. :)
  • Now these are some basic commands, which are rite now supported by this version of GSM Module.
  • It won't be able to send or receive SMS rite now because these functionalities are not added yet but they are coming soon, as I am still working on it.
Note: Here's the complete list of commands currently supported by this Sim900D module:
  • AT
  • AT+CPIN?
  • AT+CSQ
  • AT+CGMI
  • AT+COPS?
  • AT+CGMM
  • AT+CGSN
  • AT+CNUM
  • ATA
  • ATH
  • AT+COLP
  • AT+CLIP
  • AT+VTS=1
  • AT+CSMP?
  • AT+CSCS?
  • AT+CSCS="HEX"
  • AT+CSMP
  • AT+CNMI=1,2,0,0,0
  • AT+CMGF=1
  • AT+CMGD=1
  • So, these are the commands which are currently supported by this Version 1.0 of our SIM900D GSM Module. I am gonna add more soon. :)
  • Now, here's a quick video in which I have shown its working, which will give you the better idea of this GSM Module.

Upgrade # 1: Send SMS with Sim900D

That's all for today, I hope you are gonna enjoy this GSM Module. Must write your experience in the below comments which will work as a boost for me and I will design it even faster. :) So, till next tutorial, take care and have fun !!! :)

Receive SMS with AT Commands using Sim900 and Arduino

Update: I have updated the code and removed the bug. Thanks for informing. Now this code will work perfectly.

Buy This Project

Hello friends, hope you all are fine and having good health. Today, as the name suggests, I am gonna post on how to Receive SMS with AT Commands using Sim900 and Arduino. I have already posted a tutorial on How to Send SMS with Arduino UNO and Sim900, so now we are gonna check the opposite. Sending SMS is quite easy, you just need to write some AT commands and write the message you wanna send and hit the Cntrl + Z and it will be sent. But receiving a text message on your SIM900 shield is a bit difficult because now you need to place a check when user will send a message. So, ideally whenever anyone send a message to your SIM900 module, you should get notified. Today, we are gonna cover this how to receive SMS with AT Commands in detail.

Now, after you get notified, there's a need to read the message as well and also who has sent this message. So, we are also gonna cover it today. So, first of all we will place a check that whenever someone sends a message to our SIM900 module, we get notified and after that we will extract the message and the mobile number of sender. We have designed this code after a lot of effort that's why this code isn't free but we haven't placed a very small amount of $20 so that engineering students can also buy it easily. We can also interface our GSM board with other microcontrollers like PIC Microcontroller as well as 8051 Microcontroller. I have also posted tutorial on How to Receive SMS with SIM900 & PIC Microcontroller and How to Send SMS with PIC Microcontroller so if you are working on PIC Microcontroller then you must give it a look. So, let's get started with How to receive SMS with AT Commands using SIM900 and Arduino.

You must also check GSM Library for Proteus, using this library you can easily simulate your GSM module in Proteus ISIS. Moreover, also have a look at Send SMS with Sim900D in Proteus ISIS in which I have designed a simulation of sms sending in Proteus ISIS.

Receive SMS with AT Commands using Sim900 and Arduino

  • There are many GSM modules available in the market so it doesn't matter which one you are using unless its having SIM900 module in it.
  • I have explained in my previous post that all GSM modules work on AT commands, so here first of all we are gonna have a look on AT commands we are gonna use for receiving the SMS.
  1. ATE0 - IT is used to turn off the Echo of GSM shield.
  2. AT - Just to check that your GSM module is working fine.
  3. AT + CMGF = 1 - This command will convert the message style to text. In other words we are telling our shield that we are expecting a text message.
  4. AT+CNMI=1,2,0,0,0 - This command will alert our GSM shield and now whenever it will receive message, it will automatically send an alert on the serial port.
  • We are gonna use these four commands in our code and we will be able to receive text message on the GSM shield.
  • Remember we have to put Enter after each of the above AT commands in order to execute it.
  • Below is the first phase of the code and as you can see in this code we are simply sending these four commands serially from arduino to GSM shield.
  • These are two functions I have shown below, the first function is Config() which is simply sending the commands via serially and then the Response() function which is called after every AT command and is receiving the response of that AT command.
  • So, here's the partial code for How to Receive SMS with AT Commands using Sim900 and Arduino.
void Config()
{
delay(1000);
Serial.print("ATE0r");
Response();
Serial.print("ATr");
Response();
Serial.print("AT+CMGF=1r");
Response();
Serial.print("AT+CNMI=1,2,0,0,0r");
Response();
}

void Response()
{
int count = 0;
Serial.println();
while(1)
{
if(Serial.available())
{
char data =Serial.read();
if(data == 'K'){Serial.println("OK");break;}
if(data == 'R'){Serial.println("GSM Not Working");break;}
}
count++;
delay(10);
if(count == 1000){Serial.println("GSM not Found");break;}

}
}
  • The response of these commands is shown below on the Serial Monitor of Arduino.
  • For each AT command, we get a response "OK" from the GSM shield.
  • Now, I know that I have sent all these four AT commands and my GSM shield is ready to receive the text messages and will inform me.
  • So, when you send a message to your GSM shield, it will give a notification as shown in the below figure:
  • Each message received by SIM900 module is start with "+CMT" and after that it has the mobile number of the sender and at the end lies the body of the message, which in our message is "www.TheEngineeringProjects.com"
  • So now let's extract this mobile number and the text body from this CMT string.

Getting the SMS Text & Sender Mobile Number

  • Till now we have learnt How to Receive SMS with AT Commands using Sim900 and Arduino and send you notification over the serial monitor.
  • Now we have to place some checks in our code so that we could be able to get the required data out of this string.
  • In order to do so, I am gonna first save this CMT string into an array, which I named as RcvdMsg[index].
  • But before saving the data into this string, first I need to make sure that I am actually getting the requried string, that's aso possible that I am receving some garbage values.
  • So, I placed a check first, which is checking for these four characters "+CMT", and when I got these character on my serial terminal I got sure that I have the string ready so I made the index = 0 and starting receving the string.
  • Next thing I need to do is make sure that I have got the complete string, that was really a tricky part as there's no end character in the string.
  • So, I used "n" null character for that. If you check the string then you can see that we are getting two null characters in complete string.
  • I placed this check that when I get 2 null characters means I have got the complete string so I stopped receving the string.
  • After that I simply count the charaters, in my string the sender mobile number is at posting 4 to 16 so I made a loop and save it in another array. and similarly did for the message text.
  • Now when I send message after uploading this final code into my Arduino board, I get the below result on my Serial Monitor.
  • Isn't it cool :) So, now we have separated the complete text as well as the sender's mobile number from our GSM string and we can use it anywhere we want.
  • We can use this mobile number in the previous post code and can reply some text back and can also give a missed call to the user, anything we want. I am gonna post on How to send a call using SIM900 in the next post.
  • You can buy the codefor How to Receive SMS with AT Commands using Sim900 and Arduino from our shop by clicking the below button:
Buy This Project
  • I have highlighted all the functions in the code.
  • As I always say, understand it first and then write on your own and do mistakes so that you learn.
That's all for today. I hope you have enjoyed this project named Receive SMS with AT Commands using Sim900 and Arduino. I will meet you guys in the next post. Till then have fun !!! :)

Send SMS with Arduino UNO and SIM900D using AT Commands

Hello friends, today's post as the name suggests is about how to send SMS with Arduino UNO and SIM900D using AT Commands. There are different types of SIM900D modules available in the market, so it doesn't matter which module you are using. All SIM900D modules work at AT commands basically so today I am going to show you how to send an SMS via AT commands without using any Arduino library. You should first read the AT commands manual which will give you an idea about AT commands. AT commands are special sets of commands which are used for communicating with SIM900 module. Using these AT commands we let our GSM work for us. Like if you want to send SMS then there's a specific AT command for sending the SMS similarly if you want to change the PIN code for your GSM module then you have a different AT command. So, there are lots of AT commands available. We can interface this GSM module with any microcontroller like PIC Microcontroller or 8051 Microcontroller but here I have interfaced it with an Arduino board. You should also check How to Send SMS with PIC Microcontroller if you wanna use PIC Microcontroller instead of Arduino board.

You must also check GSM Library for Proteus, using this library you can easily simulate your GSM module in Proteus ISIS. Moreover, also have a look at Send SMS with Sim900D in Proteus ISIS in which I have designed a simulation of SMS sending in Proteus ISIS.

Note:

Where To Buy?
No.ComponentsDistributorLink To Buy
1SIM900AmazonBuy Now
2Arduino UnoAmazonBuy Now

Components Used

I have shared the list of components used in this project. I am giving a comparison of three vendors below, you can buy from any of them:
Components List Amazon Ali Express
Give Your Suggestions !!!
Arduino UNO R3 Click Here to Buy Price: $10.99 Click Here to Buy Price: $2.79
GSM Module Sim900 Click Here to Buy Price: $28.99 Click Here to Buy Price: $10

Connect Arduino UNO with SIM900D

  • First of all, connect Arduino UNO with SIM900D module, which isn't much difficult. If you have the module in hand then the first thing you need to do is to power it up and wait for the module to get connected.
  • Usually, an LED is placed on the SIM900D module which keeps on blinking. If it's blinking fast, it means the modules haven't yet captured the signal. When the module captures the signal then the LED keeps on blinking but at lower speed.
  • Now find the TX and RX pins of your SIM900D module and connect the TX of module with RX of Arduino UNO, which is pin # 0 and similarly RX of module with TX of Arduino UNO, which is pin # 1.
  • The module, which I have used for my project is shown in the below figure, with labelled pin configurations and if you want to buy it in Pakistan then click here.
  • One other thing mentioned in above figure is pKey, connect it with ground.
  • Once your connections are ready, then upload the below sketch in your Arduino UNO and start sending messages.
    void setup()
    {
    Serial.begin(9600);
    }
    void loop()
    {
    delay(1200);
    Serial.print("AT");
    delay(1200);
    bool bOK = false;
    while (Serial.available() > 0)
    {
    char inChar = (char)Serial.read();
    bOK = true;
    }

    if(bOK)
    {
    index = 0;
    Serial.println();
    Serial.println("AT+CMGF=1"); // sets the SMS mode to text
    delay(100);
    delay(1200);
    bool bOK = false;
    while (Serial.available() > 0) {
    //Serial.write(Serial.read());
    char inChar = (char)Serial.read();
    bOK = true;
    }
    if(bOK)
    {
    Serial.println();
    Serial.print("AT+CMGS=""); // send the SMS number
    Serial.print("+923004772379");
    Serial.println(""");
    delay(1000);
    Serial.print("A new post is created by Zain."); // SMS body

    delay(500);

    Serial.write(0x1A);
    Serial.write(0x0D);
    Serial.write(0x0A);

    }
    }
    }
  • Change the mobile number with the number, on which you want to send the SMS, I have written mine.
  • You should also change the body of the SMS and can write anything you wanna send as an SMS.
  • The AT commands are required to send the SMS. I have added the comments in front of these commands but still if you get into any trouble, ask in comments.
  • That's all for today, in the coming post, we will have a look how to receive SMS with SIM900 and Arduino.
Syed Zain Nasir

I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

Share
Published by
Syed Zain Nasir