Video Tracking Fot Gait Analysis

  • August 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Video Tracking Fot Gait Analysis as PDF for free.

More details

  • Words: 17,750
  • Pages: 52
REHAB Tech- Monash Rehabilitation Technology Research Unit assume no liability for any claim of adverse effects resulting from misapplication of the information presented here in. While every effort is made to ensure the accuracy of the guide no responsibility or liability will be taken for any inaccuracies.

REHABTech is finance and supported by

In collaboration with

© Copyright 1998 All rights reserved. No part of this publication may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopy, recording or any information storage and retrieval system, without permission in writing from the publisher. Requests for permission to make copies of any part of the work should be addressed to: REHAB Tech- Monash Rehabilitation Technology Research Unit C/- C.G.M.C. 260 - 294 Kooyong Road CAULFIELD VIC 3162 AUSTRALIA Email [email protected]

CONTENTS: CHAPTER 1: 1.1

INTRODUCTION

2.1

AN INTRODUCTION TO GAIT ANALYSIS

3.1 3.2 3.3 3.4

OUTLINE OF TOTAL DESIGN STRATEGIES AND IDEAS ASSESSABLE SECTIONS OTHER POSSIBILITIES

4.1 4.2

VIDEO CAMERA SELECTION CAMERA/LENS OPERATION

5.1 5.2

CIRCUIT DESCRIPTION VIDEO SIGNAL EXTRACTION PAL VIDEO FORMAT SCANNING LIMITS AND VIDEO OUTPUT TIMING AND ANALOGUE TO DIGITAL CONVERSION MOTOR PULSE GENERATION AND SAFETY LIMIT SAFETY FOR TROLLEY AUXILIARY CIRCUITS CRYSTAL OSCILLATOR LED POSITION DISPLAY

CHAPTER 2: CHAPTER 3:

CHAPTER 4:

CHAPTER 5:

5.2.1 5.3 5.4 5.5 5.6 5.7 5.7.1 5.7.2 CHAPTER 6: 6.1 6.2 6.3

ULTRASONIC DISTANCE MEASUREMENT BASIC CONCEPT CIRCUIT DESCRIPTION

7.1 7.2 7.3

MOTOR SELECTION AND CONTROL MOTOR SELECTION MOTOR DRIVING TECHNIQUES

8.1

CONSTRUCTION

9.1

CONCLUSION

CHAPTER 7:

CHAPTER 8: CHAPTER 9: CHAPTER 10: 10.1 BIBLIOGRAPHY

UPDATE 18.1.1996

CHAPTER 1: 1.1 INTRODUCTION Bipedal walking, the act of human locomotion and one of the defining characteristics which separates us from the rest of the animal kingdom, has been a subject of study in one way or another ever since mankind first performed the act itself. The high efficiency with which humans can undertake what amounts to be an incredibly complicated mechanical function is reason enough in itself to stimulate study. To appreciate the complexity of the task one must only observe some of the highly advanced, yet still unwieldy attempts that scientists and engineers have made to construct two legged walking machines. Still, researchers in every field find a multitude of reasons to delve deeper into the topic and add to the already enormous volume of data held on the subject. As a few randomly selected examples; • Prosthetists and Orthotists may want to examine a patients’ gait to improve their walking style for greater comfort and function. • A biomedical engineer may study gait so as to construct a muscle stimulator to activate legs left motionless by spinal damage • A chiropractor may study gait to find the source of a patients back pain. • Sports analysts may study a sprinters style to find a faster and more efficient way for the athlete to run. Gait analysis could be a much simpler science if there existed a definable ’normal %DFNJURXQG gait’, but unfortunately there is no such concept. Every human on earth has a slightly different way of walking. The factors which effect our walking are numerous; a persons height, weight, sex, ancestry, mood, state of health and footwear just to name a few. The lack of correlation does not, however, render all data on gait assessment useless even if one style cannot be labelled as ’average’. Patterns still emerge which are common to all gait styles within subgroups, and models can be produced that fit given percentiles of the population. An orthotist does not fit a patient with an apparatus which will conform them to a ’normal’ style of walking, but rather to a gait which is most efficient and comfortable for that individual, and which will not cause further problems in the future. Trying to correct their gait to a theoretical ’normal’ style could cause greater damage. What this project aims to produce is a tool which will enable professionals to 3UHYLRXV analyse an individuals walking style in a way not used before. The first question $FKLHYHPHQW which must be examined is How does one investigate and record someone’s gait? There have been a plethora of qualitative and quantitative inventions to do this since the early 1800’s. Complicated stills cameras, interrupted light techniques, inserted pins, motion film, force plates, pneumatic shoes, glass walkways and electromyographs have all been used, and many more. This project is using a video technique for qualitatively recording an individuals gait during a sequence of step cycles.

Figure 1.1: Example of wireframe plotting Program (Rose P216)

CHAPTER 2: 2.1 AN INTRODUCTION TO GAIT ANALYSIS

%&

 V

3QHXPDWLF VROHV

One of the first (recorded) observations regarding the science of human movement was made by Aristotle around 350BC. He noted that “if a man were to walk...alongside a wall (with a reed dipped in ink attached to his head) the line would not be straight but zigzag, because it is lower when he bends and higher when he stands upright and raises himself” [17] . He went on to describe the transfer of body weight from side to side during walking, and joint flexion and extension. At the time his observations remained just that, but later work in the area tested Aristotle’s theories on the subject, and found them to be accurate. The next notable advancement in human motion analysis occurred in the 1600’s. Around the time that Galileo was formulating his laws of motion, and Newton was gathering inspiration for his most noted work, Principa, which described the basis of modern dynamics, Giovanni Borelli [17] was applying these concepts in a mechanical framework that viewed bones as levers and muscles as forces on those levers. He also defined the location of the centre of gravity for humans. More importantly, at this time it was now possible to test such theories experimentally. Around two hundred years later Wilhelm and Eduard Weber [17] combined their talents (which covered most of the known sciences) to produce some models of physiological motion that were widely acclaimed in the field. Using simple tools available at the time (distance measurement instruments and a timepiece) they made observations such as head displacements, stride lengths, and dimensions of the limbs in differing degrees of flexion. But more importantly than these measurements were the complex deductions they made about this data, resulting in a detailed model of mechanical locomotion. It must be noted, however, that because the available instruments were limited, many of the Weber brothers theories were not based on direct measurements and were later proved to be erroneous in some cases. In the mid 1800’s physiologists began to construct more complicated equipment. A major jump forward in technology took place when French physiologist Etienne Marey and student Gaston Carlet [1,5,17] developed a method of obtaining measurements from the subject without major interference from the scientists. They used a special pair of shoes which had air chambers in the mid metatarsal region, and thus changes in the pressure were able to be recorded on an instrument carried by the subject. Later, Carlet added extra air chambers to the shoes and confined the subject to walk in a circle by using a rotating arm Figure 2.1: Carlet’s device for recording gait using which would hold the pneumatic pneumatic soles and rotating arm (Gamble P205) tubes for recording, and also avail measurements of vertical and horizontal oscillations from any point on the body.

)LUVW 3KRWRJUDSKLF 0HWKRGV

The photographic gait quantifying methods so common today had (as common with many scientific advancements) an unexpected origin. Late in the 1800’s the then governor of California had a bet with a friend that all four feet of a horse were, at some instant, off the ground simultaneously. To prove the bet Eadweard Muybridge [1,17] was hired to gather evidence. Muybridge set up a series of electrical switches which would activate sequentially the shutters in a linear array of cameras, placed at the side of a race track. The resulting photographs won the governor the bet, and Muybridge went on to publish many studies of locomotion using his photographic methods. Marey seized upon this idea and constructed a camera capable of exposing the subject on the same photographic plate many times, rather than using multiple cameras. The special camera rotated the unique cylindrical plate so that sequential images were exposed evenly around the outside of the plate.

Figure 2.2: An example of Marey’s chronophotography method (Rose P206)

0DUH\ V WHFKQLTXH

6WHUHRPHWU\

Problems arose when human walking was to be investigated in detail since the frequency of images needed caused the exposures in current methods to overlap. Marey fixed this by only photographing essential parts of the body, and dressing the subject in dark cloth with white stripes on regions of interest. The resulting procedure provided Marey with plates which showed the succession of white stripes but in which the subject was not visible. Thus a pattern of sequenced movements was recorded. This procedure was termed geometric chronophotography. Although this data was still relatively imprecise, Marey was able to use it to make a basic definition of the relationship between walking speed and energy expenditure. German born Wilhelm Braune and Otto Fischer [17], his student, wished to perform an analysis of human movement by modelling the body as a connection of 12 linked segments. Using cadavers they found the centre of gravity of each chosen body segment, but to complete the study experimental data of the displacement, velocity and acceleration of each segment whilst the body was in motion was required. Thus the pair needed a method to obtain instantaneous spatial measurements in three dimensions. Since the methods used in the past by Muybridge and Marey yielded only two dimensional information, Braune and Fischer modified the geometric chronophotography method yet again, and set up a laboratory that used a new stereometric process. Their version of stereometry used four cameras, two on each side of the subject so that each point on the body was viewable from two perspectives. Using this process each pair of two dimensional points could be transformed to one three dimensional point, and finally the body could be tracked through three dimensional space. This is not as simple as it sounds however; Braune and Fischer made a special plotting table to read the points from the photographic prints and coordinates were recorded by hand. The calculations which resulted took many months to complete. The preparation of the subject was just as important for good results. The volunteer

%UDXQH V HDUO\VWUREH PHWKRGV

was dressed in black and Geissler tubes were used for illumination points that would show up easily on the plates. Geissler tubes consisted of rarefied nitrogen in a small glass cylinder. Current passing through the gas caused it to illuminate and thus the points of light could be strobed electronically to obtain discrete measurements from the resulting prints. Black tape was used to secure these to the body, with only the middle of the tube left uncovered, signifying the anatomical position to be tracked. This laborious preparation of the subject could take up to 8 hours. Fortunately Braune and Fischer gained much from this work. They were able to calculate the length of each body segment, the centre of mass of the body and velocity and acceleration of each joint. Using moments of inertia of body parts (gained from previous cadaver studies) and calculations of inertia of centre of mass of those parts, forces acting on the Figure 2.3: An early stroboscopic flash joints could be computed. Furthermore, the data photographic record. This subject was also fitted with white on these forces enabled the pair to find muscle stripe down the leg for clarity. action present on each segment. (Ghista P140)

,QYDVLYH WHFKQLTXHV

