<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Following a bright object through a simple computer-controlled system</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Genti Progri</string-name>
          <email>genti.progri@uniel.edu.al</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Petrika Maranga</string-name>
          <email>petmara@yahoo.com</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Polytechnic University of Tirana</institution>
          ,
          <addr-line>Tiranë</addr-line>
          ,
          <country country="AL">Albania</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>University “A. Xhuvani”</institution>
          ,
          <addr-line>Elbasan</addr-line>
          ,
          <country country="AL">Albania</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>This material will describe a simple object tracker system through the processing of images brought by a camera. The follow-up system described and accomplished in this material can serve to track any object in a camera image, so it is an almost universally follow-up system. The schematic system presented follows a way how by following the movement of the sun, the solar panel with the photo element is positioned in the direction where the active surface for the light flow gets the maximum value. The result of this panel positioning is that the generated current is maximized by the fact that the energy that falls on the photoelectric panel receives the maximum value.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>The principle scheme of the follower system is
presented in Figure 1.
Elements that are part of this system:
Below, there are a couple of ways on how to build the
schematics which provide control for the
steppermotors [Pau84]. The stepper-motor comands come
from the analysis of the pictures taken from the camera.
A more detailed system is provided below in Figure 2.
The system is made up of two stepper-motors which
provide the movement of the photoelectric-panel
(known also as a solar panel) in two different planes,
making possible the pursuit of the moving object (in
this case the sun).[ Tau97]




</p>
      <sec id="sec-1-1">
        <title>The computer.</title>
        <p>Module for the stepper-motor control.</p>
        <p>Camera.</p>
        <p>The solar panel with its mechanical system
which provides the movement of the oanel in
one, two and three directions.</p>
        <p>The devices that control the level of charge for
the batteries, the battey system, inverter etc.</p>
        <p>The main steps for the pursuit of the bright object are
as shown below in the diagram in Figure 3. Below there
is also a list of steps to be followed when we are in the
pursuit of the bright object.</p>
        <p>We take the image from the camera and send
it to the computer.</p>
        <p>The image is changed into a black and white
picture(green scale).</p>
        <p>We identify the position of the bright object
from the images.</p>
        <p>We calculate the displacement of the center of
the bright object from the center of the image.
We check if the displacements from the center
are greater than a variable that holds the
minimal value for moving.</p>
        <p>We convert the pixels calculated from the step
above into number of steps for the
steppermottor.</p>
        <p>We execute the commad that will move the
stepper-motor using the anlge of movement
calculated from the step above.</p>
        <p>The process is repeated starting at step 1
oncwe again, after some time.</p>
        <p>Controlling the solar panel from the computer
using PIC18F4550-I/P Microchip
Microcontroller &amp; ULN2803 [Tau84]
Controlling the solar panel from the computer
using the module Stepper-Bee.</p>
        <p>We will analyze two simple computer-controlled
systems, for the pursuit of the bright object :








We know the functions that we need to use to controll
the steps of the motor from the USB port using
PIC18F4550-I/P &amp; ULN2803 as well as the module
Stepper-Bee [Tau84]
The program will control the pursuit of the bright
moving object (the sun) orienting the solar panel
towards the sun in order to get the maximal energy
generated. We know that the panel and the sun rays
need to form a 90 degree angle. In such a case, the
camera that is connected with the solar panel, will have
on its focus the sun. In oder for the camera not to be
damaged from the sun, its lenses will be painted with a
dark color or a dark lens will be placed instead.
During the movement of the sun, the bright image that
we get from the camera with a dark background will be
displaced from its initial position. As a result, the rays
from the sun will not be perpendicular with the plane of
the solar panel.</p>
        <p>In order for them to be perpendicular, the image of the
bright object should be displaced in the center of the
image provided from the camera. This can be done
only if we rotate the solar panel until the sun is on top
of the center of the image we got from the camera. The
rotation of the panel can be done using a stepper-motor
only in one direction, following the movement of the
sun from east to west. In this case , the control of the
solar panel from the computer as shown in Figure 4,
can be done using PIC18F4550-I/P Microchip
Microcontroller &amp; ULN2803.
The rotation of the panel can be done using two stepper
motors. In this case the movement of the sun would be
in both planes, from east to west and from north to
south.
The system can be described in the schematic given in
Figure 6. The program that is built in Visual Basic 6.0
[Fra11] allows for the control of the systems that are
shown in Figure 4 and Figure 5. After identifying the
position of the bright object in the general image
provided by the camera,we calculate the number of
pixels from the center of the image of the sun to the
center of the image of the camera [Gar12].</p>
      </sec>
      <sec id="sec-1-2">
        <title>In the figure, this variables are :</title>
      </sec>
      <sec id="sec-1-3">
        <title>NrRreshtaPixelNgaQendraObjektit</title>
        <p>and</p>
      </sec>
      <sec id="sec-1-4">
        <title>NrKolonaPixelNgaQendraObjektit</title>
        <p>This two variables will be converted into numbers of
steps and then we will control each of them so that they
rotate according to the calculated steps. This way, the
object will be displaced towards the center of the image
of the camera.
2. Following of the bright object,
commanded by the computer program
The GUI program built to control the movement of the
panel in one and two axises is shown in Figure 7. The
initial activation of the program starts with the click of
the button ‘INICIALIZIME PER MOTORET’ which
creates the connection with the module
PIC18F4550I/P Microchip Microcontroller &amp; ULN2803 or module
Stepper-Bee [6]. The program has two ways of
functioning, manual control and automatic control of
the module. The manual control of the module allows
the system to function in a manual way, allowing the
user to control motors A and B. The motors can get the
set of movements using the arrows shown in GUI and
stop when you click on the ‘Stop’ button.</p>
        <p>The codes that provide the movement of the motors are
