Displacement Detection Application of HDNS A2051 Optical Sensor for Controlling a 4-DOF Cylindrical Manipulator

Parallel port interface circuit is designed, fabricated and tested for programmable control of electrical motor actuators used in a cylindrical robotic manipulator. The robotic arm built in – house has four degrees of freedom through the use of five electrical motors (four for joint actuating and one for end–effector). The interface circuit consists of relays as output devices, an octal bus transceiver, and a quad 2-input exclusive-XOR gate as input devices. An optical mouse – sensor (one for each joint) is used to indicate the actual position of the joint and uses it as a feedback signal. A menu driven QBASIC program is developed for controlling the robotic arm using the manipulator kinematics. The program contains a counter for counting the variation in digital signal (changing times of the state). The entire circuits, devices, and the program worked accurately. The result shows that the optical mouse sensors function properly in the controlling system and displacement measuring. A2051 HDNS 4

( .also investigated the use of the optical sensor as an inexpensive camera-like device, by processing images and the available data from the forward looking sensor, object recognition and avoidance gives the robot the ability to navigate within dynamically changing real-world environments.His work showed that the optical mouse sensors are a highly viable alternative to more traditional odometry methods such as wheel encoders and the sensors can be configured to perform as a low-level image capture devices, in order to provide real time visual feedback of the operating environment.
Given an omni-directional mobile platform using four Mecanum wheels, it required further capability being programmed to achieve various motion behaviors and intelligence, Cooney, Xu, and Bright [5] describe a solution to the problem involving both hardware and software developments, two optical mice are attached to the front and rear of the robot giving positional feedback for closed-loop control and dead-reckoning for navigation and a microcontroller is interfaced to all TTL compatible devices and subsequently programmed to implement various robotic behaviors.A closed-loop control scheme using three independent PID controllers is implemented to follow three DOF motions.Their work found out that the optical mice are promising sensors to the dead-reckoning for the robot motion control.
In this paper, a 4-DOF robotic manipulator has been designed and manufactured with five electrical motors.Three of these motors are those used in satellite receiver antenna actuating and one motor for twist actuating and another for end-effecter.Ten relays are used as output devices, and one octal bus transceiver (buffer) for input signal.All output and input signals are interfaced using DB-25 parallel port of the PC.The manipulator involves four optical mouse-sensors as position sensors and feedback signal to the PC for closed-loop control s y s t e m t h r o ug h qu a d 2 -i n p ut e x c l us i v e -O R g a t e .A m e n u dr i v e n Q B A SI C p r og r a m i s developed for controlling the robotic arm using the manipulator forward and inverse kinematics.The program contains a counter for counting the input digital signal.The goal of this paper is the use of an optical mouse-sensor in a noncomplex manner in manipulation control systems and design a simple and inexpensive optical position sensor circuit, figure (1) shows the built in-house manipulator.

Forward kinematics:
The forward kinematics problem is concerned with the relationship between the individual joints of the robot manipulator and the position and orientation of the end-effector.Stated more formally, the forward kinematics problem is to find the position and orientation of the end-effector given the values for joint variables of the robot.
The joint variables are the angles between the links in the case of revolute or rotational joints, and the link extension in the case of prismatic or sliding joints.A large part of robot kinematics is concerned with the establishment of various coordinate systems to represent the positions and orientations of rigid objects and with transformations among these coordinate systems [6].Homogeneous transformations combine the operations of rotation (R) and translations (P) into a single matrix multiplication.The fixed coordinate systems attached to the 4-link cylindrical manipulator linkages, which called the word or base frame are shown in figure (2).Five word frames are used to describe the position and orientation of the endeffector (word frame 4) with respect to manipulator base (word frame 0).

Vol.17
No.6 Dec. 2009 Manipulator base The homogeneous transformations or Denavit-Hartenberg (DH) convention, which is used to simplify the transformation among the attached coordinate frames and finding the link parameters, for 4-link cylindrical manipulator, is: (for more details, see the appendix A) Where i & i denote cos( i ) and sin( i ) respectively, and a 2 , a 3 , a 4 , d 1 , and d 4 are constants and depend on manipulator dimensions and geometry.The link parameters are given in table (1).The joint variables are the relative angle between links one and two 1 , relative angle between links three and four 4 , and links two and three extension * d 2 , & * d 3 .

Inverse kinematics:
The inverse kinematics problem concerned with finding the joints variables in terms of the end-effector position and orientation, and it is, in general, more difficult than forward kinematics problem.The more degrees of freedom that the manipulator may have, the more difficult inverse kinematics solution is.Because the current manipulator has 4-DOF, closed form solution that based on analytic expressions can be used [7].Let: .Therefore: and  3) through (7) are the general solutions of inverse kinematics; the practical limitations of the joint variables because of manipulator workspace are shown in table (2).