At the University of California [17] in 1945, the Engineering and Medical School wished to undertake an accurate study on movement, focussing especially on the rotations in the transverse plane. In order to study pelvic and lower extremity rotations pins were surgically implanted into the pelvis, femur and tibia of subjects. Using 35mm film and interrupted light techniques in conjunction with two (strain gauge) force plates the team was able to do the most comprehensive study of the time, and the data accrued was invaluable as a basis for comparisons of amputee and various other pathological gaits. The basic ideas that govern modern photographic techniques remain the same as those used in Marey’s times, as do the problems that encumber the procedures. Modern film and video methods have the advantages of faster frames rates and high quality recording Figure 2.4: Example of interrupted light technique. A rotating slotted disc was placed in from of the equipment. Thus with faster image camera and bulbs placed on parts of the lower rates, more accurate data can be lifted body (Gamble P13) from the media. It has been shown in studies [13,18,19] that for a study of walking, 25 samples per second is sufficient for accurate representation, with little difference from data obtained at double this rate. However, this project endeavours to produce a visual record rather than a mathematical one, and for human vision 60Hz is a much more desirable scanning rate. This is exactly what video cameras use, so this media can be utilised safely for the project at normal scanning rates. For the recording of running motion, over 200 frames/sec should be used [19], but in all cases the more frames per second the better. However it must be kept in mind that the data processing overhead also increases with frame speed. The highly respected physiologist Verne Inman [17] used over 400

frames/sec in one early study of walking to achieve great accuracy in speed and acceleration values. Additionally, if a three dimensional study is being taken, then the subject must be shot by at least two cameras simultaneously, although many more (four to six) are often used in practice. More relevant to this project are the various film and video methods that have 6DPSOLQJ been used in the past, and are still used in gait laboratories today. The earliest and UDWH UHTXLUHPHQWV simplest method (but most time consuming) was first used in 1972 by Sutherland and Hagey [17] with 16mm film at 50 frames/sec. Markers were placed on the subject, a reference clock placed in the field of view and a cartesian coordinate grid placed on a wall behind the subject. The film was developed and projected onto a special motion analyser, from which the markers points were recorded by hand. This

0RGHUQ HOHFWURQLF PHWKRGV

tedious recording system was soon replaced by a Figure 2.5: Operator using a computer to enter data points from a motion film. computer with a crosshair cursor that was placed (Winter P26) over the point and automatically recorded the coordinates [9,13,17,18]. Video systems have the advantage of an image that is in electronic form, and thus is more suitable for automatic processing. Early video systems used passive markers (markers made from reflective material) with a light source directly behind or surrounding the camera. Images stored on video tape allowed the operator to mark (using a computer) the points on the digitised image, and these can be stored and processed at will. More recent systems can extract the marking points with little human intervention, such as the result shown below.

Figure 2.6: Example of Computer Gait analysis Program (Rose P215)

Each point is able to be labelled (L.wrist, R,ankle etc) and studied singularly, or with the other sets of points from different joints. These systems can sometimes encounter problems with some pathological gaits, where the motion of one marker may overlap another (such as the toe and ankle markers in the diagram), and the computer may incorrectly assign the point to the wrong joint. These systems usually place stringent conditions on lighting and subject clothing. A popular method is the use of infra red lighting and reflectors, along with the appropriate cameras specially manufactured to record images in the infra red frequency range. This removes the usual problem of ambient light and unwanted reflections from skin, shoes and so forth. The active marker method is also relatively popular. Active markers, most often a group of Light Emitting Diodes (LED’s), flash one at a time in a prearranged order. Thus the computer can tell what marker is being detected by using the time frame, since only one marker will be visible at a time. Another similar method is to use

$FWLYH 0DUNHUV

markers of different colours, and thus anatomical points may be distinguished this way. The use of markers can, however, present problems for studies which require accurate results. Unless the invasive technique used by California University [17] is employed, large errors can be induced by incorrect marker placement. External 3UREOHPV ZLWKPDUNHUV markers will tend to move with the skin and underlying soft tissue[18]; this is a particular problem when looking the knee and hip. Marker placements must be reliable if they are to be to used with repeat testing, and even more so for three dimensional work. If patients require canes, walkers, or crutches for locomotive assistance, this can interfere with the data collection. Any kind of encumbrance to the subject, even passive markers, can cause unease to a patient, and thus their gait pattern will not be the same as if they were walking in their normal relaxed state [17,18]. This is even more pronounced when active markers, ECG devices and/or electrogoniometers (devices which measure the

Figure 2.7 and 2.8: The diagram on the left shows a male wired for ambulatory ECG measurement, with recording box on his waist. (Ghista P129) The right image shows a leg fitted with a typical Electrogoniometer for the knee (Winter P15)

relative angle of limb segments) are required to be affixed to the subject. Fortunately the outline for this project is not to return quantitative data, so small deviation of marker position is not disastrous, and encumbrance to the subject should be minimal.

CHAPTER 4 4.1 VIDEO CAMERA SELECTION The choice of video camera is pivotal to many other parts of the project. Besides the most important features such as size and weight, there are also options involving format, resolution, quality, compatibility and cost. The basic guidelines set before looking at any cameras were that the unit should satisfy these requirements: • Small • Lightweight. These two stipulations are to enable the pulley and motor mechanism to operate as quickly as possible. The greater the weight and size, the more powerful the motor, and the stronger the pulley mechanism will need to be. • Able to be affixed and detached to brackets easily. To allow easy setup and 9LGHR dismantlement of the device. &DPHUD • Colour. Simply for viewing quality. 5HTXLUHPHQWV • Composite Video output. RF output would require extra demodulation circuitry, and since composite output is often available, this added complexity may as well be avoided. • Low voltage supply. The camera will be several meters from a power source, and will be close to a large amount of sensitive circuitry, so mains power is best avoided. The cables needed to supply low voltage power are also lighter and more flexible. • Able to be fitted with a zoom lens ,or any other lens that may be required. Many cameras have fixed lenses. In the future this camera may be needed for many other projects at Rehab Tech, so this modularity will be useful. • Zoom and Focus on the lens MUST be manual. As the camera moves, the distance from it to the subject will change often. Many cameras have automatic focus, motion compensation and zoom (using distance measurement transducers) and these have the effect of blurring rapid movements. This should be avoided. The first cameras investigated were the two already owned by Rehab Tech. They were unsuitable for the following reasons; 1. JVC GR570 This camera is relatively small and lightweight. It is termed a ’handheld’ unit. Unfortunately the lens is fixed, and not capable of large zooms or manual focussing. The zoom and focus are automatic and there is no override. 2. JVC GF51000H This camera had suitable zoom capabilities, and the automatic focus can be overridden. However the unit is large and heavy, as it is mostly used for professional video results. Next some commercial, handheld video cameras were investigated. These had some 3UREOHPV general problems, mostly due to market trends in this area, which made this style of ZLWK unit inappropriate. KDQGKHOG • Very few had external output sockets. Most had direct record to tape only. FDPHUDV • Most had automatic zoom only. Manual zoom override was a rare option, and alway added in excess of $600 to the price of a fully automatic unit. • Few had mounting holes. • All were expensive.

• All models had some zoom capability, but this was always limited, and not suitable for the project’s requirements. Thus investigation was focussed on the so-called ’CCD’ variety of camera. CCD (Charge Coupled Device) actually refers to the sensing chip, which converts the image into electronic signals. It is common now, however, to use the term CCD camera when referring to small, self contained units, most commonly used in closed circuit security situations. These cameras are, in general, small, lightweight, low power and low voltage, and able to take a large variety of lenses. Furthermore, for the security market, a large array of lenses are available. A survey was conducted of locally available CCD cameras, along with their defining characteristics, and these are outlined in Table 1. The columns are labelled as: NAME: Brand name. &&'&DPHUD MODEL: Local model number VHOHFWLRQ COL/BW: Is the camera colour or black and white. FULWHULD POWER SUPPLY: External power supply needed by the camera to operate. (NOT supply voltage of the internal circuitry) COST incl tax: Using sales tax at 22%. COST ex tax: Cost without sales tax as of 30/7/95 CCD SIZE: This is the actual surface area of the CCD sensing chip, which is located behind the lens. The most common sizes are 1/2" and 1/3", where the smaller is a more recent development. 1/4" CCD chips are currently coming onto the market. The CCD size determines the fitting of the lens; a lens for a 1/2’ camera will not fit onto a 1/3" unit. LINES OF RES: Number of lines of resolution on the CCD chip. Regardless of this resolution, the output of their camera is still the standard 625 line format used in Australian Television. The image from the CCD ship is digitally processed by the camera and spread over the 625 lines. VIDEO OUTPUT: Format available at the output socket. 1Vpp PAL is most common and refers to composite output. (Although 1Vpp is always stated on specifications, the actual maximum peak to peak voltage of the signal is 2.2V) Some cameras (Such as the PULNIX) have two formats available. SVHS is SuperVHS, and transmits colour and image intensity separately. Composite format combines the two into one signal, and is the format to be used in this project. SUPPLIER: Local supplier. This is not necessarily the only supplier of a particular camera in the area; simply the ones that were visited. The model decided on was the Jetcom colour camera, in the 1/2" size. This was influenced by the fact that a suitable lens (to be discussed) was available through the same supplier. One of the initial requirements for the optical portion of the project was that /HQV the lens be capable of manual zoom and focus. So there remains the quantitative UHTXLUHPHQWV decision of lens choice. And as CCD cameras and lenses are sold separately, there is little restriction. In the market place, there are four common ranges available in zoom lenses for CCD cameras, and these are identified by their scope of focal lengths. They are • 8-48mm • 8.5-51mm



9-57mm • 12.5-75mm On detailed specifications more useful data is available, the most relevant here are the • minimum object distance • angle of view (horizontal and vertical) By the design in chapter 3, the subject will be no less than 2m away. The smallest region that will want to be focused on will be a single joint (eg; knee, ankle, hip), and the largest is the entire lower body. In graphical form, refer to the figure below.

a 2m

h

From the diagram, a = 0.5(vertical angle of view) assuming camera is oriented horizontally, and not tilted. h = height visible in image if object is 2m away. so a h = 4 tan( ) 2 If the lower body is approximated to be 1.2m in height, then the required angle is at least 1. 2 a = 2 tan −1 ( ) = 33. 3° 4 The minimum viewing angle is less vital, but if the smallest height required is set to be 0.2m, then, from the formula above, the minimum required angle is 5.72°. Thus a zoom lens is required which covers the range of 5.72°-33.3° for the vertical viewing angle. For a 1/2" camera, the 8-48mm zoom comes closest to covering this stipulation in most models. As a typical example, the eventual model chosen has a vertical angle of view range of 5.22°-33.1°, which is satisfactorily close to the theoretical requirement. The models with other focal length ranges may be able to fit more of the subjects body in a wide angle, but not be able to zoom in as well, or alternatively be able to zoom in well, but have insufficient wide angle capabilities, so the 8-48mm focal length is the best alternative. Table 4.1 also outlines a range of available lenses. The columns are labelled as: NAME: Brand name of lens. /HQVVHOHFWLRQ RANGE: Focal length range in millimetres. AUTO indicates automatic iris control FULWHULD (aperture control). MAN is manual aperture, as is required. Auto iris lenses are also significantly more expensive. COST: excluding tax only, as on 30/7/95 SUPPLIER: Local supplier name.

CAMERAS NAME

MODEL

ELMO ELMO COMPUTAR SAMSUNG JETCOM GOLDSTAR JVC (CLONE) PANASONIC PANASONIC PANASONIC PANASONIC PULNIX PULNIX MINTRON PHILIPS

