Friday, August 2, 2013

How to Program Arduino Pro Mini With USB to UART Serial Converter Module


How to start with Arduino Pro Mini and USB to UART Serial Converter Module

Arduino is very popular within electronic hobbyist and robotics due to its simplicity.Freely you can download all the data of arduino from http://www.arduino.cc/
Arduino software,The hardware reference designs and all the libraries are free to download from their site.

Arduino Pro Mini is a small version of Arduino. Original Arduino Pro Mini is about $18. Also you could buy one from ebay for lower prices.To program the board you need a USB to UART Serial Converter Module if you are going to program it using your laptop since modern laptops doesn't include any serial port.When you are ordering Arduino Pro Mini remember to order USB to UART Serial Converter Module which you can easily buy from ebay.




Monday, July 15, 2013

Techfest 2012 IIT Bombay


Techfest is the Asia's Largest Science and Technology festival, with more than 92,000 people in attendance and a reach of over 2200 colleges across India and over 500 overseas.

Sri Lankan Robotics Challenge 2012 - 2nd runners up


                                       

Sri Lankan Robotics Challenge (SLRC) ,the Sri Lanka's biggest robotics competition was held in December 2012 at University of Moratuwa,Sri Laka.We won the third place from all the competitors all around the country.Got selected for Techfest 2012 at IIT Bombay,India.

Image zooming with MATLAB Sample Codes


Here I will explain two algorithms of image processing.They are Nearest-neighbor interpolation and Bilinear interpolation.When an image is zoom its' dimensions are larger than the original image.To fill the extra pixels' intensity levels of the zoom image we can use above mentioned algorithms.

Nearest neighbour Interpolation

Following picture shows original image is scaled twice without filling intermediate pixels and after filling intermediate pixels respectively





In Nearest neighbor algorithm intensity value of the v(x,y) is assigned to the nearest intensity value of the original image f(x,y).You can easily understand the logic behind this by referring following image.


You will understand the algorithm furthermore by studying following matlab code.



Original Image before zoom

Zoom Image using Nearest-Neighbor Algorithm


Bilinear Interpolation


If you familiar with linear interpolation, then it is easy to understand what is bilinear interpolation. So lets look what is linear interpolation by going through this link.


Now you are familiar with linear interpolation. It is use to find a point between two points in a two dimensional space. As the word says bilinear interpolation is used to find a point of between two functions on a 2D grid.




Following is the Matlab code for image zooming using Bilinear Interpolation.

clc
clear all
close all
a=imread('Slanka.jpg');      %import image"y.jpg"

[row col d] = size(a);  %3 dimentional array
zoom=3;                 %zooming factor
zr=zoom*row;
zc=zoom*col;

for i=1:zr
    
    x=i/zoom;
    
    x1=floor(x);
    x2=ceil(x);
    if x1==0
        x1=1;
    end
    xint=rem(x,1);
    for j=1:zc
        
        y=j/zoom;
        
        y1=floor(y);
        y2=ceil(y);
        if y1==0
            y1=1;
        end
        yint=rem(y,1);
        
        BL=a(x1,y1,:);
        TL=a(x1,y2,:);
        BR=a(x2,y1,:);
        TR=a(x2,y2,:);
        
        R1=BR*yint+BL*(1-yint);
        R2=TR*yint+TL*(1-yint);
        
        im_zoom(i,j,:)=R1*xint+R2*(1-xint);
    end
end
imshow(im_zoom);

Original Image before zoom

After zooming Bilinear Interpolation





Saturday, June 15, 2013

How to make a simple line following robot





I'll explain how to build a 'Line Following Robot step by step.

                                         
It is better if you have any basic knowledge about electronics,such as reading resister color code,soldiering, familiar with circuit symbols,polarity of capacitors,diodes etc..

If you are not familiar,then use following links to learn about them before read this page

As the first step of line following robot,we have to make the chassis of it.
Following conditions should be considered before making the chassis of the bot.
  1. Weight.
  2. Moment of  inertia.
  3. Center of gravity.
  4. Wheel size.

Since we are planing to make a normal line following robot,we do not need to consider above conditions heavily.
  1. Weight   :-It is better if the robot is light weight.Because it is easy to control when its' weight is low.Also it helps to save energy of battery.
  2. Moment of inertia  :-It is hard to control robot movements when moment of inertia is high.so keep heavy items such as batteries,motors etc as close to robot center as possible.
  3. Center of gravity  :-To accelerate/decelerate robot weight should on its tires.If there is no weight on tires -> no grip.So center of gravity should close to the axle of wheels.C.G. should be low as possible.You can use Lighter or slimmer motors to lower c.g.
  4. Wheel size  :-Bigger wheels higher the c.g.smaller wheels lower the c.g.Keep wheels & shaft as light as possible.Wider wheels are hard to turn.
Lets select motors and wheels,
  • Motor   :-This is a 500rpm geared DC motor.You can use this kind of motor or any kind of 12v DC geared motor.


Thursday, March 28, 2013

Connecting PLC to PC


Hi all,Since I'm new to PLC  world I will not explain about how PLC work in this article.But I'll publish new articles when I get to know about them more and more.

In this article I will show you how to connect PLC to your computer to read its register values.This tutorial will only work for Xinje XC-6TCA .PLC is mainly use in automation industry due to its reliability and good performances in harsh environments.Ladder logic is use to program PLC.It is easy to understand than any other programming language.


I recommend you to read the manual of the PLC before working with any PLC,because it gives us all the information about functions of it.

There are two ways to communicate with PLC and PC.They are Free communication and MODBUS communication.In this article I will only show you how to communicate with Free communication.

Step -1
Connect PLC to the PC through data cable provided.
If your cable is PS2 to serial DB9 cable,it is unable to connect it directly to    the   your laptop.You have to connect it to the laptop using serial DB9 to USB  cable.

Step -2
There are two ports in PLC. Configurations of port 1 cannot be changed.COM 1 (Port1) is the program port, it can be used to download the program and connect with the other devices. The parameters (baud rate, data bit etc.) of this COM port are fixed, can’t be re-set.


COM 2 (Port2) is communication port, it can be used to download program and connect with the other devices. The parameters (baud rate, data bit etc.) of this COM port can be re-set via software.

I'am going to use port1 to download the program and port2 to read the data from PLC.

Open software,go to Configurations select serial port 2.Note that not to change settings of port1.




Step -3
Change serial port2 settings as following image

set communication mode to User Protocol
Baud rate to 9600
and the others as in the image
Then click Write To Plc

Step -4
Download your program to PLC and run it.

Step -5
Disconnect power and remove the cable from port1,connect it to port2 to read data from PLC according to your program.
Re power PLC to read data from PLC.If you don't have any serial port moniter. microc will help you to show the data comming from PLC.


Step -6
Open microc software ,then open USART monitor,set the values as you set into the PLC.Then click connect.you are done!