as shown below :
FilloLevizjenMotori 1, CInt(Abs(.NrRreshtitQenderObjekti
.NrRreshtitQenderImazhi) / txtInterval.Text), txtInterval.Text,
0, 1
FilloLevizjenMotori 2, CInt(Abs(.NrKolonesQenderObjekti
.NrKolonesQenderImazhi)/ txtInterval.Text), txtInterval.Text,
1, 1
In GUI we are given the calculated coordinates of the
center of the object in pursuit, the coordinates of the
center of the image as well as the distance of those two
in pixels.</p>
      </sec>
      <sec id="sec-1-5">
        <title>The codes are as shown below:</title>
        <p>LlogaritKordinataXY = GjejPozicioninObjektit(Picture1,
txtStep.Text)
valRreshtiQenderObjekti.Caption =
valKolonaQenderObjekti.Caption =
valRreshtiQenderImazhi.Caption =
valKolonaQenderImazhi.Caption =</p>
        <p>LlogaritKordinataXY.NrKolonesQenderObjekti
LlogaritKordinataXY.NrRreshtitQenderImazhi
LlogaritKordinataXY.NrRreshtitQenderObjekti
FilloLevizjenMotori = RunMotor1(Steps, Interval,</p>
        <p>LlogaritKordinataXY.NrKolonesQenderImazhi
lDistanca_QenderObjekti_QenderImazhi.Caption =
LlogaritKordinataXY.Distanca_QenderObjekti_QenderImaz
hi
The automatic control of the module follows the same
steps shown at the beginning of this paragraph. An
important variable in this case will be ‘allowed pixel
error’ which will hold the smallest value of the
difference of the coordinates between the centers, for
which the motors will not move. The intervals for the
recalculation of the coordinates of the object that we
are following are defined by another variable that is
expressed through a Timer component in Visual Basic.
It will get activated only when the movement of the
stepper-motors is over and the cycle has restarted again
with a new image obtained from the camera.</p>
        <p>The codes for the control of the motor are as follows :
' Fillim i levizjes - Motor 1
Public Function FilloLevizjenMotori(</p>
        <p>ByVal NumberMotor As Integer, _
ByVal Steps As Integer, _
ByVal Interval As Integer, _
ByVal Direction As Integer, _
ByVal</p>
        <p>Outputs</p>
        <p>As</p>
        <p>Integer)</p>
        <p>As
Boolean</p>
        <p>Select Case NumberMotor
Case 1</p>
        <p>' Startim i motorit 1
Case 2</p>
        <p>' Startim i motorit 2
Case Else</p>
        <p>End Select
End Function</p>
        <p>FilloLevizjenMotori = RunMotor2(Steps, Interval,
Direction, Outputs)
Direction, Outputs)
The program built in Visual Basic 6.0 to control the
modules PIC18F4550-I/P Microchip Microcontroller &amp;
ULN2803 and Stepper-Bee in the pursuit of the moving
object (in our case it is related to the solar panel) was
built with the help of the model provided in Figure 4
and Figure 5.</p>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>3. Conclusions</title>
      <p>

</p>
      <p>We described a simple system that follows
objects through the analysis of the images that
were provided from the camera. The system
that we described and built can be used for th
pursuit of any bright object, making it a
universal system for pursuit of bright objects.
The system shows a way of how the solar
panel with photoelectric elements is positioned
where the energy generated from the light has
the greatest value.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [Tau97] Taub, Herbert, Principles of Digital Designer; Prentice-Hall;
          <year>1997</year>
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [Tau84] Taub, Herbert, Circuitos Digitais e Microprocessadores;
          <string-name>
            <surname>McGraw-Hill</surname>
          </string-name>
          ,
          <year>1984</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [Pau84]
          <article-title>Paul Acarnley, Stepping motors: a guide to modern theory and practice</article-title>
          ,
          <string-name>
            <surname>P. P. P.</surname>
          </string-name>
          <article-title>Peregrinus on behalf of the IEE</article-title>
          ,
          <year>1984</year>
          , c1982.
          <source>LC number: TK2537 .A28 1984</source>
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [Fra11]
          <string-name>
            <given-names>Francesco</given-names>
            <surname>Balena</surname>
          </string-name>
          ,
          <source>Programing Microsoft Visual Basic</source>
          <volume>6</volume>
          .
          <fpage>0</fpage>
          <string-name>
            <surname>;</surname>
          </string-name>
          <fpage>2011</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [Gar12]
          <article-title>Garry Berkovic and Ehud Shafir , Optical methods for distance and displacement measurements</article-title>
          ..
          <source>Received April 3</source>
          ,
          <source>2012; revised July 16</source>
          ,
          <year>2012</year>
          ; accepted July 24,
          <year>2012</year>
          ; published September 11,
          <source>2012 (Doc. ID 166051)</source>
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [Ste09]
          <article-title>StepperBee. Stepper motor control from a PC's USB port</article-title>
          .
          <article-title>Available exclusively from PC Control Ltd. www.pc-control.co.uk 2009 Copyright PC Control Ltd</article-title>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>