COL BW FC 62B BW CCS324AP COL COL BW COL WVCP412 COL WVCP212 COL WVBP104 BW WVBP312 BW TMC-63M COL TMC-6 COL OS 3511 COL COL

COL/BW

POWER SUPPLY 240V AC 240V AC 24V AC 24V AC 12V AC

12V AC/DC 12V AC/DC 24V AC 12V AC/DC 12V DC 12V DC 12V DC 12V DC

COST incl tax $900 $600 $488 $915 $915 $400 $560 $1,466 $1,069 $830 $1,066 $1,878 $1,854 $1,011 $1,318

LENSES NAME

RANGE

COST

SUPPLIER

KOSMIKA KOWA KOWA COMPUTAR PANASONIC D6x9.5AI COMPUTAR COMSICAR

8-48mm 8.5-51 AUTO 8.5-51 MAN 12.5-75 8.5-51 AUTO 9.5-57 MAN 8-48 MAN 8-48 MAN

600 ex tax 959 ex tax 456 ex tax 559 ex tax 1356 ex tax 445 ex tax 580 ex tax 580 ex tax

COLLINS PHILIPS PHILIPS GEC GEC HADLAND MAINLINE MAINLINE Table 4.1:

COST ex tax $738 $492 $400 $750 $750 $328 $459 $1,202 $876 $680 $874 $1,539 $1,520 $829 $1,080

CCD SIZE 1/2" 1/2" 1/3" 1/3" 1/2" 1/3" 1/3" 1/3" 1/3" 1/3" 1/3" 1/3" 1/2" 1/2" 1/3"

LINES VIDEO OUTPUT 370 370 380 320 420 400 330 480 330 380 570 450 450 380

SUPPLIER

COLLINS VIDEO COLLINS VIDEO 1Vpp PAL MAINLINE SECURITY 1Vpp PAL MAINLINE SECURITY MAINLINE SECURITY CAMVEX CAMVEX 1Vpp PAL GEC 1Vpp PAL GEC 1Vpp PAL GEC 1Vpp PAL GEC PAL/SVHS HADLAND PAL/SVHS HADLAND 1Vpp PAL PHILIPS 1Vpp PAL PHILIPS

,WHPV 3XUFKDVHG

The final choice for the camera/lens pair is: • Jetcom colour CCD camera with 1/2" lens socket. ($750) • Computar 8-48mm zoom lens ($580) • Also a 12VDC adaptor (unregulated) for supply to the camera.($20) These were purchased from Mainline Security Products, Nepean Highway, Elsterwick.

4.2 CAMERA/LENS OPERATION The camera and lens are shown connected in figure 4.1. A VHS video tape is shown alongside for a dimensional reference. Table 4.2 shows some more detailed specifications.

Figure 4.1: Camera and Lens connected together with Video Cassette for size reference

CAMERA Model: CCD: Lens Mount Resolution Power Consumption: Dimensions: Weight: LENS: Model: Focal Length: Angle of view; vertical Angle of view; horizontal Minimum object distance Dimensions Weight: Aperture

Jetcom Super Colour, High Sensitive CCD Camera 1/2" Inteline-Tranfer Type CS - Mount 420 lines 4.5W 51(W) x 43(H) x 128(L) 380g Computar H6Z0812 8-48mm 5.22 - 33.11° 7.44 - 43.31° 1.2m Φ57 x 95mm 430g F1 - F22 Table 4.2: Detailed Specifications

The side controls of the camera are shown in figure 4.2, whilst the rear connections are displayed in figure 4.3.

Figure 4.2: Side view of camera showing (L to R) Shutter Speed, AGC and White Balance.

Figure 4.3: Rear of camera showing video output and DC voltage socket.

The controls mounted on the camera are set in the factory for the best performance, and thus should not need to be tampered with, but for completeness they are outlined quickly here. On the side of the camera the shutter speed (ES), automatic gain control (AGC) and white balance (WB) are situated. The settings should be kept on: ES=6 AGC=ON WB=1 At the rear of the camera are the external connection points. Video output is a normal &DPHUDDQG 75Ω BNC connector, and the 12V supply is a low voltage socket. Also on the rear are /HQV&RQWURO sockets for external sync inputs (when more than one camera is being displayed on one monitor) and automatic iris. These last two facilities are not used in this project and are primarily designed for use in closed circuit TV situations. The mounting of the lens is an important operation. If the lens is screwed all the way into the lens mount on the camera, the expected range of focal points will be unobtainable. Instead, the lens should be screwed in only far enough to allow the

objects in the range of 1.2m - ∞ to be focussed on. This is an iterative process but does not take more than a few minutes. Once the lens is in the correct place, it may be fixed by tightening the hex screw situated on the base of the camera housing. The lens and camera can be left permanently together since there is little reason to remove the lens from the camera when not in operation.

Film and video have certainly been used before, for decades in fact. Commonly the camera (film or video) is static and views a length of a walkway, and records the cycles of gait as the person walks from one extreme of view to the other. Often a marker is (or many markers) placed on the body so that the points may be recorded by computer (automatically or by an operator), which may then produce a wireframe simulation of the locomotion, along which various statistics, as seen on the previous page. Nowadays this is almost standard in any well equipped gait laboratory. There have been some apparatus which have had cameras mounted on trolleys and been pushed by hand to follow and film a subject on the walkway, such as the example below, at the University of Waterloo.

Figure 1.2: Walkway and manually operated tracking cart, carrying both film and video cameras. (Winter 1982, P409)

$LPV

This project aims to combine these last two methods to produce a device which will use a marker as a defining point to follow. That is, the device will aim to keep the marker laterally in the middle of the video image at all times. Instead of just following the person at walking pace and filming the lower body the instrument conceptually will allow the study of a particular piece of anatomy. For example the camera may film a close up of the knee (which therefore is where the marker would be placed) in action, or the ankle, or a suspect prosthetic component in a fitted artificial limb. The most important improvement that will be gained is increased resolution. If the example of the kneeis continued; the knee would still be visible with a static camera, and with the dolly mounted version, but the camera’s frame of reference makes close and detailed examination of the joint difficult. Ideally with this new device the joint in question will appear almost laterally static on the video screen, allowing professionals to observe motion in a more convenient form. The objective of the project is not to provide quantitative information, but rather to improve the clinicians subjective viewpoint of the patient. This qualitative information cannot be measured to rate its success, but feedback from professionals should give an indication of the usefulness of this equipment.

CHAPTER 5 5.1 CIRCUIT DESCRIPTION To make the explanation of the circuit design more readable, it will be presented in sections. The circuit diagram in each section will be shown and then explained, along with a description of the section’s function and relation to the system as a whole. The context of this chapter is such that it is assumed that someone may in the future need to make changes or additions to the system, and thus explanation of the circuit is in sufficient detail to enable this without the party having to refer to a great many external texts.

5.2 VIDEO SIGNAL EXTRACTION This section forms the front end of the system. This is where the video signal from the camera is fed in and the required information is stripped off. The circuit diagram is shown in schematic #1. This section covers the the following material: • Format of video signals used • DC restoration • Buffering of video signal • Colour burst stripping • Line sync pulse extraction • Field sync pulse extraction • Intensing triggering • Contrast Triggering • Target latching First it will be useful to outline the format in which the video signals are presented.

5.2.1 PAL VIDEO FORMAT The upper waveform shown in figure 5.1 is a typical single line of picture information from a PAL video source. (ie a camera, a VCR etc). PAL is the format which is used in Australia, the UK and some parts of South East Asia to transmit television and video information . (Other formats are similar but contain subtle differences) The waveform shown was taken from the output of the CCD camera. 'HVFULSWLRQ RI3$/YLGHR )RUPDW

FIGURE 5.1: Example of a single line of a PAL video signal showing Line sync pulses, colour burst and picture information.

5.4 TIMING AND DIGITAL TO ANALOGUE CONVERSION This portion of the electronic system takes the signals created by the functions described in 5.1 and 5.2, and provides an output voltage proportional to the distance of the marker from the left edge of the screen. An LED display is also included, which tells the operator how many markers are currently being sensed; thus for optimal operation only a ’1’ should be displayed. This section describes a circuit with the following fucntions: • Rouge image noise rejection • Region selection • Target latching • Digital to Analogue conversion • LED display IC10, an 74HC164 8 bit shift register, has its reset pin connected to the inverted field pulse pin (IC6, pin 4), its clock input connected to the line pulse output (IC6 pin 5) and its serial data inputs both connected to the latched target pulse (IC9 pin 3). This means that at the beginning of each field all of the shift register’s outputs are reset to logic low. At the end of each picture line, the value of the latched target (0 8QZDQWHG VLJQDO or 1) is clocked into output Q1, and all other outputs are shifted along one output. The UHMHFWLRQ eight outputs are connected to the inputs of a 74HC30 8 input nand gate (IC11). The output of this gate will only go low when all of the outputs from the shift register are high, in other words, a marker has been spotted on all of the previous 8 lines of the image. This is simply another precaution to exclude unwanted information from the system. Single white pixel’s will therefore not upset the system since the next 8 lines will not contain a marker, and the target information will be ignored. The output of the ,QFRUSRUDWLQJ 74HC30 goes to one input of a 74HC32 OR gate (IC12). IC7:C is a NAND gate VHOHFWHG which conveys information from the region selection (see section 5.2) circuits. The UHJLRQV output of IC12:D will only be LOW when the current line of the image is in the selected region and the option is selected, by setting the switch to logic high. This information is placed at the other input of the OR gate IC12:A. Thus when a target has been found (and is more than 8 lines in height), the current line is in the scanning region and the region select option is switched on, the output of the OR gate will be logic high. IC9:B is a 74HC107 JK flip flop, which is used to finally latch the target )LQDOODWFKLQJ signal once per frame. It is reset at the start of each frame by the inverted field pulse RQWDUJHW (IC5 pin 4) and must be clocked at the exact instant that the marker is detected, not just at the start of the relevant line. This is the reason why the output of IC12:A OR gate is combined with the inverted pulse from the target latch (IC9 pin 2), so the pulse drops at the correct time within the line of pixel’s. Figure 5.7 shows an illustrative example. The camera is looking at a table tennis ball.

5.7 AUXILIARY CIRCUITS This final part of the chapter covers all portions of the circuit not covered elsewhere. These are the 5MHz waveform generator, and LED position display.

5.7.1 CRYSTAL OSCILLATOR This oscillator drives the 12 stage counter which provides the input to the 8 bit DAC. Thus the best level of resolution will be achieved if the 256 levels available are spread evenly across the whole screen. If a time of 45µS is conservatively set aside for a whole line of pixel information, then the required clock rate for the counter is f c = 1 45µS = 5. 68 MHz

256 If a higher frequency is used there is the possibility that the counter will go over 6HOHFWLQJ binary 256, and the DAC will give a false output. The next available alternative is to VDPSOLQJUDWH IRUJUHDWHVW use a 5MHz rate, which is achieved using a 10MHz crystal and dividing the result. The crystal oscillator circuit is shown in figure 5.13. DFFXUDF\

Figure 5.13: Schematic diagram of 5MHz oscillator circuit.

