Getting Started with EasyVR Commander
In the previous post we have seen the project description of Voice Recognition Project using EasyVR shield. Today we will have a look at Getting started with EasyVR commander. EasyVR shield is a module which is used for voice recognition. First of all, we save our commands in the EasyVR shield and then we use these commands to control anything. In this project, I need to control the robot with voice commands like when someone says FORWARD then the robot start moving in forward direction.
Now first of all what I need to do is to save this FORWARD voice in the shield, which we will see today how to save the command in the shield and after that I will show you the
Interfacing of EasyVR shield with Arduino UNO. So that when I say Forward the motor start to move in forward direction, which we will see in the next post. When I was working on EasyVR Shield then I got into a problem which was
How to solve Training Error: Recognition Failed in EasyVR and I solved it so you should also have a look at this tutorial if you got such error.
What is EasyVR Commander?
- EasyVR Commander is a software using which we save the voice commands in the EasyVR Shield. You guys can easily find it using google and its totally free.
- Download this software and install it.
How to use EasyVR Commander?
- First of all connect your EasyVR shield with the Arduino UNO Shield as shown in below figure.
- Now be careful in this step as it took the most of my time, on EasyVR shield you will find a jumper J12. Put this jumper on position PC.
Note: When you are adding commands in EasyVR shield using EasyVR Commander, then this jumper J12 must be on position PC and when you are using this shield in the circuit with arduino then this jumper J12 must be on position SW.
- Connect your Arduino UNO shield with the computer and run the software EasyVR commander. The software will open up as shown in the figure below.
- Now select the COM Port on which Arduino UNO is attached, which in my case was at COM20.
- After selecting the COM Port, click the Connect icon as shown in below figure.
- When you hit on Connect icon, the software will connect to the COM Port and will open up as shown below:
- If you check the left pane, there are many groups and wordset.
- In wordset, there are pre defined words, which are already saved in the EasyVR shield.
- The words which I want to save in the shield, will be saved in the Groups.
- Now to save these words click on any group where you want to save.
- In the below figure, I have selected Group 2 and then click on the Add Command button (Click # 1) shown in the figure.
- It will add the command in the group as you can see I have saved the command OK.
- Now I have saved the command OK but I have to give it some voice to this command.
- In order to do so, click on the Train Command icon ( Click # 2 ).
- Now when you click on the Train Command icon, a message box will pop up as shown in below figure.
- Click on the button which says Phase 1.
- Now as you click on this button, a box appears which say "speak now", now its the time to say your command in the mic like I said OK.
- After listening the command this pop up will again show up and this time the button will be Phase 2.
- Again click on the button and it will ask for "speak now" and you again speak the same command in the mic.
- After that the software verifies the two words and if they are same it will confirm the command.
- You should also have a look at these Arduino Projects for Beginners.
- In my case, I have saved total 5 commands in my software as shown in the below figure.
- These were my five commands to control my robot.
- Now after adding the commands, simply close the software as the voice commands are now saved in the EasyVR shield.
- Place the jumper J12 back to position SW.
Note:
- You can also test your added commands,to do so click on Test Command icon on the software and speak up any of the commands from the selected group.
- If the command matches, then the software will indicate it. Test it and you will see.
In the next post we will check the
arduino side of controlling this shield. I will post the code as well so that you can easily test it. If someone's having any problem in using this shield post in comments and I will surely help you out and subscribe us via email to get such exciting tutorials rite in your mailbox. Take care !!!
Voice Recognition using EasyVR Shield
Hello friends, today's post is, as the name suggests, about the Voice Recognition using EasyVR Shield. Voice recognition is quite a difficult task and usually done on software like MATLAB, but what if someone needs a stand alone project, a kind of autonomous voice recognition project, which doesn't use computer.
EasyVR is the solution for such projects. I recently did one project on this module named as Voice Recognition using EasyVR Shield and it worked really cool so I thought to share this new technology with you guys. I couldn't write the next part of Proteus tutorial, actually firstly I was busy in this project and then I thought to share this one as its quite exciting one. After completing this project, I will come back to Proteus tutorial.
This is the first tutorial in this EasyVR shield series. In the next tutorial, I have shared Getting Started with EasyVR Commander and once you got familiar with the EasyVR Commander then you must read Interfacing of EasyVR Commander with Arduino. When I was working on this awesome shield, I got Training Error: Recognition Failed in EasyVR so if you got such error this read this tutorial.
Project Description - Voice Recognition using EasyVR Shield
- The complete project was quite messy, it involves a lot of sensors as well as dtmf control, so I am not explaining that part in this tutorial. In this project I will explain that section of the project where we used this module.
- The functioning of this module is to control the robot movement using voice.
- So, when someone says FORWARD in the mic of this module, the robot moves forward. Someone says RIGHT and the robot moves right and so on.
- I have divided this project in parts so that you can easily understand the basic concept behind this project.
- If you are working on such project and are unable to make the code work then you can also get our services by Contacting Us.
- I have plans on designing this same project on PIC Microcontroller as well as 8051 Microcontroller and I will share their links once I uploaded them.
So, that was all about the Project Description of Voice Recognition using EasyVR Project. In the next posts, we will first see how to add these voice commands in the EasyVR shield and after that we will have a look at the code, I used in Arduino.
Complete Guide on Proteus ISIS & ARES
Hello friends, I hope you all are fine and having fun. In today's tutorial, I will provide you a
Complete Guide on Proteus ISIS & ARES. I will start from very basics & will gradually move towards complex projects. I have already shared a lot of tutorials on Proteus software on my blog, I will add their links in today's tutorial as well, in the projects section.
If you guys have any problem anywhere, ask in comments and I will try my best to resolve your issues and also subscribe to our newsletter so that you get these burning tutorials rite in your mail box. I will continuously update this list of tutorials so that we have all tutorials at one place.
Course Content of Proteus Guide
I have divided this tutorial in few sections and you have to follow them in sequence and at the end of this course, I hope you will be able to create any simulation in Proteus ISIS & also design its PCB model in Proteus ARES. These sections are as follows:
- In the 1st section of this course, we will have a look at few basic concepts in Proteus, which are necessary for a beginner to understand.
- In the 2nd section, we will discuss various components available in Proteus. I know there's countless components in its database and we can't discuss them all but we will have a look at most commonly used components i.e. DC motor, servo motor, serial port, etc. We will design some simple electronics circuits in Proteus to get better understanding.
- In the 3rd section, we will have a look at How to simulate different Microcontrollers in Proteus ISIS, and we will also simulate different sensors in it. Moreover, I will guide you How to Install 3rd Party Proteus Libraries.
- In the 4th section, we will first have a detailed introduction to Proteus ARES & then we will design different PCB boards in it, both single layered and multi-layered.
- In the 5th section, we will see how to design a component in Proteus along with its PCB footprint, if it's not already in Proteus database. Its important, especially when you need to design a PCB in Proteus.
- In the 6th section, we will simulate different final year complex projects.
Complete Guide on Proteus ISIS & ARES
- I have created above mentioned sections and added respective links in sequence.
Section 1: Basics of Proteus ISIS
So, let's get started with Basics of Proteus ISIS, these are very basic tutorials, so if you have worked on Proteus before, then you can skip this section. Although, I would recommend you to read them once:
Section 2: Components Available in Proteus ISIS
Proteus has a wide range of components in its database. Using these components you can design almost any kind of circuit and can test and debug it. Below tutorials mention few of these components, which are most commonly used while working on Proteus.
Components Libraries for Proteus
Proteus has a wide range of components available in its database. But it happens quite a lot that you search for some component in Proteus but you can't find it in Proteus database. For such cases, Proteus has given a method using which you can design your component in Proteus and can add all of its features in it. Its quite a lengthy process and needs a lot of effort as it involves creation of DLL files using C++ and VSM. We have designed few components libraries for Proteus, using which you can simulate that component or module in Proteus. Here's the list:
Arduino Projects in Proteus
Arduino is most widely used Microcontroller board these days, which is famous for its flexibilty and ease of use. Arduino board is not available in Proteus but we have provided with Arduino libraries using which you can quite easily use Arduino in Proteus and can test your circuits in Proteus before implementing them in hardware. Below are the tutorials and projects in which we have used Arduino in Proteus.
PIC Microcontroller Projects in Proteus
PIC Microcontroller is another microcontroller which is used by engineers in engineering projects. This microcontroller is available in Proteus so we have designed few projects on it which are mentioned below:
8051 Microcontroller Projects in Proteus
8051 Microcontroller is another microcontroller series which is quite popular and is used in engineering projects quite a lot. 8051 Microcontrollers are also available in Proteus and most normally used 8051 Microcontrollers are AT89C51 and AT89C52. I have shared many projects on 8051 Microcontroller, which are as follows:
Sensors simulation in Proteus
[dt_gap height="7"]
Proteus has a wide range of sensors available in its database. We have designed simulations of few of these sensors which are mentioned below. Ultrasonic sensor is not available in Proteus so we have provided its library so thaat students can easily interface and test it in Proteus. These sensors' simulations are mentioned below:
555 Timer Projects in Proteus
555 Timer is known as the king of electronics projects after microcontrollers. 555 timer is used in a lot of electronics projects where you need to ddo control or generate some timing or PWM pulse. 555 Timer is available in Proteus and have designed a lot of tutorials on it, which are mentioned below:
PCB Designing Tutorials in Proteus ARES
Proteus not only provide the capability of circuit designing and testing but also provide the facility of designing a PCB. Proteus comes with two packages one is named as Proteus ISIS in which we design our circuits and the other one is Proteus ARES which is used for PCB designing. Here we have post tutorials on How to design PCBs in Proteus.
So these are the tutorial on which I have written. If you guys stuck at any point, feel free to ask in comments and I will try my best to satisfy you as much as I can. Moreover subscribe to our mailing list so that you get these tutorials rite into your mail box. Stay blessed & take care.
How to Burn MikroC code Using PICkit3
Today's post based on my personal experience so I thought of sharing it with you guys. Today I thought of using PICkit3 for programming PIC microcontroller. Before that, I was using PIC JDM Programmer for PIC , the only reason for switching is the usb port as I want to burn the PIC on my laptop instead of PC, as my laptop don't have serial port. So, I connected PICkit3 with my laptop and tested it with MPLAB and it worked well. But actually the project on which I am currently working demands MikroC (Client's requirement to use MikroC compiler but personally I always prefer MPLAB).
Anyways I thought it wont be much of an issue to connect it but when i practically did that i was kind of surprised, there was no method anywhere (at least i didn't find any) not even in the mikroC forums of how to connect PICkit3 with mikroC. I almost spent two to three hours finding some direct way to connect PICkit3 with mikroC but didn't find any. Although I got few tips from the forums, that's what I love most about forum discussion, and finally I got able to program the MikroC code through PICkit3. Although its not a direct way but quite quick and working great for me. If anyone knows any better than this one, kindly post in comments or send me directly.Now just follow these simple steps and you are on.
Requirements for Connecting PICkit3 with MikroC
- PICkit3 Programmer
- External Simple Hardware to connect PICkit3 with PIC Microcontroller.
- MikroC Pro (Full Version)
- MPLAB with C18 compiler
Note:
- If anyone needs any of the above software than Subscribe to our Newsletter and post your email ID in the comments and I will email them to you.
Step 1: Create program in MikroC
- First of all, create your program in MikroC which you want to burn via PICkit3.
- Now when you are done, go to Project > Build and build your program.
- When you click on Build, the MikroC will create a hex file of your program which will be in the same folder in which you have saved your program.
Step 2: MPLAB settings
- Now open the MPLAB software and make sure that you don't have any open project in your workspace. If you have, then simply go to File and click on Close Workspace, it will automatically close all the files.
- After that click on Configure and then Select Device and select the microcontroller on which you want to burn the program. Make sure that it is the same one which you have selected in MikroC, and then click OK.
- Now, again click on Configure and then on Configuration Bits and make sure to tick the option above the table which says Configuration Bits set in code. I have also shown it in the below figure.
- Now connect your PICkit3 with the computer, if MPLAB is installed than its driver will be automatically installed and soon you will get a prompt that hardware is working.
- After that again go to MPLAB and click on Programmer and then Select Programmer and from the list, select PICkit3, it will be on 4th number.
- Here comes the role of external hardware you are using to connect your PICkit3 with the PIC microcontroller. If this external hardware is self powered i.e. externally powered than you wont get any error and the PICkit3 will successfully Connected but if your external hardware is not self powered means you are using PICkit3 to power it up then you will get the below error.
- So if your external hardware is self powered then you can skip this point but if you got this error than click on Programmer and then on Settings and a dialog box will open up. In this dialog box click on Power and then tick the option which says Power target circuit from PICkit3 as shown in below figure.
- Now click OK and again click on Programmer and then on Reconnect and you will get no error this time, your PICkit3 will successfully connect to the MPLAB and also support your PIC microcontroller.
Step 3 : Importing Hex file in MPLAB
- Now the last step is to import the hex file we generated in the step 1 using mikroC into MPLAB. To do so, click on File menu in MPLAB and then click on Import and select your hex file you want to burn in your microcontroller.
- Output pane will show that file is loading and when its loaded click on Programmer and then on Program and your program start to burn in your microcontroller and soon a message will show up in output pane that program/verify completed. Hurrah! your program is successfully burned in the microcontroller.
- Now, you don't need to do anything, these all setting are just one time only save these settings, now just make your program in MikroC, compile it and then program it using MPLAB just two clicks. .... :))
Important Note:
- Don't Import hex file before connecting the PICkit3, the sequel must remain same otherwise it will create problem.
- The PIC chip must be same for both MPLAB and MikroC otherwise although the program will burn but it wont work on your hardware as I have mistakenly experienced it.
- Dont use any third party software for programming through PICkit3, i tried the beta version software but it didn't work on my system and just crashed.
If you having any problem in any part of this tutorial ask in comments, I will try my best to resolve it and if you like this tutorial then Subscribe to our Newsletter so that you got such tutorials right into your mail box. Ok than let's meet in the next tutorial. Take care.
Sending Email in Microsoft Visual Studio 2010
Hello friends, today's tutorial is about adding functionality in Microsoft Visual Studio 2010 basic email form. In the previous part of this tutorial How to Send Email in Microsoft Visual Studio 2010, we have seen a basic email form which just sends email to constant email address which is specified in the coding.
Today we will make this email form a bit flexible and will be able to send the emails to any email id we want. If you have read the previous part of this tutorial, then this article will be nothing for you, you will got it just like a piece of cake instantly.
So, I suppose that you have read the previous tutorial and you have the knowledge of smtp etc so I am not gonna explain it further, so i suggest again to read it first if you have any doubt in configuration part, lets come to this part.
Steps to follow:
- First of all create a new project in your Microsoft Visual Studio 2010 and if you have already created it in the previous part then don't need to create it again, just open that project.
- Now in your main form add one button, three labels, two text boxes and one rich text box.
- Change the Name and texts of all these controls from their properties as i specified below and be careful in doing this part and its better if you simple copy paste them.
- Change Label1 text to Send Email To.
- Change Label2 text to Subject.
- Change Label3 text to Mesage.
- Change TextBox1 name to txtSend and place it after Label1.
- Change TextBox2 name to txtSubject and place it after Label2.
- Change RichTextBox name to rtbMessage and place it under the Label3.
- Now at the end change the Button1 text to Send Email and name to SendEmail.
- Place them as shown in the image below or you can also change their positions as well. Anyways your final software will look like this :
- Now the last part is adding code so go into your code editor and remove all the previous code and place this code in it.
Imports System.Net.Mail
Public Class Form1
Private Sub SendEmail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SendEmail.Click
Dim Mail As New MailMessage
Mail.Subject = txtSubject.Text
Mail.To.Add(txtSend.Text)
Mail.From = New MailAddress("email@gmail.com")
Mail.Body = rtbMessage.Text
Dim smtp As New SmtpClient("smtp.gmail.com")
smtp.EnableSsl = True
smtp.Credentials = New System.Net.NetworkCredential("email@gmail.com", "password")
smtp.Port = "587"
smtp.Send(Mail)
End Sub
End Class
- Change email@gmail.com with your email address and password with your password.
- Now if you compare it with the code in the previous part, you will see there's just a slightest change.
- In the previous software, we were adding the subject and email id to which we have to send email and the email body in the code section but in this software we have created text boxes and in the code we are getting these things from those text boxes, quite a simple thing.
Things to Notice:
- One thing you have observed that this software lack the functionality of login so its not kind of a messenger on which we just login with any id and send the email to your recipient.
- The reason is we haven't yet covered the login form. In my next article on visual studio, i will cover the login form.
- By the way you can add a simple login form by yourself, just add two text boxes and in the code, get data from them where we are using our email id and password.
Note:
- This sotware along with code has been sent to all the subscribed members already.
- In order to get the complete code and software, kindly Subscribe to our Newsletter and post your subscribed email address in the comments and I will send them to you.
I will recommend you guys to must read these two tutorial on Microsoft Visual Studio as well:
That's all for today guys, if someone having any kind of trouble in any part, ask in comments and help me to help you ..... Take care ..... ALLAH HAFIZ :))
How to Send Email in Microsoft Visual Studio 2010
Hello friends, first of all I am really bad in designing stuff. Although I have tried to design the top image for this post but I know its not much cool well try to bear it .... :))
After the Microsoft Visual Studio 2010 - COM Port and Creating a Database in Microsoft Visual Studio 2010 tutorial, here's my next tutorial on VB.net. As the name suggests, this tutorial is about sending an Email through Visual Studio. Again I will use Microsoft Visual Studio 2010 and the language will be Visual Basic for this tutorial.
Usually Sending an Email through software seems quite a difficult task but in actual its really a very easy task. So at the end of this short and quick tutorial, you will be able to develop a software which will send email on your click. I have divided this tutorial into two sections. Today we will just create a simple app which will send emails on just one click and later on we will add few features in it and make it able to send emails through multiple accounts with log in capability. Two parts of this tutorial are as follows:
Steps to Follow
- First of all create a new project in Microsoft Visual Studio as shown in figure below:
- Now select Visual Basic from the Installed Templates and then Windows Form Applications.
- Give your project some name and then click on OK.
- Now it will redirect you to your form. Add one button in your form and rename it to Send Email and change the Name of the button to SendEmail.
- Now move into the code section of your application and remove everything and paste the below code into it.
Imports System.Net.Mail
Public Class Form1
Private Sub SendEmail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SendEmail.Click
Dim Mail As New MailMessage
Mail.Subject = "First Email"
Mail.To.Add("Email1")
Mail.From = New MailAddress("Email2")
Mail.Body = "First Email Through VB.net --- www.TheEngineeringProjects.com"
Dim smtp As New SmtpClient("smtp.gmail.com")
smtp.EnableSsl = True
smtp.Credentials = New System.Net.NetworkCredential("Email2", "Password")
smtp.Port = "587"
smtp.Send(Mail)
End Sub
End Class
- Now make few changes in it.
- Email1 is the email whom you wanna send the email.
- Email2 is your email from which the mail will be sent.
- Password is the password of your email i.e. email2.
Note:
- SmtpClient and SmtpPort are different for different email providers.The above mentioned are only for Gmail.If you search a little you can easily find these for Hotmail and yahoo etc.
- If someone needs this software along with complete code, kindly subscribe to our newsletter and post your email in the comments.
Updating Database Table with Programming in VB 2010
Hello friends, I hope you all are fine and having fun. In today's tutorial, we will have a look at updating database table with Programming in VB 2010. In the previous posts of this tutorial, we have seen How to Create a database in VB 2010 and then we have added button control in VB Database in it, which was quite an easy job. But usually in such applications, its necessary that the application update its database automatically. Like in one of my project, I have designed a software for hotel management in which the data is coming from all the rooms wirelessly to the master room where the software is installed. It was quite a big project but the thing, for which I have mentioned this project, is the software installed in the master room was updating its database itself i.e. if data of room 1 changed then software automatically update the info of that room in its database.
So, for students and also for freelancers its essential that they must have full command over database, and in order to understand today's post its also essential that you must read the previous two posts of this tutorial
.
- In the last post of this tutorial, we have designed this application which is shown in the below figure:
- In this post I am not gonna use images as its really not necessary, because we don't make any change in the layout of application, the whole programming will be at the back end.
Code for Updating Database internally in VB 2010
- Here's the simple code which you need to place in your application, I have explained each line with comments but still if anyone got any trouble please ask in comments, I am always here to help you out.
- For this code, things to be noted are:
- database name is database1,
- Var1 and Var2 are two variables,
- Contact Form is the name of our table which we have saved in our database.
- FullName and LastName are the columns name of our table.
Dim Var1 As database1DataSet.ContactFormRow 'Defining a vaiable
Dim Var2 As database1DataSet.ContactFormRow 'Defining a variable
Var1 = database1DataSet.ContactForm.FindByID(2) 'Here, we are assigning our variable Var1 the location of row 2.
Var2 = database1DataSet.ContactForm.FindByID(2) 'Here, we are assigning our variable Var2 the location of row 2.
Var1.FullName = Var2.LastName 'Now as our variables are in row 2 so they can access any value in row 2. So in this line of code, I just assign the LastName to First Name. So, after execution of this command whatever present in Full Name of row 2 will be replaced by Last Name of row 2.
Me.table5TableAdapter.Update(Me.database1DataSet.ContactForm) 'Now at the the end updated our database or in other words save the database.
Mostly data we receive is through serial port so in that case simple remove the Var2 with the variable in which you are receiving data from serial port. For the programming of serial port in visual basic 2010, check the below tutorial.
That's all for today friends and finally this tutorial completed. If you guys have any question regarding any part kindly ask in comments and also subscribe to our newsletter to get the new updates and software.
Button Control in VB Database
Hello everyone, I hope you all are fine and having fun. In today's tutorial, we are gonna have a look at How to add Button Control in VB database 2010. I have posted the first part of this tutorial few days ago in which I have shown that
How to Create a Database in Microsoft Visual basic 2010. If you have missed that part then you can't understand the today's lecture. Today we will continue with the same application which we created in the last part and will add few new features in it.
Creating database is difficult but adding features in it is very easy job and its also a must requirement of the application because user wants an easy control of application. So in order to make the application user friendly its necessary to add few features in it. In the next post, I have discussed
How to Update Database Table with Programming in VB 2010.
I have divided this project or tutorial into few parts, as covering the whole database topic in one tutorial is not possible. If any of you have any problem in any part,ask in comments. So let's get started with Button Control in VB Database.
- In the last part of this tutorial, we have created a database application shown in the below figure:
- In today's lecture we will add few new features in the above application and at the end of today's lecture, the above application will looks like this.
- You can see in the below figure that now we have Button Control in VB Database.
Step 1 : Add, Save & Remove Buttons
- First of all open the application which we created in the previous part of this tutorial.
- Now add three buttons on it as shown in the below figure :
- Now click the button 1 and change its name from properties to Add, button 2 to Save and button 3 to Remove as shown in figure below.
- We have added buttons and also changed their names according to our requirement, now we are gonna add functionality in these buttons i.e. what function they perform when someone click them.
- Double click Add button and put this code in its function.
Try
Me.Contact_FormBindingSource.AddNew()
Catch ex As Exception
End Try
- Now double click Save button and add this code in its function.
Try
Me.ValidateChildren()
Me.Contact_FormBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.ContactsDataSet)
Catch ex As Exception
End Try
- Now double click the Remove button and add the following code in its function.
Try
Me.Contact_FormBindingSource.RemoveCurrent()
Catch ex As Exception
End Try
- Now run your application and if everything's fine then when you click Add button, a new line will appear in the database where you can enter the next contact. After adding the contact, when you click on the Save button software will automatically save the contact in database and if you click the Remove button then the selected entry in database will be deleted.
Step 2 : Next & Previous Buttons
- Now add two more buttons from toolbar, just under these three buttons as shown in the figure below:
- Change their names to Previous and Next as shown in image below:
- Now double click the Previous button and add the below code in it.
Contact_FormBindingSource.MovePrevious()
- After that double click the Next button and add the below code in its function.
Contact_FormBindingSource.MoveNext()
- Now run your application and when you click the Next button the selection in database will move downward i.e towards the next entry and when you press previous it will move upward i.e towards the previous entry.
Step 3 : Move To Top & Move To End Buttons
- Now again add two more buttons as shown in the figure below:
- Remove Button1 to Move To End and Button2 to Move To Top as shown in below figure:
- Now double click on Move To End Button and insert the below code in it.
Contact_FormBindingSource.MoveLast()
- After that double click on Move To Top button and add the below code in its function.
Contact_FormBindingSource.MoveFirst()
- Now run your application, and check the working of these two buttons. When you click Move To Top button the database will rolled up and you will reached the first line and vice versa for second button.
Okay friends that's all about Button control in VB Database, and I really got tired. Level of today's post is intermediate but its really important as in the next chapter of this tutorial we are gonna move into pro level so if you don't practice it you wont get the next chapter. Okay I gotta go. Stay Blessed. Take care.
Note :
- This software along with code has already been emailed to all the subscribed members. If someone didn't received it then post your email in the comments and i will send it to you.
- if someone wants this software along with the code then subscribe to our email newsletter and it will be automatically emailed to you.
Roots of Quadratic Equations in MATLAB
Hello friends, hope you all are fine and enjoying good health. In today's tutorial, I am going to share How to find Roots of Quadratic Equations in MATLAB. It's quite a quick tutorial in which I will give you the code and will explain it a little. Benefit of this project is that when you are learning MATLAB then you must design such small codes so that you know more about the behavior of MATLAB.
Today two of my juniors came to me for a simple MATLAB term project. It's quite an easy project but i thought to share it for those students who are dealing with basics of MATLAB. Mostly such projects are offered to students in first or second semester when they have very basic knowledge of MATLAB coding and they feel helpless while solving such problems as is the case with those two students. So, let's get started with How to find Roots of Quadratic Equations in MATLAB.
Roots of Quadratic Equations in MATLAB
- This finding Roots of Quadratic Equations in MATLAB takes three inputs from user.
- Variables of Quadratic Equation.
- Domain limit.
- Variable to choose whether to show roots of the equation or minimum of function or both.
- After taking these inputs the function calculates the roots of the quadratic equations.
- After that finds the minimum of the function within the domain limit.
- And finally show both of them on the graph.
Code of the Project
MATLAB is a really amazing tool and I really love to do coding in it.The code for this project is given below. I didn't give description of the code because its a simple project and second thing I want the young students to search these commands themselves so that they could learn something. Second thing MATLAB has a very strong help section, if you are having problem with any command simply enter
doc [Command] or
help [Command] in the main window and MATLAB will give you everything you need related to that command. Here's the code :
%==== Code Starts Here(www.TheEngineeringProjects.com) ====
clc
clf
% ============ Taking Inputs From User ==============
handle = input('Enter the handle of the function : ');
limit = input('Enter the domain limits : ');
initial = input('Enter the initial solution estimate : ');
k = input('Enter 1 for min, 2 for roots & 3 for both : ');
syms x;
a1 = 100000;
%====== Calculating Roots of the Quadratic Equation =========
func = @(x)handle(1,1)*x^2 + handle(1,2)*x + handle(1,3);
root1 = (-handle(1,2) + sqrt((handle(1,2)^2)-(4*handle(1,1)*handle(1,3))))/(2*handle(1,1));
root2 = (-handle(1,2) - sqrt((handle(1,2)^2)-(4*handle(1,1)*handle(1,3))))/(2*handle(1,1));
roots=[root1,root2];
%====== Calculating Minimum Value Within Domain Limits =========
for x = limit(1,1):0.1:limit(1,2)
a = func(x);
if (a < a1)
a1 = a;
x1 = x;
end
if(k==1 || k==3)
plot(x,a,'--rs','LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','g',...
'MarkerSize',10)
hold on;
end
end
min = a1;
%====== Displaying Roots & Minimum Values =========
if ( k == 1)
min
end
if ( k == 2)
roots
plot(x,root1,'--rs','LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','r',...
'MarkerSize',10)
hold on;
plot(x,root2,'--rs','LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','r',...
'MarkerSize',10)
end
if ( k == 3)
min
roots
plot(x,root1,'--rs','LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','r',...
'MarkerSize',10)
hold on;
plot(x,root2,'--rs','LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','r',...
'MarkerSize',10)
end
%==== Code Ends Here(www.TheEngineeringProjects.com) =======
Test Input
- For the testing purposes, use the below values as a testing input :
- First input = [1 5 6]
- Second input = [-1 1]
- Third input = 0
- Fourth input = 3
- The Code is self explanatory but if anyone having any problem in it may ask in comments.
That's all for today. I hope you now have the idea How to Find Roots of Quadratic Equations in MATLAB. I will meet you guys in the next lecture. Till then take care.
Create Database in Microsoft Visual Studio
Hello friends, hope you all are enjoying good health. Today, I am going to share How to create a
Database in Microsoft Visual Studio 2010. Around two to three months ago, I have shared a topic on
Microsoft Visual Basic 2010 - Com Port in which I have explained completely how to make the serial communication in Microsoft Visual studio using visual basic language. Today I am going to share another complete tutorial on how to create a database in Microsoft visual studio. Its a most common project in computer science which usually students do as a semester project, so I thought of sharing it here.
I have divided this project or tutorial into three parts, today we will just create a simple database in which we can add out objects easily and later on we will add few functionality in it. In this tutorial we are going to create a database driven application. In this tutorial we are going to create a simple contact form database. Simply follow these steps. I have also posted How to add
Button Control in VB Database and How to
Update Database Table with Programming in VB 2010. You must read them as well if you are planning to work on VB database. So, let's get started with creating a Database in Microsoft Visual Studio 2010.
Creating a Database in Microsoft Visual Studio 2010
- I have tried my best to make this creation of database in Microsoft Visual Studio as simple as possible, that's why I have added screenshot of each step with commenting but still if you guys have any problem at any step ask in comments. At the end of this tutorial, we will create a database driven application as shown in the figure below:
Step 1 : Creating New Project
- First of all open the Microsoft Visual Studio 2010 and click on the New Project as shown in figure below:
- After clicking it, the below screen will show. Now, choose the language and the project type and then give this project a name and click OK. In our project I am using Visual Basic language and project type is Windows Form Application.
- It will create a new project for you, where we are gonna add the database.
Step 2 : Creating a Database
- Now we are gonna create a database in our project.
- For this first go to the Solution Explorer in your project.
- Now right click on your project name and then click on Add and finally click on New Item.
Note :
- If you can't find it click on View in the above menu tab and then click on Solution Explorer.
- If you can't find the Solution Explorer then click on View in the above menu tab and then click on Solution Explorer.
- After clicking on New Item, a list of items will open up as shown in below figure. Now from these select the Service Based Database. Give it a name like I gave it Contacts.mdf and then click on Add.
- That's now gonna open up a data source wizard as shown in below figure. Just cancel it for now as we don't have anything right now to add in our database.
- Now our database has been created which you can also see in the solution explorer but rite now its empty, so now in the next step we are gonna add a table in our database.
Step 3 : Creating a Table
- Now, double click on the database which we just created in the step 2 and named it Contacts.mdf. (You will find it in Solution Explorer)
- Double clicking the database will open up Server Explorer.
- Now in the Server Explorer, right click on the Tables and then Add New Table.
- Now, it will open a Table where we will add the Columns Name of our Table.
- I have given the first Column as ColumnID and Data Type is int and unmark the Allow Nulls Option.
- Now click on the Primary Key as shown in below figure.
- After that go in the properties of table and click on Identity Specification to expand it.
- Now change the option from No to Yes.
- I have done this to make it auto incremented, now as you add the data in it the ContactID will be incremented on its own showning you the total number of data present in the Table.
- Now quickly fill the other columns name as shown in below figure, you can choose any data type you want but I have choosen varchar(50).
- Now click on Save button to save the table and it will ask for the table name.
- Give the table name and click Ok.
- Now close this tab.
- Now our table has been created, in the next step we are gonna add some data in the table.
Step 4 : Adding Data in the Table
- In order to add data in the table we just created, go to Server Explorer and Expand the Table Section.
- In the Table Section, you will get your table which we created in the Step3.
- Right Click on the Table which we named Contact Form and then Click on Show Table Data.
- It will open up the Contact Form data table. Now fill the few lines as you can see I have added few info in it and then click Save.
- It will ask for the name, remain the name as it is and click Save.
- Uptill now, we have created our database and then we created a table and added some data in it.
- Now we are gonna attach a data source with our database in the next step.
Step 5 : Attach a Data Source
- Now we need to attach a data source with our database.
- For this first click on Data and then Add New Data Source as shown in below figure.
- Now it will open the data source configuration wizard. Select the database and click on Next.
- Again click on the Next as shown in below figure.
- Now we need to attach this data source with the database which we created in the Step 2, so select the Contacts.mdf database and click Next.
- Now it will ask for the components you want to add in your data source.
- Click on the Tables to expand and the select Contact Form, this is the table which we created in step 3.
- Now click Finish.
- Now we have created our data source which contains the table. In the next step we are gonna add this database on our form so that we can use it easily.
Step 6 : Adding Database on the Form
- Now go to the Data Source, if you cant find it then open it from Data tab in the top menu.
- Now click on the Contact Form (which is our table) and drag it to the Form Board as shown in the below figure.
- Now re size it using the mouse according to your form.
- Next click on the Contact Form in the Data Source and select Details, it will give us detail view of our database.
- Now again click the Contact Form and drag it in the Form Board and it will show like detail view as you can see in the figure below.
- We have add the both views on our board. Now run it and your project will open up.
- Now you can add or delete or edit any column and then save it.
- So the final form of our project is something like that.
- You can see the above bar where are options to add, delete or move forward, backward etc.
- In the next tutorial we will add some functionality in it like adding new column with button and save etc.
- Hope you guys enjoyed it. If someone needs this database in Microsoft Visual studio along with the exe file of this project then Subscribe Us via Email and post your email in the comments and we will email it to you.
That's all for today, and I hope you guys are not familiar with How to create Database in microsoft visual studio 2010, will meet you in the next tutorial, till then take care
ALLAH HAFIZ. :))