3-Optical Mouse-Sensor Units:
The HDNS A2051 sensors implemented for this project was chosen due to the availability of the datasheet, as well as the sensors being available in computer mice at the start of the project.The sensors are manufactured with a small aperture on the underside of the chip, which is aligned to a small lens that rests between the sensor and the operating surface.This surface is illuminated by a high-intensity LED, in order to make the features of the surface more distinguishable.This layout can be seen in figure (3).The sensors are generally implemented with a red light source, that varies between a partially and fully on state, depending if movement is sensed under the device.The LED is placed into high intensity mode during movement, which is controlled directly by an output pin of the device.With the surface illuminated, the internal programming of the optical sensor processes the captured pixel data by examining highlights and particular components of the image.By marking particular features in one frame (each captured image is called a frame), and comparing this to additional frames captured after a small increment in time, movements can be calculated by examining the displacement of particular features between the frames.This process takes place within the optical sensor units, and is detailed to operate at 1500 frames per second (fps), with the default resolution of the sensor set to 400 counts per inch (cpi).This gives the sensor the ability to detect movements of up to 12 inches per second [8].The output from the sensor represents the displacement of the sensor between the captured frames which is in the Joint actuator (electrical motor)

Operating voltage (V)
Joint  State 0 is entered after a power up reset.When it detects the object moves in any direction by one unit, it transfers to the next state.So the motion amount of the object can be calculated if the continuous transformation of the state is detected.A corresponding logical calculus of the impulse signal can help to decide the distances between the current state and the pervious state and base on the above theory, the software and the hardware of the manipulator can be designed.Four optical sensor devices have been placed directly to each joint in the four links manipulator and calibrated to give the correct joint displacement.The sensors report the progressive movements as displacement measurements, and the values are reset after each displacement register read.The lens system provides a magnified view of the area immediately under the sensor, making it possible to track and report even the smallest of movements.Figure (7) shows the sensor chip pin configurations.The standard method for  connection of the mice to a PC is via the (USB) or PS/2 connection standards, in this project, the connection to a PC is made directly from the optical sensor chip (figure 8).

4-Circuit Design and Implementation:
System design: The parallel port interface circuit is designed using the DB-25 parallel port connector, shown in figure (9).The parallel port contains the eight data lines D0-D7 as output, five status lines as input, and four control lines as output.The 8 data line bits together with 2 bits of control lines are used for controlling the selection and direction of the actuating motors through ten electrical relays.Four bits of status lines are used to input position information for robotic arm through the use of four optical mouse-sensors and four quad 2-input exclusive-OR gate (74LS86) in the assigned special format as shown in figure (10).An Octal bus transceiver buffer (SN74LS245) is connected to the input digital signal.A power output circuit consisting of NPN transistor is required to translate the TTL level outputs from the digital control logic into required power level for the relays.A block diagram of the over-all circuit is shown in figure (11).Table (2) gives the details about the electrical motors used.For joints one, two, and three.

Hardware design of displacement detection using the optical mouse sensor:
The capture velocity of the optical sensor chip is 1500 fps.As the time of each frame is 667 µs and the minimum state time is 133 µs, up to four states can exist in each frame [8].The maximum motion distance of the optical sensor chip is 12 ips under the condition that no frame is lost.So the linear distance between a state and the consecutive state is: where: P is the maximum motion distance between two consecutive states (ips), F is the number of frames captured each second (fps), N is the time of states changes (state / frame).
Equation ( 8) is used as the basis of distance detection.After the procession of information collected by the optical mouse chip, two pulse signals been output from X 1 and X 2 and the phase between them is 90 degrees.The distance detection can be realized by inquiring about the state changing times and calculating the moving distance.The logical XOR gate operates between X 1 and X 2 signals (for joints one, two, and three) and between Y 1 and Y 2 signals for joint four, the number of logical 1 is half of the changing times of the states (due to the quad 2-input exclusive-OR gate hardware specification).Impulse is counted by a software counter which is convenient to get the changing times of the states.The connection to the PC is made Joint displacements (Optical devices data) 74LS86 OR gates directly from the optical sensor chip, pins 2 and 3 for joints one, two, and three and pins 4 and 5 for joint four, (figure 8).