The output from IC7:B is thus a 10MHz square wave. A binary counter (74HC4040) is used as a divider to reduce the frequency to 5MHz.

5.7.2 LED POSITION DISPLAY This module allows the operator to visually determine if the system is tracking the marker as expected. A row of LED’s visually displays the horizontal position of the spot which the circuit is triggering on, thus the user can determine whether the circuit is detecting 9LVXDORXWSXW the marker, or something else in the field of view. RISRVLWLRQ IRUXVHU The unit is detectable from the rest of the circuit FRQWURO board so it can be removed when not needed. The circuit diagram is shown in figure 5.14. The module uses a LM3914 Dot/Bargraph driver. This IC

CHAPTER 6 6.1 ULTRASONIC DISTANCE MEASUREMENT

This chapter outlines the work done on the ultrasonic distance measurement circuits. Originally this was to be a part of the thesis assessment but as more emphasis was placed on the video tracking portion, the time spent on this segment became detrimental to the more important aspects of the project, so research was stopped. However, a stage was reached such that when the rest of the project is completed at a later date, some ultrasonics can be trailed with minimal further time investment.

6.2 BASIC CONCEPT 3ULQFLSOHVRI VRQLF GHWHFWLRQ

8VXDO PHWKRGRORJ\

0\PHWKRG

In air, at 20°C, the speed of sound is 331.6ms-1. If a measurement of the time in taken for a sound wave to travel from a point of emission to a receiver, then the distance between those two points can be easily calculated. This is the basis for all sonic distance measurement instruments. The speed of sound will alter will air temperature, pressure and humidity, but the figure of 331.6ms-1 is adequate for the level of accuracy required here. Ultrasonic frequencies are defined as those above the audible range for humans, about 20kHz. Most ultrasonic transducers operate at 40kHz-50kHz. Rangefinders using these frequencies are commonly used in robotics, industrial equipment, cameras and underwater vehicles. All devices work by sending out ultrasonic waves from a transmitter, then waiting until they are reflected off an object and returned to a receiver (which is most commonly Ultrasonic transducers in the same location as the transmitter) Most rangefinding equipment works in the following way: • Transmitter sends a short burst of ultrasonic pulses • Digital timer starts • Receiver detects returning pulses and stops timer. • Digital count processed further or displayed in distance units. However, the purpose of the rangefinder in this project is to drive a motor so as to keep the inline camera a constant distance from the subject being filmed on the walkway. The motor driving circuits (which will use a Pulse Width Modulation method) will need an analogue input, so converting from analogue pulses, to a digital timer, and then back to analogue output is quite wasteful. This is the reason that this design instead uses a totally analog output method. The new design approach is: • Transmitter sends a short burst of ultrasonic pulses • Voltage ramp starts to increase linearly. • Receiver detects returning pulses and clamps voltage ramp to ground. • Peak detector maintains highest voltage level from ramp (with slow discharge)

CHAPTER 7 7.1 MOTOR SELECTION AND CONTROL This chapter deals with the selection of the stepper motor and the circuits to control it. A large amount of effort was put into designing a stepper motor driver from discrete components, rather than simply purchasing a commercial unit. This chapter outlines the designs that were built and tested, and why they were not chosen for the final design. Eventually a commercial unit was sought, and its operation is also described here.

7.2 MOTOR SELECTION To determine the correct motor to use a calculation of the maximum expected loads must be done. The maximum speed and acceleration can be obtained from gait data.

5HTXLUHG VSHFLILFDWLRQV IRUPRWRU

Figure 7.1: Displacements of hip, knee and ankle over one step cycle [17]

