Electronics Projects
Hello friends, hope you all are fine and having fun with your lives. Today, I am going to share a complete list of Electronics Projects which I have posted on our blog. I hope you are gonna enjoy these electronics projects. Most of these electronics projects are designed using Proteus simulation software. I have also uploaded these simulations in the respective project tutorial. So, you can download those projects and can learn from them a lot. If you ask me then I suggest that instead of downloading these electronics projects simulations, you should design them on you own so that you learn from them. I know you are gonna do mistakes but you won't learn unless you do mistakes. :)
All these projects are completely designed by our team so other bloggers are welcome to share them on their blogs to share the knowledge but do mention our blog link as a favor. Moreover, if you guys got into any trouble in any of these tutorials then ask in comments and I will try my best to resolve them as fast as I could. I will keep on updating this list. Whenever I post some new electronics project on my blog, I will share the link here. So, its like we are having all electronics projects in one place. I hope you are gonna like it. I have divided these electronics projects in sections depecding upon the microcontroller used for designing them. I have used Arduino , PIC Microcontroller and 8051 Microcontroller usually for designing electronics projects so I have divided it in the same category. Let's get started with it:
Electronics Projects
I have divided these projects in separate sections as posting them all at once will make them a mess. So, I have divided them according to their types and I think it will be easy to read them out that way. So, first of there's Arduino based Electronics Proejcts and after that I have posted electronics projects on PIC Microcontroller and finally on 8051 Microcontroller. I have also added few projects on 555 Timer at the end. So, let's start with it:
Arduino based Electronics Projects
All these below electronics projects are designed using Arduino board. If you are interested in Arduino then you should check Arduino Projects where I have posted all about Arduino and have posted many tutorials on it. Here I am posting only those Arduino links where's electronics is involved. On the Arduino main page you will also find Arduino Library for Proteus which is designed by our team and will be really helpful to you if you wanna design the simulation of Arduino based projects in Proteus.
PIC based Electronics Projects
Here's a list of PIC Microcontroller based electronics projects. These are not much but I am gonna add more soon. Most of these PIC Microcontroller projects are designed in Proteus software. Their simulations and programming code are also given in these projects which you can download and use. But as I always say don't just copy paste them. Instead design them on your own so that you learn from them.
8051 based Electronics Projects
Here's a list of 8051 Microcontroller based Electronics Projects. These are all design in Proteus software and their simulations are also given in the respective project to download. I am gonna add more soon in this section as I am working on many projects which involves 8051 Microcontroller. I will update the list soon.
555 Timer based Electronics Projects
These are 555 Timer based Electronics Projects. These are also designed in Proteus software. You can download the simulations as well in these links. Its kind of a bonus here :) but you 555 Timer is used quite a lot in simple projects because microcontroller become costly for simple projects and also there's no need of programming 555 Timer.
So, that's all for today. I hope you are gonna enjoy these Electronics Projects. Actually I am compiling things on my blog and giving them a proper arrangement. :) If you have any suggestion please post in the comments. So, take care and have fun !!! :)
Top 3 PIC C Compiler
Hello friends, hope you all are fine and having fun in your lives. Today, I am going to share Top 3 PIC C Compiler. We all know about PIC Microcontrollers because of which now we can quite easily add complex automation in our projects. So, today, I am going to share C compilers for PIC Microcontrollers. When an engineer starts working on some engineering project then he must have to choose a microcontroller. PIC is most commonly used Microcontroller in engineering projects. So, now when you have selected that you are gonna use PIC Microcontroller in your project then there comes a need which compiler to use for designing programming code for PIC Microcontroller.
It's quite a difficult as well as important decision because I have seen that once you started working on some compiler then its quite difficult to switch from that compiler to any other compiler. The reason is, you have to first learn that compiler and then you start designing your codes on it and after learning one compiler you don't want to learn any other compiler. So, today I am going to share a List of PIC C compiler which are quite useful and I consider them the best compilers for PIC Microcontroller. Before going into details, lets first have a look at what is compiler.
What is Compiler ???
- In the start when microcontrollers were newly introduced, they were programmed in Machine language which is in the form of 0 and 1. We can also call it binary language. So, programming a microcontroller in machine language was quite difficult so designers did some research and they cme up with the idea of assembler.
- In assembler we write programming codes for Microcontrollers in assembly language then function of assembler is to convert that assembly language code into machine language and create the hex file and then we upload that hex file in our Microcontroller. But, if you have worked on assembly language then you must have the idea that assembly language is also not much easy and you have to write a lot of code just to perform a simple task and then researchers did some more work and finally they invented compilers. (Thanks a lot to them :D )
- Now in those compilers, we write our code in C Language and then these compilers convert those C Language codes into machine language and we get our hex file which is then uploaded in any microcontroller like PIC, Atmel, 8051 Microcontroller etc.
- Using compilers, the programming has become quite easy, we have ready to use libraries in these compilers using which we can do complex to complex tasks in just 2 to 3 lines.
- Now in different compilers the back end generated machine code is almost same but the front end C coding syntax is quite different. For example if you are working on LCD then it has different commands for printing in different compilers. So, that's why I mentioned earlier that if you are working in one compiler then switching to another compiler is quite difficult as in that case you first have to learn the syntax of that second compiler.
- There are lots of C Compilers available in market using which we can quite easily write our programming code. For different microcontrollers there are different compilers and today, I am going to share compilers for PIC Microcontroller. So let's get started with it.
Here's the list of
PIC C Compiler,which we are gonna discuss in detail below:
- MPLAB C18 Compiler
- MikroC Pro for PIC
- CCS Compiler
Top 3 PIC C Compiler
As the topic indicates, today I am going to share top 3 PIC C Compiler. These compilers are best compilers for PIC Microcontroller. I have worked on all 3 of them and that's why I have quite an idea that all of them are best compilers. They have their pros and cons but still you can work on any of them. You can say this list is a result of my 5 years hard work. :) So, let's get started with them:
1) MPLAB C18 Compiler
- MPLAB C18 compiler comes at top in the list of top 3 PIC C Compiler as its the best one in the series. MPLAB is an official software developed by Microchip for PIC Microcontroller.
- It is free to use and you can download it from official site of Microchip.
- First of all, you need to install the MPLAB software so you should read How to install MPLAB software in Windows.
- Once you installed the MPLAB software, then you should install the MPLAB C18 Compiler so you should read How to Install MPLAB C18 Compiler in Windows.
- In MPLAB you can work on assembly language as well but using the C18 compiler you can write your code in C Language.
- MPLAB is the most flexible compiler for PIC Microcontroller as you can do anything in it with you PIC Microcontroller. But its a bit difficult to learn and program as in MPLAB you have to set every bit on your own.
- When I started my programming career, then I first started working on this compiler as I like it the most.
- So, if you want complete grip on your project then this is the compiler for you.
- If you are interested in working on this compiler then you should also read Getting started with MPLAB software.
2) MikroC Pro for PIC
- MikroC Pro for PIC comes at second place in my list of top 3 PIC C Compiler.
- Its not free but has a student version using which you can compile your up to some limit. If the size of you code exceeds that limit then you can't compile your code using it.
- Its also one of my favorite compiler because of its easiness and user friendly environment.
- MikroC has a long list of built in libraries using which you can quite easily perform your tasks.
- Its not much flexible but is very user friendly, it gives you all the setting in hand and you can set them just by clicking some combo boxes.
- These days, I am working on this compiler because its easy to use and you have a great team at its back which gives you great support. So, if you ask me then I will recommend this PIC C Compiler.
Note:
Here are few projects designed in MikroC Pro for PIC Compiler:
3) CCS Compiler
- CCS Compiler comes at third place in PIC C Compiler list.
- I have used it in some projects where there was a restriction to use this compiler.
- Its a bit difficult to learn and program because of its pure C style syntax but also has a great list of libraries with it.
- If you have already worked on C Compiler for windows then I think this one is best for you as the syntax is almost similar and you can learn it easily.
That's all for top 3 PIC C Compiler. I hope you have learn something out of it. Let me know if you have any comments and I will reply you.
Top 10 PCB Design Software
Hello friends, hope you all are fine and having fun with your lives. Today, I am going to share an informational tutorial about top 10 PCB design Software. These PCB design software are used for designing PCBs. In all engineering projects especially related to electronics, PCB designing is an important task and in order to design the PCB we have to use some software. There are many software available in market and today, I am gonna give a complete list of PCB Design software.
Few of these software and free to use and few have limited versions available but in order to get their advanced features you have to buy them. I have also mentioned their features below. If you have read my blog in detail then must have the idea that I use Proteus software for designing my PCB boards. So, if you ask me then I will recommend Proteus software as you can simulate your circuit design in it as well along with PCB designing. I have also used Eagle software for PCB designing and its also quite easy and rich with features. Anyways let's get started with top 10 PCB Design Software
PCB Design Software - Basics
There are few things, which you must remember before starting your PCB design. When you start your project, never jump directly to PCB designing. Instead, you must first design your circuit on wero board or bread board and then test it out. Once you confirmed that all features of your project are working perfectly, then you should move to designing part. If you started the PCB design at first then there's a chance that you miss something in your hardware and then your PCB boards will simply go to waste. So, first design your hardware temporarily adn then test its working and then design your PCB board. You can also simulate your circuit design on some software before designing its PCB. Anyways its up to you. When I design any project then I first design hardware on wero board and then once its perfect then I design its PCB board. Anyways, now let's have a look at top 10 PCB Designing software.
1 Altium
Altium is at first rank in my list of PCB Design software. You can get this software from their official site. Altium is used for designing PCB boards, you can design PCB of any layer in this software. Its very powerful and has a long list of tools for editing or designing your PCB board. Its a paid software and you can buy ti easily from their official site, whose link I have posted above. You can also create the component list, BOM file etc in this software. You can also design flexible PCB designs in it and can also check their 3D simulator to know about the final shape of your PCB baord.
2 Eagle
Eagle is another great PCB design software which comes after Altium software. Its also quite powerful and has great list of tools for designing your PCB board. Eagle is the most commonly used PCB Design software as its easy and quite flexible in its features. Eagle has quite a lot of support available online in forums as its quite an old software. It also provides the component list and the BOM file etc.
3 Proteus
This one is my favorite PCB Design software and if you have read my blog then you must have the idea how much i like this software. In Proteus you not only design your PCB boards but also can simulate your complete circuit design. When I design a PCB board then I first design its simulation in Proteus and then I move on to designing its PCB board. It also has quite flexible tools using which you can design your PCB board and then can also check its 3D design.
So, if you ask me then I will recommend you Proteus software for PCB designing. If you wanna start working in this software then you must read How to do PCB designing in Proteus ARES. I have also shared a the PCB design of Arduino UNO baord which you can also download from this link.
4 Fritzing
Fritzing is another tool used for designing PCB boards. I like its interface. It has quite attractive and user friendly interface and you can design your PCB layout in it quite easily. But drawback of fritzing is that its not professional software, it has quite small list of components available in it so I never thought of using this software for PCB Designing. But if you have simple designing then give ti a try, you are gonna like it.
5 TinyCAD
TinyCAD is also used for PCB Designing. and is quite famous. It also has a long list of tools for designing your PCB boards. Its quite similar to Eagle software and is easy to learn and operate.
6 ZenitPCB
When discussing PCB Design software, then how can we forget ZenitPCB. It also a great PCB Design software which is used for PCB designing in quite efficient way. Its easy to use and has a user friendly interface.
7 ExpressPCB
ExpressPCB is also a cool tool for design your PCB boards. Its good for new users as its easy to use and learn. You can learn this software just by watching its single video. Its too easy to get started with and have a cool and user friendly interface.
8 KiCAD
KiCAD is an open source software which you can easily download online and is also free to use. Using this software you can design PCB boards up to 16 layer quite easily. It is rich with PCB designing features and can handle complex designs quite easily.
9 DesignSpark PCB
DesignSpark PCB software is also another great tool in the list of free PCB Design software. Its also a flexible software with a lot of tools and options for PCB designing. You are gonna like this one if you need quick and easy PCB designing.
10 EasyEDA
EasyEDA is also used for design PCB boards. It also has a user friendly interface and is good for first time user as it has everything in front and one can design PCB boards quite easily in it. You can also design multi layer PCB boards in it. It has small database of components that's why you have to design your components on your own while using this PCB design software.
That's a long list of PCB Design software. These all software are quite easy to use and anyone can work on them just after a little training. So, you can select any of them for designing your PCB boards. If you ask me then I will recommend Proteus and Eagle software as I use the for designing my PCB boards.
Convolution Calculator in MATLAB
Hello friends, hope you all are fine and having fun with your lives. In today's post, I am gonna design a Convolution Calculator in MATLAB. We all know about convolution but if you don't know then here's the wiki page for convolution which has a detailed description of Convolution. In simple words, convolution is a mathematical operation, which applies on two values say f and g and gives a third value as an output say v. In convolution, we do point to point multiplication of input functions and gets our output function.
Convolution is an important technique and is used in many simulating projects. It has a vital importance in image processing. So, today we are gonna do convolution in MATLAB and will check the output. You should also check Image Zooming with Bilinear Interpolation in MATLAB in which we have used correlation technique which is quite similar to convolution. It will give you a better idea of convolution, I recommend you to read their difference. Anyways, coming back to our today's Convolution Calculator, let's start its designing:
Convolution Calculator in MATLAB
- MATLAB has a built in command for convolution using which we can easily find the convolution of two functions.
- Syntax of this builtin convolution command is v=conv(x,h) where x and h are the input functions while v is our output.
- In my code I have used this builtin function as well as I have also design a small algorithm for calculating the convolution using its formula.
- After finding both the convolutions, I have simply compared them by plotting them on graph so that we can also verify that our result is correct.
- You can use this convolution calculator to find convolution of any two functions.
- So, first of all, copy this code and paste it in your m file and run it in your MATLAB:
clc
close all
clear all
x=input('enter the sequence, x(n)=')
h=input('enter the sequence, h(n)=')
m=length(x);
n=length(h);
subplot(4,1,1)
stem(1:m,x,'fill','r')
grid on;
title('input sequence, x(n)=')
xlabel('time n------>')
ylabel('amplitude----->')
subplot(4,1,2)
stem(1:n,h,'fill','r')
grid on;
title('impulse sequence, h(n)=')
xlabel('time n------>')
ylabel('amplitude----->')
%------linear convolution using inbuilt command------------------------%
v=conv(x,h)
l=m+n-1;
subplot(4,1,3)
stem(1:l,v,'fill','r')
grid on;
title('output sequence using inbuilt command, v(n)=')
xlabel('time n------>')
ylabel('amplitude----->')
%--------linear convolution using 'for' loop------------------------------%
X=zeros(1,l);
H=zeros(1,l);
X(1:m)=x;
H(1:n)=h;
for i=1:l
Y(i)=0;
for j=1:i
Y(i)=Y(i)+X(j)*H(i-j+1);
end
end
Y
subplot(4,1,4)
stem(1:l,Y,'fill','r')
grid on;
title('output sequence using loop, Y(n)=')
xlabel('time n------>')
ylabel('amplitude----->')
- The above code for convolution calculator is quite self explanatory but let me explain it a little.
- First of all, I am asking for inputs from user and they are saved in variables named as x and h.
- After that I am plotting them using stem function.
- In the next section, I have used the default MATLAB command for Convolution and calculated the convolution of x and h and saved it in v.
- Next I applied my simple algorithm and calculated convolution of x and h and saved it in Y and also plotted it.
- Once you run the simulation and give your input functions, you will get the below results:
- You can see in the above figure that I have given two inputs x and h and MATLAB Convolution Calculator calculated the convolution and gave us v and Y.
- v is calculated by default MATLAB command while the Y is calculated by our small convolution algorithm.
- Their graph representation is shown in the below figure:
- You can see in the above figure that we have plotted all the four signals, two inputs and two outputs and you can see both the outputs are same.
- Here's the video for this convolution calculator in MATLAB:
That's how you can design a convolution calculator in MATLAB. Let me know about your experience with this convolution calculator. I am planning to design a GUI for this calculator and will add it in this post.
MATLAB Projects
Hello friends, hope you all are fine and having fun with your lives. Today, I am going to combine all of my MATLAB Projects in this post. I have posted quite a lot of projects on MATLAB but they are not well arranged that's why are not easily accessible. So, today I finally thought to combine all my MATLAB Projects and post their links in this post so that you guys can easily access all of them in one place just like Arduino , PIC Microcontroller Projects. All these MATLAB Projects and tutorials are designed and written by our team and we have done quite a lot of work in compiling these projects as you all know MATLAB is the most difficult and vast educational tool.
Most of these MATLAB Projects are free to use and users can easily download their codes from the respective project but few of them are not free but we have placed quite small amount on them so that engineering students can buy them easily. If you got problem in any of these tutorials, then ask in comments of that respective project and I will try my best to resolve your problems as soon as possible. Moreover, I am also gonna add more MATLAB Projects in future so I will keep on adding their links in this post so that we have complete record in one place. :) As I always say, other bloggers are welcome to copy these codes but do mention our blog link in your posts and help us grow. :) So, let's get started with MATLAB Projects:
Basics of MATLAB
These are basic tutorials on MATLAB and are essential for beginner to must read them once and then move on to next tutorials. In these tutorials, I have just shown some tricks of using MATLAB, so must read them once.
MATLAB Projects - Coding
These are coding based MATLAB Projects. In these projects, I have designed algorithms in m file of MATLAB software. If you have problem in any of these projects then ask in comments and I will resolve them.
Embedded MATLAB Projects
Simulink Projects
Below are given MATLAB Projects designed in Simulink. Simulink is an awesome simulation tool available in MATLAB and is used for designing complex projects. Till now, I haven't posted much simulations but I have plans to post more simulations in near future:
Inverters Simulation
Image Processing
Image Processing is one of the best tool of MATLAB software. We can perform any kind of image processing in MATLAB. Below are given image processing projects in MATLAB software.
Speech Recognition in MATLAB using Correlation
Hello friends, hope you all are fine and having fun with your lives. Today, I am going to share a tutorial on Speech Recognition in MATLAB using Correlation. Speech recognition is used in almost every security project where you need to speak and tell your password to a computer and is also used for automation. For example, I want to turn my AC on or off using voice commands then I have to use Speech Recognition. I have to make the system recognize that whether I am saying ON or OFF. In short, speech recognition plays a vital role in voice control projects. In today's post, I am gonna show you How to do Speech Recognition in Matlab and the technique I have used in this project is known as cross correlation. You should also have a look at Eye Ball Detection in MATLAB.
Correlation is normally used in signal processing, where you need to compare two signals and need to find the similarity between them. It is also known as the dot product of those two signals. Correlation has many uses and you can read more about it on its Wiki Page. Correlation is also used for pattern recognition like you want to find some pattern in the signal then you can use Correlation. Anyways, in our project, we are using correlation to find similarities between our stored signals and the testing signal. So, let's get started with Speech Recognition in MATLAB using Correlation.
Speech Recognition in MATLAB using Correlation
- First of all, download this complete project by clicking the below button:
- Now in this package, you will find nine audio wav files.
- Five of them are the recorded sounds that are already feed in MATLAB.
- Two are test files that will be recognized by the code.
- The remaining two are success and failure files which will run if you got the recognition or not.
- Let me explain the code a bit. First of all, what we need to do is to upload the first five training audio files in the software so and then we need to test these fives files with the test files and we need to check which one is a maximum match.
- Here's the complete code:
function speechrecognition(filename)
voice=wavread(filename);
x=voice;
x=x';
x=x(1,:);
x=x';
y1=wavread('one.wav');
y1=y1';
y1=y1(1,:);
y1=y1';
z1=xcorr(x,y1);
m1=max(z1);
l1=length(z1);
t1=-((l1-1)/2):1:((l1-1)/2);
t1=t1';
%subplot(3,2,1);
plot(t1,z1);
y2=wavread('two.wav');
y2=y2';
y2=y2(1,:);
y2=y2';
z2=xcorr(x,y2);
m2=max(z2);
l2=length(z2);
t2=-((l2-1)/2):1:((l2-1)/2);
t2=t2';
%subplot(3,2,2);
figure
plot(t2,z2);
y3=wavread('three.wav');
y3=y3';
y3=y3(1,:);
y3=y3';
z3=xcorr(x,y3);
m3=max(z3);
l3=length(z3);
t3=-((l3-1)/2):1:((l3-1)/2);
t3=t3';
%subplot(3,2,3);
figure
plot(t3,z3);
y4=wavread('four.wav');
y4=y4';
y4=y4(1,:);
y4=y4';
z4=xcorr(x,y4);
m4=max(z4);
l4=length(z4);
t4=-((l4-1)/2):1:((l4-1)/2);
t4=t4';
%subplot(3,2,4);
figure
plot(t4,z4);
y5=wavread('five.wav');
y5=y5';
y5=y5(1,:);
y5=y5';
z5=xcorr(x,y5);
m5=max(z5);
l5=length(z5);
t5=-((l5-1)/2):1:((l5-1)/2);
t5=t5';
%subplot(3,2,5);
figure
plot(t5,z5);
m6=300;
a=[m1 m2 m3 m4 m5 m6];
m=max(a);
h=wavread('allow.wav');
if m<=m1
soundsc(wavread('one.wav'),50000)
soundsc(h,50000)
elseif m<=m2
soundsc(wavread('two.wav'),50000)
soundsc(h,50000)
elseif m<=m3
soundsc(wavread('three.wav'),50000)
soundsc(h,50000)
elseif m<=m4
soundsc(wavread('four.wav'),50000)
soundsc(h,50000)
elseif m<m5
soundsc(wavread('five.wav'),50000)
soundsc(h,50000)
else
{soundsc(wavread('denied.wav'),50000)}
end
- Now if you read the code from start then you can see, first of all, I uploaded the test file which I want to compare with my samples.
- After that, I uploaded all 5 samples and also get their correlation with the test sample.
- Finally, in the end, I compared the results and on the basis of it I figured out which one is the correct speech file.
- You will also get spectrum graphs of your sound files as shown in the below figure:
- It was quite an easy project and I have done it within half an hour and I hope you guys will understand.
- If you got any problems then ask in the comments and I will resolve them.
- Here's the complete video demonstration for this project and I hope it's going to help you out in understanding it.
That's all for today, and I think you have understood How to do Speech Recognition in MATLAB using Correlation. Will meet you guys in the next tutorial soon. Till then take care !!! :)
Image Zooming with Bilinear Interpolation in MATLAB
Hello friends, hope you all are fine and having fun with your lives. Today, I am going to share a simple tutorial on Image zooming with bilinear Interpolation in MATLAB. We have seen many software in which there's an option of zooming an image. For example, if you have used paint or photoshop then you have seen that you can zoom your image quite easily by clicking a button. Today's we are gonna do the same thing but in MATLAB and we will have a look at the code behind this feature.
Now, when we are zooming some image then in fact we are increasing the pixels of that image and in order to do that we have to fill those extra pixels with the color of their neighbor pixel. This thing is know as interpolation. There are many different techniques for interpolation and the one we are gonna use for this tutorial is known as Bilinear Interpolation. Bilinear interpolation is simple type of linear interpolation in which we simply apply interpolation formula on both the x and y axis. So, let's have a brief overview of Bilinear Interpolation first and then we will move on to MATLAB implementation.
What is Bilinear Interpolation ?
- As I explained earlier, Bilinear Interpolation is a simple interpolation technique in which we fill the gaps between pixels using the neighbor pixels.
- For example, we have an unknown pixel in between four pixels, and let's say the unknown pixel is f(x,y) and it is surrounded by four pixels which are:
- Q11 = (x1, y1).
- Q12 = (x1, y2).
- Q21 = (x2, y1).
- Q22 = (x2, y2).
- All these four neighbor pixels are known , now by using Bilinear Interpolation we can find the values of this unknown pixel.
- Now, first of all, we will move in the x direction only.
- The formula used for Bilinear Interpolation for x factor is:
- Now after calculating these x formulas, now we will move in y direction and the formulas are:
- Now using these formulas we can quite easily find our unknown pixel f(x,y) using Bilinear interpolation. These formulas are taken from Wiki Page of Bilinear Interpolation and you can read more details about it there.
- Now we have seen the Bilinear Interpolation so now let's move and see How to do Image Zooming using this Bilinear interpolation in MATLAB.
Image Zooming with Bilinear Interpolation in MATLAB
- You can download the complete code by clicking the below button but also read the post, as I have explained this code in this remaining post.
Download MATLAB Code for Image Zooming
- In order to do image zooming with Bilinear Interpolation in MATLAB, first of all, what you need to do is to read an image file, which I have done using this simple formula:
im0=imread('TEP.jpg');
im=cast(im0,'int16');
imshow(cast(im,'uint8'));
[h,v,d]=size(im);
- So, in this above code, what we did is , we simply read the image file which I have named as TEP.jpg
- After that I have converted this image file into int16 and then to uint8 and finally I get the size of this image file using size command.
- After that I have applied a simple algorithm and have zoomed my image using below code:
for i=1:h
for j=1:v
im1(1+(i-1)*fac,1+(j-1)*fac,:)=im(i,j,:);
end
imshow(cast(im1,'uint8'));
end
- Now in the above loop what we have done is we simply enhanced our image and named it as im1, I have used a variable fac, which is factor, its user defined like if you want to zoom image by 2 then factor will be 2.
- Now we have enhanced our image, next thing we need to do is to apply the bilinear Interpolation on this complete image and we will get the result.
- Here's the complete code for Image Zooming with Bilinear Interpolation in MATLAB.
function bilinear_zoom(fac)
im0=imread('TEP.jpg');
im=cast(im0,'int16');
imshow(cast(im,'uint8'));
[h,v,d]=size(im);
for i=1:h
for j=1:v
im1(1+(i-1)*fac,1+(j-1)*fac,:)=im(i,j,:);
end
imshow(cast(im1,'uint8'));
end
%bilinear interpolation
for i=1:1+(h-2)*fac %row number
for j=1:1+(v-2)*fac %column number
if ((rem(i-1,fac)==0) && (rem(j-1,fac)==0))
else
h00=im1( ceil(i/fac)*fac-fac+1,ceil(j/fac)*fac-fac+1,:);
h10=im1( ceil(i/fac)*fac-fac+1+fac,ceil(j/fac)*fac-fac+1,:);
h01=im1( ceil(i/fac)*fac-fac+1,ceil(j/fac)*fac-fac+1+fac,:);
h11=im1( ceil(i/fac)*fac-fac+1+fac,ceil(j/fac)*fac-fac+1+fac,:);
x=rem(i-1,fac); %coordinates of calculating pixel.
y=rem(j-1,fac);
dx=x/fac; %localizeing the pixel being calculated to the nearest four know pixels.
dy=y/fac;
b1=h00; %constants of bilinear interpolation.
b2=h10-h00;
b3=h01-h00;
b4=h00-h10-h01+h11;
im1(i,j,:)=b1+b2*dx+b3*dy+b4*dx*dy; %equation of bilinear interpolation.
end
end
imshow(cast(im1,'uint8'));
end
imshow(cast(im1,'uint8'));
imwrite(cast(im1,'uint8'),'zoomed_pic.jpg');
- Now if you check in the Bilinear Interpolation code, we have applied the same equations which we have discussed in the above section.
- The Image I have used for this code is as follows:
- Now in MATLAB window, I have given this command bilinear_zoom(2) , where fac = 2, so I am increasing my image by factor 2. So it will be zoomed by 2 times.
- Its the image from my 555 Timer post but as I have posted it recently so this image was on my desktop thats why I used it. :P
- The result obtained is as follows:
- Now you can see the image has been zoomed and is now looking big and because of Bilinear Interpolation in MATLAB we haven't lost the in between pixels.
- Here's a video for this tutorial, which will give you better idea of How to do Image Zooming with Bilinear Interpolation in MATLAB.
That's all for today, I hope you have enjoyed this post. Will meet you guys in the next tutorials soon. Till then take care. :)
Automatically Connect with Wifi SSID using Arduino YUN
Hello Friends, hope you all are fine and having fun. In today tutorial i am going to elaborate How to Automatically Connect with Wifi SSID using Arduino YUN. If you recall one of my previous tutorials named Getting started with Arduino YUN , in which i gave a brief introduction about Arduino YUN, its working and features. In that tutorial, I have explained How to connect Arduino YUN with Wifi manually. A little problem encounters while connecting Arduino manually to available wifi networks that if wifi connection drops then, then Arduino will also disconnect automatically and if wifi connection is energized again, it will still remain disconnected unless you reconnect it by yourself. This thing has very serious drawbacks in industrial projects, where data is continuously uploaded through multiple servers and if at any stage connection drops and Arduino stops working then, this thing leads to drastic outcomes.
So there is serious need to design an algorithm in which Arduino automatically connects to the available wifi connections and should enables the server to upload data through it. This whole process is a bit lengthy and much complicated. So, i will elaborate all this in the coming tutorials. In today's tutorial i am going to restrict myself only How to get Available wifi SSID using Arduino YUN. First of all lets recall the basics of Arduino YUN. Arduino YUN has 2 micro processors embedded on the same board. First is the Arduino microprocessor and the second is Atheros micro processor. Atheros supports Linux server (commonly used in Apple computers). With both these on-board micro processors, we can do anything we want to do. The beauty of Arduino board is that it has built in wifi, Ethernet port, USB host and SD card slot. We can also upload data into Arduino through wifi without physically connecting it with computer. That's why Arduino boards are the most widely used micro processors now a days, and are able to handle multitasking industrial projects. Above was a little introduction about Arduino YUN and now lets get started with our today's tutorial.
Automatically Connect with Wifi SSID using Arduino YUN
- First of all open the Arduino softeare. On toolbar click on the icon named "Tools" and a new window will open. Then go to the option "Board" and from the next opened window select the board "Arduino YUN".
NOTE:
- Remember you must download the Arduino software version 1.5.5 + instead of 1.0.3 because Arduino sketches will be only compiled in 1.5.5 version which is specifically designed for Arduino YUN.
- After selecting the board, you will load the given below code into Arduino Board.
#include <Process.h>
#include <FileIO.h>
String ESSID = "TEP";
String Pass = "Pakistan";
String Encrypt = "psk2";
void setup() {
Serial.begin(9600);
delay(5000);
FileSystem.begin();
delay(5000);
Bridge.begin();
delay(5000);
}
void loop() {
// put your main code here, to run repeatedly:
WifiAuthentication();
}
void WifiAuthentication()
{
uploadScript();
delay(1000);
runScript();
delay(20000);
}
void uploadScript()
{
File script = FileSystem.open("/tmp/setupwifi.sh", FILE_WRITE);
script.print("#!/bin/sh\n");
script.print("/sbin/uci set network.lan=interface\n");
script.print("/sbin/uci set network.lan.proto=dhcp\n");
script.print("/sbin/uci delete network.lan.ipaddr\n");
script.print("/sbin/uci delete network.lan.netmask\n");
script.print("/sbin/uci set wireless.@wifi-iface[0].mode=sta\n");
script.print("/sbin/uci set wireless.@wifi-iface[0].ssid=" + ESSID + "\n");
script.print("/sbin/uci set wireless.@wifi-iface[0].encryption=" + Encrypt + "\n");
script.print("/sbin/uci set wireless.@wifi-iface[0].key=" + Pass + "\n");
script.print("/sbin/uci commit wireless; /sbin/wifi\n");
script.print("/etc/init.d/network restart\n");
script.close();
Process chmod;
chmod.begin("chmod");
chmod.addParameter("755");
chmod.addParameter("/tmp/setupwifi.sh");
chmod.run();
}
void runScript()
{
Process myscript;
myscript.begin("/tmp/setupwifi.sh");
myscript.run();
Serial.println("Connected");
}
- The above given code is a bit complicated and it consists of many steps. Now i am going to show all the steps through a block diagram and then i will try to explain every step one by one.
- Using this code, the Arduino YUN board will automatically connected to the available SSID which is in our case is TEP. So you can give any other SSID there and it will connect to that one.
- In the above block diagram, you can see that first of all Initialize Serial Port. When you will connect Arduino YUN with your computer through cable or as i described earlier that Arduino YUN also have built-in wifi so you can also connect Arduino YUN with computer through wifi.
- Then you will load the code to Initialize Serial Port, which is the first step and also shown in the above block diagram.
- In this project we have kept Baud rate of Arduino YUN 9600.
- The next step in the block diagram is to 'Initialize File System' . In this step we will load 'File System' into our code as viewed in the code image given above.
- Now in the next step we have to initialize the Arduino YUN Bridge. The block diagram representing the internal structure of Arduino YUN is shown in the image below:
- As i stated earlier in the beginning of the tutorial that Arduino YUN has 2 on-board micro processors and Arduino YUN is the intermediate source who performs communication between both micro processors.
- The Bridge library facilitates communication between the two processors, giving Arduino sketches the ability to run shell scripts, communicate with network interfaces, and receive information from the AR 9331 processor.
- The USB Host is connected to the ATmega 32u4, while the all external interferences(like Wifi, Ethernet, SD card) are connected to Linux micro processor.
- The beauty of this board is that Bridge libraries also enables the Arduino micr processor ATmega to communicate with the other interferences, which are also connected with Linux microprocessor.
- When bridge has been activated then, Arduino YUN enables its wifi and search for the nearby available wifi connections.
- When it will get some available wifi connections in its surrounding then, from its algorithm, Arduino YUN will get the SSID from that available wifi connections.
- The next thing which we have implemented in the code is to get SSID String. It is a built in function and also available in Arduino libraries that if it gets any available wifi connection near it, then it automatically gets strings from those connections.
- When Arduino has searched for all the available wifi connections near it and after getting the SSID of available wifi connections, it sends all these SSID to serial port of Arduino YUN board.
- After that Arduino YUN will automatically connect to that wifi connection whose SSID matches with the given SSID.
- Now the end step is very important and it distinguishes Arduino YUN from all other Arduino boards, which is, After sending data to serial port it again starts the loop and got o step #4 and it again starts to search for available wifi networks.
- This phenomenon can also be verified from the above shown block diagram.
- At any stage, if wifi connection drops then the loop will again start and will search for available wifi connections, get their SSID and it will send these SSID to serial port and it will rehabilitate the connection within no time and no problem will occur at any stage of data execution.
Alright friends, that was all from today's post. It is a very basic and very important post and we have seen How to Automatically Connect with Wifi SSID using Arduino YUN. I hope you have learned something new in today's post. If you have any problem in understanding any step of this tutorial then, you can ask in the comments and i will try my best to resolve the issue. Follow us to get the codes and simulations straight in your inbox. For more tutorial and projects, stay tuned and until next tutorial Take Care !!! :)
555 Timer Projects
Hello friends, hope you all are fine and having fun with your lives. Today I am gonna post 555 Timer projects list which are already posted on our blog. Actually, I have posted many 555 Timer Projects on my blog but we don't have a list of these tutorials and they are quite scattered. So, today I thought to arrange them in a proper list so that you can find all of them in one place. All these 555 timer projects are simulated in my favorite simulating software Proteus. I have also given their simulations for download in almost all tutorials. If you feel problem in any of them then ask in comments and I will resolve them.
All these 555 Timer Projects and tutorials are written and designed completely by our team so we hold the complete ownership for these projects. Other bloggers are welcome to share them on their blogs to spread knowledge but do mention our post link as we have done a lot of work and effort in designing these tutorials and projects. :)
I will keep on updating this list in future as I am gonna add more projects on 555 Timer, I will add their links below. So, enough with the talking, let's get started with 555 Timer projects.
555 Timer Projects
I have divided these projects and tutorials in different sections depending on their complexity. Follow all these tutorials step by step and you are gonna be expert in 555 Timer real soon. I will keep on updating this list in future, whenever I am gonna add new project on 555 Timer, I will post the link here.
Basics of 555 Timer
Below tutorials will give you the basics of 555 Timer IC. So these tutorials are kind of must because if you don't know the basics of any integrated chip then how can you use it in your ciruits. So must read them once and then move to next section:
555 Timer Projects - Basics
I hope you have read the basics of 555 Timer, so now here's time to get started with 555 Timer Projects. These projects are designed in Proteus simulating software and are working perfectly. Simulations are given for download in most of these tutorials. So, lets get started:
555 Timer Projects - Advanced
Now I think you are quite expert in 555 Timer and have done the basic projects so now its time to move to the next level and design advance level projects with 555 Timer. In these projects we are gonna interface difference electronic modules with 555 Timer.
How to Generate PWM in 8051 Microcontroller
Hello everyone, hope you all are fine and having fun with your lives. In today's post, I am going to share How to generate PWM in 8051 Microcontroller. PWM is an abbreviation of Pulse Width Modulation and is used in many engineering projects. It is used in those engineering projects where you want an analog output. For example, you want to control the speed of your DC motor then you need a PWM pulse. Using PWM signal you can move your motor at any speed from 0 to its max speed. Similarly suppose you wanna dim your LED light, again you are gonna use PWM pulse. So, in short, it has numerous uses. If you are working on Arduino then you should read How to use Arduino PWM Pins.
PWM, as the name suggests, is simply a pulse width modulation. We take a pulse and then we modulate its width and make it small or big. Another term important while studying PWM is named duty cycle. The duty cycle shows the duration for which the PWM pulse remains HIGH. Now if the pulse remains high for 50% and LOW for 50% then we say that PWM pulse has a duty cycle of 50%. Similarly, if the pulse is HIGH for 70% and Low for 30% then it has a duty cycle of 70%.
Most of the microcontrollers have special pins assigned for PWM as in Arduino UNO it has 6 PWM pins on it. Similarly, PIC Microcontrollers also have PWM pins but unfortunately, the 8051 Microcontroller doesn't have this luxury means there are no special PWM pins available in 8051 Microcontroller. But PWM is necessary so we are going to manually generate the PWM pulse using Timer0 interrupt. So, before reading this tutorial you must first read How to use Timer Interrupt in 8051 Microcontroller so that you understand the functioning of Timer Interrupt. Anyways, let's get started with the generation of PWM in the 8051 Microcontroller.
Where To Buy? |
---|
No. | Components | Distributor | Link To Buy |
1 | 8051 Microcontroller | Amazon | Buy Now |
How to Generate PWM in 8051 Microcontroller ???
- You can download both the simulation and the programming code for PWM in 8051 Microcontroller by clicking the below button:
Download PWM Code & Simulation
- First of all, design a simple circuit as shown in the below figure:
- Now what we are gonna do is we are gonna generate a PWM pulse using timer0 interrupt and then we are gonna send it to P2.0.
- I have attached an oscilloscope on which we can easily monitor this PWM pulse and can check whether it's correct or not.
Code in Keil uvision 3
- Now, copy the below code and paste it into your Keil uvision software. I have used Keil uvision 3 for this code compiling.
#include<reg51.h>
// PWM_Pin
sbit PWM_Pin = P2^0; // Pin P2.0 is named as PWM_Pin
// Function declarations
void cct_init(void);
void InitTimer0(void);
void InitPWM(void);
// Global variables
unsigned char PWM = 0; // It can have a value from 0 (0% duty cycle) to 255 (100% duty cycle)
unsigned int temp = 0; // Used inside Timer0 ISR
// PWM frequency selector
/* PWM_Freq_Num can have values in between 1 to 257 only
* When PWM_Freq_Num is equal to 1, then it means highest PWM frequency
* which is approximately 1000000/(1*255) = 3.9kHz
* When PWM_Freq_Num is equal to 257, then it means lowest PWM frequency
* which is approximately 1000000/(257*255) = 15Hz
*
* So, in general you can calculate PWM frequency by using the formula
* PWM Frequency = 1000000/(PWM_Freq_Num*255)
*/
#define PWM_Freq_Num 1 // Highest possible PWM Frequency
// Main Function
int main(void)
{
cct_init(); // Make all ports zero
InitPWM(); // Start PWM
PWM = 127; // Make 50% duty cycle of PWM
while(1) // Rest is done in Timer0 interrupt
{}
}
// Init CCT function
void cct_init(void)
{
P0 = 0x00;
P1 = 0x00;
P2 = 0x00;
P3 = 0x00;
}
// Timer0 initialize
void InitTimer0(void)
{
TMOD &= 0xF0; // Clear 4bit field for timer0
TMOD |= 0x01; // Set timer0 in mode 1 = 16bit mode
TH0 = 0x00; // First time value
TL0 = 0x00; // Set arbitrarily zero
ET0 = 1; // Enable Timer0 interrupts
EA = 1; // Global interrupt enable
TR0 = 1; // Start Timer 0
}
// PWM initialize
void InitPWM(void)
{
PWM = 0; // Initialize with 0% duty cycle
InitTimer0(); // Initialize timer0 to start generating interrupts
// PWM generation code is written inside the Timer0 ISR
}
// Timer0 ISR
void Timer0_ISR (void) interrupt 1
{
TR0 = 0; // Stop Timer 0
if(PWM_Pin) // if PWM_Pin is high
{
PWM_Pin = 0;
temp = (255-PWM)*PWM_Freq_Num;
TH0 = 0xFF - (temp>>8)&0xFF;
TL0 = 0xFF - temp&0xFF;
}
else // if PWM_Pin is low
{
PWM_Pin = 1;
temp = PWM*PWM_Freq_Num;
TH0 = 0xFF - (temp>>8)&0xFF;
TL0 = 0xFF - temp&0xFF;
}
TF0 = 0; // Clear the interrupt flag
TR0 = 1; // Start Timer 0
}
- I have added the comments in the above codes so it won't be much difficult to understand. If you have a problem then ask in the comments and I will resolve them.
- Now in this code, I have used a PWM variable and I have given 127 to it as a starting value.
- PWM pulse varies from 0 to 255 as it's an 8-bit value so 127 is the mid-value which means the duty cycle will be 50%.
- You can change its value as you want it to be.
Proteus Simulation Result
- So, now when you upload the hex file and run your simulation then you will get below results:
- Now you can check in the above figure that the duration of HIGH and LOW is the same means the pulse is HIGH for 50% and LOW for the remaining 50% cycle.
- Now let's change the PWM duty cycle to 85 which is 1/3 and it will generate a PWM pulse of 33% duty cycle. Here's the result:
- Now you can easily compare the above two figures and can get the difference. In the above figure now the duty cycle has decreased as the HIGH timing of the pulse is now reduced to 1/3 and pulse is LOW for 2/3 of the total time.
That's all, for today. That's how we can generate PWM in 8051 Microcontroller. Will meet you guys in the next tutorial. Till then take care !!! :)