Interfacing of GPS Module with Arduino in Proteus ISIS
Hello Everyone, hope you all are fine and having fun with your lives. Today, I am going to interface GPS Module with Arduino in Proteus ISIS software. Recently, I have shared this amazing GPS Library for Proteus, using which you can quite easily simulate your GPS Module in Proteus software. Today, I am going to interface this GPS Module with the Arduino UNO board and will simulate the result in Proteus software. I am going to use TinyGPS Library and will get Longitude and Latitude out of this GPS Module.
So, if you are new to GPS and you haven't yet installed the GPS Library for Proteus, then you must first download that library and install it. I am using Arduino board in today's tutorial but you can use any other microcontroller as well like PIC Microcontroller or 8051 Microcontroller. So, let's get started with the Interfacing of GPS Module with Arduino in Proteus ISIS. I have explained this project in detail in the below video:
Interfacing of GPS Module with Arduino in Proteus ISIS
- You can download the complete Simulation along with Arduino Code by clicking the below button, but as I always suggest, design it on your own so that you learn the most out of it.
Download Project Files
- So, design a simulation in your Proteus software as shown in the below figure:
- As shown in the above figure, I have used Arduino UNO along with GPS Module.
- I have used a Virtual terminal to show values getting from the GPS Module.
- So, I am getting data from the GPS Module via the RX pin of Arduino and then sending this data to Serial Terminal via TX pin.
- Now, the next thing you need to do is to upload the below code to your Arduino board:
#include <TinyGPS.h>
TinyGPS gps; //Creates a new instance of the TinyGPS object
void setup()
{
Serial.begin(9600);
Serial.print("Simple TinyGPS library v. "); Serial.println(TinyGPS::library_version());
Serial.println("Testing GPS");
Serial.println("Designed by: www.TheEngineeringProjects.com");
Serial.println();
}
void loop()
{
bool newData = false;
unsigned long chars;
unsigned short sentences, failed;
// For one second we parse GPS data and report some key values
for (unsigned long start = millis(); millis() - start < 1000;)
{
while (Serial.available())
{
char c = Serial.read();
//Serial.print(c);
if (gps.encode(c))
newData = true;
}
}
if (newData) //If newData is true
{
float flat, flon;
unsigned long age;
gps.f_get_position(&flat, &flon, &age);
Serial.print("Latitude = ");
Serial.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
Serial.print(" Longitude = ");
Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
}
Serial.println(failed);
// if (chars == 0)
// Serial.println("** No characters received from GPS: check wiring **");
}
- Now you can see in the above figure that we have our Latitude and Longitude.
- This Latitude and Longitude will not change because we have added the dummy values in our GPS module.
- So, that's how you can quite easily simulate your GPS module with Arduino in Proteus ISIS.
If you have any questions then ask in the comments and I will try to resolve them. Take care. :)
Gas Sensor Library for Proteus
Hello friends, hope you all are fine and having fun with your lives. Today, I am going to share a new Gas Sensor Library for Proteus. I hope you guys are going to enjoy this one. We are all well aware of Gas Sensors which are used for the detection of different gasses in the atmosphere. These sensors are not available in Proteus so that's why I have designed a library using which now you can use these different gas sensors quite easily in Proteus software. You can interface this Gas Sensor with any Microcontroller i.e. Arduino, PIC Microcontroller or 8051 Microcontroller etc.
In this Gas Sensor Library for Proteus, I have added eight different Gas Sensors, which are used for the detection of different gases. As we all know that Proteus is a simulating software so it won't be able to detect the gas in real in Proteus. So, that's why I have placed a Test Pin in each of these sensors so when you make this pin HIGH, then it means the gas is present and if this Test Pin goes LOW then it means there's no gas available and sensors will give LOW output. We will have a look at How to use these sensors below. You should also have a look at the project LPG Gas Leak Detector using Arduino in which I have used this Gas Sensor MQ-2 with Arduino. So, here's the list of all eight gas sensors, I have added to this library:
- MQ-2 Gas Sensor
- MQ-3 Gas Sensor
- MQ-4 Gas Sensor
- MQ-5 Gas Sensor
- MQ-6 Gas Sensor
- MQ-7 Gas Sensor
- MQ-8 Gas Sensor
- MQ-9 Gas Sensor
So, let's start with downloading and installing of Gas Sensor Library for Proteus.
Note:
Other Proteus Libraries are as follows:
Gas Sensor Library for Proteus
- First of all, download the Gas Sensor Library for Proteus by clicking the below button:
Gas Sensor Library for Proteus
- Once you download the file, you will get a rar file so unrar it and you will find three files in it, named as:
- GasSensorTEP.LIB
- GasSensorTEP.IDX
- GasSensorTEP.HEX
- Place all these three files in the Library folder of your Proteus software.
Note:
- Now open your Proteus software or restart it, if it's already open.
- In the components section, make a search for Gas sensors as shown in below figure:
- Now place all of them in your workspace and they will look something as shown in the below figure:
- So, these are all the Gas Sensors available in this Gas Sensor Library for Proteus.
- You can see all of these sensors have four pins on them.
- Two of these pins are Vcc and GND while the third is OUT Pin.
- Test Pin is used for simulation purposes, when you have HIGH on Test Pin then it means that you have Gas in the atmosphere and your sensor will give HIGH as well on the OUT Pin.
- So, let's check out how to use these gas sensors. So, take any of these sensors and design a small circuit as shown in the below figure:
- Now before running your simulation, one thing you need to do is to double click this gas sensor and open the Properties.
- In Properties, you will find a Program file section. In this section browse for the GasSensorTEP.HEX file, which we just downloaded above and placed in the library folder of our Proteus software.
- Now run your simulation, and when you turn the logic state HIGH then you will see the OUT Pin will also go HIGH as shown in the below figure.
- You can plug this OUT Pin of your Gas Sensor in your Microcontroller e.g. Arduino, PIC Microcontroller etc.
- So, that's how you can quite easily simulate this Gas Sensor in Proteus ISIS.
- Here's the video in which I have demonstrated this library in detail:
So, that's all for today, I hope you guys have enjoyed this Gas Sensor Library for Proteus. You should have a look at LPG Gas Leak Detect using Arduino in which I have designed its Proteus simulation. I will also share its tutorial with PIC Microcontroller soon. I hope you will enjoy it. Thanks.
DS1307 Arduino based Digital Clock in Proteus
Hello everyone, today I am going to share a complete project which is DS1307 Arduino based digital Clock in Proteus ISIS. In this project, I have designed a digital clock using Arduino UNO and DS1307 RTC Module. So, first of all, if you haven't yet installed then, you should install Arduino Library for Proteus using which you will be able to easily simulate Arduino baords in Proteus. Along with Arduino Library you will also need to install DS1307 Library for Proteus, which I have shared in my previous post as we are gonna use this RTC Module DS1307 for designing our digital clock.
So, now I hope that you have installed both these libraries successfully and are ready to design this DS1307 Arduino based Digital Clock. I have given the Simulation and Code for download below but as I always advise, don't just download the files. Instead design your own simulation and try to write your own code. In this way, you will learn more out of it. So, let's get started with DS1307 Arduino based Digital Clock in Proteus ISIS:
DS1307 Arduino based Digital Clock in Proteus
- You can download the complete Proteus Simulation along with Arduino Code by clicking the below button.
- You will also need DS1307 Library for Arduino, which is also available in this package.
Download Project Files
- Now, let's get started with designing of this DS1307 Arduino based Digital Clock.
- So, first of all, design a circuit in Proteus as shown in below figure:
- You can see in the above figure that I have used Arduino UNO along with RTC module, LCD and the four buttons.
- These four buttons will be used to change the year,date etc as mentioned on each of them.
- Now here's the code for DS1307 Arduino based Digital Clock.
#include <LiquidCrystal.h>
#include <DS1307.h>
#include <Wire.h>
LiquidCrystal lcd(13,12,11,10,9,8);
int clock[7];
void setup(){
for(int i=3;i<8;i++){
pinMode(i,INPUT);
}
lcd.begin(20,2);
DS1307.begin();
DS1307.setDate(16,4,7,0,17,50,04);//ano,mes,dia,semana,horas,minutos,segundos
}
void loop(){
DS1307.getDate(clock);
lcd.setCursor(0,1);
lcd.print("Time: ");
Print(clock[4]);
lcd.print(":");
Print(clock[5]);
lcd.print(":");
Print(clock[6]);
lcd.setCursor(0,0);
lcd.print("Date: ");
Print(clock[1]);
lcd.print("/");
Print(clock[2]);
lcd.print("/");
lcd.print("20");
Print(clock[0]);
if(digitalRead(7)){
clock[5]++;
if(clock[5]>59) clock[5]=0;
DS1307.setDate(clock[0],clock[1],clock[2],0,clock[4],clock[5],clock[6]);
while(digitalRead(7));
}
if(digitalRead(6)){
clock[4]++;
if(clock[4]>23) clock[4]=0;
DS1307.setDate(clock[0],clock[1],clock[2],0,clock[4],clock[5],clock[6]);
while(digitalRead(6));
}
if(digitalRead(5)){
clock[2]++;
if(clock[2]>31) clock[2]=1;
DS1307.setDate(clock[0],clock[1],clock[2],0,clock[4],clock[5],clock[6]);
while(digitalRead(5));
}
if(digitalRead(4)){
clock[1]++;
if(clock[1]>12) clock[1]=1;
DS1307.setDate(clock[0],clock[1],clock[2],0,clock[4],clock[5],clock[6]);
while(digitalRead(4));
}
if(digitalRead(3)){
clock[0]++;
if(clock[0]>99) clock[0]=0;
DS1307.setDate(clock[0],clock[1],clock[2],0,clock[4],clock[5],clock[6]);
while(digitalRead(3));
}
delay(100);
}
void Print(int number){
lcd.print(number/10);
lcd.print(number%10);
}
- Now get your hex file from Arduino software and then upload it in your Proteus software.
- Now run your simulation and if everything goes fine, then it will look like something as shown in below figure:
- Now you can see its today's date in the LCD and the same is shown over on the small pop up of DS1307 Clock.
- Now the time will start on ticking and the buttons will used to change the minutes hours etc.
- You will get the better demonstration of this project in the below video.
So, that's all for today. I hope this projects DS1307 Arduino based Digital Clock will help you in some way. So see you in next post.
Circuit simulator and PCB design software - EasyEDA
Hello friends, hope you all are fine and having fun with your lives. Today, I am going to share a new circuit simulator and PCB Design software named as EasyEDA. You guys all are well aware of Proteus software which I share quite a lot on my blog for Circuit simulating. No doubt Proteus is quite a cool software but recently I got a chance to work on this amazing EasyEDA software. And I must admit that its better than Proteus software because of its cloud based EDA tools. Yes you have read correctly, in order to use this amazing software, you don't have to do anything you just need to create an account online and start designing your PCB designs. All your designs will be saved online so you dont have any tension about where to save your files. :)
EasyEDA is a free, zero-Â install, cloud-based EDA tool, designed to give electrical engineers, educators, engineering students and electronics hobbyists an Easier EDA Experience. It is easy to use circuit design, circuit simulator and PCB design that runs in your web browser. I will post more about it in my coming posts i.e. How to use this software and How we can get benefit out of it, but today we are gonna focus on its main feature so that you know more about this wonderful PCB design software named as EasyEDA.
Features of PCB design software - EasyEDA
Draw schematics quickly using the available libraries on browser. Seamless automatic upgrades.
Verify analog, digital and mixed signal circuits with spice subcircuits and models!
With multiple layers, thousands of pads, you could still operate quickly and layout smoothly.
The system is very stable, reliable and easy to learn. The user interface is very pleasant and responsive operation.EasyEDA has a rich library of thousands of electronic components (for both circuits and printed circuit boards, and for modeling), and tens of thousands of examples of schematics! Anyone can use this library and expand it. It also can import existing designs done in Altium, Eagle and KiCad and then edit them in EasyEDA . Moreover, another outstanding feature of EasyEDA is that users can access to Open Source modules developed by thousands of electronics engineers.
There is a
tutorial explaining the main features of the tool and aÂ
Simulation ebook, introducing circuit simulation in EasyEDA using ngspice.
The following
video briefly presents the features of EasyEDA tool.
DS1307 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 a new DS1307 Library for Proteus. Recently, I have shared the GSM Library for Proteus, which was really appreciated by the readers so I got quite excited and have designed another new Proteus Library. Currently I am working on many Proteus Libraries. In future, I am gonna design almost all the sensors in Proteus. So stay tuned with us.
Anyways coming to today's post, today we are gonna have a look at DS1307 Library for Proteus. Using this library, now you can quite easily simulate DS1307 module in Proteus in a quite stylish way. ;) I have designed it in red color because its available in red color in market. DS1307 module is already available in Proteus but that one is quite basic and it looks quite dull. The one designed by our team looks quite attractive and is also easy to use. I will post its tutorials soon in which I will interface it with Arduino and PIC Microcontroller. You should also have a look at DS1307 Arduino based Digital Clock in Proteus. So, let's get started with DS1307 Library for Proteus:
DS1307 Library for Proteus
- First of all, download the DS1307 Library for Proteus, by clicking the below button:
DS1307 Library for Proteus
- Now, when you click this button you will get a rar file so unrar this file and in it you will find two files named as:
- RTCModuleTEP.IDX
- RTCModuleTEP.LIB
- Place both of these files in the library folder of your Proteus software.
- Now restart your Proteus software or open it.
- In the search component bx, search for RTCModuleTEP or DS1307 and place it in your workspace.
- If everything goes fine then you will get your RTC Module DS1307 as shown in below figure:
- That's it, now you have the ready to use DS1307 module in Proteus.
- You need to add a crystal oscillator between X1 and X2 pins while the remaining are used for I2C Protocol, which is a common protocol for RTC Modules.
- I will also post a tutorial in which I will interface this RTC Module with Arduino or PIC Microcontroller and then you will get a better idea of how to use it.
- If you design some project using this DS1307 Library for Proteus then do share it with our community so that others could also get benefit out of it.
So, that's all for today. You should also have a look at these New Proteus Libraries for Engineering Students. I hope you are gonna enjoy this DS1307 Library for Proteus. If you have any suggestions or feedback then do let us know in comments. Till next tutorial, take care and have fun!!! :)
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 !!! :)
Interfacing of Multiple DS18B20 Arduino
Hello everyone, hope you all are fine and having fun with your lives. Today, I am going to share a new project named as Interfacing of Multiple Temperature sensors DS18B20 arduino. I have already shared a tutorial on Interfacing of Temperature Senor 18B20 with Arduino but in that tutorial, we have seen how to connect one temperature sensor DS18B20 arduino. But today, I am gonna interface multiple temperature sensors DS18B20 Arduino. For this project I have used two sensors but you can use more if you want.
Temperature sensor DS18B20 is a one wire temperature sensor means we can get its data through a single wire and we can connect as many as we want temperature sensors with this single wire and can call them through their addressing. Each temperature sensor is allotted an address and when we call that address, we get its value. So, in today's project, I have used two sensors and displayed their values on LCD. Both of these sensors are connected with single wire. I am not using both DS18B20 sensors instead I am using one 18B20 and one 18S20 temperature sensors just to give a taste, but you can connect any kind of Dallas Temperature sensor. I have designed the simulation in Proteus and the simulation is also available for download. Anyways let's get started with interfacing of Multiple Temperature Sensors DS18B20 arduino.
Interfacing of Multiple DS18B20 Arduino
- You can download the complete simulation along with progrmming code by clicking the below button:
Download Simulation and Code
- Now, let's design our simulation because its always a good practice to design from basics. So, open your Proteus software and design the below circuit diagram:
- Now, as you can see in the above figure, I have used two temperature sensors DS18B20 Arduino is used as a micrcontroller and LCD is used for displaying the values of these two temperature sensors.
- Both of these temperature sensors are connected with a single wire of Arduino board which is Pin # 2.
- So, now using this single wire we can connect as many temerature sensors as we want.
- So, now next thing we need to do is to Get the Hex File from Arduino Software. So for that place the below code in your Arduino software and get your hex file.
#include <LiquidCrystal.h>
#include <OneWire.h>
OneWire ds(2); // pin 2
LiquidCrystal lcd(13,12,11,10,9,8);
void setup(void) {
lcd.begin(20,4);
lcd.print("Temp 1 = ");
lcd.setCursor(0,1);
lcd.print("Temp 2 = ");
lcd.setCursor(1,2);
lcd.print("www.TheEngineering");
lcd.setCursor(4,3);
lcd.print("Projects.com");
}
void loop(void) {
byte i = 0;
byte data[9];
byte addr[8];
int temp;
boolean type;
//get the addresses of Temperature Sensors
if(!ds.search(addr)){
return;
}
switch(addr[0]){
case 0x10: type = 1; break;//DS18S20
case 0x22: type = 0; break;//DS1822
case 0x28: type = 0; break;//DS18B20
default: break;
}
ds.reset();
ds.select(addr);
ds.write(0x44);
delay(750);
ds.reset();
ds.select(addr);
ds.write(0xBE);
//Leitura
for ( i = 0; i < 9; i++) {
data[i] = ds.read();
}
if(!type){//DS18B20 ou DS1822
lcd.setCursor(9,1);
if((data[1]>>7)==1){
data[1] = ~data[1];
data[0] = (~data[0]) + 1;
lcd.print("-");
}
else{
lcd.print("+");
}
temp = (data[1]<<4) | (data[0]>>4);
lcd.print(temp);
lcd.print(".");
temp = (data[0] & 0x0F) * 625;
if(temp>625){
lcd.print(temp);
}
else{
lcd.print("0");
lcd.print(temp);
}
}
else{//DS18S20
lcd.setCursor(9,0);
if((data[1]>>7)==1){
data[0] = ~data[0];
lcd.print("-");
}
else{
lcd.print("+");
}
temp = data[0]>>1;
lcd.print(temp);
lcd.print(".");
lcd.print((data[0] & 0x01)*5);
}
lcd.print(" ");
lcd.write(223);// degree symbol
lcd.print("C ");
}
- Now, when you uploaded your hex file in Arduino board of your Proteus software then run your Proteus file.
- If everything goes fine then you will get the results as shown in below figure:
- So, you can see in the above figure that I am getting the data of both these temperature sensors and displaying them on LCD.
- Both of these temperature sensors are showing different temperature values and their respective values are displayed over the LCD.
That's all for today, I hope you can now easily interface multiple temperature sensors with Arduino. Will meet in the next tutorial. Till then take care and have fun !!! :)
Stepper Motor Control using PIC Microcontroller
Hello everyone, today I am going to share Stepper Motor Control using PIC Microcontroller. We are all quite well aware of stepper motor but if you don't have much of the idea about this motor then you should give it a google search. :P Stepper motor is used in such projects where precise movement is required. Projects where we need to move the object at some particular angle. Stepper Motor works on electromagnetic phenomena. Electromagnets are present in the stepper motor and when we supply voltage across them, these electromagnets got polarized and produce a magnetic field and in order to depolarize them, what we need to do is simply depolarize these electromagnets. We all know that in motors, we have rotor and stater so in stepper motor these electromagnets act as a stater and we need to polarize them one by one. When we polarize the first electromagnet then it attracts the stater towards it and then we depolarize this first electromagnet and polarize the second electromagnet. And the rotor attracts towards the second electromagnet. In this way, we can move our stepper motor from first to the last electromagnet and then start the process again.
So, that was a brief introduction about Stepper Motor and if you wanna read in detail about it then you should read the Wiki Page of Stepper Motor because they have explained each and everything about stepper motor in detail. I would also recommend you to read Stepper Motor Drive Circuit in Proteus ISIS because in this post I have given the basic movement of the stepper motor in detail. Our today's task is stepper motor control using PIC Microcontroller. I have used PIC16F877A for stepper motor control and I have designed the simulation for stepper motor control in Proteus ISIS software. Code written for PIC Microcontroller is designed in MikroC Pro for PIC Compiler. Simulation and Programming code is given below for download but I would recommend you to design it on your own so that you learn most of it. Anyways, let's get started with Stepper Motor Control using PIC Microcontroller.
Stepper Motor Control using PIC Microcontroller
- In this project, I am gonna control the speed angle and direction of the stepper motor using a PIC Microcontroller.
- I will send commands via Serial Terminal and on the basis of these commands, our stepper motor will change its step size as well as direction.
- You can download the stepper motor control simulation and code by clicking the below button:
Download Simulation and Code
- Now let's design it in Proteus, first of all, design a circuit as shown in the below figure:
- Now you can see in the above figure that I have used L297 and L298 as stepper motor drivers.
- You can do stepper motor control without these drivers in Proteus software but when you design it in real hardware then these drivers will be required.
- Moreover, I have used the COMPIM which is used for serial control. We will send commands via serial port and the motor will follow the instructions.
- So, now upload the below code in your PIC compiler and get your hex file.
char uart_rd;
void main()
{
TRISB = 0;
PORTB = 0;
UART1_Init(9600);
Delay_ms(100);
while(1)
{
PORTB.F0 = 1;
Delay_ms(250);
PORTB.F0 = 0;
Delay_ms(250);
if (UART1_Read() == ('e') ) {
PORTB.F2 = 0;
}
else {
PORTB.F2 = 1; }
if (UART1_Read() == ('a') ) {
PORTB.F3 = 1;
}
else {
}
if (UART1_Read() == ('b') ) {
PPORTB.F3 = 0;
}
else {
}
if (UART1_Read() == ('c') ) {
PPORTB.F4 = 0;
}
else {
}
if (UART1_Read() == ('d') ) {
PPORTB.F4 = 1;
}
else {
}
}}
- Now upload the hex file in your PIC Microcontroller and run your simulation, if everything goes fine then you will get results as shown in the below figure:
- Obviously, you can't see the motor running in the above picture but you can see it has moved to some angle.
- In actuality, it will start moving continuously and will stop when you send a command on the Serial terminal.
- The below video will explain the whole project in detail:
So, that's all about stepper motor control. I hope you have liked it and it will help you in some way. In the coming post, I will share the stepper motor control with the Arduino board. So stay tuned and have fun!!! :)
DC Motor Speed Control using Arduino in Proteus
Hello friends, hope you all are fine and having fun with your lives. Today, I am going to share a tutorial on DC Motor Speed Control using Arduino in Proteus ISIS. In my previous post, we have seen How to design a DC Motor Direction Control Project using Arduino in Proteus ISIS and if you haven't checked it out then I would recommend you to have a look at it first. Because, in today's tutorial, I am gonna extend that tutorial and will add the DC Motor Speed Control in it. So, today, we will control both the direction as well as speed of the DC Motor. Moreover, you should also have a look at How to use Arduino PWM Pins if you are not much familiar with PWM control.
In the previous tutorial, we have seen How to control the direction of a DC Motor, which is important when you are working on some robot and you need to move that robot in both forward and reverse direction. So, in such cases you need to do the direction control of DC motor. But in most projects, along with direction, we also need to control the speed of DC motor so that we can implement some PID algorithm on the motors. So, in such cases, there comes a need for DC Motor Speed control, which we are gonna cover in today's post. So, let's get started with it.
DC Motor Speed Control using Arduino in Proteus
- As I have explained earlier, I am gonna take it further from our previous tutorial. So, in previous tutorial, what we have done is, we have controlled the direction of DC Motor using Serial Terminal.
- When we send commands on the Serial Terminal the motor moves in clockwise or Anti-clockwise direction.
- So, now the above mentioned functionality will remain the same but an addition will be of speed control.
- I have placed a LDR sensor in the simulation and depending on the value of that LDR sensor our DC motor speed will either increase or decrease.
- So, you can download the complete simulation of DC Motor Speed Control by clicking the below button:
Download DC Motor Simulation
- As I always recommend, design this simulation on your own so that you learn most of it.
- So, first of all, design a circuit as shown in below figure:
- As you can see in the above figure, its exactly the same as we designed for Direction Control of DC Motor in Proteus ISIS with a slight difference.
- The difference is NPN transistor which is used for DC Motor speed control.
- The base of this NPN transistor is connected with PWM pin of Arduino board.
- So, I am generating a PWM pulse on this pin which is then applied on the base of transistor.
- Now if I increase the duty cycle of this PWM pulse then the transistor induction will increase and thus the speed of the DC motor.
- Now in order to control this PWM pulse I have used the LDR sensor, now depending on the LDR sensor the speed of DC motor will increase or decrease.
- Now upload the below code in your Arduino software and Get the hex file from Arduino software.
int Motor1 = 2;
int Motor2 = 3;
int PWMControl= 6;
int PWM_Input = A0;
int PWM_Value = 0;
void setup() {
pinMode(Motor1, OUTPUT);
pinMode(Motor2, OUTPUT);
pinMode(PWMControl, OUTPUT);
pinMode(PWM_Input, INPUT);
Serial.begin(9600);
}
void loop() {
PWM_Value = analogRead(PWM_Input);
PWM_Value = map(PWM_Value, 0, 1023, 0, 255);
analogWrite(PWMControl, PWM_Value);
if(Serial.available())
{
char data = Serial.read();
Serial.println(data);
if(data == 'C'){MotorClockwise();}
if(data == 'A'){MotorAntiClockwise();}
if(data == 'S'){MotorStop();}
}
}
void MotorAntiClockwise()
{
digitalWrite(Motor1, HIGH);
digitalWrite(Motor2, LOW);
}
void MotorClockwise()
{
digitalWrite(Motor1, LOW);
digitalWrite(Motor2, HIGH);
}
void MotorStop()
{
digitalWrite(Motor1, HIGH);
digitalWrite(Motor2, HIGH);
}
- So, now I am starting the simulation and then will send the commands via virtual Terminal and it will start moving and then by changing the LDR position DC motor speed control will take place.
- I know its not clear from above figure so that's why I have designed this video. In the below video you will get the clear idea of DC Motor speed motor.
So, that's all for today. I hope you have got the idea of DC Motor Speed Control. Take care and have fun !!! :)