0D[LPXP DFFHOHUDWLRQ DYDLODEOH

Data will be taken from the ankle, since it experiences the highest velocities and accelerations. From experiments carried out at Rehab Tech, the time for one step during a brisk walk was found to be approximately 1 sec. Using the displacement graph in figure 8.1, the gradient at the point of maximum slope is 100cm v= = 2. 32ms −1 1sec × 43% Calculations were done to check the suitability of several motors, but only the chosen model will be included here. The motor is a Size 23 Hybrid Stepper Motor, which runs on a rated voltage of 5V, with phases rated at 1A. The specified maximum step frequency is 880 steps/sec. For a step angle of 1.8° this amounts to ω=4.4rev/sec. For a tangential velocity the effective radius of the gears will need to be v r= = 0. 083m 2 πω The specified torque for the motor is 500mNm, so the tangential force will be τ F = = 6. 01N R Since the camera and lens weigh in total 810g (round conservatively up to 1kg), this provides the moving camera with a maximum acceleration of 6ms-2.

CHAPTER 8 8.1 CONSTRUCTION All of the circuits described were built onto a standard veroboard as commonly used for prototypes. Since it is likely that some modifications will have to made in accordance with later parts of this project, the circuit was not made into a dedicated PCB. Room soon ran out on the first prototype board and was forced to use an IDC connector between the two halves of the circuit. This undoubtedly has introduced noise into the circuit, which will not be present when the system is eventually put onto one fabricated board. The LED position display, optical limit sensors, motor driver and power supply are all separate from the main boards, and connect via plugs. Figure 7.1 shows the first board.

Figure 8.1: First half of prototype board. • • • • •

• • • • • • •

Some features are highlighted: Power in and indicators: Socket for ±5V supply, and LED’s to indicate when power is on. BNC in: Composite video signal input socket. Trigger Select: Switch to select between targeting on brightness or contrast Trigger set: Potentiometer to adjust level of triggering 7 Segment display: Indicates how many spots the circuit is currently detecting. Similarly for the second board; in figure 8.2 overleaf Pushbuttons: to select scanning region Show targets: switch to select whether to display visual targeting information on screen or not. Scan select: switch to select whether to use scanning regions or leave then off. Normal/info : display normal image or overlay scanning regions, targets etc. To motor driver: plug which connects to motor driver board Limit indicator: LED illuminated when optical limit sensors are triggered. BNC out: composite video out.

CHAPTER 9 CONCLUSION The aim of this thesis project was to construct a system which would follow a marker placed on a subject, using a video camera, specifically for the implementation in gait analysis. The system comprised of an electronic control circuit and a mechanical trolley which would be driven by a stepper motor. Unfortunately, motorised testing of the device was not able to be undertaken, due to the unavailibility of the trolley (still being constructed). If the trolley was able to be used then examples of actual tracking of an object, would have been able to be done, rather than simply looking at a voltage output, or the motor turning whilst its shaft is unconnected. However, great progress was made in the electronic circuitry design and construction, which was the main aim for thesis assessment. A list of the major achievements is listed below: • Design of Ultrasonic rangefinding circuitry • Construction and testing of Ultrasonic rangefinding circuitry • Testing and evaluation of commercial Ultrasonic rangefinding module. • Design and construction of Video Signal extraction circuitry • Design and construction of signal processing and display circuitry • Survey of available video cameras. • Survey of available zoom lenses for CCD cameras. • Design and construction of Motor control circuitry • Design and construction of two stepper motor driver circuits • Testing and Evaluation of commercial stepper motor driver. • Design and Construction of 15V, 6A overload protected power supply. • Fabrication of all plugs and cables. • Design of Trolley mechanism. The major part of the project, the design and construction of the circuits which : Accepts video input from the CCD camera • Provides output for video display or recording • Has the user definable option of two triggering methods to track marker • Has a display showing how many markers are currently being detected. • Has a display showing the relative horizontal position of the market that the circuit is detecting • Incorporates a method to reject any small patches of bright pixels on the image • Makes the motor run at a constant velocity when more then one marker is found, or no markers are found • Has user input and visual feedback on screen to define regions of the image which are to be scanned, and those that are to be ignored. • Provide visual feedback as to bright areas on image which are being triggered on. Rejects sudden jumps in marker position • Drives motor at correct speed and direction • Has facilities to stop trolley running off its track, yet does not deadlock the system All of these features were designed by the author and work correctly.

BIBLIOGRAPHY 1. Braun, M (1992) Picturing time : the work of Etienne-Jules Marey (1830-1904). Chicago : University of Chicago Press 2. Chelihi, N and Gaydecki, A (April 1993) A low-cost video-based multiple target digital tracking system. Measurement Science and Technology, Vol 4, pp447-50. 3. Ciarcia, S (February 1986) Build an Audio and Video Multiplexer. Byte, Vol 11, pp85. 4. Ciarcia, S (July 1985) Living in a Sensible Environment. Byte, Vol 10, pp141158. 5. Dagognet, F (1992) Etienne-Jules Marey : a passion for the trace, New York : Zone Books 6. Dolman, P (May 1989) Inside S-VHS. Electronics and Wireless World, Vol 95, pp466. 7. Frerking, M (1978) Crystal Oscillator Design and Temperature Compensation, Van Nostrand Reinhold Company. 8. Howard, P (February 1982) Camera Interface for a Microcomputer. Electronics and Wireless World, pp37. 9. Keemink, G Snijders, C and Hoek van Dijke (January 1991) Upgrading of efficiency in the tracking of body markers with video techniques. Medical and Biological Engineering and Computing, Vol 29, pp70. 10. Kleeman, L (1995) A three dimensional localiser for autonomous robot vehicles. Robotica, Vol 13, pp87-94. 11. Lenk, J (1988) Complete Guide to VHS Camcorder Troubleshooting and Repair. New Jersey: Prentice Hall. 12. Ma, C (September 1994) Direct Adaptive Rapid Tracking of Short Complex Trajectories. Journal of Dynamic Systems, Measurement and Control, Vol 116, pp537. 13. Milner ,M (1981) Human Locomotion: Data monitoring and processingclinical applications. (p123-155) Biomechanics of Medical Devices. New York: Marcel Dekker Inc. 14. Newton, A and Maeder, H (Nov 1991) A TV analogue to digital conversion system. IEEE Transactions on Consumer Electronics, Vol 37, pp829.

15. Omran, S (June 1985) Fast camera interface. Electronics and Wireless World, Vol 91, pp17-19. 16. Perkins, G and Clayton, K (August 1992) A low cost, general purpose S-video, PAL/NTSC encoder. IEEE Transactions on Consumer Electronics, Vol 38, pp512. 17. Rose, J and Gamble, J (Ed’s) (1994) Human Walking. London: Williams and Wilkins. 18. Vaughan, C and Sussman, M (1993) Human Gait: From Clinical Interpretation to Computer Simulation. (p53-66) Current Issues in Biomechanics. Champaign: Human Kinetics Publishers. 19. Wezel ,R (1987) Video Handbook. Melbourne: Heineman Professional Publications. 20. Winter, D (1982) Camera Speeds for normal and Pathological gait analysis. Medical and Biological Engineering and Computing, Vol 20, pp408. 21. Winter, D (1990) Biomechanics and Motor Control of Human Movement. New York: John Wiley and Sons, Inc. 22. Wobschall, D (1987) Circuit Design for Electronic Instrumentation. New York: McGraw-Hill. 23. (May 1988) Motors. Machine Design, Vol 60, pp57-97.

The only minor problem with the circuit is that of some noise in the DAC output. Over a 0-5V signal there is max 40mVpp noise, ie 0.8%. This problem is most probably due to the wiring on the prototype boards, and thus the accuracy of the system will be even higher when the circuit is placed on a PCB. In the current state of the project, as soon at the trolley is readied, the system will be able to be tested, since the video, control, and motor driving portion all operate as designed. The larger design, involving the inline camera, motorised dolly and ultrasonic distance measurement will be undertaken at a later date, but this area has a solid foundation due to the work already done in this report on the ultrasonic rangefinding equipment.

Figure 8.2 Second half of circuit on prototype board.

The final version would also be housed in a box, which would have clearly labelled controls and displays mounted. All components of the system would pug together, thus providing easy storage when the system is not in use.

Figure 8.3: Layout of system

Shown are the two prototype boards, LED position display, optical limit sensors (on end of white cable), camera, and connecting mini coax cable. The motor driver board and power supply are not shown. The design of the trolley to carry the CCD camera was completed early in the year. The construction was to be done by the departmental workshop, but unfortunately the unit has not been completed at the time of writing, even though the request was made in late July. The design for the trolley is shown overleaf in figure 8.4. The dimensions of smaller pieces are not shown as these were subject to component availability in the workshop. The entire construction is to be aluminium to keep mass low. The motor is coupled via gears to a driving wheel. A chain is looped around this and is also connected to the actual trolley, such that it has a travel of 1.3m. This lenght was based on figure 7.1, in chapter 7. Notice the that peak to peak displacemeant of the ankle is about 80cm. An extra 50cm ws added to allow for pathalogical gaits, unusual prosthetic devices and lag time in the dolly following the subject.

150mm

120mm 80mm

The calculation of the gear ratio is as follows: Maximum velocity required, as calculated previously, is 2ms-1, but use 3ms-1 to leave space for any power loss in the device. The maximum speed of the rotor is 1000Hz at 1.8° per step. This is (1000*1.8)/360 = 5 rev/sec. In radians this is 2π*5 = 31.4 rad/sec. The maximum trolley speed is 3m/sec. The pulley is 15mm in diameter, thus the required angular velocity is ω=v/r = 3/.015 = 200 rad/s. Therefore the gears need a ratio of 200/31.4 = 6.36 to obtain the maximum speed. 1530mm 1300mm

ø30mm

100mm

Camera Trolley Motor, gears and pulley

Camera secures here

Nylon wheels with bearings base

Close up of Trolley, End view

The entire frame is to be made of aluminium for weight conservation. The transmission methodwill be lightweight link chain, or plastic toothed wire, strung aroung both pulleys in a continous loop and attached at the camera trolley. At each end there shall be an optical limit sensor (not shown) so that the device cannot damage itself. The wheels will be nylon on bearings, and are angled such that sideways movement of the camera trolley is eliminated. Below is an isometric diagram, showing orientation of camera. (Lower diagram is not to scale)

Figure 8.4: Design of trolley mechanism

7.3 MOTOR DRIVING CIRCUITS As mentioned in earlier chapters, stepper motors require that their coils be excited in a specific sequence for motion to occur. Fortunately there exists integrated circuits that take care of most of this bother. These chips require only the direction and step inputs, and produce logic signals for the four phase outputs. For low power motors, the coils can be connected directly to the IC, but since each phase in the motor being used here can pass up to 1A, external components are required. Circuit #1 in schematic #6 shows such a circuit. The driving chip is UCN5804B, which uses TTL level inputs. Eight MosFets are used to create four inverting buffers, capable of switching the required voltage and current. The reverse )LUVW H[SHULPHQWDO biased diodes are to protect the mosfets against voltage spikes due to inductive FLUFXLW switching. This circuit worked, but the maximum stepping rate achieved was only 300Hz, less than one third of the specified maximum of 1kHz. At higher frequencies the voltage at the coils became chaotic and put the motor out of sequence, when ideally the waveform at the coils should be square. Part of the problem was current drain, so more powerful power supplies were tried . This remedy improved performance slightly but the maximum step frequency was still only around 400Hz. The present mosfets (P channel IRF9520, N channel IRF510) were replaced with new components with lower gate threshold voltages (P channel BUZ171, N channel BUZ71) to make sure that the mosfets were switching properly. This did little 6HFRQG H[SHULPHQWDO to aid the performance. On closer examination of the gate voltages, it was apparent FLUFXLW that the mosfets were indeed not being driven hard enough, even with the new components. Thus circuit #2 (on schematic 6) was constructed. This used a new IC, the SAA1027 which runs on higher voltage levels, but still performs the same functions as the UCN5804B. Thus the mosfets were driven much harder, (since the Vgs is now much higher), and performance increased accordingly. The maximum rate was now 700Hz. Continuing on this avenue of research the lower supply rails of the SAA1027 were made negative, so that the P channel mosfet was also driven harder than before. This also improved performance, but the rotation of the shaft was not smooth at high speeds and the available torque was quite low. After some more experimental circuits, some deeper research into higher performance stepper motors was done. It was found that for better performance a current regulated circuit was needed. That is, instead of simply switching the coils to 3UREOHPV the 5V rails, the circuit also needs to control the current through each coil, keeping it ZLWKGHVLJQ constant. One elementary way to perform this function was trialed, which is to use DQGVROXWLRQV higher voltage with a resistor to drop the voltage down to the motors specifications, but without added control circuitry this made little difference. This technique is called the Unipolar L/nr method, and is described further below. Fluctuation of phase current was the primary cause of the non-performance of the previous circuits. A consultation with Mr Holmes of the power electronics group was made, and he stated that simply with a lack of power background the construction of such a circuit would be impossible. Indeed, it could nearly be a thesis project in itself. Thus attention was promptly turned to the option of commercial motor drivers, which incorporate current regulation, and obtained a RS Unipolar Stepper Motor Driver Board. The board connects using a standard 32 way 41612 socket (as used with Eurocards). The module uses a driving method called Unipolar L/nr drive, and is a one way to obtain some standard of current and voltage regulation. nR is the sum of

external resistance plus winding resistance (R), where n is a real number. By selecting a higher value for n (ie: larger external resistance) and using a higher DC supply to maintain specified voltage and current on the windings, the torque and speed ratings are improved. Coupled with other control circuitry this module provides excellent performance with speed up to 1200Hz (over the motor specifications) and high torque. For the motor purchased, (5V, 1A) at a supply voltage of 15V, the &RPPHUFLDO recommended resistor value is 10Ω, rated at 10W. ERDUG Since the control signals from the system are at TTL levels, whereas the motor VSHFLILFDWLRQV driver runs at 15V, an open collector TTL Nand gate is used to interface the two. This is the 74HC03. The connections to the driver module are shown in schematic 7.

Figure 7.2: View of commercial stepper motor driver board

Also required for the driver is a 15V power supply. A suitable supply was constructed which is capable of up to 6A current, and is overload protected. The circuit for this is shown in schematic #7. The voltage is dropped from 240VAC to 17.5VDC and smoothed, rectified. A 'HVLJQRI three terminal 15V voltage regulator is used (LM7815) to provide the required output. 9$ SRZHUVXSSO\ These regulators are rated to 1A, which is satisfactory according to the motor specifications. However, in practical situations stepper motors can require much higher peak current supply, over 4A in a worst case. Such instantaneous current spikes would cause interruptions in the supply due to the internal overload protection in the LM3815. Therefore a current boosting transistor is used to provide greater current availability. This is P3, a TIP2955. When current through the regulator is over 90mA, the VBE exceeds 0.6V and the transistor switches on, carrying all excess current. Furthermore, to ensure that any accidental short circuits do not damage the supply or motor driving circuitry, a current limiting feature has been included. Resistor R5 sensed the load current being delivered, and when the voltage drop across it exceeds about 0.6V P2, another TIP2955, cuts off the drive current to P3, thus initiating the automatic cutoff in LM7815. For 0.6V to appear over R5, a current of 6A must be sunk. This is enough to cover all requirements for the motor, but will not damage the supply circuit or driver.

The peak of the voltage ramp will be in proportion to the time taken to send and receive the pulses, thus if pulses are sent and received regularly the output of the peak detector will follow proportionately the distance of the object from the transmitter/receiver pair. The block diagram of the basic circuit is shown below in figure 6.1. 40khz generator

pulse timer

ramp

low pass filter

receiver voltage output proportional to distance Figure 6.1: Block diagram of basic Ultrasonic rangefinding circuit

6.3 CIRCUIT DESCRIPTION

8OWUDVRQLF SXOVH IRUPDWLRQ

7UDQVPLWWHU

5HFHLYHU

The circuit diagram for this first prototype is shown in schematic #5. The base ultrasonic frequency is produced by a crystal oscillator and a divider. The crystal oscillates at 5.0688MHz, using a biasing circuit similar to that described in chapter 5. A 4040 12 Stage Binary Counter is used to divide this clock input by 128 (by connecting an output to Q7) which gives an output square wave frequency of 39.6kHz. This is acceptable since the receiver and transmitter being used operate in the range 40±1kHz. The NE555 timer is configured to give an output pulse at a frequency of 4.34Hz, with each pulse going logic low for 0.69mS. This pulse and the 39.6kHz frequency are combined using a 4011 Nand gate. Thus the output of this gate is a 0.69mS burst of 39.6kHz signal. This is enough time to transmit 27 pulses, which is easily enough for the receiver trigger on. The frequency with which the pulses are sent induces a limit on the maximum distance that the device can measure. Pulse bursts are sent at 4.34Hz, which is every 0.23sec. The maximum distance that can be covered in this time is d = 331. 6ms −1 × 0. 23s = 76. 4 m Since the sound must be reflected back, the actual measurable distance is 35.9m, but this is quite ample considering the low power of the transducers restricts their maximum range to about 10m (5m reflected). Spare time after the reception of the pulse is advantageous since rogue reflections (off distance walls, roof etc.) in a laboratory environment can sporadically interfere with the reception of the correct pulses, so these can be dissipated in the extra time before the next pulse is transmitted. The ultrasonic transmitter is driven by a 2N222 transistor. The signal from the ultrasonic receiver is amplified by two 741 op amps. Figure 6.2 shows various waveforms taken from the circuit. The top trace is the pulse output of the NE555, and the next trace is the output of the Nand gate, showing the short burst of 39.6kHz cycles that are produced. Trace three is the beginning of the amplified receiver signal, created by the reflection off an object about 20cm away.

Figure 6.2: Traces from ultrasonic rangefinding circuit. From top: Timing pulse from NE555, input to transmitter, received signal after amplification, and signal after comparator.

From the trace, the delay from the transmission of the pulse, to its arrival at the receiver is 1.2mS. Thus the distance of the object from the transmitter/receiver is 1 d = 331. 6 × 1. 2 × 10−3 × = 19. 8cm . 2 In the first version of the circuit a phase locked loop was used to trigger when the 3KDVHORFNHG pulse appears at the receiver. This PLL was in the commonly used NE567 tone ORRSWULDO decoder, which is capable of a large range of locking frequencies, and has adjustable detection bandwidth. This component can be damaged by supply voltages over 10V, so a LM3808 was used to create a secondary supply of 8V to the PLL and the two preceding amplifiers. The rest of the circuit runs on 12V to obtain the maximum power output from the transmitter, which has a rating of 12V. Components C10 and P1 are used to set an internal reference frequency that the NE567 uses to compare to the incoming signal. This internal frequency is governed by VI 1.1 fo ≈ BW = 1070 (% of fo) f oCX RX CX BW is the detection bandwidth. VI is the amplitude of the input signal, 2.5V in this circuit. In this case fo is set to 40kHz, and the bandwidth is 9.3%. The NE567 takes 812 cycles to lock onto an incoming signal. The circuit performed with the tone decoder, but the output of the circuit was spasmodic, even when the experimental conditions were static. Unfortunately the PLL was not congenial toward the shifting amplitude present in the receiver signal, even if the frequency was constant. Adjustments were made to the receiver amplifier but this did little to improve the performance. At this the necessity of the PLL in the receiver was questioned. The ultrasonic ,PSURYHPHQW receiving transducer only resonates in the 40±1kHz range, so the problem of audio XVLQJ FRPSDUDWRU interference will not be a problem, and the tone decoder is not needed to trigger on the amplified pulse when another device could do the same task by triggering on the voltage levels, and do away with the tuning circuitry need for the NE567. Thus MKII of the circuit used a comparator to produce a suitable output for the receiver. The LM311 (IC4) was used, and the output of this chip is shown as the bottom trace in

figure 6.2. The results from this new design were much more encouraging, so now the analogue timing portion of the circuit could now be developed. For the ramp a simple RC circuit was used, with an analogue switch used to 9ROWDJHUDPS discharge the capacitor and reset the circuit. A very long time constant is used, so that RSHUDWLRQ only the first few percent of the rise time are ever used as a ramp, and this part of the exponential is linear enough to model a voltage ramp. The RC combination is made up of R16 and C11, and using a 4016 Quad Bilateral Switch for the discharge. The 4016 switch is controlled by a 4013 Quad D type flip flop. This uses the starting pulse of the NE555, and the finishing pulse of the comparator to provide a logic low at its output from the time of transmission of the ultrasonic pulses to their arrival back at the receiver. This turns the analogue switch off for this period, allowing the ramp to rise (almost) linearly during this time. Figure 6.3 shows this operation.

Figure 6.3: Traces from the ultrasonic Circuit. from top; start pulse from NE555, output from receiving comparator, voltage ramp, output from flip flop.

2XWSXWRI 8OWUDVRQLF V\VWHP

The top trace is the pulse provided by the NE555. Channel 2 shows the received pulses after being amplified and passed through the comparator. (Note that the pulses are not clear on this channel due to aliasing in the digital oscilloscope at this relatively low scanning rate.) The forth trace shows the output of the D flip flop, thus controlling the period of the ramp, shown on channel three. It is obvious that the longer the delay between transmission and reception, the longer the ramp time and the higher its peak voltage, which will increase by 0.65V/mS (adjustable by R16). This ramp output is buffered by the voltage follower created by a 741 op amp. Finally the output is passed into a crude peak detector with slow discharge via pot R17. This produces a sawtooth waveform, the average of which is proportional to the distance of the closest object from the transducers. This final output could be passed through a low pass filter for smoother results, but this was not done on this initial prototype. This circuit provided better results than the design using the PLL, since the comparator always triggered on the returned signals. However, the range of the device was still no more than 1.0m for a reliable signal output. Further research indicated that these type of transducers inherently have a high Q, and performance can vary greatly over a transmission frequency range of a few hundred hertz, a fact not mentioned in the specifications. A variable frequency generator unit was used to replace the initial 39.6kHz generator, so that performance could be tuned with frequencies around 40kHz. Aswell, new and

higher quality transducers were obtained. This resulted in some extra sensitivity (up to 2m), but the reliability was still insufficient for the device to be incorporated into the rest of the project. It is also important to note that the laboratory experiments were done by reflecting the sonic signals off hard objects such as books and walls. Human 3UREOHPVDQG beings unfortunately are not quite so substantial, especially in a clinical situation VROXWLRQVIRU where subjects are more likely to be donning loose fitting attire. It was at this stage EHWWHU SHUIRUPDQFH that a decision was made to discontinue the development of this circuit in favour of more pressing parts of the project. However a few ideas for further development were entertained, but time will not permit experimental validation of these concepts. These were: • Use a solid reflector (eg: stiff plastic) on the subject to aid reflections. • Separate the transmitter and receiver. The transmitter could be battery powered and clipped onto the walking subject. At the same instant that the ultrasonic pulses are transmitted, an ultraviolet signal could also be transmitted by an array of UV LED’s. The receiver would time from the reception of the UV pulse to the arrival of the ultrasonic signals. This would totally omit the need for a solid reflecting surface, but the circuitry and battery power will make for a more complicated circuit. • Try other ultrasonic transducers available. This last notion was briefly explored when, along with another student, an investigation of a commercial sonar ranging module was carried out. The exact name is the Polaroid 6500 series, and the device contains the a transducer (transmitter and receiver combined) and driving circuitry. The module runs off a 5V supply, and &RPPHUFLDO accepts a driving pulse from the user, at which point it will transmit pulses, process XQLWWHVWLQJ the returned signal, and provide a logic output high when the pulses have returned DQGUHVXOW satisfactorily. Unfortunately the unit requires high current for the period when transmission occurs, of over 2A. For normal power supplies this is too great a drain, and as a result the supply voltage drops instantaneously, resetting the whole circuit. Thus the output is never triggered. Experiments were conducted with more power supplies and smoothing capacitors on the supply rails, but the unit still failed to give correct results. Eventually an idea was trialed which was to bypass a section of the modules circuitry and take a signal (which pulses high when the module senses the return waveforms) directly from a pin on an internal IC. This worked well and is easy to implement, requiring only one external logic IC. The module (costing around $50) offers a high range (we tested to over 7 metres) and good reliability, so this is a good possibility for the remainder of the project to be completed at a later date.

simply transforms an analogue signal into a linear display. Pot P3 is used to adjust the voltage level which corresponds to full scale deflection.

Figure 5.14: Schematic of position indicator circuit

Figure 5.7: Trace showing (from top) pulse after shift register, scanning region, combination with latched target, and final latching for whole field.

Note that this oscilloscope trace covers one entire field. The top trace is the output from 8 input nand gate IC11, showing the set of lines for which the marker is visible. The second trace is the output from IC7:D, showing the region selected for scanning by the user. This has been purposely place so that half of the ball is in the region, whilst the other half is outside, for the purpose of illustration. Channel 3 is connected to the output of OR gate IC12:B, displaying the combination of the latched target pulse, but only where the object is within the selected scanning region. Finally, the bottom trace shows the latched JK flip flop, which remains latched high until the beginning of the next field. The bottom two traces bear closer examination. Figure 5.8 shows more detail of the same example.

/DWFKLQJRQ WDUJHWDW FRUUHFWWLPH

Figure 5.8: Trace showing picture information lines, output of OR gate, combination with latched target and latched JK flip flop.

The top trace shows normal PAL picture information. The location of the ball is quite obvious here. The second trace is the output of OR gate IC12:A; after 8 lines with target latches have been put into the shift register, the output of the OR gate finally goes low (if the lines are within the selected scanning region). The third trace is from the inverted output of the OR gate IC12:B. This combines the latched target pulses, and thus the JK flip flop latches at the instant the target (the ball) is

'LJLWDOWR DQDORJXH FRQYHUVLRQ

encountered. This is vital since the output of the JK latch will be controlling the inputs to the DAC. This latching time is so important because the noninverted output of the flip flop (pin 5) latches binary time information from a 12 stage counter. The counter used is the 74HC4040 (IC13), and the latch is a 74HC374 octal D type flip flop (IC14). The counter is driven by a 5MHz crystal oscillator, and is reset at the beginning of each picture line. The first eight binary digits are fed directly to the octal latch (controlled by the JK flip flop as above), and the outputs from the latch continue to the inputs of the digital to analogue converter. This component is the commonly used DAC0800. From above it can be seen that binary information is latched through once in every field, when a target is found. If no target is detected the latch remains in its previous state, and thus the DAC output remains at the same level until a target is located. The DAC0800 has dual current outputs, so a LM741 is used to convert this to a voltage waveform, producing the final voltage output at pin 6. An example of the output is shown in figure 5.9. The camera is observing the motion of a table tennis ball swinging in front of the camera over a period of 50 seconds. The sinusoidal motion and the exponential decay of the amplitude are quite visible. The fist few periods of motion appear to have equal amplitudes; this is because the ball swings momentarily out of the image, thus the signal appears clipped.

Figure 5.9; Example output of DAC, showing exponential damping of a pendulum.

8VHU ,QWHUIDFH

As mentioned at the beginning of this section 5.3, the circuit includes a 7segment LED display to indicate how many markers the system can detect in the current image. The number found is kept in a binary counter, another 74HC4040 (IC17) which is reset at the end of every field. IC18 is a 4511 BCD to 7-segment latch/driver. The major problem in this part of the circuit is that the latch enable (LE) on the 4511 must be driven logic low (to allow new data into the latch) then high (to lock in the data) before the counter is reset. Since all of the available sync pulses occur simultaneously, some new pulses had to be created. This is where the extended field pulse is used. This longer field pulse is logic ORed with the short field pulse to provide a negative going pulse (used to latch the 4511) which is just after the normal field pulse (used to reset the counter). Figure 5.10 illustrates:

Figure 5.10; From top: inverted long field pulse, short field pulse, inverted short field pulse, result of OR between traces 1 and 2.

The top two traces are the inputs to the OR gate. Trace 3 is the inverted short field pulse, used to latch the data into the display driver. Trace 4 is the output from the OR gate, and resets the binary counter just after the latch has occurred.

5.5 MOTOR PULSE GENERATION AND SAFETY

6WHSSHU PRWRUV

This section of the system takes the signal from the DAC and transforms it into outputs that the stepper motor driver can use. Stepper motors have a number of coils (usually four) which are each externally accessible. The internal mechanics of the motor are such that the phases must be excited in a certain sequence for the shaft to rotate. The advantage of these motors is that each step in the sequence rotates the shaft by a specified amount, thus they are extremely useful for precision work since the position of the end effector is known to some accuracy, but complicated shaft encoders and feedback loops are not required for good results. They are also popular since their design is very compatible with digital control. The motor used in this project has a rotation of 1.2° per step. All stepper motor drivers require at least two inputs to control the motor, step and direction. Often a half/full step option is also offered, where the half step sequence is more complicated but offers better resolution that the sequence of phase excitation used in the full step control. Naturally the faster the steps, the faster the motor rotates. Thus the DAC 0-5V signal output must be transformed into a direction and step output for the motor driver. The dynamic control system will initially be a simple proportional output; ie the further the marker is from the middle of the image, the faster the motor will turn in the opposite direction to correct this. This will certainly have to be improved to a more complex control system, but without the trolley on which to mount the and test camera on, this is a futile task. The signal conditioning is represented in the block diagram below;

DAC signal

LP Filter

Reduction and Offset

Active Rectification

Comparator with Hysteresis '$&VLJQDO PRGLILFDWLRQ

Speed

VCO

Direction

Figure 5.11: Block diagram of signal conditioning circuit

The signal is first put through a low pass filer. This is to reduce the impact of any instantaneous disruptions in the signal, from momentary reflections, the marker being obscured, and so forth. The level has filtering has been carefully selected because if the -3db point is too low, the RC circuit will introduce a phase difference that will effect the dynamic response of the whole system. An offset is then introduced to the signal. The DAC output is 0-5V, but for upcoming parts of the circuit a signal is required that is centred about zero volts, so the offset (which is adjustable) shifts the waveform while degrading it by a factor of two, to prevent clipping. A comparator is then used to extract the direction signal. The offset signal is then rectified (to obtain a speed magnitude) and finally passed to a VCO which produces pulses with a frequency proportional the voltage magnitude. The circuit is shown in more detail in schematic #4. The lowpass filter is made from R18 and C4. The offset and degradation are /3ILOWHULQJ achieved simply using a LM741 (IC32). The zero volts point is now the reference DQGRIIVHW point for the centre of the image, since the speed and direction of the motor are determined by the amplitude of the signal voltage with respect to this point. Thus the variable offset is useful, for the operator can define where on the image s/he wishes the system to centre the marker on. The rectification is slightly more complicated. A simple diode rectifier was insufficient since the 0.6V voltage drop inherent with such 5HFWLILFDWLRQ devices will distort the waveform. Thus active rectifiers were used, made up by IC33A and B, two halves of a LF412 dual fet op amp. This signal is then amplified by IC35, another LM741. The direction in which the motor must turn is determined by the comparator &RPSDUDWRU IC34, a LM311 comparator. Simply, if the signal is negative the motor turns in one ZLWK direction (at a speed determined by the amplitude), and if it is positive it turns in the K\VWHUHVLV other. The comparator is fitted with a 150mV hysteresis, because when the signal is around zero volts, any noise would cause the motor to change direction instantaneously, interrupting the tracking. The hysteresis is induced by R13 and R14. The hysteresis is controlled by the equation VT1 = − L+ VT 2 = − L−

R13 R14 R13 R14

L+ Vt1

Vt2

L-

L+ and L- are the saturation voltages of the comparator (+5V and -5V in this case). Values of R13 and R14 were chosen to be 47K and 1.5K respectively to give a

hysteresis of ±150mV. Since the rails of the comparator are ±5v, the output from pin 7 will also swing between these two rails. Thus transistor N1, a NPN548 is used the restore the output to 0-5V levels. Finally the amplified signal from IC35 is placed at the input of IC36, a LM331 Precision Voltage to Frequency Converter. The output of this component is governed by VIN R9 fo = 2. 09 R11 R7 C1 where Vin is the input voltage at pin 7. In the configuration shown in the schematic,

Figure 5.12: Trace of DAC output, rectified signal, and direction output from comparator.

the range of frequencies available when the input is 0-5V is 1-1200Hz. Over this range the linearity of the VCO is ±0.01% of full scale. Figure 5.12 shows an example of this circuit output. The uppermost waveform is the output of the DAC, created again by a pendulum infrom of the camera. Trace two shows the rectified waveform (not here that the initial signal has been offset so that the zero volt point is at the midpoint of the sinusoid.) The bottom trace shows the output of the comparator, showing the direction changes.

5.6 LIMIT SAFETY FOR TROLLEY It is vital to provide some protection on the trolley mechanism for occasions when the motor attempts to drive the trolley further than physically possible on the track. This is acheived using two UV optical slot sensors, one at each end of the trolley’s track. Rectangles of opaque material shall be placed on the moving trolley, so that when it is too close to either end, the material will enter the slot and interrupt the /LPLWVHQVRUV light beam. These optical devices are available already in suitable packages. The WRDYRLG GDPDJHWR electronics to do this is also shown on schematic #4. Each sensor has its emitter driven WUROOH\ by 20mA, and the collector of the output transistor drives the base of a PNP548 transistor, so that an interruption of the beam causes a positive output from the collector. The two signals from the sensors are fed into an array of logic gates, along with the direction signal, and the speed output. The efftect of these gates is that if the trolley is travelling in one direction and exceeds its limit the speed output is disabled

until the direction input changes, at which time the speed output is once again enabled. Thus if the trolley travels too far along the track, it simply stops and waits until the dirction signal instructs it to go in the opposite direction, instead of simplistically stopping and deadlocking the entire system.

A video picture is made up of 625 lines, but to save bandwidth they are transmitted alternately, in two sets called fields. Every second line is transmitted in one field, then the remaining lines are transmitted in the next. (These are also called the odd and even fields) Since the interleaving lines are still transmitted at 50Hz, and due to the persistence of the phosphor screen, our eyes cannot perceive the difference. Thus each field contains 312.5 lines of pixel information. To enable the television monitor to correctly place the picture, the source generates various pulses to synchronise the electron guns in the picture tube. Before each line of picture information there is a line synchronisation pulse which &RORXU instructs the electron gun to turn off and sweep to the beginning of the next line of WUDQVPLVVLRQ pixels. Also present, just after the sync pulse (in a region called the ’front porch’) is a PHWKRG short sequence of pulses called the colour sync burst or chroma burst. This series of 8-10 cycles is used in colour televisions to help decode the chrominance (colour) component of the signal. It is actually at a very high frequency (many MHz) and so is not clear on this trace. The colour component of the picture signal (which is transmitted at the same time as the intensity information) is phase modulated at a frequency over 4MHz, and the colour burst is needed to provide a reference phase at the beginning of each line. After the colour sync burst is the picture information, which takes up about 40µS of the 65µS period. The magnitude of the picture waveform determines the intensity of the pixels at that point along the line, ie. a higher voltage produces a bright pixel. There is also colour information in this section of the signal but again it is at very high frequencies, so is not visible in the diagram.

FIGURE 5.2: Trace of PAL signal showing lines of Picture information and start of the Field Sync Pulses

After the 312.5 lines have been displayed on the screen, the video generator tells the monitor to return to the top of the screen by transmitting a series of short pulses. This is shown in figure 5.2. (Note on the left side there is half a line of picture information at the end of the last field. The next half is at the beginning of the next field) This section of the signal is called the field synchronising pulses. After this group of pulses has been sent, the next 312.5 lines of picture information in the next field are transmitted. Now the scheme is continued to extract this information in a useful way. It is required to somehow distinguish the anatomical marker from the rest of the picture, and there are two way that have been implemented to do this.

0DUNHU 'HWHFWLRQ PHWKRGV

,QSXWVLJQDO FODPSLQJ



The first is to assume that the marker is the brightest part of the picture. Since there is a signal which has a voltage level directly proportional to luminance (picture intensity) a voltage comparator can be used to pick up the bright parts of the image. The operator will be able to adjust the sensing level of the comparator to the correct level, so that the marker is detected but the rest of the picture is not.



The second scheme is to detect changes in pixel intensity. By differentiating the video signal the rate of chance of picture intensity can be determined. This works on the assumption that the marker will be in contrast with its surroundings. For example, a white marker on a dark background, or a black marker on a fair background. This also creates the possibility of using a marker in a bullseye format (right). The marker itself will provide a very high group of contrasts, and the result is also independent of its orientation (a problem that a chequered marker would have) Again the minimum rate of intensity change that the comparator should trigger on will be manually set by the operator.

Since information is being extracted via voltage levels from the video input it is important that the signal be in reference to a selected level, or DC in other words. The problem with video is that it is inherently an AC signal, and thus, depending on the magnitude of voltages in the signal, the waveform will shift with respect to the shielded ground. Appropriately the first components in the circuit solve this problem in a commonly used way. C1 and D1 form a DC restorer (also often termed a clamped capacitor). The 47pF capacitor charges to a voltage equal in magnitude to the most negative peak of the video input signal. The diode stops conducting and the capacitor retains its charge. Thus, if the capacitor is charges to a voltage of Vc the waveform will be shifted up by Vc volts. The most negative part of the waveform is shifted to zero volts, thus the signal is clamped to zero volts, which is why the process is called DC restoration. (Note that in reality the signal is clamped to a voltage about 250mV below ground, due to capacitor charge leakage and the voltage drop across the diode.) The video signal is then buffered to make sure that the camera is not loaded by the circuit or effected by accidental short circuits, voltage spikes etc. The device chosen to do this job is the LM310 voltage follower, because of its low input current requirements, high bandwidth (20MHz) and low cost. (around $3 while specialised video buffers cost around $20). The bandwidth requirements for colour video signals are less than 5MHz.

FIGURE 5.3: Multiple trace showing video signal, signal after processing, and extracted line sync pulses.

&RORXU 6WULSSLQJ

5HPRYDORI /LQHV\QF SXOVHV

5HPRYDORI )LHOGV\QF SXOVHV