5-Software Design:
In this project, the controlled software can be divided into two parts, the first part interests in controlling the input signals from the optical sensor devices and determine the measured displacements for each moving joint, while the second part is developed to control the manipulator operation.In both parts, QBASIC has been chosen for the software development.The PC that is used for system control has 2.4 GHz processor, 256 RAM, GIGABYTE motherboard with parallel port address (as LPT1) shown in table (3).

Parallel port
Data (base address) Status (base address + 1) Optical sensor software: Basically the main step in software design for measuring the position of each joint is using a counter for counting the variation in the digital input signal.The input signal has a decimal form therefore it must be converted to a binary form so that the program knows which joint is moving (may two or more joints move at the same time).The next step is counting the variation in each binary number (between 0 and 1) which is equivalent to changing times of the states and using equations ( 9) (appendix B) to calculate the actual displacement for each joint.Using this procedure, the program can determine the displacement of each joint even if the four joints are actuated at the same time.The flow-chart is shown in figure (12).

Manipulator operation control software:
Menu driven QBASIC program is developed to control the manipulator actuators.The desired end-effector position is input to the program, and then the joint variables are calculated using equations (3), (4), (5), and (7).The joint displacements, measured by the optical devices, are used as feedback signals and are compared with the calculated joint variables to determine the error signal.A simple program is developed for this operation because basically the project's goal is to provide further information about the usage of optical mouse-sensor in manipulation control systems and not to design effective control software.To test the software and the system, a task is chosen as follows: the arm should move from a zero reference point to a specific position, carry a bottle full with liquid, fill a glass with this liquid, bring the glass to the programmer hand, and finally go back to the zero

6-conclusion:
A 4-DOF manipulator has been designed and four optical sensor devices have been used as feedback signal transducers.Simple software is developed for controlling the system and the work of the optical sensors using the PC printer port as an interface port.Although, a simple technique is used in connection of optical sensor chips with the PC (without using the standard USB or PS/2 technology), the entire system and software operated flawlessly, and the errors are quite small, therefore it can be said that the optical PC-mouse sensor works very well as a measurement transducer and as a feedback device.With a simple software and a relatively cheep and available device (optical PC mouse), one can get a high accuracy and reliable position sensor which can be used in closed-loop control systems, complex robotic systems, or to measure distance such as measuring material deformation or fluid flow.

Appendices Appendix A
The homogeneous transformations or Denavit-Hartenberg convention between the 4linkages and equation (1) are driven using the procedure found in [10]

4 )
homogenous transformation, here H represents the desired position and orientation of the end-effector, and the task is to find the values for joint variables 1 , 4 , * d 2 , and * d 3 so that H T 0 4 ): Operating voltage and joint displacement limitation form of quadrature format (figure4) gives four output signals x1, x2, y1, y2; with voltage level from 0V (system ground) to 3.3V.The pair x1, x2 indicates the displacements in Xdirection, and the pair y1, y2 indicates the displacements in Y-direction.The reference direction for the displacement results can be seen in figure(5), where movement to the right and upwards are both positive in magnitude, in the same manner as a Cartesian coordinate system.The initial state of quadrature outputs may be arbitrary.The condition of quadrature outputs is renovated one time at the end of frame.While displacement in and direction equals zero, corresponding pair of quadrature outputs does not change.If in each frame displacement is equal to +1 pixel, quadrature outputs will change in accordance with timing diagram in figure (4a), and when displacement is equal to -1 pixel, quadrature outputs will change in accordance with timing diagram in figure (4b)[9].It has two state machines inside of HDNS A2051 which point to X direction and y direction respectively.Each state machine has four solid states, figure(6).

Figure ( 10 )
Figure(10): DB-25 digits format as used for controlling the manipulator operation
Figure (12): Flow chart for calculating joint displacements