Microcontroller Based Bottle Inspection using Image Processing

DOI : 10.17577/IJERTCONV3IS06034

Download Full-Text PDF Cite this Publication

Text Only Version

Microcontroller Based Bottle Inspection using Image Processing

Chetna Samant , Megha Navale, Manoj Duduskar, Prathamesh Jadhav

Department of Electronics,

K.C. College of Engineering & Management Studies & Research, Thane, Maharashtra, India

Abstract In todays era the automation is omnipresent , be it for business , medicine , entertainment or even education. It is even more vital to make production faster and safer it will revolutionize the way we live and work. The microcontroller based automation concept will make the mass production which is useful, secure and perform at a high speed. It consists of a camera connected to host (computer) , sensor and automation circuit. The aim of this project is to achieve bulk production of capsule packet or medicine bottle after bottle cap is placed. Also we can add pusher circuit to make the production independent of availability of person.

KeywordsMicrontroller, Sensor, Camera, Image Processing.


    Microcontroller based bottle inspection system is used in pharmaceutical company where monitoring of level of bottle is done by human being. The main concept of our project based on the same aspects. Our project consist camera to take image of the bottle and two sensors to sense the position of the bottle, once the cap of the bottle is sense the trigger will be given to camera that will take a picture of the bottle. It will check the value in terms of the pixel of the bottle. If the bottle is half filled or over filled then it should not reach to the customer. In this case over system reject that particular bottle which is over fill or under fill. Our system avoid human error which occur during our regular working. The microcontroller based bottle inspection system placed just after the liquid filled bottle comes out on conveyor belt. The camera will compare the image value in pixels with the stored value of the good bottle. The sensor will also give the count of the good bottle and bad bottle that can be use to analyze the overall production of the day. The data which is generated can be store in log file like a notepad document to check the values of the bottle in terms of pixels. Image processing is used to get the value of image in pixels. Image processing is a method to convert an image into digital form and perform some operations on it, in order to get an enhanced image or to extract some useful information from it. It is a type of signal dispensation in which input is image, like video frame or photograph and output may be image or characteristics associated with that image. Usually Image Processing system includes treating images as two dimensional signals while applying already set signal processing methods to them.


    A. Image Processing

    It is a method to convert an image into digital form and perform some operation on it ,in order to get an enhanced image or to extract some useful information from it.


    1. Hardware

      Figure 1: System Block Diagram

      1. Microcontroller(89C51):

        The 89c51 is the heart of the microcontroller based bottle rejection system. It having most of the operation in our system. The output of the sensor1 is given to the microcontroller. As microcontroller receives 1 it gives trigger to the camera to capture the image of the bottle. The image of the bottle took by the camera and the grayscale value of the image given to the microcontroller. The microcontroller compaire the value of the new image with the stored image value.(Eg.100 ml bottle pixel value).If the pixel value is within the range then bottle is accepted else it is rejected. For rejection mechanism pusher can be used but we use LED to indicate half- filed or over- filed bottle.

        Figure 2: Pin configuration

        Sensor i/p 1 to check that bottle is arrived at camera should take photo.

        Sensor i/p 2 to check that good or bad bottle reach to that sensor with respect to this sensor o/p Red or Green LED will turn ON.

        2 IS FOR 16*2 LCD display to indicate no of good and bad bottle count.

        Make Vcc and GND common of camera sensor 1 and sensor 2 and also of LED ,LCD.

        Add MAX 232 circuit to convert 12v to +5v using 7805 and keep one serial port to burn hex file.

      2. Sensor :

        Figure 3: Mechanical Structure of Sensor

        The sensor is used to sense the bottle cap. It is a bottle cap sensor which senses the cap of the bottle. The sensor has 3 wires one is Vcc, second ground and third output. The

        output is high that means the bottle is sense by the sensor. The sensor 2 is used for rejection mechanism. The sensor 2 in our project is used to count the bottle same as the sensor 1. If the bottle is faulty then that particular bottle should rejected from the conveyor belt. The sensor 2 does that work. In our project we use LED to indicate the rejection mechanism that is bottle is under-filed or over-filed

      3. LCD :

        The 16*2 LCD is used to display the count of good bottles and rejected bottle. This will help the user to count the production of the day or week or for that particular sample.

      4. Camera :

        The camera is used to capture the image and that image is used to calculate the pixel value and based on that good or bad can be detected. As soon as the camera get trigger from sensor 1 the camera capture the image.

    2. Software

    Image Processing is among rapidly growing technologies today, with its applications in various aspects of a business. Image Processing forms core research area within engineering and computer science disciplines too.

    Image processing basically includes the following three steps.

    • Importing the image with optical scanner or by digital photography.

    • Analyzing and manipulating the image which includes data compression and image enhancement and spotting patterns that are not to human eyes like satellite photographs.

    • Output is the last stage in which result can be altered image or report that is based on image analysis.

    MATLAB (matrix laboratory) is a multi-paradigm numerical computing environment. MATLAB allows and fourth-generation programming language matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages, including C, C++, Java,Fortran and Python.

    The coding of the microcontroller with image processing is done by matlab.


    Eagle is powerful and flexible pcb design software provides High level functionality of expensive commercial circuit board design at fraction of cost. Eagle is easy to learn and easy to use. It allows feature enhancement such as simulation,data import and export and self defined commands through ULPs.


    Figure 4: Bottle Level Detection Mechanism

    The diagram shows the ideal system where the camera and sensor placed to capture the image of the bottle. The bottle after taking image passes over a conveyor belt.

    Figure 5: Bottle Rejection Mechanism

    The diagram shows the half filled bottle reached at sensor 2.As that bottle reach to sensor 2 instead of rejection mechanism the red LED glows indicate that the bottle is faulty and should be removed from the conveyor belt. The microcontroller based rejection mechanism used in Pharma Company where the production of different product carried out in the month.

    1. Operation :

      The microcontroller based bottle inspection system has camera inpu given to port 1.1.As soon as sensor 1(connected to p1.2) sense the bottle cap it triggers the camera to take image. The camera process the image and compaire the pixel value of the bottle image with good bottle value (eg. If 100 ml bottle is to be passed then the 98 ml and 102 ml bottle should get rejected).If the good bottle value is 125 pixel then we set the range to reject the bottle between 115 to 135 pixel value. The sensor 2 also count the bottle. The counter is attach to sensor 2.The good and bad bottle count is given to sensor 2 through microcontroller. The count is given to sensor 2 and it will indicate the bad bottle by red LED and also increment the count of good and bad bottle.

      The output port 2.0 is used to connect the 16*2 LCD to display the count of bottle. The port 3 is used to red and transmit the and burn the hex file of the program also used to connect the pc serially to the microcontroller.

      PCB Layout


      1. Cover wide range of industries.

      2. Very easy to operate.

      3. Flexible due to use of microcontroller. 4.Operation difficult in noisy environment.

    1. Software support needed for camera and microcontroller.

    2. It is used in pharma company.

    3. It is used in industries like cold drink and water etc.


IP allows a much wider range of algorithms to be applied to the input data and can avoid problems. Such as the build-up of noise and signal distortion during processing. sophisticated performance at simple tasks, and the implementation of methods which would be impossible by analog means.

User friendly. It also applicable for tablets and capsules.

It can be made wireless by using GPS system. By using rejection mechanism the speed of the system can be increses.


  1. USB Implementers Forum Inc, www.usb.org/ interoductionusb- 2.0papers/

  2. William Shotts, Jr.. Linux bash shell programming tutorials

  3. John Hyde, USB design, a technical introduction to USB 2.0, white papers.

  4. Jan axelson, USB Complete, Penram Publications, 2nd edition, pp. 5-7. Nov 1999.

  5. Jan axelson, USB mass storage, Lakeview Publications, 2nd edition, chp. 4, pp 57-69. 2000.

  6. Raspberry pi Arm IC Detail.pdf

  7. http://www.chalk-elec.com/?p=1576

  8. http://msdn.microsoft.com/en-us/library/ms894725.aspx

  9. http://www.devicegadget.com/resources/raspberry-pi-start ers-guide.html

Leave a Reply