Since the colour sync burst and high frequency colour signal detracts from the basic intensity levels that are to be examined, the video signal is low pass filtered to remove this unnecessary information. The simple RC filter made up of R14 and C8 can be adjusted to filter the chrominance information, which is at a frequency of 4.43MHz. The DC restored picture signal and the filtered signal are shown in figure 5.3. (top two waveforms). This filtered signal is only used in the target sensing; the sync pulse extraction uses the unfiltered video signal. The line sync pulses are extracted by IC2, a LT1016 Ultra Fast Precision Comparator. The response time of this comparator is around 10nS, which is adequately fast for our purposes. The potentiometer P1, connected to the noninverting input, is adjusted so that only the sync pulses trigger the comparator output, not the picture information. Note that the voltage available from P1 is from 5V to 0V, not from 5V to -5v, since it is known that the waveform is totally positive now that it has been clamped. To ensure that the output pulses from the comparator are always the same width and suitable for other digital parts of the circuit, they are shaped by a 74HC123 Dual Retriggerable One Shot (IC5:B). Many of these versatile blocks are used throughout the circuit. The duration of the output pulse of the 74HC123 is set by the RC combination according to: Tw = KR x Cx where Tw is in nS, Cx in pF, Rx in KΩ and K=0.37. Thus, in this case there is a period of 2µS. Note that this does not mean that the resulting pulse is 2µS in duration, because the monostable is retriggerable, the pulse will continue for a further 2µS after the output of the comparator has gone low. Since the length of the line sync is about 5µS the final pulse will be approximately 7µ S long. Notice that complementary outputs are available on the monostable IC. The resulting line sync pulse is shown as the bottom waveform of figure 5.3. The formation of a single field sync pulse is not quite as straightforward, since in the video signal they are identical in shape and magnitude to the line sync pulses. Advantage is taken of the fact that they have smaller periods. This is accomplished by using an integrator and a comparator fitted with a hysteresis. The integrator is formed by R3 and C2, and has a period of 47µS. When the ordinary line sync pulses are encountered, the integrator simply produces a sawtooth waveform, but when the

