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 !!! :)
DC Motor Direction Control with Arduino in Proteus
Hello friends, hope you all are fine and having fun with life. Today, I am going to share DC Motor Direction Control with Arduino. I have designed a complete simulation in Proteus, which will help you in understanding the controlling of DC motor. I would recommend you to first read How to Control relay in Proteus ISIS which will help you in understanding the functionality of relays because in today's tutorial, I have used relays to do the DC Motor Direction Control. I have already posted a tutorial on DC Motor Drive Circuit in Proteus ISIS.
So, for DC Motor Direction Control, I have used Arduino UNO baord, so you should also download this Arduino Library for Proteus so that you can use Arduino boards in Proteus software. I have also provide the simulation and the code for DC Motor Direction Control but I would recommend you to design it on your own so that you learn from it. If you have any problem then ask in comments and I will try to resolve them. In this project, I have used Serial Terminal. So, whenever someone, sends character "C" on serial terminal then the motor will move in Clockwise Direction and when someone sends character "A" then it will move in Anti-clockwise Direction and will stop on character "S". Anyways, lets get started with DC Motor Direction Control with Arduino in Proteus ISIS.
DC Motor Direction Control with Arduino in Proteus ISIS
- You can download the Proteus simulation for DC Motor Direction Control by clicking the below button:
Download Proteus Simulation for DC Motor
- So, now let's move on with designing it, first of all get the below components from Proteus and place them in your workspace:
- Now, design a circuit in Proteus software, as shown in below figure:
- You can see in the above figure that I have used two relays which I have used for DC Motor Direction Control.
- Moreover, there's a Virtual Terminal through which I am sending the commands.
- I have used Arduino UNO board for DC Motor Direction Control through Virtual Terminal. You should download the Arduino Library for Proteus so that you can use it in Proteus.
- Now upload the below code in your Arduino software and get the hex file. You should read how to get the Hex file from Arduino.
int Motor1 = 2;
int Motor2 = 3;
void setup() {
pinMode(Motor1, OUTPUT);
pinMode(Motor2, OUTPUT);
Serial.begin(9600);
}
void loop() {
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);
}
- In the above code, I have designed three functions which I am calling on Serial receive.
- The code is quite self explanatory but if you got problem then ask in comments and I will resolve them.
- Once everything's done then run your simulation and if you have done fine then it will start working as shown in below figure:
- Obviously, you can't see a moving DC motor in an image but you can get the idea from Relays position in above figure. :)
- The below video will give you the better idea of How it works.
So, that's all for today. Hopefully now you have got the idea of How to do DC Motor Direction Control with Arduino in Proteus ISIS. In the next tutorial, I am gonna add speed control of DC Motor. So, till then take care and have fun. :)
Genuino Library for Proteus
Hello friends, hope you all are fine and having fun with your lives. Today, I am going to share a new Genuino Library for Proteus. Genuino boards are just the same as Arduino boards but with slight difference of color and shape. I have already posted a tutorial on Arduino Library for Proteus in which I have explained how to download the Arduino Library and use it in Proteus. Today, I am going to post a similar library but for Genuino boards. Their functionality is exactly the same as the Arduino Library but they have better look and Genuino Color.
II hope you are gonna like this library as well. Other bloggers are welcome to share this library with their reader but do mention our link in creator section, we will be really obliged. Now, let's start with the Genuino Library for Proteus.
Genuino Library for Proteus
- First of all, download the Genuino Library for Proteus from the below button:
Genuino Library for Proteus
- In the above link, you will get an rar file which will have two files, named as:
- GenuinoTEP.LIB
- GenuinoTEP.IDX
- Now place these two files in the Library folder of your Proteus software.
Note:
- Now start your Proteus software and go to Component searching section and search for GenuinoTEP as shown in the below figure:
- Now place them in your Proteus work space and they will look like as shown in below figure:
- In the above figure, five of these genuino boards are visible. The sixth board is Arduino Mega1280, which is similar to Arduino Mega 2560 in shape so that's why I have omitted it in the above image.
- Now you can design any of your project on Genuino board quite easily in Proteus using this Genuino Library for Proteus.
- In order to upload the code in any of these boards you need to double click it to open its properties.
- For example I double click the Arduino UNO baord then the Properties panel will look like as shown in below figure:
- In the above figure, you can see a section named Program file, that's where you are gonna browse your hex file.
- You should read How to get Hex file from Arduino, if you don't know already.
- So, get the hex file and upload here and your Genuino board will get active.
- In the below video, I have explained in detail How to use this Genuino board in Proteus and have already tested the blink example.
That's all for today, I hope you will enjoy this Genuino Library for Proteus. Let me know your suggestions about this library. Have fun !!! :)
How to Install Android Studio ???
Hello Friends, welcome back to the second tutorial of ‘Android Application Development’ by ‘The Engineering Projects’. I hope you guys are fine and enjoying your lives. In the previous tutorial, we have seen How to Get started with android studio. Today, we are going to have a look at How to install Android studio on your computers. Its a beginner level tutorial and is quite essential for beginners. Because when you plan to start learning some new software then its correct installation and environment setup is the main key. When you are going to start with the installation of any platform, first of all, what you need to do is to set up the environment in proper way. So that's why, today we are going to cover the installations of all the software required to start with Android application development.
It is very important for you guys to follow each and every step carefully. But sometimes even by adopting the right methodology, you are not being able to set up the right environment for the development. This happens because of your product version or system configuration unexpected results. Before stepping up the installing phase, I would like to mention one important thing that Android Studio is a very strong development tool. So that's why, I would recommend you guys to use at least i3 with 4GB but preferable is 8GB RAM, otherwise your laptop or computer will struck again and again and takes a lot of time. Let’s start without wasting anymore time. As I recall, in the end of our previous tutorial, I mentioned all the software we required to start our first project. So let’s install Android studio and all of the related software one by one.
Installation of Java Development Kit (JDK)
In order to install Android studio, first what we need to install is Java Development Kit which is known as JDK. Java Development kit is essential to install before the installation of Android studio because our Android studio works on Java so that's why its essential to install JDK first. JDK contains libraries, compiler, Debugger, java virtual machine, user interface toolkit and all the other basic components required for Android Application and Applets Development. Let’s move to the Java Development Kit (JDK) installment, as I mentioned in my previous tutorial that all the software required for Android Application Development are free of cost, so you guys can simple download JDK from their official site, just by clicking on JDK and I will recommend you to install the latest version of it. After the installation of JDK, now we are ready to install Android Studio. So, let's get started with it.
How to install Android Studio ???
- Android Studio is the actual development software we are going to use for the Android application development. We will do designing and will write all the codes in Android Studio.
- Android Studio is also free of cost, so you guys should download it from the official site of Android.
- The site would have the display as shown in below figure, click on the green button on the left bottom to download Android Studio.
- Once you click the download button, Google will ask you to accept their ‘Term and Conditions’.
- After reading all the ‘Terms and Conditions’ go to the end of the page, you will see the check box.
- Click on the check box to accept all the Terms and Conditions of Google and then click on the button under the check box to download Android Studio.
- Now the downloading will be started.
Installation of Android Studio
- Once the downloading completes, double click on the downloaded file and execute it. Installation will start like the one given below:
- It will take a few seconds and then it will move to the next step, as shown below:
- Click on the ‘Next’ Button and then check the box for “Standard” and click ‘Next’.
- And finally click on the ‘Finish’ as shown in below figure:
- After clicking on ‘Finish’, it will take some time to complete the installment. You will also need to be connected with the internet.
- Once everything done, then you will get to the below screen and simply click finish to complete the installation.
- You will see the Welcome Screen after the installment would be completed. So now friends, you guys are ready to develop your first Android Application.
- Here's the welcome screen of Android studio:
Software Development Kit (SDK)
In the previous section, we have seen How to Install Android Studio. Now, we are gonna install the SDK. Basically SDK is a set of tools which allows you to make applications, games, Applets for certain software package, computer system, software framework, video game console, hardware platform, operating system, or similar development platform. So it is pretty much important to install required SDK before developing your first application. So, let's get started with installation of software development kit (SDK).
- First of all, click on the ‘Configure’ and it will take you to the window as shown in below figure:
- Click on the SDK Manager. It will take a few seconds to check all the online SDK available right now and then it will show you all the installed, not installed, update available and partially installed SDK as shown in below figure:
- Click on the pointed ‘Launch Standalone SDK Manager’ as shown in above figure.
- Now when you click, it will open the window, where you can select the SDK, you want to install, as shown in below figure:
- I will suggest you to install at least 3 of them which are very important and plays important role:
- Tools
- Android 4.4.2 (API 19)
- Extras
Unexpected Results or Errors:
Several users have to face some difficulties after completion of the Android Studio Installation on Windows 7 and windows 8. When they try to open Android Studio after installing it, they get errors.
- Fail to load JVM.DLL
- dll is missing
So here is the solution to these problems.
Fail to load JVM.DLL
When you open the Android studio, this error will pop up like the window given below:
- Go to the Control Panel and selectSystem.
- Click on “Advanced system settings” from the column on the left side and go to the “Advanced” tab.
- Click the “Environment Variables” button at the bottom. On the next screen, you will see two sections, User Variables and System Variables.
- Now add a system variable with the following values.
Variable name:JAVA_HOME
Variable Value: c:\program Files\Java\jdk1.7.0_21
May be you have different jdk version as compare to the one given in Variable Value. So before adding the value check your jdk version in this directory c:\program Files\Java\
MSVCR100.dll is missing
If this window comes up after adding the System Variable, then you need to install Visual Studio 32 or 64 bit.
This is it for now. I hope you now have got the idea about How to install Android studio in windows. In the next tutorial we’ll develop our first Android Application and discuss some of the basics of Android Studio. If you guys have any questions or suggestions, feel free to comment about them. So Stay tuned and have fun. See you guys later.
Getting Started with Android
Hello Friends, My name is Syed Daniyal Nasir. I hope you guys are fine and enjoying your lives with passion. Today, we are going to start the new series of tutorials related to Android Development and here's my first tutorial in thie series which is, Getting Started with Android. This is gonna be my first tutorial of Android Development for “The Engineering Projects”. As we all know, Android Development is enhancing vigorously day by day, Google Play Store is flooded with tons of new mobile applications each day. So a lot of people want to understand the basics of Android Development, so that they could develop their own applications. But some people find it very difficult due to certain reasons. That’s why we are going to make these tutorials as simple as possible, so that most of the people can find it useful. Now let’s get started with today's tutorial which is Getting started with Android.
In today's tutorial, we are not gonna cover anything technical. Instead, we are gonna stick to the basics of Android, like why we need Android and why we need to getting started with android. I will also share some useful theoretical knowledge in this post. So, my suggestion is to must read it once. Anyways, let's have a look on Android. :)
Note:
- This tutorial is written by my brother SyedDaniyal Nasir, as he mentioned above, I am just posting it here on my blog as he was not free to do it on his own.
- Welcome bro to my blog. :)
Getting Started with Android
Android Platform was developed by Open Handset Alliance which is then led by Google and they gave it a very attractive look and now a days, Android has been the most selling OS on Smart Phones and Tablets. Android is basically a touch screen mobile open source operating system based on Linux Kernel. In 2007, Google released the first beta version of the Android Software Development kit (SDK) and later in the next year, first commercial version by the name “Android 1.0” was finally released in September, 2008 by Google.
Android Programming
Android Programming style is based on Java Language. So for Android Development, you need to have a little bit knowledge of Java Language. Sun Microsystems released the first version of Java language in 1995. Most of the devices support Java language like, smart phones, Tablets, Raspberry Pi, laptops, desktop computer and many more. There is a little complication, to run Java code on any platform, needs to have a Virtual Machine implementation. But you don’t need to worry about it right now, we’ll cover this in our upcoming tutorials. So if you have some knowledge of Java Language then I am sure that you will find it very interesting.
Why Android?
If you are taking your first step towards the Mobile Application Development. You should definitely start with Android. Some of the key points are shown in the following figure.
Android Versions
Android versions were named in alphabetical order. This first android version was named as Aestro while the latest one is Marshmallow. So, we have Android versions from A to M, which are shown as follows:
- Aestro.
- Blender.
- Cupcake.
- Donut.
- Eclair.
- Froyo.
- Gingerbread.
- Honeycomb.
- Ice Cream.
- Sandwitch.
- Jelly Bean.
- KitKat.
- Lollipop.
- Marshmallow.
What is API?
API stands for Application Programming Interface and API is used to interact with different systems, libraries and applications. API level is a value which shows the API version. Here's a small table for different versions of Android with respect to their API versions.
Android Applications
As of July, 2015, more than 1.6 million applications have been published on Google play store and the number are increasing day by day. If we categorized the Android Applications, the top categories will be:
Operating System Requirement for Android Development
This is one of the beauties of Android that you have a lot choices for Operating Systems. Some of the commonly used operating systems are:
- Microsoft Windows XP or later version.
- Mac OS X 10.5.8 or later version with Intel chip.
- Linux including GNU C Library 2.7 or later.
Development Tools
Second beauty of Android is that all the development tools are free of cost. You just simple go to their website and download them as requirement. Some the important tools you will probably be needed for the Android Development are:
- Java JDK5 or later version
- Android SDK
- Java Runtime Environment (JRE) 6
- Android Studio
- Eclipse IDE for Java Developers (optional)
- Android Development Tools (ADT) Eclipse Plug-in (optional)
This is it for now. In the next tutorial we’ll discuss about the Development Tools qualities and their installation process. If you guys have any questions or suggestions, feel free to comment about them. So Stay tuned and have fun. See you later guys.
Bluetooth Library for Proteus
Hello friends, hope you all are fine. Today, I am going to share a new Bluetooth Library for Proteus. Using this Library, now you can quite easily use Bluetooth modules in Proteus ISIS. I have designed two Bluetooth modules which are HC-05 and HC-06. We all know about these modules. We use these modules for sending data through Bluetooth. Till now, there's no such Bluetooth Library designed for Proteus and we are the first developers of this awesome Bluetooth Library for Proteus. I hope you guys are gonna like it. I have also posted a tutorial in which I have done Arduino Bluetooth Communication using HC05 in hardware. I hope that one will also be interesting to read, if you have planned to start working on Bluetooth Module.
Other bloggers are welcome to share this Bluetooth Library for Proteus on their blogs but do mention our link as a respect to our efforts. These Bluetooth modules are not gonna accept AT Commands rite now as we haven't added much functionality in it but we are gonna add more soon. I will also add more Bluetooth modules in this library and will update it with time. Rite now, it just has two Bluetooth modules in it, which are:
You can do serial communication with these modules quite easily. So, let's get started with Bluetooth Library for Proteus an see How to install it and how to use it in Proteus.
Note:
Other Proteus Libraries are as follows:
Bluetooth Library for Proteus
- So, first of all, download this Bluetooth Library for Proteus by clicking the below button:
Bluetooth Library for Proteus
- In this rar file, you will find two files which are named as:
- BluetoothTEP.IDX
- BluetoothTEP.LIB
- So, download these two files and place them in the library folder of your Proteus ISIS software.
Note:
- Now open your Proteus software or restart it if its already open and search for Bluetooth and you will get something as shown in below figure:
- Now select both of these modules and place them in your workspace and it will look like something as shown in below figure:
- As, I told earlier, we have just used the basic TX and RX pins of these Bluetooth modules.
- That's why you can see in the above figure that only TXD and RXD are working while all others are not working.
- Let's have a look at it working, so let's design a simple circuit and do the communication between these two Bluetooth modules.
- If you haven't worked on Virtual Terminals then you should read How to use Virtual Terminal in Proteus.
- So, design a simple circuit as shown in below figure:
- Now click any HC-05 module and you will get a pop up window.
- In this window, select COM1 for first HC05 module and COM2 for second HC05 module.
- Now your COM1 and COM2 should be virtually connected, I have shown how to connect the COM ports virtually in the below video.
- Now, run your simulation and whatever you send in first terminal will show in second terminal and vice versa.
That's all for today, hope you have liked this post and are gonna enjoy it. Let me know about your remarks for this Bluetooth Library for Proteus. Have fun !!! :)
Arduino Bluetooth Communication using HC05
Hello friends, hope you all are fine and having fun with your lives. Today, I am going to share a new project in which we are gonna do Arduino Bluetooth communication. The Bluetooth module I have used for this project is HC-05, which is a serial Bluetooth module. We can quite easily perform the Bluetooth communication with this module using Arduino board. I have worked on many projects in which I have to send the data from sensors to my computer via Bluetooth. So, in such projects I normally use this Bluetooth module which is connected with the sensors and then Arduino gets the data from these sensors and then send this data to computer via Bluetooth module. In this project, I have used Arduino board but you can use PIC Microcontroller or 8051 Microcontroller as well. Because they both have the Serial pins on them.
Note:
Before reading any further, I think you must have a look at the below post from where you can download the Bluetooth Library for Proteus, using this library you can easily simulate HC-05 or , HC-06 in Proteus software:
I have also done Bluetooth communication with Android mobiles. In these projects I have sent the data from this Bluetooth module to Android mobiles but in such projects I have also designed Bluetooth app on which this data is received. Anyways, that's a topic of another tutorial. Today, I am gonna connect this Bluetooth module with Arduino board and then will send some data to my computer using Bluetooth. So, let's get started with Arduino Bluetooth communication using HC-05 module.
Arduino Bluetooth Communication using HC-05
- First of all, what you need to do is to buy the Arduino board. I have designed this project using Arduino UNO board but you can buy any of the Arduino Microcontroller board.
- Next thing you are gonna need is Bluetooth module which is HC-05. But this tutorial will also work for HC-06 or HC-07.
- Now if you have seen HC-05 then the pins are written on it so connect them with your Arduino board as shown below:
- This pin configuration is also shown in the below figure:
- Now that you have connected your Arduino board with the Bluetooth module HC-05 so you are ready to do the Arduino Bluetooth communication.
- Now upload the below code in your Arduino board:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3);
void setup()
{
Serial.begin(9600);
mySerial.begin(9600);
}
void loop()
{
if (mySerial.available())
Serial.write(mySerial.read());
if (Serial.available())
mySerial.write(Serial.read());
}
- Its a simple software serial code in which we are sending data from our Serial terminal to Bluetooth means whatever you write in your serial terminal will be sent over to Bluetooth and whatever you receive on your Bluetooth will be shown in serial terminal.
- Now, download this Serial monitor software, I have designed this software and its quite simple one. You can use any other serial monitor like Virtual Terminal in Proteus or Hyper Terminal in Windows XP.
- We are gonna use this software to get the data on our computer via Bluetooth and you computer must have the Bluetooth in your computer. :P
- So, download this software by clicking the below button and you can read more about it Microsoft Visual Basic 2010 - Com Port Tutorial.
Download Serial Terminal
- Now turn on your Arduino and search for the Bluetooth device in your Bluetooth settings and paired with it as shown in below figure.
- The default pin code for HC-05 is 1234.
- Now you can see I have paired the HC-05 device.
- Now, open this software and connect with the COM port of your Bluetooth device.
- The Bluetooth device generates two COM ports in my case it generated COM11 and COM12 but COM11 worked.
- So, I connected with COM11 and then whatever I entered in my software is shown on the serial monitor of my Arduino and whatever I entered in the Serial monitor of Arduino is shown in the serial terminal software.
- Its quite simple and you can do it quite easily.
So, that's all for today and I hope you are gonna make it work in the single attempt. If still having problems then ask in comments and I will resolve them. So, today we have done Arduino Bluetooth communication using HC-05 module.
Electronic Door Locks using PIC Microcontroller
Hello friends, hope you are having fun. Today, I am going to share two types of Electronic Door Locks design using PIC Microcontroller and simulated in Proteus ISIS software. We all know about Electronic Door Locks as we have seen them in many homes. In electronic door locks, there's some password that is only known to some persons. Now if you enter the wrong password then the door won't open up and will ask for the password again. And if you keep on trying the wrong password then it will start the buzzer or can alert the concerned person via SMS etc. So, such electronic door locks are quite common in our society and are considered among the best electronic door locks.
Today, I am going to share a similar project in which I have simulated an Electronic Door lock using PIC Microcontroller. I have used PIC18F452 Microcontroller and the compiler I have used for designing the code in MikroC Pro For PIC and the simulation is designed in Proteus ISIS. The code and the Proteus simulation are given for download below. You can also design this project using Arduino or any other microcontroller like 8051 Microcontroller. Let's start with this project.
Note:
Electronic Door Locks using PIC Microcontroller
I have divided this Electronic Door Locks Project into few parts, and I have explained them separately. You can download the complete project along with the Proteus simulation by clicking the below button. But as I always suggest don't just download it, also design it on your own so that you learn more from it:
Electronic Door Locks using PIC Microcontroller
Project Overview of Smart Door Lock
- In this smart door lock project, I have used a solenoid along with a relay.
- We all know that in order to lock a door we have to use either a DC Motor or some solenoid, which should be connected with the manual lock of the door.
- Now, all we need to do is to move that motor according to our needs automatically. Like if I move the motor in one direction, the door goes locked and if I move it in opposite direction then it got unlocked.
- So, in my simulation, I have used a solenoid valve for locking purposes and I have represented it using Inductors in my simulation.
- Moreover, I have used Serial Terminal as a communication medium, means we are gonna input for password etc in the serial monitor.
- I have also used EEPROM in this project to save the current password.
- There's an option in this project to change the password, so if the user changed the current password then the new password will be saved in EEPROM.
- So, even if the device restarts, the newly changed password will remain active as it's saved in EEPROM.
- If the user entered the wrong password then the system will for the password again.
- But if the user entered the wrong password three consecutive times, the system will shut down and will start blinking the RGD lights, which I have used as an indication.
Schematics Diagram of Smart Door Lock
- Let's first design the schematics diagram of the Electronic Smart Door Lock using a PIC Microcontroller.
- I have designed the schematic in Proteus ISIS software as it's the best simulating software.
- The schematic diagram is shown in the below figure:
- It's quite clear from the above figure that I have used a PIC Microcontroller as the brain of the system.
- I have a serial terminal, which is used to take inputs from the users.
- I have used two relays and in order to drive those relays, I have used transistors.
- Transistors are converting 5V coming from Microcontroller into 12V which are driving relays.
- Moreover, I have also used optocouplers, which are just used for protection.
- Finally, I have used three LEDs that are acting as RGB and will just indicate the wrong password.
- These two relays are actually actuating the solenoid which will lock or unlock the door.
- There's no active solenoid component available in Proteus that's why I have used a simple inductor.
- Now, let's have a look at the programming code for this project.
Programming Code of Electronic Door Lock
- I have designed the programming code for PIC Microcontroller in MkiroC Pro for PIC compiler.
- You should have a look at these Top 3 PIC C Compilers and can select the one you like.
- The PIC Microcontroller used in this Electronic door locks project is PIC18F4520. You can also use other PIC Microcontrollers like PIC16F877a etc.
- You can use any other PIC Microcontroller if you want. You just need to change it in simulation and in code settings.
- Now here's the complete programming code for Electronic Door Locks using PIC Microcontroller:
char Indata;
char P1 = '1';
char P2 = '2';
char P3 = '3';
int PassCheck = 0;
int WrongCheck = 0;
int CPassCheck = 0;
void Initialization()
{
UART1_Init(9600);
TRISD = 0;
PortD = 0;
P1 = EEPROM_Read(0x01);
P2 = EEPROM_Read(0x02);
P3 = EEPROM_Read(0x03);
}
void PassChange()
{
while(1)
{
if (UART1_Data_Ready())
{
Indata = UART1_Read();
if(CPassCheck == 2){
CPassCheck = 3;
EEPROM_Write(0x03, Indata);
P3 = EEPROM_Read(0x03);}
if(CPassCheck == 1){
CPassCheck = 2;
EEPROM_Write(0x02, Indata);
P2 = EEPROM_Read(0x02);}
if(CPassCheck == 0){
CPassCheck = 1;
EEPROM_Write(0x01, Indata);
P1 = EEPROM_Read(0x01);}
UART1_Write_Text("*");
if(CPassCheck == 3){break;}
}
}
UART1_Write(10);
UART1_Write(13);
UART1_Write(10);
UART1_Write(13);
}
void CorrectPass()
{
UART1_Write(10);
UART1_Write(13);
UART1_Write(10);
UART1_Write(13);
UART1_Write_Text("Select one of the below Options: ");
UART1_Write(10);
UART1_Write(13);
UART1_Write(10);
UART1_Write(13);
UART1_Write_Text("1) Press Y to Lock.");
UART1_Write(10);
UART1_Write(13);
UART1_Write_Text("2) Press N to Unlock.");
UART1_Write(10);
UART1_Write(13);
UART1_Write_Text("3) Press C to Change Password.");
UART1_Write(10);
UART1_Write(13);
UART1_Write(10);
UART1_Write(13);
UART1_Write_Text("Waiting for Response: ");
while(1)
{
if (UART1_Data_Ready())
{
Indata = UART1_Read();
if((Indata == 'Y') || (Indata == 'y')){
UART1_Write_Text("Y");
PortD.F0 = 1;
PortD.F1 = 0;
UART1_Write(10);
UART1_Write(13);
UART1_Write(10);
UART1_Write(13); break;}
if((Indata == 'N') || (Indata == 'n')){
UART1_Write_Text("N");
PortD.F0 = 0;
PortD.F1 = 1;
UART1_Write(10);
UART1_Write(13);
UART1_Write(10);
UART1_Write(13); break;}
if((Indata == 'C') || (Indata == 'c')){
UART1_Write_Text("C");
UART1_Write(10);
UART1_Write(13);
UART1_Write(10);
UART1_Write(13);
UART1_Write_Text("Enter New Password: ");
PassChange();break;}
}
}
}
void WrongPass()
{
int x = 0;
PortD.F5 = 1;
while(1)
{
PortD.F2 = 1;
Delay_ms(100);
PortD.F2 = 0;
PortD.F3 = 1;
Delay_ms(100);
PortD.F3 = 0;
PortD.F4 = 1;
Delay_ms(100);
PortD.F4 = 0;
x = x + 1;
if(x > 30){break;}
}
PortD.F5 = 0;
}
void main() {
Initialization();
do
{
UART1_Write_Text("Enter Password: ");
while(1)
{
if (UART1_Data_Ready())
{
Indata = UART1_Read();
if((Indata == P1) && (PassCheck == 0)){PassCheck = 1;}
if((Indata == P2) && (PassCheck == 1)){PassCheck = 2;}
if((Indata == P3) && (PassCheck == 2)){PassCheck = 3;}
if((Indata == 13) && (PassCheck == 3)){
PassCheck = 0;
WrongCheck = 0;
UART1_Write(10);
UART1_Write(13);
UART1_Write_Text("Correct Password.");
CorrectPass();break;}
if((Indata == 13) && (PassCheck != 3)){
PassCheck = 0;
UART1_Write(10);
UART1_Write(13);
UART1_Write_Text("Wrong Password.");
WrongCheck = WrongCheck + 1;
if(WrongCheck == 3){WrongPass();}
UART1_Write(10); UART1_Write(13);
UART1_Write(10); UART1_Write(13);break;}
UART1_Write_Text("*");
}
}
} while(1);
}
- I have placed checks on the Enter button like when the user presses Enter button then it will check either password is correct or wrong and then will decide and on or off the respective relays.
- Moreover, the third option is to change the password and you can see right after the change password, I have used EEPROM commands to save the password for later use.
- Let's now start the simulation and test our project.
Note: If you are not much familiar with relays, then you should read these tutorials on relays:
Electronic Door Lock Simulation Result
- We have seen all the details about the project and I am quite confident that now you can quite easily design this project on your own.
- So, now let's start the simulation and have a look at the results.
- When you start your simulation then you will have such a screen:
- Now you can see, it's asking for a password in the Virtual Terminal.
- The default password set is "123". So, I am gonna give it 123.
- Now, when I gave it the correct password, it asked for the correct option.
- I have added a total of 3 options to it, which are shown in the above figure.
- So, if the user presses Y then it will lock the door and if he presses N then it will unlock the door and last option is to change the password which is set for C.
- So, that's how this project is working.
- Similarly, if I gave it the wrong password the nit will ask for try again for 3 times and then will set off the RGB lights to warn.
- Complete demonstration and working of this project is given in the below video:
That's all for the electronic smart door lock project using PIC Microcontroller. I hope you have enjoyed it. Will meet you guys in the next tutorial soon. Till then take care and have fun. :)