Following a bright object through a simple computer-controlled system Genti Progri Petrika Maranga University “A. Xhuvani” Polytechnic University of Tirana Elbasan, Albania Tiranë, Albania genti.progri@uniel.edu.al petmara@yahoo.com Abstract Below, there are a couple of ways on how to build the schematics which provide control for the stepper- This material will describe a simple object motors [Pau84]. The stepper-motor comands come tracker system through the processing of from the analysis of the pictures taken from the camera. images brought by a camera. The follow-up system described and accomplished in this A more detailed system is provided below in Figure 2. 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. 1. Introduction Figure 2: The system for the pursuit of the bright object The principle scheme of the follower system is presented in Figure 1. Elements that are part of this system:  The computer.  Module for the stepper-motor control.  Camera.  The solar panel with its mechanical system which provides the movement of the oanel in one, two and three directions.  The devices that control the level of charge for the batteries, the battey system, inverter etc. The main steps for the pursuit of the bright object are as shown below in the diagram in Figure 3. Below there Figure 1: The principle scheme of the follower system. is also a list of steps to be followed when we are in the pursuit of the bright object.  We take the image from the camera and send The system is made up of two stepper-motors which it to the computer. provide the movement of the photoelectric-panel  The image is changed into a black and white (known also as a solar panel) in two different planes, picture(green scale). making possible the pursuit of the moving object (in this case the sun).[ Tau97]  We identify the position of the bright object from the images.  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.  We convert the pixels calculated from the step above into number of steps for the stepper- mottor.  We execute the commad that will move the stepper-motor using the anlge of movement calculated from the step above.  The process is repeated starting at step 1 oncwe again, after some time. We will analyze two simple computer-controlled systems, for the pursuit of the bright object :  Controlling the solar panel from the computer using PIC18F4550-I/P Microchip Microcontroller & ULN2803 [Tau84]  Controlling the solar panel from the computer using the module Stepper-Bee. We know the functions that we need to use to controll the steps of the motor from the USB port using PIC18F4550-I/P & ULN2803 as well as the module Figure 3: The main steps in realizing the pursuit of the Stepper-Bee [Tau84] bright object. The program will control the pursuit of the bright moving object (the sun) orienting the solar panel In order for them to be perpendicular, the image of the towards the sun in order to get the maximal energy bright object should be displaced in the center of the generated. We know that the panel and the sun rays image provided from the camera. This can be done need to form a 90 degree angle. In such a case, the only if we rotate the solar panel until the sun is on top camera that is connected with the solar panel, will have of the center of the image we got from the camera. The on its focus the sun. In oder for the camera not to be rotation of the panel can be done using a stepper-motor damaged from the sun, its lenses will be painted with a only in one direction, following the movement of the dark color or a dark lens will be placed instead. sun from east to west. In this case , the control of the solar panel from the computer as shown in Figure 4, During the movement of the sun, the bright image that can be done using PIC18F4550-I/P Microchip we get from the camera with a dark background will be Microcontroller & ULN2803. displaced from its initial position. As a result, the rays from the sun will not be perpendicular with the plane of the solar panel. 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]. In the figure, this variables are : NrRreshtaPixelNgaQendraObjektit and NrKolonaPixelNgaQendraObjektit This two variables will be converted into numbers of Figure 4: Controlling the solar panel from the steps and then we will control each of them so that they computer via PIC18F4550-I/P Microchip rotate according to the calculated steps. This way, the Microcontroller & ULN2803 object will be displaced towards the center of the image of the camera. 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. Figure 6: Scheme of tracking the sun from the system afterwards analyzing the image taken from the camera 2. Following of the bright object, commanded by the computer program Figure 5: Controlling the solar panel from the computer The GUI program built to control the movement of the via Stepper-Bee modul panel in one and two axises is shown in Figure 7. The initial activation of the program starts with the click of LlogaritKordinataXY.NrKolonesQenderImazhi the button ‘INICIALIZIME PER MOTORET’ which creates the connection with the module PIC18F4550- lDistanca_QenderObjekti_QenderImazhi.Caption = I/P Microchip Microcontroller & ULN2803 or module Stepper-Bee [6]. The program has two ways of LlogaritKordinataXY.Distanca_QenderObjekti_QenderImaz hi 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 The automatic control of the module follows the same user to control motors A and B. The motors can get the steps shown at the beginning of this paragraph. An set of movements using the arrows shown in GUI and important variable in this case will be ‘allowed pixel stop when you click on the ‘Stop’ button. 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 The codes that provide the movement of the motors are recalculation of the coordinates of the object that we as shown below : are following are defined by another variable that is FilloLevizjenMotori 1, CInt(Abs(.NrRreshtitQenderObjekti - expressed through a Timer component in Visual Basic. .NrRreshtitQenderImazhi) / txtInterval.Text), txtInterval.Text, It will get activated only when the movement of the 0, 1 stepper-motors is over and the cycle has restarted again with a new image obtained from the camera. FilloLevizjenMotori 2, CInt(Abs(.NrKolonesQenderObjekti - .NrKolonesQenderImazhi)/ txtInterval.Text), txtInterval.Text, 1, 1 The codes for the control of the motor are as follows : ' Fillim i levizjes - Motor 1 In GUI we are given the calculated coordinates of the center of the object in pursuit, the coordinates of the Public Function FilloLevizjenMotori( center of the image as well as the distance of those two ByVal NumberMotor As Integer, _ in pixels. ByVal Steps As Integer, _ ByVal Interval As Integer, _ The codes are as shown below: ByVal Direction As Integer, _ ByVal Outputs As Integer) As Boolean LlogaritKordinataXY = GjejPozicioninObjektit(Picture1, txtStep.Text) Select Case NumberMotor Case 1 valRreshtiQenderObjekti.Caption = ' Startim i motorit 1 LlogaritKordinataXY.NrRreshtitQenderObjekti FilloLevizjenMotori = RunMotor1(Steps, Interval, Direction, Outputs) valKolonaQenderObjekti.Caption = Case 2 LlogaritKordinataXY.NrKolonesQenderObjekti ' Startim i motorit 2 FilloLevizjenMotori = RunMotor2(Steps, Interval, valRreshtiQenderImazhi.Caption = Direction, Outputs) LlogaritKordinataXY.NrRreshtitQenderImazhi Case Else End Select valKolonaQenderImazhi.Caption = End Function References [Tau97] Taub, Herbert, Principles of Digital Designer; Prentice-Hall; 1997 [Tau84] Taub, Herbert, Circuitos Digitais e Microprocessadores; McGraw-Hill, 1984. [Pau84] Paul Acarnley, Stepping motors: a guide to modern theory and practice, P. P. P. Peregrinus on behalf of the IEE, 1984, c1982. LC number: TK2537 .A28 1984 [Fra11] Francesco Balena, Programing Microsoft Visual Basic 6.0; 2011 Figure 7: The GUI program built to control the movement of the panel in one and two axises. [Gar12] Garry Berkovic and Ehud Shafir , Optical methods for distance and displacement measurements.. Received April 3, 2012; The program built in Visual Basic 6.0 to control the revised July 16, 2012; accepted July 24, 2012; modules PIC18F4550-I/P Microchip Microcontroller & published September 11, 2012 (Doc. ID ULN2803 and Stepper-Bee in the pursuit of the moving 166051) object (in our case it is related to the solar panel) was built with the help of the model provided in Figure 4 [Ste09] StepperBee. Stepper motor control from a and Figure 5. PC’s USB port. Available exclusively from PC Control Ltd. www.pc-control.co.uk 2009 Copyright PC Control Ltd. 3. Conclusions  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.  We showed the functions that we need to use in order to control the stepper-motor from a USB port using: o PIC18F4550-I/P & ULN2803 o Modulit Stepper-Bee & ULN2803 ose ULN2003