pulses become closer together the integrator causes a culmination of voltage for a short time. This can be seen in figure 5.4.

FIGURE 5.4: Waveforms from top to bottom: Field synchronisation pulses, integrator output, resulting field sync pulse from monostable..

,QWHQVLW\ VHQVLQJ

&RQWUDVW VHQVLQJ

The pulse is sharpened and made more friendly to digital processing by IC4, a simple LM311 comparator (IC4). The hysteresis has an upper trigger point of 3V and a lower point of 2.5V. This range is slightly adjustable by use of potentiometer P3, which should be tuned so that a clean, single pulse is obtained at the output of the comparator. This pulse is sent to a 74HC123 (IC5:A) which creates and output pulse of 30µS. Note that a similar pulse is created by another monostable (IC6:A). This has a special purpose, which will be elaborated on later. This component shall be ignored for now expect to note that it produces a pulse shorter than the other. Now attention is turned to the target sensing. As mentioned before, there are two schemes available to detect the presence of the marker in the image. The SPDP switch S1 chooses between these two options. The first option (triggering on intensity) connects the filtered video signal straight to the noninverting input of IC3, another LT1016. This high speed comparator triggers when the signal amplitude rises above that set by potentiometer P2, signifying that a bright spot has been located. P2 is set by the operator to a voltage at a level that will detect the marker sufficiently, but not low enough, so that other objects or ambient light will trigger the comparator. The output of the comparator is connected to the input of another monostable (IC6:B) which produces a pulse of duration 0.8µS. The second option is the differentiated signal. IC10:A, a LM347 quad opamp is configured as a differentiator by the RC combination of C9 and R2. The output is dV Vout = − RC in dt The following opamp (IC10:B) is used as an inverter to get the signal in the format required. This resulting waveform is placed at the input of the LT1016 comparator as before. Figure 5.5 shows (from top to bottom) a line of picture information, the differentiated and inverted signal, and the resulting output from the monostable when P2 is appropriately set.

