Friday 16 August 2013

Colour Identifying and picking robot using OpenCV

Hi, I would like to add my B.Tech main project to be the first post in this blog. Even I have done many works before and after, this was really one of my favourite works and my first OpenCV project.



The aim of the project was to design a robot that can identify colour and it can be instructed to pick one particular colour and the robot have to move to the particular coloured object and pick it with a servo controlled robotic arm.  The robot is fitted with a rover with 100-RPM DC Geared motor and the well known DC Motor drive L293D, A robotic arm made of V3003 servo motors for joint and 8g micro-servo for grabber assembly, parallel port interface with pc for the controlling of the robot, a webcam to stream video from robot and this video is used for processing, a proximity sensor for checking whether the target reached or not.

The main thing about the robot’s structure is that it is made from scrap materials, piece of PVC pipes are used as the materials. I was in a search for Acrylic plastic in some cities nearby my place, but the availability was an issue, so I thought about an alternative to this to complete my project. I thought about PVC pipes, I felt it is a good solution, large dia PVC pipes can be used if they are stretched, so I put one cut axially the pipe then used ironbox at low temperature to heat the PVC, it is really a slow process, because we can’t increase the temperature above a level because the plastic will melt and stick on the ironbox, so maintained low temperature and put a paper in between the ironbox an PVC to avoid stick on it. I continued this process until the full pipe is stretched. Then I put a carbon copy paper over it and then placed the CAD designs of the parts over it and then marked the designs and cut it with angle grinder. It was really a great experience when I completed making all the parts.

About the algorithm and electronics, the entire image processing is done in the PC with the powerful image processing library OpenCV. I was trying to do the project with MATLAB, but I felt it was really slow when solving Realtime video processing from the camera, so I searched for another option to get fast image processing, and I heard about OpenCV. I studied it for this project and it was really a good opportunity to study it. It is really an awesome tool for image processing. It is the powerful Open source library from Intel Corporation, you can find and download it here . The video from the camera is taken each frame and do some noise filtering and the colour based segmentation for the required colour in HSV colour space. The robot is controlled so as to move it to the target object through parallel port interface, I used the parallel port because, it was one of the best interface before the arrival of Arduino, after arduino came serial and USB interface become more simpler and cheaper. I done this on parallel port to study its implementation in windows, It has some problems when interfacing the parallel port with the windows, because the OS will not give privilege to access the ports, here you get more details about it. An 8051 is used for controlling the robotic arm after get the feedback from the IR proximity sensor and send it to the parallel port for acknowledge PC that it reached the target.  After getting that ack, the PC will send command to 8051 to pick the object with the robotic arm.




After completing the work, it gave a Real-time performance and good response in almost all lighting conditions if we precisely calibrate each colours.
Courtesy: My friends Sreeja and Shyama, who are my project mates and best friends :)

5 comments:

  1. i'm really very impressed with your work and i need some help from you ..

    i have a question about parallel port communication as you work on this part on your project ,



    if i have a vector of 4 different variables Say m1,m2,m3,m4 which their values will be (1 or 0) and i want to pass them to Parallel connected with motors that will be active depending on output value (1 or 0) How to pass those values to Parallel Port Interface ..

    i have searched for some solutions ... i found some tutorials using inpout32.dll , it was not useful for me or
    i can't run them correctly ..


    cloud you help me please ?
    Thanks in advance ...

    ReplyDelete
  2. Hello Rashad,
    In windows most of time you cannot get access to output port directly from calling from a C code, I have mentioned that thing in my details above, I was also having the problem for accessing port, I used a software called 'port talk'. It is used to interface with port, it has some driver files which u need to install in your system32 folder and you will get a header file with it, you can call the functions in that header file to access the port.
    Just search about porttalk and tell me if any more doubt.
    And one suggestion, why you need parallel port? you can use an arduino to connect to usb and from C code access the COM port corresponding to the arduino and write code in arduino to convert the serial data to its IO pins, so that you can execute you project in a laptop also.

    ReplyDelete
  3. thank you very much , i will try and tell you what the result will be :)
    i have one more Q .. i just want to know if this software working for all Windows versions or Win Xp only ??
    i'm working on Win 8 ..

    ReplyDelete
    Replies
    1. I'm not clear about that, mostly for my experiments i use XP, there can be issues because the processing is 64-bit in win-8, you just try and update me if any bug.

      Delete
    2. Thanks very much .. i will try and tell you

      Delete