Hey guys hope you all are fine and healthy. Today I am going to start a new tutorial, about PIC Microcontrollers. I will start from the very basics of PIC Microcontroller so that the beginner can also learn from it and can easily work on their projects and I will also post some projects in which I will use PIC Microcontroller and will control different modules using it.
The only thing I hate about PIC Microcontroller is the designing of its basic circuit, which we will discuss in coming tutorials, that's why I prefer to work on Arduino which is way more user-friendly than PIC Microcontroller but if look at the brighter side of PIC Microcontroller than it is much more flexible in option as compared to Arduino. Let's start today's tutorial, today I will just give an overview of what actually Microcontroller is and why to use it. So, let's begin with getting started with microcontrollers.
Microcontrollers are used to put the brain in your projects. Let's take an example, you have seen different light patterns at weddings or different functions where it seems like lights are walking, sometimes they show some characters glowing on and off quickly, etc. Before microcontrollers such patterns of light were very difficult you need a a lot of circuitry (serial & parallel combinations of lights) and then have to decide which light to on and which to off. A big messy thing but with the invention of the microcontroller, now you just have to add a microcontroller and put in some coding and you are done. That's the benefit of the microcontroller. and second thing in order scenario if something goes wrong then you have to change the hardware connections but in the microcontroller just change the code and you are done with no need for soldering etc.
There are different microcontrollers manufactured by different companies these days. A few of them are:
but all of them have the same function. Let's look at their function.
A microcontroller is a simple chip (IC). We are not discussing its internal architecture as it's beyond the scope of this tutorial. We are here just concerned with its output. So a microcontroller is just a simple hardware chip. Now how to operate that chip is a question. A microcontroller has different no of pins some have 8 pins some 16 and some 40 even have 80 pins. Each pin has its function and we tell the microcontroller what function each pin will perform by adding a code in the microcontroller.
PIC microcontrollers are manufactured by a company named Microchip. There is a wide variety of PIC microcontrollers. They are named PIC16F877A or PIC 18F452. The first two numbers show the series like the PIC16F series and PIC18F series. Each series has its own functions and qualities and the number of pins also varies. In my tutorial, I am gonna use the PIC18 F452 which is shown in the above figure too.
That's all for right now. I will continue it after afternoon. Stay blessed .... :))
In the last post, we were able to get the continuous data from COM port using Labview and we have also separated the data based on a character which I have used this one "," i.e. comma. Now, suppose you are sending 3 values from your COM port and these are the sensors' values so tthe best way to display these value is by using a graph. In the last post we separated the values and displayed them in a 1D array, so today we are gonna display those values in a graph. As I have taken three values so today I am gonna plot 3 graphs. Each graph will show one of the values and display them in real time. Let's start it.
Let's start today's post, in today's post we will receive data from serial port and show it in LabView software. In order to do so, first of all you need to download LabView software, you can easily download it from their official website. They offer a trial period of around 45 days for the students and after that you have to buy it. Now, follow the below steps carefully and if you find any trouble anywhere, let me know in comments and I will try my best to sort them out.
Response is showing the complete data whatever is coming from the Serial Port, while the Data 1D is splitting the data and showing each data in each box and the separation character I selected is "," (comma).That's all for today, now play with the vi and I hope you will find it really amusing. In order to download the complete working vi click on the below button.
Download Labview SimulationIn the next post, I have discussed how to Display Serial Data on Real Time Graph in Labview.Displaying data on graph is usually required in most of the projects. So have a look at it.
Coming to today's post, as we have done adding the Arduino Library in Proteus, so I thought to do some projects on it and the first one I chose is quite simple one i.e. Circuit Designing of LCD with Arduino in Proteus ISIS. So we will have a look on how to show some characters on LCD using Arduino in Proteus. If you are working on LCD then you should also have a look at my new post Scrolling Text on LCD using Arduino. Let's get started with Circuit Designing of LCD with Arduino in Proteus ISIS:
#include <LiquidCrystal.h> LiquidCrystal lcd(12, 11, 5, 4, 3, 2); void setup() { lcd.begin(16, 2); lcd.print("www.TheEngineer"); lcd.setCursor(0,1); lcd.print("ingProjects.com"); } void loop() {}Note:
Download LiquidCrystal Arduio Library
Hello friends, hope you all are fine and enjoying life. Today's post is about removing a small error named as Recognition Failed in EasyVR, which I encountered while working with EasyVR shield with Arduino UNO. I have posted a complete project on EasyVR shield around a year ago in which I haven't mentioned this error because at that time I didn't encountered it. But today while working with EasyVR shield, I encountered this problem so I thought to share it with you guys.
EasyVR shield is a voice recognition module which is used for recognizing voices and operating accordingly. Using this module, one ca quite easily control anything using voice. In the previous project, I have controlled a robot using voice commands like when I say Forward then it starts moving forward, when I say REVERSE then it start moving backward and so on. So, its quite a cool feature to be added in projects but its not the perfect one as the efficiency of this module is not even 50%, if you are operating in a noise environment then it won't work as you want it to work.So ,let's get started with How to solve Training Error: Recognition Failed in EasyVR.
You must also check GSM Library for Proteus, using this library you can easily simulate your GSM module in Proteus ISIS. Moreover, also have a look at Send SMS with Sim900D in Proteus ISIS in which I have designed a simulation of SMS sending in Proteus ISIS.
Note:
Where To Buy? | ||||
---|---|---|---|---|
No. | Components | Distributor | Link To Buy | |
1 | SIM900 | Amazon | Buy Now | |
2 | Arduino Uno | Amazon | Buy Now |
Components List | Amazon | Ali Express |
---|---|---|
Give Your Suggestions !!! | ||
Arduino UNO R3 | Click Here to Buy Price: $10.99 | Click Here to Buy Price: $2.79 |
GSM Module Sim900 | Click Here to Buy Price: $28.99 | Click Here to Buy Price: $10 |
void setup() { Serial.begin(9600); } void loop() { delay(1200); Serial.print("AT"); delay(1200); bool bOK = false; while (Serial.available() > 0) { char inChar = (char)Serial.read(); bOK = true; } if(bOK) { index = 0; Serial.println(); Serial.println("AT+CMGF=1"); // sets the SMS mode to text delay(100); delay(1200); bool bOK = false; while (Serial.available() > 0) { //Serial.write(Serial.read()); char inChar = (char)Serial.read(); bOK = true; } if(bOK) { Serial.println(); Serial.print("AT+CMGS=""); // send the SMS number Serial.print("+923004772379"); Serial.println("""); delay(1000); Serial.print("A new post is created by Zain."); // SMS body delay(500); Serial.write(0x1A); Serial.write(0x0D); Serial.write(0x0A); } } }
Arduino YUN can be used as a server, you can also run python scripts quite easily on it, which we will cover in coming posts of this tutorial. You can run the Telnet session on it, can access the FTP servers, in short you can do anything with it quite easily. Let me give you an example, around 3 months ago I have designed a project on Arduino YUN in which the sensors data attached to the YUN were uploading directly on the web server via FTP and were saved in the sql database and I did all of it, just by using Arduino YUN alone. No computer was attached for FTP connection as python scripts in the Arduino YUN were doing this task. Now, I think you have gotten better idea of capability of Arduino YUN.Arduino YUN also have built in Wifi, Ethernet, USB host and SD card slot.
One another unique feature of Arduino YUN is that you can upload Arduino sketches in it wirelessly without any cable connection, if your computer and Arduino YUN are connected with the same Wifi connection. Now, let's have a look at how to manually connect the Arduino YUN with available wifi connection, which should be your first step after buying an Arduino YUN.
Now I suppose that you have got your Arduino YUN. After getting the Arduino YUN, open your box and plug the mini usb cable into your Arduino YUN and the other side of cable in your computer. I am also assuming that you are plugging it first time with your computer via usb cable.
Note:
Today I am going to show you Sensorless Speed Estimation of Induction Motor in MATLAB. In order to control and estimate the speed of Induction motor, there are many methods proposed by different scientists. The method I have selected in my project is Adaptive method. Using this method, I have controlled the speed of Induction motor using MATLAB software. Matlab software is used for simulation design. The simulation is designed in simulink and the MATLAB version used for designing this project is MATLAB 2010. It is also tested on MATLAB 2012 and 2013. All the details of this project are mentioned below.
If someone wants to buy this project then click on the button shown on right side. Its quite difficult to implement and is designed because of the efforts of our team that's why we haven't made it open source but we have placed a very small purchase amount because mostly it is asekBefore going into the details of Induction motor, let’s first have a look on the mathematical derivations. Few of the well-known methods are:
In order to apply the adaptive method on the Induction motor, there was a need to first design the induction motor on Simulink. For designing the Induction motor on Simulink, mathematical calculations were required. So, my first task was to derive the complete mathematical equations for all the variables of Induction motor.
The basic mathematical model also known as the a-b model (or two-phase equivalent model) of induction motor is given as:
The approach used in this report is to consider the speed as an unknown constant parameter. The reason for choosing this parameter is that it changes slowly as compared to all the other electrical parameters and as it changes slowly so it can be controlled more effectively. The adaptive method techniques are applied on the speed parameter and thus estimated it. This adaptive method approach on speed parameter was first implemented by Shauder and are further enhanced and researched by Peng and Fukao. Using the last two equations of the system (1), I derived the below equations:
Now take the second and third equations of system (1) and divide them by M / LR and then differentiate them w.r.t time and the below equations are obtained:
System (3) gives us the derivative of magnetic fluxes. In order to calculate the error dynamics induced in the system, we need to calculate the estimated values of these magnetic fluxes and then subtract them from the system (3). The estimated values of the magnetic fluxes are as follows:
V (ema, emb) = ½ (e2ma + e2mb)
Using the above equation and the values of ema and emb, we get:
The model designed in MATLAB is shown in the figure 1. This model is performing the simulation of motor moving in both the directions i.e. clockwise and anti-clockwise. It contains four main blocks, which are:
All these four blocks are discussed below in detail:
This block, as the name depicts, is used for generating variable frequencies. In the start, the first model, I generated, was for fixed frequency of induction motor and was also showing just one direction of motor. So, I did few modifications in the model and added this block so that the motor could move both in positive and negative directions and can also move at different frequencies.
Figure 2 shows the parameter block for this block and from this block one can set the frequency of this motor quite easily. From this parameter block, one can set:
By default, I have taken two frequencies, for which the motor will rotate during a cycle.
In order to change the direction of the motor, I have used the phase change. When the voltage applied to the motor reverses its direction, the direction of the motor also reverses. For this simulation, the motor will rotate in clockwise direction when:
And it will reverse the direction, when:
i.e. Vb and Vc are changing their positions. In order to do so I added a phase change in this block and thus for the first 5 sec the motor will move in one direction and for the last 5 sec it will move in the opposite direction automatically.
This block is separately shown in the figure 2. This block takes Vabc as an input and gives output in the form of V(alpha) and V(beta). This conversion is known as Clarke Transformation. This transformation is used in order to simplify the implementation of three phase systems as in Clarke Transformation, a reference signal is obtained. V (gamma) becomes zero in Clarke Transformation that’s why it becomes very easy to use.
In Clarke Transformation, the relation between Vabc and V (alpha) and V (beta) is given as:
If we closely examine the figure 3, then it is shown that inputs coming are Va, Vb and Vc. After that the above equations are applied on these input signals and the output received is V (alpha) and V (beta). In simple words, figure 3 is implementation of Clarke Transformation.
Motor system block is the practical implementation of set of equations shown in the system (1). It is the basic mathematical model of Induction motor shown in figure 5. It is taking V (alpha) and V (beta) as an input along with the load applied on Induction motor. In other words, I can say that this block is the actual Induction motor and I need to apply the adaptive method technique on this block in order to estimate and control its speed.
V (alpha) and V (beta) applied here are the same obtained in the Clarke Transformation explained in the previous section. Outputs of this function are the states which we will study in detail in the fourth section and the derivatives of currents Isa and Isb.
Let’s double click this motor system block and check the functions it’s calculating. The functions of this sub system are shown in the figure 6. As I told earlier, this block is the simulation of system (1), which is also shown below:
As shown in the figure 6, motor block is implementing all the five equations of system (1), which are:
All these functions are shown in the figures 7(a-e).
Figure 7c: Implementation of equation 1 of system 1
Figure 7d: Implementation of equation 4 of system 1
Figure 7e: Implementation of equation 5 of system 1
Figure 7f: Graphical Representation of equation 2 of system 1
Figure 7g: Graphical Representation of equation 3 of system 1
Figure 7h: Graphical Representation of equation 4 of system 1
Figure 7i: Graphical Representation of equation 5 of system 1
After the implementation of all these equations, a complete model of Induction motor has been obtained. Now there’s a need to apply the technique of adaptive method on it so that the speed could be controlled without the help of sensor, which is done explained in detail in the next section.
In order to change the parameter of this system, I have added a parameter block in it shown in the below figure:
Let's have a look at the Speed Estimation Block of Sensorless Speed Estimation of Induction Motor in MATLAB. Speed Estimation is the place where adaptive method technique is applied to estimate the speed of Induction motor. This block is actually implementing the system (3) and system (4) and thus calculating the real speed and the estimated speed of the Induction motor respectively. After the calculation of these speeds, it is further calculating the error dynamics by subtracting the estimated speed from the real speed.
Speed Estimation block is shown in the figure 8. Inputs coming to the speed estimation are the same obtained in the first and second block i.e. V (alpha), V (beta), Isa, Isb, dIsa/dt and dIsb/dt. The functions implemented by this subsystem are shown in the figure 9.
Figure 9: Functions Implemented by System Estimation Block
System (3) and system (4) are implemented in the figure 9, which are as follows:
Thus the outputs of these two blocks will give us the real speed values.
So, the output of these two blocks will give us the value of estimated speed. The internal functions of all these four blocks are shown in figures 10a, 10b, 10c and 10d respectively.
Figure 10a: Implementation of Equation 2 of System 3.
Figure 10b: Implementation of Equation 1 of System 3.
Figure 10c: Implementation of Equation 2 of System 4.
Figure 10d: Implementation of Equation 1 of System 4.
After the calculation of all the four values, the speed estimator block then implemented the system (5), which is:
Implementation of this system 5 is separately shown in the figure 11, which finally gives us the value of estimated speed.
Graph of both the estimated speed and the actual speed is shown in the figure 12.
Figure 12: Graph of Estimated Speed and Actual Speed
Let's have a look at the conclusion of Sensorless Speed Estimation of Induction Motor in MATLAB. Figure 12 shows both the actual and estimated speed induction motor. In the start, the motor is moving at the speed of around 25 rpm, after that the speed is increased to 50 rpm, and the motor starts to rotate in the opposite direction that’s why the graph shows the negative value. Now, it’s moving at 50 rpm in the opposite direction and lastly, it is moving at 25 rpm in the opposite direction. Figure 13 shows the graph for estimated errors. It is quite obvious from the error graph that whenever the speed of the motor fluctuates the error goes quite high. In other words, the acceleration produced in the motor causes the error to increase while the error remains zero when the motor is moving at constant speed, regardless of direction.
Figure 13: Estimated Error Dynamics
So, that's all for today. I hope you have enjoyed Sensorless Speed Estimation of Induction Motor in MATLAB. Will meet you guys in the next tutorial. Till then take care and have fun !!! :)As shown in the below figure, first of all you need to select the COM Port from which you want to receive the data and then select the Baud Rate. Hit Connect and you are now ready to communicate with the selected com port.Download link for this software is given below:
Different features are added in the serial terminal to make it more user friendly. First, let's talk about the Transmitting portion. If you guys have noticed, in the previous version of serial terminal. there was no option for Carriage Return and Line Feed but now these options are added.
Showing data in different formats helps in designing the project because understanding of coming data is quite necessary. Give this software a try and let me know your suggestions for the improvement. That was all for today, will see you guys in next tutorial. Have fun !!! :)
Today's post is a very small trick but yet very effective one. In a recent project of mine, it helped me a lot and yet its quite a small thing but it took me around half an hour to find it online and that's the reason I decided to share it with you guys. I have to design a software in which I was using a database in visual studio 2010 and in that project I have to add some delay in my readings addition in database so I was like :O how to add delay in visual studio 2010. I searched online and after quite a lot of time I finally able to get it, which I am sharing now in this post. Btw if you wanna learn about database then read How to create a database in visual studio 2010. After the creation of any software in visual studio there's a need of creating its executable file so that we can use the software standalone and just simply install our software on any computer so I think you should also read How to create exe file in Visual Studio 2010. Anyways coming back to adding delay in visual studio 2010, let's first discuss delay in programming language. :)
System.Threading.Thread.Sleep(1000)This command will generate a delay of 1sec. You can change this value in order to change the time of delay. i.e.