FIGURE 5.5: From top to Bottom; Filtered PAL signal, differentiated signal, target pulses, latched target pulses.

Note that the target pulses (the output from the monostable) are many and bunched together where the comparator triggers repeatedly. This ’bouncing’ is not a problem since the target pulse is latched by IC9:A. This latch is made from a 74HC107 Dual JK Flip Flop with Clear. The latch is reset at the beginning of every line by a line sync pulse from IC5:B, and if a target pulse is sent by the output of monostable IC6:B, the flip flop remains latched until the beginning of the next line of picture information. The output from this latch is shown on the bottom of figure 5.5. The reason for this latch will become apparent in later circuit sections. It is important to note, however, that this latching of the target pulse means that any further target pulses on the same line will have no effect on the latch, and thus are ignored by the circuit. This causes the system as a whole to search for the brightest mark which is the leftmost and highest on the screen, because the circuit if alway scanning from top to bottom and left to right.

5.3 SCANNING LIMITS AND VIDEO OUTPUT This section of circuitry contains most of the operator controls and the video output, which can be sent for recording or direct viewing on a monitor. The circuit diagram is shown overleaf in schematic #2. Note that the video signals from the output of this circuit (or the camera alone) cannot be seen directly on a television set, because they are in a composite video format. This means that video and audio &RPSRVLWH YLGHR signals are separated (so two cables are needed for image and sound, but this is not UHTXLUHPHQWV applicable in our case since audio is not required.) and are not modulated. Because standard TV sets require a RF input, the video output from this circuit will need to be put through a VCR (a model able to accept composite inputs) which will convert to RF signals. Alternatively, some modern television monitors will accept composite signals directly. It is apparent which monitors and VCRs accept composite signals by the existence of separate video and audio input plugs at the rear. As mentioned in chapter 3 a method is needed to select a region in which to scan for the marker, so that other bright objects in view do not effect the operation of the system. This piece of electronics enables the operator to select the scanning region, choose whether to display the scanning limits on the screen (or whatever

5HJLRQ FRXQWHU

output is used) and whether to show targeting information on the screen. (This last option will be explained shortly) In point form the circuit areas covered are: • Pushbutton pulse generation • Region counting • Toggle output • Display method for monitor • Output buffer • Visual targeting information The scanning region will be selected by two push buttons, which will change the upper and lower limits of the region. It should be pointed out that the term ’scanning region’ does not mean that outside of this region the target comparators and monostables do not operate, it means instead that any target pulses triggered outside this region will be ignored (as long as this option is selected.) Each push button is connected to a NE555 timer (IC22 and IC23), configured as astable multivibrators. When a button is pressed the corresponding timer will produce a square wave output with a frequency of around 7Hz. The frequency is determined by the equation (for IC22): 1. 44 f = ( R1 + 2 R 2) C1 This square wave is sent to the clock input of half of a 74HC393 Dual Binary Counter (IC24) . IC25 is a 74HC4040 12 Stage Binary Counter . This counter has its clock input connected to the output of the line pulse monostable, and its reset input to the output of the field pulse monostable. Thus it keeps count of the current line number, and is reset to zero at the beginning of every new field. The next components of interest are two 74HC85 Four Bit Magnitude Comparators (IC26 and IC27). These accept two four bit words and produce an output which indicates whether input word ’A’ is less than, equal to, or greater than input word ’B’. Each magnitude comparator has its ’A’ inputs connected to one of the 74HC393 counters, and its ’B’ inputs connected to four outputs of the 12 Bit Counter. Since the 74HC393 is only a four bit counter, only 16 different states can be moved through before it repeats, and thus the screen can be split into 16 sections at the most. So, although there are 312.5 lines (the 4040 counter will count to 313) the circuit only needs to count from zero to 16 (or less). Thus the outputs used on the 74HC4040 are Q5-Q9. The Q5 output will divide the output by 25=32, and 313/32 = 9.78. So now the circuit has a counter which counts from zero to nine as the pixel lines are transmitted, and two counters that can be set at any number between zero and sixteen. Further explanation will be made easier in the form of an example, using decimal numbers: Consider the case where counter IC24:A has been set to 2, IC24:B to 7, and IC25 counts from 0 to 9 as lines are transmitted as usual.

3XVKEXWWRQ RSHUDWLRQ

IC24:A

2

A B =

count 0-9

([DPSOHRI RSHUDWLRQ

toggle output

B = IC24:B 7

A

IC28:A is a J-K Flip Flop wired in a toggle configuration, so that a positive pulse sets the output, and the next pulse resets it, and so on. Initially the line counter will be zero, and the toggle output will be low. As the counter progresses, it will reach ’2’, and since this is also at the output of IC24:A, the comparator ’=’ output will go high. The OR gate is IC12:D, a 74HC32. The output of this will not go high also, and cause the toggle output to go high. The line counter will continue, and the comparator output will go low again, but the toggle output will remain high. Finally, when the line counter reaches ’7’, the equality output of the lower comparator (IC27) will go high, and thus the output of the OR gate also. Since the output of the toggle is currently high, it will now go low. The line counter will continue counting until the end of the frame, where it will reset, and exactly the same will happen for the next frame. So, between the chosen numbers (2 and 7) the output of the toggle is high, and low elsewhere. And since the two counters can be set by using the push buttons, a region of the image is now able to be selected. Note that neither push button is actually assigned to ’upper limit’ and ’lower 3RVVLEOH limit’ because if, in the previous example, the IC24:A had a value of ’7’ and IC24:B LPSURYHPHQWV had a value of ’2’, the outcome would be exactly the same. So effectively the region starts at the value of the lowest counter and finishes at the highest value. One side effect of this scheme occurs when both counters are of the same value. Thus the input to the toggle is only high once per frame. Thus the output of the toggle is high for an entire frame, then low for the next, and so on. The number of regions available in the image could be increased by simply using 8 bit counters and comparators instead of the 4 bit components used on this prototype board. If a PCB is produced then the chance would be conceptually easy to implement. A solution to the above side effect (when both counters are equal) is to use an XOR gate instead of an OR, thus the toggle input will not be triggered when both equality outputs from the comparators fire at the same time. Again, this would be easy to implement if a PCB was manufactured, but is not a high priority on this prototype. The next part of this circuit displays this region of the screen so the user can see exactly what parts of the image are to be excluded from targeting. The output of the toggle is sent to one input of a 74HC00 Nand gate (IC20:A). The other input is connected to pin 5 of IC5:B, which is the line pulse monostable. Thus the output (pin 3) of the nand gate goes low for a brief period at the start 0HWKRGWR of every picture line that is in the selected scanning region, but not for lines that are GLVSOD\RQ outside this region. This output triggers a 74HC123 monostable, which has a pulse RXWSXW PRQLWRU length adjustable from 0-120µS. To change the appearance of the video image, three 74HC4066 Analog Switches are used (IC30:A-C). These bidirectional switches have a sufficiently low ’on’ resistance (105Ω max) and fast switching speeds (40nS max). It is required that the inside and outside of the scanning regions be distinguishable, so it

was decided to make the outside of the scanning region darker than the inside, but with the image still visible. When inside the scanning region (the output of the toggle is high) the 75HC123 monostable will produce a pulse starting from the at the beginning of every line in that region. The length of this pulse is adjustable, and it is required to be equal in length to the whole 40µS of picture information. This positive pulse (from pin 5 of IC29:B) will turn on analog switch IC30:B and thus connect the normal video signal (from the input video buffer) through to the output video buffer. Assume for the moment that analogue switch IC30:C is turned on. When outside the scanning region, the complimentary output on the monostable is high, and thus switch IC30:A is turned on. The signal input to this switch is a potentiometer which provides a signal proportional to the input video signal. That is, the signal input to the switch can be varied linearly from zero volts, to the full video signal. Remember that since the picture information has a voltage proportional to intensity, the closer to zero volts the signal is, the darker the image will be. However, if the signal is depleted too much by potentiometer P1, the VCR/monitor will no longer be able to decode the image, since the line and field sync pulses will also be diminished. The output of this analogue switch is again connected to the output buffer. So 2XWSXWYLGHR now the system creates an image with dark regions outside the scanning region, and EXIIHU normal image inside. The output buffer (IC31), like the input buffer, is a LM310 voltage follower, connected to a BNC female socket. The third analog switch is used for showing targeting information on the screen. That is, the graphically display exactly where on the video image the target pulses are being triggered. This is very handy for the operator, since now they do not 9LVXDO need to guess what the system is following, they can now visually see what parts of WDUJHWLQJ the image are being triggered, and adjust the comparator levels accordingly, so that, in LQIRUPDWLRQ conjunction with the scanning region, only the required marker is triggered on. Figure 5.6 ,over the page shows an example.

The top image is the normal video frame, showing a bright object, and a table tennis ball pendulum. The second image shows the output when the targeting information is overlayed. The this is done by simply switching off the video signal for the instant when the target pulse is high. So the input of the third analogue switch is connected to the inverted output of the target pulse monostable (IC6, pin 12), and this puts a dark spot on the screen whenever the monostable is triggered, and the user can visually see where the circuit is detecting bright spots. The next is an example of a screen with a scanning region selected, so as to exclude the upper bright object, but still allow the circuit to track the ball on its trajectory.

Figure 5.6 Sequence of frames showing two bright objects, target marking, and region selection

Related Documents

Gait
August 2019 32
Video Self-analysis
December 2019 11
Gait-phases.pdf
December 2019 23
Tracking
November 2019 34