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.
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
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 !!! :)
Smart Blind Stick using Arduino in Proteus
Buy This Project
Hello everyone, I hope you all are doing great. Today, I am going to share a new Project which is
Smart Blind Stick using Arduino in Proteus ISIS. I have designed its complete Simulation which I am gonna share today. We have designed this Proteus simulation off Smart Blind Stick after quite a lot of effort that's why its not free. We have placed a small amount on it and you can buy it from our shop via PayPal. You need to click on above button in order to buy this project's code and Simulation. If you have any problem in understanding this project, then you can ask in comments and I will try my best to resolve your issues.
Smart Blind Stick project is designed quite a lot in engineering universities. That's why, I thought of sharing this simulation. Although its a Proteus Simulation but if you wanna design it on hardware then this code will work perfectly fine as I have tested it on hardware. If you got into any trouble in running this simulation then you can also send me message via Contact Form and I will surely help you out. So, let's get started with Smart Blind Stick using Arduino in Proteus ISIS:
Smart Blind Stick using Arduino in Proteus
- In this Smart Blind Stick, I have used:
- Three Ultrasonic Sensors are placed in Front, Left and Right Directions.
- Ultrasonic Sensors on blind stick are used for detection of any hurdle or intruder in the passage of blind person.
- Once it detects the hurdle, then the buzzer will go ON and alert the blind person.
- Similarly I have also placed a PIR sensor which is detecting the presence of any other person, so when you place it on the blind stick then make sure that it is placed on front side so that it won't detect the blind person.
- Although blind persons can't read the values on LCd but still I have placed an LCD just to display all the values.
- I have used Arduino Pro Mini because its smaller in size and can easily be placed on a blind
- Here's a screenshot of Smart Blind Stick using Arduino in Proteus ISIS:
- Because the simulation was big in size that's why these sensors are looking so small, you need to zoom in to get all the details.
- It's got lengthy because I have designed a stick in Proteus and I have placed all the sensors on that stick except PIR sensor because that was quite big.
- It's looking quite cool because of the stick simulation. :)
- Here's a screen shot of zoomed in Ultrasonic Sensors:
- Now when you buy this Project, then you will get all these Library files in the folder along with complete Arduino code and Proteus Simulation.
- I have also designed a video which is given at the end of this tutorial, if you wanna buy this project, then must watch that video as I have shown the working of this Proteus Simulation in that video.
- Now, Get the Hex File from Arduino Softwre and upload it in the Arduino Pro Mini.
- Once you are done, run your Proteus Simulation of Smart Blind Stick and if everything goes fine then you will get the first screen as shown in below figure:
- This first screen is displaying the name of Project as well as our website in LCD.
- After 5 sec, it will change and will start displaying sensors' values, as shown in below figure:
- You can see in above figure that LCD is displaying values of all ultrasonic sensors, along with the Motion detection.
- Because PIR Sensor's TestPin is HIGH that's why its showing that Motion Detected and at this time the buzzer is also ON, which you can't hear in the image. :P
- Here's a detailed video, in which I have shown the functionality of this Smart Blind Stick Proteus Simulation:
If you want to buy this project then, you must first watch this video, so that you got the idea of what you are buying. That's all for today. I hope you have enjoyed this Smart Blind Stick. Till next tutorial, take care and have fun !!! :)
Arduino Projects for Beginners
Hello everyone! I hope you all will be absolutely fine and having fun. Today, I am going to elaborate you, how to make
Arduino Projects for beginners. Before gong into the detail of this tutorial first of all I would like to explain you a bit about Arduino. Arduino is an open source micro controller. A lot of help is available online so its user friendly hardware. Most of the students prefer to do work on this device.
Arduino is a low cost high performance device. Due to its cost effectiveness and open source feature it is commonly available in the market these days. An amazing thing about Arduino is that students can take help online with a lot of examples regarding any of the task. There are thousands of Arduino projects are available online from beginner level to the major real life projects. Students can make their own projects without having a lot of programming experience. Arduino kits for the beginners are also available in the market now a days. These kit usually consist of an Arduino board, jumper wires, motors, LED's, sensors, relays etc. Arduino has a very wide of real life applications including automation, robotics, remote control, LED's, environmental sensing, Internet of Things (IoT), display, monitoring etc. Further detail about this tutorial will be given later.
Arduino Projects for Beginners
In this section of the tutorial Arduino Projects for beginners, I will elaborate you how to make basic and very simple projects using Arduino which will lead you to the better and better understanding of Arduino environment later. With the help of such a projects you will be much confident and will be able to make large projects too. So here I am going to share some of the basic and beginners level Arduino projects from my blog.
Arduino Basic Projects
In this section I will provide Proteus ISIS libraries for the different Arduino boards e.g. Arduino Nano, Arduino UNO, Arduino Mega 2560 etc and other different projects too. Here is the list of those projects.
- Getting Started with Arduino Software
- Arduino Library for Proteus
- Arduino UNO Library for Proteus
- Arduino Genuino Library for Proteus
- Arduino Lilypad Library for Proteus
- Arduino Mega 2560 Library for Proteus
- Arduino Nano Library for Proteus
- Arduino Pro Mini Library for Proteus
- Arduino UNO PCB Design for Proteus
- Arduino Library for Seven Segment Display
- How to get .hex File from Arduino
- How to use Arduino Software Serial
- How to use Arduino Serial Flush
- How to use Arduino Serial Read
- Ultrasonic Sensor Library for Proteus
- These are the very basic Arduino Projects, a student must go through all of these projects for the better understanding of the other projects.
- Now, I am going to share all of the mini projects designed by our team using Arduino board.
1. A Simple Arduino LED Example in Proteus
In this tutorial I have shared an LED control example using Arduino UNO in Proteus ISIS. I have designed the circuit to control a single LED using Arduino in Proteus. First I have testes and verified the control of an LED using Arduino.
After its successful testing I have designed another circuit in Proteus to control a bundle of LED using the Same Arduino board. You can also check the blinking of an on board LED attached to the pin 13 of Arduino board. I have provided the complete Proteus ISIS design and Arduino source code for your easiness.
- You can download the entire package here by clicking on the button below.
Download Simulation
- Download .rar file, extract it and enjoy the simulation.
2. Circuit Designing of LCD with Arduino in Proteus
In this tutorial I have shared the design of a circuit for LCD interfacing with Arduino UNO in Proteus ISIS. I have used LCD here basically for debugging purpose in order to check whether the Arduino source code is in working condition or not.
I have designed the Proteus simulation first and then I wrote source code in Arduino software. At the end after uploading .hex file in Arduino I have verified the code as show in the figure.
- You can download the entire package here by clicking on the button below.
Download Simulation
- Click on the button above and go through the detailed discussion.
3. Interfacing of Keypad with Arduino in Proteus ISIS
In this article I have elaborated the circuit designing of keypad with Arduino UNO. I have used 4*3 keypad. Keypads are most common in a lot of real life applications such as calculators, laptops, ATM machined etc. The functionality of keypad is based on matrix systems.
I have interfaced Arduino UNO, LCD and keypad in such a way that the text is displayed on LCD with respect to the corresponding buttons pressed from the keypad.
- You can download the entire package here by clicking on the button below.
Download Simulation
- Download the file, extract it and enjoy the simulation.
4. Scrolling Text on LED Matrix 8*8 using Arduino in Proteus ISIS
This part of this tutorial will explain the design for scrolling text on LED matrix 8*8 using Arduino in Proteus ISIS. I have used an LED matrix. It is basically used to display long messages that we want to write on it.
I have designed the complete circuit simulation in Proteus ISIS. Then I have written the Arduino source code. After uploading the code I have verified the results as well. They were absolutely perfect. Our team has done a lot of hard work to design this project. So, I have imposed a very lost on it that a student can easily buy this project even with his pocket money.
- You can buy this project here by clicking on the button below.
Buy Simulation & Arduino Source Code
5. Ultrasonic Sensor Simulation in Proteus
This article presents the detailed discussion about the circuit designing for interfacing of SONAR with Arduino UNO. I have used the library for ultrasonic sensor whose link is given above. This sensor is very to interface using this library.
I have shared three type of examples regarding ultrasonic sensor interfacing with Arduino in Proteus ISIS. These examples include ultrasonic sensor interfacing using buttons, as a proximity switch and as a switch. I have provided both Proteus simulation as well as Arduino source code.
- You can download the entire package here by clicking on the button below.
Download Simulation
- Download the file, extract it and enjoy the simulation.
6. Interfacing of Temperature Sensor 18B20 with Arduino
The detailed discussion about circuit designing and interfacing of temperature sensor with Arduino UNO is given in this section of the tutorial Arduino projects for beginners. I have used non-water proof temperature sensor.
I have used an LCD as well to print the values obtained from the temperature sensor. We can get the values of temperature in Celsius using 18B20. There is a library for Arduino while interfacing 18B20 with it. I have shared that library too.
- You can download the entire package containing both simulation and Arduino library for 18B20 here by clicking on the button below.
Download Library & Simulation
- Download the file, extract it and enjoy the simulation.
7. Interfacing of Temperature Sensor LM35 with Arduino in Proteus ISIS
This section of the tutorial Arduino projects for beginners, will provide you the discussion about the circuit designing of L35 interfacing with Arduino in Proteus. LM35 is a low cost sensor as compared to the other temperature sesnsors e.g. 18B20.
I have designed the circuit in Proteus ISIS first and then I have written the code in Arduino software. After that I have tested the written code and verified the results. There were absolutely accurate. I have provided both simulation and code for free.
- You can download the entire package here by clicking on the button below.
Download Simulation & Code
- Download the file, extract it and enjoy the simulation.
8. Interfacing PIR Sensor with Arduino
The detailed discussion about the interfacing of PIR sensor with Arduino is given in this section of the tutorial Arduino projects for beginners. PIR sensor is designed for motion detection purposes. PIR sensor is a passive device and does not generate its own voltages and energy.
I have provided the complete circuit diagram of PIR interfacing with Arduino as well as the source code in Arduino software. You can also read the detailed discussion here by clicking on the button below.
Download Simulation
- Download source code and circuit diagram and enjoy the simulation.
9. Interfacing Flame Sensor with Arduino
In this section of the tutorial Arduino projects for beginners, I have given the detailed discussion about interfacing flame sensor with Arduino UNO. Flame sensor is designed basically fire detection purposes or you can say for temperature monitoring purposes. You have to set a threshold value and above that value an LED on the top of the sensor will be turn on as an indication.
I have designed its Proteus ISIS simulation first. Then I have written its source code in Arduino software. I have uploaded the code in Arduino in Proteus and observed the results, they were quite accurate. You have to change the state of logic state from
0 to
1. As the state becomes
1 the sensor will start working and a corresponding test will be displayed on LCD. I have provided the complete simulation and source code for this project.
- You can download the entire package here by clicking on the button below.
Download Simulation & Arduino Source Code
- Download source code and circuit diagram and enjoy the simulation.
10. Interfacing NRF24L01 Sensor with Arduino
This section of the tutorial Arduino projects for beginners, will give you the detailed discussio nabout the interfacing of NRF24L01 sensor with Arduino UNO. NRF24L01 is basically used for wireless communication between two different nodes.It operates on a frequency equal to WiFi frequency i.e. 2.4GHz. This sensor has a capability to send and receive data at the same time.
I have provided Arduino library for NRF24L01, complete circuit diagram and Arduino source code for this project for free. You can easily design your own circuit with the help of this article.
- You can download the entire simulation and source code here by clicking on the button below.
Download Simulation & Arduino Source Code
- Download source code and circuit diagram and enjoy the simulation.
11. Interfacing RFID RC522 with Arduino
In this section I will elaborate you the method for interfacing RFID RC522 with Arduino. I have used a breadboard and jumper wires to make a connection between RFID RC522 and Arduino UNO. RFID RC522 is used in the projects where there is a need of wireless communication between laptop/PC and the micro controller.
I have provide the pins configuration of Arduino as well as RFID RC522 sensor. I have also provided the library for RFID, a complete circuit diagram of in terfacing this module with Arduino as well as the source code to operate this module.
- You can download the library, circuit diagram and source code here by clicking on the button below.
Download Simulation & Arduino Source Code
- Download source code and circuit diagram and enjoy the simulation.
12. Control Servo Motor with Arduino in Proteus
This section of the tutorial Arduino Projects for Beginners, will provide explanation about control of a servo motor with Arduino in Proteus ISIS. Servo motor is commonly used in the projects where there is a need of high precision like CNC machines, robotics are such fields where high precised results are required. So, servo motors are the best option in such cases.
I have designed a complete circuit for interfacing of a stepper motor with Arduino UNO in Proteus ISIS. I have provided the complete Arduino source code as well. After uploading the source code in Arduino you will be able to control the servo motor in Proteus ISIS.
- You can download the complete simulation and source code here by clicking on the button below.
Download Simulation & Arduino Source Code
- Download source code and circuit diagram and enjoy the simulation.
13. Home Automation Project using XBee and Arduino
In this tutorial I have explained all of the steps about making a home automation project using XBee and Arduino UNO. Now a says, since every thing is going under automation. So, I thought to design a pretty simple automation projects named as home automation project. Home automation project has the features e.g. you can control the entire appliances of the home from your PC or Laptop sitting anywhere in the world. This features required internet services.
First of all I have designed the complete circuit as shown in the figure as well. I have designed the circuit to control the home using remote. I have written Arduino source code and after uploading the code in Arduino I have tested the projects and it was operating well. Our team has designed this project with a lot of hard work so we have imposed a very small amount of cost on it. Even a student can but this project with his/her pocket money.
- You buy the complete simulation as well the Arduino source code here by clicking on the button below.
Buy Simulation & Arduino Code
14. GSM Based Home Security System using Arduino
In this section of the tutorial Arduino projects for beginners, I have explained all of the necessary steps to design a GSM based home security system using Arduino. Some of people are very conscious and they want to secure there houses at any cost. So basically this type of project is pretty suitable for them.
I have designed a complete Proteus ISIS simulation for home security system using Arduino and GSM. Then I have written a complete Arduino Source code and after uploading it on the Arduino board in Proteus I have tested the results which were quite efficient and precise. This project took a lot of hard work and time. So, we have imposed a small amount of cost on it as well.
- You can buy this project easily here by clicking on the button below, its not costly at all.
Buy Simulation & Arduino Code
This tutorial contains a detailed discussion of
Arduino Projects for Beginners. I have a lot of basic Arduino projects. Some of them were free of cost and some projects are assigned with a small amount cost. I have tried to share different easy and moderate level Arduino projects. If you have any problem you can freely ask us. Me and my team is 24/7 available here to entertain you and to help you out in some good manner. I will share other informative and helpful tutorials in my upcoming articles. Till then, Taker Care :)
Stepper Motor Speed Control using Arduino
Hello everyone! I hope you all will be absolutely fine and fun. Today, I am going to tell you that how to make a simple algorithm for
Stepper Motor Speed Control using Arduino. I have already discussed with you about
DC Motor Direction Control using Arduino,
Matlab and NI LabVIEW. Moreover, I have also discussed the
DC Motor Speed Control using Arduino,
Matlab and LabView. If you are working on Stepper Motor, then you must have a look at
Stepper Motor Direction Control using Arduino,
Stepper Motor Direction Control using Matlab and Stepper Motor Direction Control using NI LabVIEW. Now, in this tutorial I will explain you about the program which will helpful for Stepper Motor Speed Control using Arduino. Before going into the details of this tutorial you must have go through my previous tutorials because I am using the same hardware. So, they will be a lot helpful for the better understanding of this tutorial.
In this tutorial I will explain you about making an Arduino program for
Stepper Motor Speed Control using Arduino with the help of the serial communication. If the stepper motor is rotating at its maximum speed and you are continuously sending the command through the serial port to reduce its speed, it s speed will be reduced in proportion to the number of command sent through the serial port. Similarly the same procedure will be followed to increase the speed of the stepper motor.
Stepper Motor Speed Control using Arduino
In the tutorial Stepper Motor Direction Control using Arduino, I will explain you about making an algorithm to run the stepper motor at different speed. If the stepper motor is already running at its maximum speed and you want want to accelerate it further then nothing will happen to the speed of the stepper motor. If the stepper motor is rotating slowly and you enhance its speed, then the speed of the motor will increase in proportion to the number of accelerating command sent through the serial port.
- You can download the complete Arduino source code here by clicking on the button below.
Download Arduino Code
- Download .rar file, extract it and enjoy the complete source code.
Flow Chart
- I have made a flow chart so that you can easily understand the entire algorithm because sometimes it becomes difficult to understand the algorithm with the help of the source code.
- Flow chart for the Stepper Motor Speed Control using Arduino is shown in the figure below.
- First of all we need to start the serial port so that our communication could be started.
- Then there is a method to check the speed, if the speed is greater than the maximum speed of the stepper motor then the program will wait for the next command.
- If the stepper motor is not rotating with its maximum speed then we can increase its speed.
- Similarly if the minimum speed of the stepper motor is reached then the program will rotate for the next commands.
- If the minimum limit of the speed of the stepper motor is not reached then we have a option to reduce its further.
- At the end we should close the serial port so that exchange of unnecessary commands through the serial port could be avoided.
Block Diagram
- Block diagram will be helpful for use for the better understanding of the exchange of information.
- It tells us that how the information is exchanged sequentially among all the components used.
- Block diagram is shown in the figure below.
- Arduino UNO communicates with the L298 motor controller to control the speed of the stepper motor.
- L298 Motor controller manipulates the Arduino's commands and starts to control the speed of the stepper motor.
Arduino Code Description
In this section of the tutorial Stepper Motor Speed Control using Arduino, I am going to elaborate you about the Arduino source.
- I have made two different functions for increasing (accelerating) the speed of the stepper motor and for decreasing (deaccelerating) the speed of the stepper motor respectively.
- I have declared a variable named as count.
- In Accelerate function, you have to send the command H through the serial port to increase the speed of the stepper motor.
- In this function, I am continuously increasing the value of the count i.e as many times you send the command H the speed of the stepper motor will increase continuously.
- The source code of the Accelerate function is given below.
void Accelerate_Motor()
{
count=count+10; //Speed will increase continuously as we continue to press H
if (count>120) //Speed must not be greater than 120
{
count=120;
}
Serial.println("Accelerating"); //printing on the serial port
Serial.println("");//prints blank line on the serial port
myStepper.step(stepsPerRevolution);//counter clockwise rotation
myStepper.setSpeed(count); //Updating the speed of the motor
lcd.setCursor(3,0);//setting LCD cursor
lcd.print("Acelerating"); //printing on LCD
}
- In Deaccelerate function, you have to send the command L through the serial port to increase the speed of the stepper motor.
- In this function, I am continuously reducing the value of the count i.e as many times you send the command L the speed of the stepper motor will reduce continuously.
- The source code of the Deaccelerate function is given below.
void Deaccelerate()
{
count=count-10; //reducing the speed of the motor
if (count<20) //speed of the motor must not be less than 20
{
count=20;
}
Serial.println("Deaccelerating"); // prints on the serial port
Serial.println(""); //prints blank line on the serial port
myStepper.step(stepsPerRevolution);
myStepper.setSpeed(count); //Updating the speed of the motor
lcd.setCursor(3,0); //setting cursor on LCD
lcd.print("Deaccelerating"); //prints the command on LCD
}
- In the main source inside the loop I am calling both of these Accelerate and Deaccelerate functions.
- The executed commands will also be printed on the LCD (Liquid Crystal Diode).
- The main source code is given below.
#include <LiquidCrystal.h>//Library for LCD
#include <Stepper.h> //Library for Stepper motor
const int stepsPerRevolution = 255;
// initialize the stepper library on pins
Stepper myStepper(stepsPerRevolution, 4, 5, 6, 7);
char data;
int count = 120;
//LCD pins assigning
LiquidCrystal lcd(8, 9, 10, 11, 12, 13);
void setup() {
// set the speed at 60 rpm
myStepper.setSpeed(60);
// initialize the serial port:
Serial.begin(9600);// rate at which the arduino communicates
lcd.begin(20, 4);//LCD type
lcd.setCursor(3,0);//setting LCD cursor and printing on it
lcd.print("Stepper Motor");
lcd.setCursor(6,1);
lcd.print("Speed");
lcd.setCursor(5,2);
lcd.print("Control");
lcd.setCursor(2,3);
lcd.print("via Arduino UNO");
delay(3000);
lcd.clear ();//Clearing the LCD screen
lcd.setCursor(0,2);
lcd.print("www.TheEngineering");
lcd.setCursor(4,3);
lcd.print("Projects.com");
}
void loop() {
if(Serial.available())
{
data = Serial.read(); //Reading the data from serial port
}
if(data == 'C'){Clockwise();} //Clockwise rotation
if(data == 'A'){AntiClockwise();} //Anti-clockwise rotation
if(data == 'S') //stopping the stepper motor
{
data = 0;
lcd.setCursor(3,0);
lcd.print("No rotation");
Serial.println("No rotation");//print on the serial
}
if(data == 'H'){Accelerate_Motor();}
if(data == 'L'){Deaccelerate();}
}
Complete Hardware Setup
- In this section of the tutorial, I will show you the complete hardware setup that I have used for this project.
- Hardware consists of 12V power supply, Arduino UNO, L298 motor controller.
- When you upload the code to the Arduino board the system will look like the figure shown below.
- When you press H to increase the speed of the stepper motor, the statement accelerating will be printed on the LCD.
- The printed executed command is printed on the LCD and is shown in the figure below.
- When you press L to reduce the speed of the stepper motor, the statement Deaccelerating will be printed on the LCD.
- The printed executed command is printed on the LCD and is shown in the figure below.
That is all from the tutorial Stepper Motor Speed Control using Arduino. I hope you all have enjoyed this tutorial. If you face any sort of problem regarding anything you can ask me anytime without even feeling any kind of hesitation. I will try my level best to solve your issues in a better way if possible. I will explore Arduino by making further projects and I will share them with all of you as well in my later tutorials. So, till then, Take Care :)
Stepper Motor Direction Control using Arduino
Hello friends! I hope you all will be absolutely fine and having fun. Today, I will elaborate you that how can we make a simple algorithm for
Stepper Motor Direction Control using Arduino. In my previous tutorials I made algorithm for
DC Motor Direction Control using Arduino,
DC Motor Direction Control using Matlab,
DC Motor Speed Control using Arduino and
DC Motor Speed Control using Matlab. Now, in this tutorial I will control a stepper motor using Arduino by entering the different commands through its serial port.
Before going into the detail of this tutorial, you must know the basic difference between stepper and DC motors. DC motors have only two input terminal one is positive and the other one is negative. You just have to provide the power supply and it will start rotating but this is not the case in stepper motor. The stepper motor which I will use in this tutorial, has six pins out of which four pins provide pulses or steps and the other two pins are power pins. So, in this tutorial I will control this six pins stepper motor using L298 motor controller and Arduino UNO board. Basically we can use stepper motor where precision is required. Stepper motor has wide range of applications e.g robotics, CNC machines, home automation etc. In simple word, we can say that stepper motor can be used where there is a need to move at particular angle. So, let's get started with Stepper Motor Direction Control using Arduino:
Stepper Motor Direction Control using Arduino
In this tutorial we will learn how to make a program for
Stepper Motor Direction Control using Arduino by sending dfferent commands from the serial port. First of all, I am going share the list of components used for this mini project.
- Arduino UNO
- Stepper motor (6 wire)
- L298 Motor Controller (H-Bridge)
- Voltage Regulator (7805)
- 1000uF
- Jumper Wires
- Solderig Iron
- Soldering Wire
I want to tell you a bit about the stepper motor because all the other components are discussed in detail in
DC Motor Direction Control using Arduino.
Stepper Motor
Basically, stepper motors are like the DC motors that rotate in discrete steps. They have multiple arranged coils and they are usually known as phases. Motor will rotate one step at a time if we energize each phase sequence. High levels of precision can be achieved by controlling the stepper motor with computer. Steppers motors are available in the market in many different sizes. The speed of the stepper motor is controlled by frequency of pulses generated. They have wide range of applications like hard disk drives, robotics, telescope, antenna, toys etc. A six wire stepper motor is shown in the figure below.
- You can download complete source code for Stepper Motor Direction Control using Arduino by clicking the below button:
Download Arduino Source Code
Selection of Wires
- I have used 6 wire stepper motor and each wire has its own function.
- I have first divided these six wires into two pair.
- Each pair is consisting of three wires out of which one wire is common and the other two generate pulses.
- The two pair of three wires are shown in the figure below.
- Then, I have chosen a common wire in each pair from which the resistance to the other two wires is common.
- I have checked the resistance from the common wire to the both of the other wires of the same pair.
- I found that the resistance from the common wire to both of the other wires is same.
- We can see in the figure above the blue, pink and white wires belong to the same pair out of which white is a common wire.
- Here is the screen shot of the figure when I found the resistance between white and blue wire and I found it to be 8.0 ohms.
- The screen shot of the above steps is shown in the figure below.
- After that. I checked the resistance between white and pink wire and found it to be 8.1 which is almost the same as 8.0 so, this shows that the white wire is common to both of the blue and pink wire.
- Here is the screen shot of the above step.
- Then I found the resistance between pink and blue wire and it was 15.6 which is exactly the double of the earlier resistance.
- It is shown in the figure below.
- I have connect the both common wires as shown in the figure below.
- Here's the video in which I have discussed it in detail How to identify the wires of Stepper Motor:
- The remaining four wires are used to generate pulses which are also know as steps
- I have connected theses four wires to the output pins OUT1, OUT2, OUT3 and OUT4 of the L298 micro controller.
- Input pins of L298 micro controller In1, In2, In3 and In4 are connected to the pin no 7, 6, 5 and 4 of the Arduino UNO's board respectively.
Note:
I have also controlled the stepper motor using PIC micro controller so I would suggest all of you to first go through that tutorial before going into the details of this tutorial.
Block Diagram
- I have made a simple block diagram for Stepper Motor Direction Control using Arduino, which will be helpful to clearly understand the algorithm and the assembling of the components of Stepper Motor Direction Control using Arduino.
- The screenshot of the block diagram is shown in the figure below.
- First of all we need a power supply to run the project properly.
- Arduino reads the commands from the serial port and sends to the L298 motor driver to rotate the stepper motor.
- The commands got printed on the LCD (Liquid Crystal Display).
Arduino Source Code Description
- The main function of the Stepper Motor Direction Control using Arduino is given below.
#include <LiquidCrystal.h>//Library for LCD
#include <Stepper.h> //Library for Stepper motor
const int stepsPerRevolution = 255;
// initialize the stepper library on pins
Stepper myStepper(stepsPerRevolution, 4, 5, 6, 7);
char data;
//LCD pins assigning
LiquidCrystal lcd(8, 9, 10, 11, 12, 13);
void setup() {
// set the speed at 60 rpm
myStepper.setSpeed(60);
// initialize the serial port:
Serial.begin(9600);
lcd.begin(20, 4);//LCD type
lcd.setCursor(3,0);//setting LCD cursor and printing on it
lcd.print("Stepper Motor");
lcd.setCursor(5,1);
lcd.print("Direction");
lcd.setCursor(5,2);
lcd.print("Control");
lcd.setCursor(2,3);
lcd.print("via Arduino UNO");
delay(3000);
lcd.clear ();//Clearing the LCD screen
lcd.setCursor(0,2);
lcd.print("www.TheEngineering");
lcd.setCursor(4,3);
lcd.print("Projects.com");
}
void loop() {
if(Serial.available())
{
data = Serial.read(); //Reading the data from serial port
}
if(data == 'C'){Clockwise();}//Clockwise rotation
if(data == 'A'){AntiClockwise();}//Anti-clockwise rotation
if(data == 'S')//stopping the stepper motor
{
data = 0;
lcd.setCursor(3,0);
lcd.print("No rotation");}
}
- In the code given above we have first initialized the LCD and Stepper motor libraries.
- Then, I assigned stepper motor pins at which it is connected to the Arduino.
- After that I initialized the LCD pins at which it is connected to Arduino UNO.
- Then I have made three different if statements, C for the clockwise, A for the anti clockwise rotation and S for the no rotation.
- Then in the loop I called clock wise and anti clockwise functions whose source code will be give and explained below.
- Then, I cleared the serial data in order to stop the rotation of the motor.
- The source code of the clockwise function is given below.
void Clockwise()//function for clockwise rotation
{
Serial.println("clockwise"); //printing on the serial port
Serial.println("");//prints blank line on the serial port
myStepper.step(stepsPerRevolution);//counter clockwise rotation
lcd.setCursor(3,0);//setting LCD cursor
lcd.print("Clockwise"); //printing on LCDa
}
- The source code for the anti clockwise function is given below.
void AntiClockwise()//function for anti clockwise rotation
{
Serial.println("anti-clockwise");//print on the serial
Serial.println("");//prints a blank line on the serial
myStepper.step(-stepsPerRevolution);//clockwise movement
lcd.setCursor(3,0);//setting LCD cursor
lcd.print("Anti-clockwise");//printing on LCD
}
- Now, open your Arduino software, just copy and paste the source code given above.
- Run the program and open the Serial Port at the top right of the Arduino software.
- Now, when you enter the command C stepper motor will start running in clockwise direction.
- If you send the command A through the serial port stepper motor will start to rotate in counter clockwise direction.
- If you send the command S the rotation of the stepper motor will be stopped.
Actual Hardware Setup
- The actual hardware operating setup for Stepper Motor Direction Control using Arduino is given in the figure below:
- Now, if you send the command C through the serial port the stepper motor will start to rotate in clockwise direction and the command will also be printed on the LCD.
- The screenshot of the printed command on LCD is shown in the figure below.
- Now, if you send the command A through the serial port the stepper motor will start to rotate in anti clockwise direction and the command will also be printed on the LCD.
- The screenshot of the printed command on LCD is shown in the figure below.
- Now, if you send the command S through the serial port the stepper motor will show no more rotation and the command will also be printed on the LCD.
- The screenshot of the printed command on LCD is shown in the figure below.
- Here's the complete video demonstration of Stepper Motor Direction Control using Arduino, I hope it will help as well:
That's all from the tutorial
Stepper Motor Direction Control using Arduino. I hope you enjoyed this tutorial. If you face any sort of problem, you can ask me anytime without feeling any kind of hesitation. I will try my level best to solve your problem in a better way if possible. I will explore Arduino by making different projects on it. Till then, Take care :)
DC Motor Speed Control using Arduino
Hello friends! I hope you all will be absolutely fine and having fun. Today, I am going to share my knowledge about how can you make a simple program for
DC Motor Speed Control using Arduino UNO. In my previous tutorial,
DC Motor Direction Control using Arduino, I have just controlled the DC motor in both directions at constant speed using Arduino. I have also performed the
DC Motor Direction Control in Matlab by sending different commands through serial port from Matlab and LabVIEW to the Arduino and then controlled the direction of rotation of DC motor. But in this tutorial I will rotate the same DC motor at variable speed in both clockwise and anti clockwise directions.
In my previous tutorial, we have seen that input pins
In1 &
In2 of motor control driver L298 (H-Bridge) are useful to control the direction of rotation of the DC motor. In this tutorial, I have controlled its speed as well by providing different voltage levels at the
enable pin of the DC motor control driver L298. It will be helpful to vary the speed of the DC motor in either clockwise or in anti clockwise direction. So, let's get started with
DC Motor Speed Control using Arduino UNO:
DC Motor Speed Control using Arduino UNO
In this tutorial we will learn that how to make an algorithm for DC Motor Speed Control using Arduino UNO. Speed control of any motor is always done y Pulse Width Modulation, abbreviated as PWM. PWM pulse can be generated using Arduino and L298 Enable Pin is used to get that PWM pulse and then it controls the motor speed accordingly. Before going into the further details I would like to tell you about the concept of PWM for controlling DC motor. Moreover, you can download the complete Arduino code for DC Motor Speed Control using Arduino by clicking the below button:
Download Arduino Source Code
Pulse Width Modulation (PWM)
PWM stands for Pulse Width Modulation. It basically describes the type of the digital signal. PWM technique is an excellent technique to control the analog circuits with microcontroller's digital PWM output. In this technique we can get analog results with the digital means. Digital control is used to create square wave. This pattern can vary voltages between full on i.e.
5V and full off i.e.
0V. The duration of on time i.e. when the the signal is present is known as
pulse width. PWM waves for the different duty cycles are shown in the figure below.
Duty cycle is basically the proportion of the time during which a system is operated. It can be expressed as a percentage. For example motor rotates for 1 second out of 100 seconds, it duty cycle can be represented as 1/100 or as 1%. For Arduino software coding the command
analogWrite(255) shows the maximum i.e. 100% duty cycle. To achieve 50% duty cycle we have to update this command to
analogWrite(127). Arduino UNO's pin no
3, 5, 6,10 and
11 are used as PWM pins. In this project we can control the speed of the DC motor by providing
high and
low voltages to the
enable pin of the motor control driver L298. For example, if a motor rotates with the maximum speed and 100% duty cycle at
12V and we provide it with the
6V then it will rotate with the half of the initial speed having 50% duty cycle.
Motor Controller L298
The pins
EnA and
EnB of the motor controller L298 are used as the PWM pins. We can rotate the DC motor at different speed providing different high and low voltage levels to these pins of the motor control driver. If we start to reduce the maximum voltage at which the motor rotates at maximum speed, the speed of the motor also starts to reduce. In this way these enable pins are helpful to control the speed of the DC motor.
Algorithm design and descrition
In this section of the tutorial
DC Motor Speed Control using Arduino UNO, I am going to explain you about designing as well as a detailed description of the designed algorithm. I will tell you about the entire algorithm in step by step procedure.
Note:Since you are working on the DC motor so you must also have a look at my previous tutorials, they will be helpful for you to simulate this project as well.
Open your Arduino software, copy and paste the source code given below in your software.
#include <LiquidCrystal.h>
//Keyboard Controls:
//
// C - Clockwise
// S - Stop
// A - Anti-clockwise
// Declare L298N Controller pins
// Motor 1
int count=255;
int dir1PinA = 2;
int dir2PinA = 5;
int speedPinA = 6; // PWM control
LiquidCrystal lcd(8, 9, 10, 11, 12, 13);
void setup() {
Serial.begin(9600); // baud rate
lcd.begin(20, 4);
lcd.setCursor(5,0);
lcd.print("DC Motor");
lcd.setCursor(5,1);
lcd.print("Direction");
lcd.setCursor(5,2);
lcd.print("Control");
lcd.setCursor(2,3);
lcd.print("via Arduino UNO");
delay(3000);
lcd.clear ();
lcd.setCursor(0,2);
lcd.print("www.TheEngineering");
lcd.setCursor(4,3);
lcd.print("Projects.com");
//Define L298N Dual H-Bridge Motor Controller Pins
pinMode(dir1PinA,OUTPUT);
pinMode(dir2PinA,OUTPUT);
pinMode(speedPinA,OUTPUT);
analogWrite(speedPinA, 255);//Sets speed variable via PWM
}
void loop() {
// Initialize the Serial interface:
if (Serial.available() > 0) {
int inByte = Serial.read();
int speed; // Local variable
switch (inByte) {
case 'C': // Clockwise rotation
//analogWrite(speedPinA, 255);//Sets speed variable via PWM
digitalWrite(dir1PinA, LOW);
digitalWrite(dir2PinA, HIGH);
Serial.println("Clockwise rotation"); // Prints out “Motor 1 Forward” on the serial monitor
Serial.println(" "); // Creates a blank line printed on the serial monitor
//lcd.clear();
lcd.setCursor(0,0);
lcd.print("Clockwise rotation");
break;
case 'S': // No rotation
//analogWrite(speedPinA, 0); // 0 PWM (Speed)
digitalWrite(dir1PinA, LOW);
digitalWrite(dir2PinA, LOW);
Serial.println("No rotation");
Serial.println(" ");
//lcd.clear();
lcd.setCursor(0,0);
lcd.print("No rotation");
break;
case 'H': //Accelrating motor
count=count+20;
if (count>255)
{
count =255;
}
analogWrite(speedPinA,count);
delay(50);
//digitalWrite(dir1PinA, LOW);
//digitalWrite(dir2PinA, HIGH);
Serial.println("Motor is accelrating slowly");
Serial.println(" ");
Serial.println(count);
lcd.setCursor(0,0);
lcd.print("Motor is accelrating");
break;
case 'L': //Deaccelrating motor
count=count-20;
if (count<20)
{
count=20;
}
analogWrite(speedPinA,count);
delay(50);
//digitalWrite(dir1PinA, LOW);
//digitalWrite(dir2PinA, HIGH);
Serial.println("Motor is deaccelrating slowly");
Serial.println(" ");
Serial.println(count);
lcd.setCursor(0,0);
lcd.print("Motor Deaccelrates");
break;
case 'A': // Anti-clockwise rotation
//analogWrite(speedPinA, 255); // Maximum PWM (speed)
digitalWrite(dir1PinA, HIGH);
digitalWrite(dir2PinA, LOW);
Serial.println("Anti-clockwise rotation");
Serial.println(" ");
//lcd.clear();
lcd.setCursor(0,0);
lcd.print("Anti-clockwise");
break;
default:
// Turn off the motor if any other key is being pressed
for (int thisPin = 2; thisPin < 11; thisPin++) {
digitalWrite(thisPin, LOW);
}
Serial.println("Wrong key is pressed");
//lcd.clear();
lcd.setCursor(0,0);
lcd.print("Wrong key is pressed");
}
}
}
- In the previous tutorials, DC Motor Direction Control using Arduino and DC Motor Direction Control using Matlab we have learnt that how to control the direction of the DC motor.
- We used the commands C, A and S for the clockwise rotation, anti clockwise rotation and stopping the motor respectively.
- In this tutorial, we have added two further commands H and L for accelerating and de-accelerating the DC motor.
- If we send the command H different times consecutively the speed of the motor will increase continuously.
- If we send the command L different times consecutively, the speed of the motor will start to decrease.
- Now, upload the source code to your Arduino UNO's board.
- Open the serial monitor at the top right of the Arduino Software.
- And enter the commands in serial monitor periodically as explained above.
Actual Hardware Setup
- When we enter the command C in the serial monitor of the Arduino software. Motor will start rotating in the clockwise direction and a statement Clockwise rotation will be printed on serial port.
- The same statement will be printed on the LCD as well as shown in the figure below.
- When we enter the command A in the serial monitor of the Arduino software. Motor will start rotating in the anti clockwise direction and a statement Anti clockwise rotation will be printed on serial port.
- The same statement will be printed on the LCD as well as shown in the figure below.
- When we enter the command H in the serial monitor of the Arduino software. Motor will start accelerating and a statement Motor is accelerating will be printed on serial port.
- The same statement will be printed on the LCD as well as shown in the figure below.
- When we enter the command L in the serial monitor of the Arduino software. Motor will start to deaccelerate and a statement Motor Deaccelerates will be printed on serial port.
- The same statement will be printed on the LCD as well as shown in the figure below.
Thats all from the tutorial
DC Motor Speed Control using Arduino UNO. I hope you have enjoyed this tutorial. If you face any sort of problem, you can ask me anytime without feeling any kind of hesitation. I will further explore my knowledge about
Arduino projects in my later tutorials. Till then, Take care :)
DC Motor Direction Control using Arduino
Hello friends! I hope you all will be absolutely fine and having fun. Today, I am going to share my knowledge with all of you about how to make a simple program for
DC Motor Direction Control using Arduino. The word DC
is basically an abbreviation of
Direct current. So, a direct current motor is commonly used motor having two input terminals, one is positive and the other one is negative. If we connect these terminals with the voltage supply the motor will rotate. If you change the polarity then motor will rotate in opposite direction. You should also have a look at
Difference between DC & AC Motors to get a better idea about these motors.
DC motor has a lot of applications. You can use it in automation projects, for controlling static as well as mobile robots, in transport system, in pumps,fans,bowers and for industrial use as well. In this tutorial, I will do the
DC Motor Direction Control using Arduino and L298 motor controller. Moreover, I have also used LCD which will give us the status of our DC Motor i.e. whether its moving in clockwise direction or anticlockwise. In my later tutorial I will control the same DC motor using NI LabVIEW 2015 and MATLAB. I have added the next tutorial on this project in which I have done the
DC Motor Direction Control in MATLAB so in that project, I have used the same hardware but instead of controlling it from Arduino I have controled it using MATLAB so you must have a look at that tutorial.
DC Motor Direction Control using Arduino
In this tutorial, I will make a simple program to do the DC Motor Direction Control using Arduino. Arduino is basically an amazing micro controller and is very easy to use because it is an open source device. So, it is a student friendly device. You can also write Arduino programs for different purpose. Arduino is also a cost efficient device in comparison to the other micro-controllers e.g. raspberyy pi, NI-myRIO, galileo, single board RIO etc. First of all I prepared my complete hardware setup. Then I made a program and interfaced it with the hardware. We will discuss all the steps in detail below. The logic is pretty simple i.e. Arduino has to send commands to L298 motor controller and then L298 decides the DC Motor Direction Control by manipulating the Arduino commands. Before going into the detail, I want to show you the list of components required. You can download complete Arduino source file here:
Download Arduino Source Code
Note:
If you are working on DC Motor then you should also have a look at these Proteus Simulations:
Components List & Description
Here's the complete list of the components required for designing DC Motor Direction Control using Arduino:
So, now let's discuss the main components for this project individually so that you get better idea of why these components are used in this DC Motor Direction Control using Arduino:
Arduino UNO
Arduino UNO is basically the back bone of this DC Motor Direction Control Project. It controls and leads the whole project. In this project, Arduino reads the commends from serial port and sends to
L298 motor controller IC in order to control the direction of rotation of the DC motor. So, the Arduino has overall major control over the whole project.
Motor Controller L298
Motor Controller is used to control the direction of DC motor. It consists of an L298 motor driver IC which is capable of rotating the motor in both clockwise and anti clockwise directions by switching its pins from
HIGH to
LOW and vise versa. Moreover, it needs +12V, GND and +5V in order to power it up. So, we will design a voltage regulator which will step down 12V to 5V. So, let's have a look at this voltage driver in next part:
Voltage Regulator
Voltage regulator is also the part of this design. In our daily life, we need to step up or to step down the voltages according to the requirements. Requirements vary with the different purpose. Small electronics components like micro-controller, LED, LCD etc. So the main purpose of voltage regulator is to step down the voltage from 12V to just 5V in order to fulfill the requirements of the electronic components. Step down transformer can also be used instead of voltage regulator. Due to the huge structure and cost we prefer to use voltage regulator.
You should read How to
Design a 5V Power Supply in Proteus to get better idea about this voltage regulator. The circuit diagram of the designed voltage regulator is shown in the figure below.
DC Motor
DC motor is the essential part of the different projects and our daily life. for example if we want to automate our house doors i.e if we want to open and close the doors automatically by detecting the person, motor plays a vital role here. Similarly in robotics, vacuum, blowers and air conditioners, DC motor has a wide range of applications.
LED is used here to show whether the designed circuit is working properly or not. Like in mobile phones and laptops as we connect the charger it shows the charging indication. So, we must need some indication that everything is going fine and the circuit is working properly.
Jumper Wires
Jumper wires are used to make the connections between all of the components. Use small pieces of the jumper wires in order to give a better look to the designed circuit. If you are using longer wires for the connections, it will create complexity and causes many problems while operating the circuits.
Power Supply
12V power supply is used as the main power supply. As we know, to operate any of the electronic components or electronic appliances we must need the main power supply. Power supply can vary according to the power consumption of the electronic equipment. Here I am using a 12V DC power supply because it is a small and simple project with minimum power requirements.
LCD 20x4
LCD is used to visualize the commands sent to the serial port. It basially display us that which function is being performed at a particular time. A 20×4 LCD is used and is shown in the figure below. If you haven't worked on LCD before, then you should have a look at
Circuit Designing of LCD with Arduino in Proteus ISIS.
Assembling of the Components
Here are the few steps followed while designing this DC Motor Direction Control using arduino:
- Connect the terminals of the DC motor with the output pins (OUT1 and OUT2) of L298 motor controller.
- Connect L298 motor controller's pin IN1 and IN2 with the Arduino UNO's pin 2 and 5 respectively.
- Now, connect ENA pin of L298 motor controller to the Arduino's pin 9.
- Connect the power supply to turn on the circuit.
- Make sure that you have supplied 12V, 5V and GND properly to the L298 motor controller.
Circuit Diagram
Completely Assembled Diagram
Arduino Code Designing
After making all the connections properly, open your Arduino source code. If you are using Arduino for the first time then you should have a look at
Installation of Arduino Driver in Windows.
- Attach the Arduino board with your PC and go to Search->Device Manager as shown in the figure below.
- Select the device manger and you can see different options here like Batteries, bluetooth radios, keyboards, monitors, ports etc.
- Open the Ports(COM & LPT) as shown in the figure below.
- See the COM Port supported by Arduino Board which COM5 in this case.
- Now open the Arduino software and go to Tools and select the Arduino board and the COM port properly.
- The description is shown in the figure given below.
- Just copy and paste the source code given below.
#include <LiquidCrystal.h>
//Keyboard Controls:
//
// C - Clockwise
// S - Stop
// A - Anti-clockwise
// Declare L298N Controller pins
// Motor 1
int dir1PinA = 2;
int dir2PinA = 5;
int speedPinA = 7; // PWM control
LiquidCrystal lcd(8, 9, 10, 11, 12, 13);
void setup() {
Serial.begin(9600); // baud rate
lcd.begin(20, 4);
lcd.setCursor(5,0);
lcd.print("DC Motor");
lcd.setCursor(5,1);
lcd.print("Direction");
lcd.setCursor(5,2);
lcd.print("Control");
lcd.setCursor(2,3);
lcd.print("via Arduino UNO");
//Define L298N Dual H-Bridge Motor Controller Pins
pinMode(dir1PinA,OUTPUT);
pinMode(dir2PinA,OUTPUT);
pinMode(speedPinA,OUTPUT);
}
void loop() {
// Initialize the Serial interface:
if (Serial.available() > 0) {
int inByte = Serial.read();
int speed; // Local variable
switch (inByte) {
case 'C': // Clockwise rotation
analogWrite(speedPinA, 255);//Sets speed variable via PWM
digitalWrite(dir1PinA, LOW);
digitalWrite(dir2PinA, HIGH);
Serial.println("Clockwise rotation"); // Prints out “Motor 1 Forward” on the serial monitor
Serial.println(" "); // Creates a blank line printed on the serial monitor
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Clockwise rotation");
break;
case 'S': // No rotation
analogWrite(speedPinA, 0); // 0 PWM (Speed)
digitalWrite(dir1PinA, LOW);
digitalWrite(dir2PinA, LOW);
Serial.println("No rotation");
Serial.println(" ");
//lcd.clear();
lcd.setCursor(5,1);
lcd.print("No rotation");
break;
case 'A': // Anti-clockwise rotation
analogWrite(speedPinA, 255); // Maximum PWM (speed)
digitalWrite(dir1PinA, HIGH);
digitalWrite(dir2PinA, LOW);
Serial.println("Anti-clockwise rotation");
Serial.println(" ");
//lcd.clear();
lcd.setCursor(3,2);
lcd.print("Anti-clockwise");
break;
default:
// Turn off the motor if any other key is being pressed
for (int thisPin = 2; thisPin < 11; thisPin++) {
digitalWrite(thisPin, LOW);
}
Serial.println("Wrong key is pressed");
//lcd.clear();
lcd.setCursor(0,3);
lcd.print("Wrong key is pressed");
}
}
}
- Now, upload the source code onto the Arduino UNO board as shown below.
- In the above figure shows that the source code is uploading to the Arduino board.
- Done uploading shows that the source code has been uploaded successfully to the Arduino borad.
- Now, go to the Serial Monitor on the top right corner of the Arduino software.
- Press C, you can see the DC motor is rotating in the clockwise direction and statement Clockwise rotation will be printed on the Serial Monitor.
- Now, press S, the DC motor will stop and a statement No rotation will be print on the Serial Monitor.
- If you want to rotate DC motor in anti-clockwise direction, press A then, the statement Anti-Clockwise rotation will be printed on the Serial Monitor.
- I have made the logic in such a way that if you press any of the other buttons the DC motor will stop in reaction to that and the statement Wrong key is pressed will be printed on the Serial Monitor.
- All of the above steps are shown in the figure shown below.
Final Testing of DC Motor Direction Control using Arduino
- The screenshot of the actual circuitry for DC Motor Direction Control using Arduino is shown in the below figure:
- You can see in the above figure that we have attached Arduino UNO board with L298 Motor Driver and then we have attached DC Motor with Arduino UNO and LCD is used to show the current movement of Motor.
- Moreover we have also designed a small circuit which I have mentioned above and named as Voltage regulator, and it is used to step down 12V into 5V.
So, that's all from the tutorial
DC motor Direction Control using Arduino. I hope you enjoyed this tutorial. In my next tutorials, I will interface this project with LabView and MATLAB. If you face any sort of problem, you can freely ask me
anytime without feeling any kind of hesitation. So, will see you guys in next tutorial. Till then Take care :)
Arduino Tutorial for Beginners
Hello friends, I hope you all are fine and having fun with your lives. Today, I am going to share a complete
Arduino Tutorial for Beginners because I was having a lot of requests about it. Reader were asking the same question that they are new to Arduino and how should they start so if you are beginner to Arduino and you don't have any idea How to learn it then you should read the below tutorials.
I have posted all the basic Arduino Tutorial for Beginners already so in today's tutorial I am just gonna arrange them and must ask you to read them one by one from top to bottom and at then end you will really be able to design any kind of project on Arduino. So, let's get started with Arduino Tutorial for Beginners:
Arduino Tutorial for Beginners
Before going into the practical Arduino Programming, you must first read some theoretical knowledge about Arduino which will really help you out in your Arduino Projects. So these are the
basic Arduino tutorial which I will post here step by step:
What is Arduino ?
First of all, you should read this tutorial in which I have given the basic introduction of Arduino. This tutorial is essential one, if you are new to Arduino.
Arduino Vs Raspberry Pi
Next thing you should read is Arduino Vs Raspberry Pi, its not that important but its always good to have a look at alternatives.
Installation of Arduino Driver in Windows
Now, I suppose that you know the basics of Arduino and have got your Arduino UNO in your hand and are ready to install Arduino Drivers in your Windows.
Arduino Library for Proteus
Next thing you need to read is How to use Arduino Library for Proteus. Using this library you can easily simulate your Arduino boards in Proteus software.
Getting Started with Arduino Software
Now you have the basic idea of Arduino board and you know How to use it in Proteus, the next thing you need to do is to have some understanding about Arduino software.
Basic Arduino Commands
Now, that you have understood the basics of Arduino and its programming so now let's have a look at some
Basic Arduino Commands and I would suggest you to test these commands in Proteus on your own so that you do mistakes and get some knowledge from them. Anyways, let's continue with these Basic Arduino Commands:
Getting Started with Arduino Programming
After having a look at the Arduino software, next thing you need to do is to read about Getting Started with Arduino Programming.
Arduino Data Types
Then we have a tutorial at Arduino Data Types in which we have explained in detail all the Data Types of Arduino.
How to use pinMode in Arduino
How to use pinMode in Arduino is the next tutorial which you must read so that you have an idea about how to make pins input or output.
How to use DigitalRead in Arduino
How to use DigitalRead in Arduino is the next tutorial which you must read so that you have an idea about how to use the digital Pins of Arduino.
How to use DigitalWrite in Arduino
How to use DigitalWrite in Arduino is the next tutorial which you must read so that you have an idea about how to use the digital Pins of Arduino.
How to use AnalogRead in Arduino
How to use AnalogRead in Arduino is the next tutorial and I have explained here how to read the status of analog Pins.
How to use AnalogWrite in Arduino
Analog Write is used to update the status of analog Pins as well as PWM Pins. Here we will discuss this command and in next tutorial we will have a look at PWM Pins.
How to use Arduino PWM Pins
How to use DigitalRead in Arduino is the next tutorial which you must read so that you have an idea about how to use the digital Pins of Arduino.
A Simple Arduino LED Example
First of all, you should have a look at A Simple Arduino LED Example in which I have designed a simple example in Proteus and blinked the LED at Pin # 13 of Arduino.
How to write Arduino code
Next article you should have a look at is How to write Arduino code, in this tutorial I have explained how to write arduino code efficiently.
- Now that you have the idea of basic Arduino programming so now let's move a little further and have a look at How to do Arduino Serial Communication. I have posted a lot of Arduino Serial Tutorial and I would suggest you to read them one by one. Here are all the links of Arduino Serial Tutorials:
At the end, I would suggest you to have a look at this list of
Arduino Projects in which I have given all the Arduino Projects which are posted on our blog, so once you get trained in Arduino then you can try those projects and can get pro in Arduino.
LPG Gas Leak Detector using Arduino
Hello friends, hope you all are fine and having fun with your lives. Today, I am going to share a new project named LPG Gas Leak Detector using Arduino in Proteus ISIS. Before reading this tutorial, you must first download the Gas Sensor Library for Proteus because we are gonna use that Library and will simulate the Gas Sensor in Proteus.
In this library you will find eight sensors and all of them works exactly the same so that's why we are gonna use one of them. For LPG Gas Leak Detector Project I have used MQ-2 sensor which is used for detection of LPG gas. I have also used Arduino UNO board which you can simulate in Proteus using Arduino Library for Proteus. Moreover, I have also placed an LCD which will display either LPG gas Leak Detected or not. So, let's get started with LPG Gas Leak Detector using Arduino in Proteus ISIS.
LPG Gas Leak Detector using Arduino in Proteus ISIS
- First of all, download the Gas Sensor Library for Proteus and install it in your Proteus software so that you can it in Proteus.
- After installing the Gas Sensor Library, now download the LPG Gas Leak Detector Project's simulation and programming code by clicking the below button:
Download Proteus Simulation & Code
- Now, let's design this project so that you can get a better idea of how it works.
- First of all, design a small circuit in your Proteus software as shown in below figure:
- Now you can see in the above figure that I have used Arduino UNO board along with 20 x 4 LCD and Gas Sensor MQ-2.
- You can use this LCD by download this New LCD Library for Proteus.
- Next thing you need to do is to download the below code and get your hex file.
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(13, 12, 11, 10, 9, 8);
int Gas = 7;
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(20, 4);
// Print a message to the LCD.
lcd.setCursor(0,0);
lcd.print("Gas Detected :");
lcd.setCursor(1,2);
lcd.print("www.TheEngineering");
lcd.setCursor(4,3);
lcd.print("Projects.com");
pinMode(Gas , INPUT);
}
void loop() {
if(digitalRead(Gas) == HIGH){lcd.setCursor(14,0);lcd.print(" Yes");}
if(digitalRead(Gas) == LOW){lcd.setCursor(14,0);lcd.print(" No ");}
}
- If you don't know about Hex file then read How to Get Hex file from Arduino Software.
- Upload this Hex File in your Proteus Arduino software and then run your simulation.
- If everything goes fine then you will get results as shown in below figure:
- So, you can see in the above figure that when Gas Sensor is HIGH then its written on the LCD that Gas Detected: Yes.
- Here's a video which will explain this LPG Gas Leak Detection using Arduino in Proteus ISIS:
So, that's all for today. I hope you have enjoyed this project named LPG Gas Leak Detection using Arduino in Proteus ISIS. Will meet you guys in the next tutorial. Till then 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:
- PIR Sensor: For Motion Detection.
- Smoke Sensor: For Smoke Detection.
- Flame Sensor: For Fire Detection.
- Vibration Sensor for Window: For Detection of vibrations on Window.
- Vibration Sensor for Door: For Detection of vibrations on Door.
- Ultrasonic Sensor for Window: For intruder Detection on Window.
- 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.