Report for JSRD Scholarship 26th Jan to 7th March 1998
Designing and Application of Environmental Control System for severe physical disability Kevin Gallagher
IntroductionPersonal background
My own educational and work experience background is one of engineering and electronics specialising in Analog IC design. After over 10 years in industry working as an engineer, I moved to Taiwan where I now work in a recently established centre for rehabilitation assistive technology. I also spent one year in industry in Taiwan in addition to two years as a volunteer in a centre for mentally retarded children. After 8 years, I consider Taiwan my home now and plan to remain there for many years in the area of rehabilitation engineering and assistive technology. It is my hope that in the future some native Taiwanese engineers will participate in the field of rehabilitation technology and that we can develop a base of expertise and manufacturing in Taiwan.Reasons for scholarship application
Our centre in Taiwan is only around three years old and one of the first ones to actively promote the use of technology to assist the disabled. During the past three years we have designed several technical aids to assist the disabled, but need to research the area even more if we are to increase and provide more efficient services to our disabled friends in society. Therefore our centre and myself were very pleased to receive this award and we hope both our contributions will lead to the enhancement of the quality of life for disabled people in both of our countries.Research Contents
The motivation behind these projects is because the price of many assistive devices is too high. Many disabled people do not have access to technology simply due to lack of funding and for this reason I feel that effort should be made to design simple, practical and low cost technical aids. As all homes in Taiwan possess a telephone, TV and other electrical devices one of the best areas to introduce technical aids is with a simple Environmental Control System or ECS. In addition the recent profusion of PCs into the home market makes any form of alternative mouse control a benefit to the disabled. It was for these reasons that the following two practical projects were decided upon. In addition the following factors were taken into account in choosing the projects:
1. My own electronic and programming experience
2. The experience of the YRC in application of technology
3. The design of practical systems and not theoretical or technically interesting systems
4. Low cost
5. Practical cases in Taiwan which could benefit from this workProject #1
Introduction
This project was chosen as I have some experience in the design of several simple ECS systems for electrical devices and TV control, but wish to improve on their design. I also know of several cases of quadriplegia in Taiwan which I would like to assist by using a multi-function ECS system. Of special interest is to incorporate telephone control into these systems, something I want to investigate here. To keep costs low and flexibility high, an 8-bit microcontroller will be used as the core of the system. The research work undertaken for this ECS was based around the following factors:
1. The design of a practical system not a theoretical system. The design must be one which can be manufactured and suitable for use in Taiwan where at present no systems exist.
2. Low cost. If the system is not low cost then very few people will utilise it.
3. Modular design giving flexibility
4. The system will utilise readily available remote equipment if possible to minimise design effort and reduce costsBefore beginning actual design I consulted the library of the YRC and was fortunate to find a paper in the IEEE Transactions of Rehabilitation Engineering (1) dealing with the implementation of ECS. In this paper statistics were gathered from 5 practical users in the US, the results of which will be used as a basis to specify the system designed for this project. One item continually highlighted was the users emphasis on telephone access and TV control and the ability to call for emergency help. After this comes the control of other electrical devices such as fans, lights etc.
System Design
Wherever possible the system will use already available electronic devices, to reduce cost, improve reliability and improve appearance. These ready made modules are:
1. Two channel electrical appliance remote control devices. Uses radio frequency transmission so is non-directional. Two of these will be used giving 4 channels. The cost of each two channel device is around 2,800 yen. They normal hand held remote can be simply interfaced to the microcontroller using a PNP transistor as the inputs are active when pulled high.
2. Programmable infra-red TV controller. Allows any TV to be controlled from single hand held transmitter. Cost around 2,600 yen. The interface is a keypad. To interface to the microcontroller 5 small reed relays are used.
3. Remote alarm call. Radio controlled. Cost around 6,000 yen. Interfaced to the microcontroller using a PNP transistor.
4. Standard low cost telephone, cost around 4,000 yen.The other interfacing and control electronics will be designed around a Holtek 8-bit OTP microcontroller. This controller is available in Taiwan at low cost and has a development system which is familiar to the author. However there are many equivalent controllers from other manufacturers, such as Microtek, that are equally suitable.
Telephone Controller
Telephone adaptations are perhaps easier in Japan due to the availability of an excellent switch controlled speaker phone. In Taiwan the situation is less favourable so the design here has to be through the modification of an existing phone, using external dialing semiconductor devices and an on-hook/off-hook relay. To simplify this initial design, though limiting the application, it was decided to use a memory dialer IC, though this limits the user to only being able to dial out the numbers already stored for them in the dialer. The design will center around a Holtek telephone dialer chip which will be used together with a standard telephone and amplifier to provide a single switch speaker phone application. The telephone dialer circuit diagram shows that only two connections are required into the standard telephone, this is the connection across the on-hook switch.
Display
The choice of display was chosen to be two 7-segment LED types. One is used to select the device to be controlled, e.g. TV, telephone etc. and the other LED is used to select the device function. The reason for choosing 7-segment displays was due to engineering and construction simplicity and low cost. The other advantage is that they require a minimum of logic lines from the microcontroller. Discussions with Mr. Takuro Hatakeyama indicated that the best display is an LED array with a written chart, however for less than seven functions, 7-segment displays are acceptable, however are really only suitable for younger people.
The display functions will take the following format:
Control or Input Method
Two methods were considered for control, single switch or double switch control. Again informative discussions with Mr. Takuro Hatakeyama gave the general rule that for less than 10 devices it is OK to use single switch control. Two kinds of single switch input control though are offered, the choice being made through an external jumper:
1. Auto Scanning. Here the user selections are scanned automatically at a fixed rate by the microprocessor. When the desired choice is reached the user presses the switch to activate the function.
2. Manual Scanning. Here the user scans the various functions manually using the switch. A short switch press activates the scanning and a long press selects the scanned choice while a very long press activated the alarm.Both scanning operations offer an emergency call function, where the user by pressing the switch for a period of longer than 3 seconds, will activate the alarm. In single switch manual mode operation, three distinct signals are given by the switch, depending upon the length of time the switch is pressed. The timing and circuit diagrams together with microcode flowchart given at the end of the report gives more details.
For manual scanning the following timing diagram applies:
Project enhancements
Every design can be improved upon. In this case, time was a limiting factor putting limitations on the design functions. An example of this is the telephone dialer which can only dial out pre-stored numbers. After prototype development has been accomplished and the basic design and manufacturing problems solved the following enhancements will be made:
1. Permit free dialing of telephone, not only pre-stored numbers
2. Incorporate LCD display to show dialed number
3. Auto-mute function on TV when telephone dialing
4. More channels for telephone memory dialing
5. Standard display interface to allow users to chose different display types
6. Variable auto-scan speedProject #2
Introduction
In the developed countries, computerisation continues to increase. The reduction in price of hardware, availability of cheap or free software, easy access to the internet and low cost email communication has seen the computer move from the specialilsed office or industry tool it was several years ago, to a normal household item. However to many disabled people who also have a right to the benefits of computer technology, the standard keyboard and especially the mouse present many difficulties. For this reason, any efforts to design low cost alternative input methods are always useful.Why a Joystick Mouse?
Already several products are available that allow emulation of the mouse. The limitation here is that only 4 or 8 directions are offered. However if an analog joystick could be used as a mouse emulator then a greater freedom of movement could be offered. The other advantage is that many cheap joysticks are now available in many shapes and forms, offering flexibility of input method at low cost and without the problem of finding a suitable package or box to house the input device and electronics. I know of no commercial product that can offer joystick emulation so any development time here will not be wasted and will be of benefit to both our countries. The other reason was that in respect to the disabled people we are trying to assist, my own desire is to only design items that are of immediate practical use and can be made at low cost.
Difficulties
The special difficulty in such a design is because joysticks are analog devices using resistors for their positional sensing, so some means has to be found for analog to digital conversion. In addition, as an analog device there are difficulties in determining if the joystick is not being moved because the resistance of the joystick X and Y potentiometers will not always be at a constant value. Both of these problems will be addressed in this project.
System design
General
The system again was chosen to operate around a low cost 8-bit microcontroller. The flexibility, low cost and availability of these devices make them very attractive for many designs within the field of assistive technology. In addition the microcontroller will be able to implement the analog to digital functions using an internal counter while keeping external components to a minimum. The calculation of a dead band or point of zero movement of the joystick should also be able to be implemented using microcode.First Method
Two systems were considered. In the first one, the microcontroller directly drives the RS-232, PS/2, or USB port on the PC, updating the X and Y co-ordinates of the mouse pointer directly and sending these to the PC port in the correct serial format. The diagram shows the block diagram for an RS-232 serial port PC system. Note that different configurations apply for PS/2, USB or the Japanese NEC mouse system.
Second Method
The second method is to utilize a microcontroller and a mouse chip. In this case the microcontroller will simulate the mouse opto-coupler inputs only. There are several advantages in this technique:
1. The PC/mouse communication protocol is handled within the mouse IC, eliminating the need to write code for the serial port
2. Mouse switch function is handled within the mouse chip, again simplifying the microcode.
3. Standard microcode can be written for both RS-232 and PS2 mouse systems as the choice of mouse chip will handle the relevant PC communication protocol.Again the configuration shown is for RS-232 controlled mouse systems, requiring special power supply generation. For PS2 systems a 5V power supply is supplied by the PC. This second method was chosen mainly because of reason 3) given above, i.e. because the same microprocessor and microcode can be used for all mouse systems. The disadvantage is that an additional IC is required, however as mouse controller ICs are inexpensive this is not considered a major disadvantage. The difficulty in Japan, may be in locating a source willing to sell these ICs in small numbers. At a last resort, the chips could be removed from cheap mouse products.
Analog to Digital Conversion
General
The standard PC joystick has two 100K variable resistors inside, one for X direction and one for Y direction. These values of resistance have to be converted to digital values, which are then used to generate the desired mouse opto-coupler simulated signals which are then sent to the mouse controller chip. To do this, some form of analog to digital conversion is required.
Method used
The simplest method is to charge a capacitor to some known voltage during which period an internal counter/register in the microcontroller is active. Sources of inaccuracy will come from various offsets, R and C tolerances, variation in threshold voltage etc. Ideally these should be minimised in a calibration routine during power up. As the threshold voltage, or the voltage at which the A/D conversion stops should be constant, the non-linear exponential relationship between time and Voltage is not a problem here. In other words the relationship between time and resistance, the unit of variance here, is linear.
Vcap = Vp (1- exp(-t/RC))
.. where Vcap is the capacitor voltage, Vp is the charging peak voltage.
From this equation we can see that although the voltage to time relationship is exponential the time to resistance relationship is a linear one for fixed Voltages.
What has to be fixed though is the relationship between the charging voltage and the conversion time of the microcontroller A/D converter.
Obviously it is advantageous to have the fastest convert time possible. The basic unit for this conversion is the time taken by the microcontroller to increment its convert counter by one. This time is given by the number of instructions times the number of cycles per instruction times the basic clock period. Assuming for now that each count cycle will take 8 instructions and each instruction requires 4 clock cycles then this basic timing for a 4 MHz clock is:
T = (8 X 4) / 4MHz = 8us.
i.e. it will take 8us for one count. For a full count or the point where the joystick is placed at its full 100K resistance , the counter should be at its max. value of FF for 8 bits, therefore the conversion time is
256 X 8 us = 2.1 ms.Calculation of A/D Capacitor Value
It is important to keep the time to reach the threshold voltage of the microcontroller in step with the A/D conversion cycle of the microcontroller. To do this the charging capacitor value has to be matched to the fastest conversion cycle.
From the equation for the charging of a capacitor from above ...Vcap = Vp (1- exp(-t/RC))
.. where Vcap is the capacitor voltage, Vp is the charging voltageRearranging the equation gives ...
-t/RC = ln(1-Vcap/Vp)
but to find the time taken for the conversion we can replace Vcap with the microcontroller threshold voltage which is estimated at 3 Volts. Vp is the peak voltage of the capacitor which is set at a zener voltage of 4.7V. Substituting these values ...
t/RC = 1 (approx.)
If the maximum 255 value of the A/D counter is fixed at when the joystick potentiometer is at its maximum value of 110K then ...
C = 8us X 255/ 110K = 18.5 nf
This value should be the starting value for hardware evaluation of the circuit, however due to unforeseen errors the value may change.Tracking Speed
The tracking speed of the mouse emulator is an important parameter that needs to be estimated. If the tracking speed is too slow, due to too slow response from the microcontroller, then the speed of movement of the mouse cursor will also be too slow. The time taken by the microcontroller to send one pulse train of information for one A/D conversion cycle is given by the time taken for the conversion plus the time taken for the microcode to output a stream of pulses corresponding to that conversion value. Assuming that it takes 50 instructions to send out the X and Y pulse train, this gives a timing of 50 X 4 X 0.25 us = 50us. When added to the conversion time of 2.1 ms this gives a total conversion time of 2.6 ms. With these figures this gives a value of around 400 conversions per second which should be adequate for most purposes. However again until suitable equipment is available for experimentation, these figures cannot be verified.
Hardware
The basic A/D hardware uses an internal register of the microcontroller as a counter for the analog to digital conversion. One input line is required for the measurement input. At the point where this input switches from low to high at the threshold voltage, the residual value in the register should be directly proportional to the resistance value. It is also required to connect a microcontroller I/O line to the capacitor to discharge the capacitor after a conversion cycle. During the conversion cycle the line is set as an input, but during discharge it is set to be an output, reset to a low value.
Project Enhancements
As this project is a semi-analog one it is expected that there will be some unknown sources of errors. Until proper hardware can be built and debugged along with evaluation microcode it is difficult to predict the nature of the problems that will be encountered. However, in addition to unknown problem areas that will exist, the following are suggested enhancements that should be included on follow on designs.
1. Some ability to set the speed range, perhaps with jumpers
2. Double click, and latch switch function
3. Ability to use in conjunction with standard mouse, removing the need to swap devices; perhaps using a switch.
4. Perhaps requires a calibration routine to determine initial settings of resistance and to fix counters at mid-pointsOther work
Although the above 2 projects formed the main part of my work in Japan, many other activities were carried out.
1. Not the least of these were frequent discussions with Mr. Takuro Hatakeyama on the subject of various technical aids for disabled people. Many long and interesting discussions took place with him and I learned much from his willingness to share his many years of technical and application experience with me.
2. Other activities were three visits to other rehabilitation centres, specifically to visit their research centres. On these visits much information was obtained on various aspects of present and past research work into various areas of rehabilitation engineering. In particular it was possible to obtain much information, technical specs. etc. on the PC mouse interface and on the Serial Key interface. Also visiting these centres provided me with many new ideas for devices which could possibly be implemented in Taiwan.
3. The third activity was home visits. I was fortunate enough to visit two homes where a full environmental control device and computer head pointer was in operation by disabled people. These were important visits as I was able to see first hand the equipment in-use and talk to the user. Another home visit was to visit a client who needed some house remodeling work. It was inspiring to see in such a small apartment, so much assistive equipment and impressed on me the possibility of installing hoists etc. in small spaces.Future Work and Developments
This reports has proposed two practical designs, however the work has just begun as these must now be implemented into real working products. Work has already started on the microcode, but until the correct microcontroller development equipment is available no actual debug work can begin. When I return to Taiwan I intend to place these two projects into my schedule and hope to have the ideas implemented into real hardware by the end of this year. I will keep the Yokohama Rehabilitation Centre informed of my progress and will present them with my completed designs when finished.
Project Conclusions
I have presented here two very practical projects, both of which I feel can offer a contribution to the field of rehabilitation engineering.
The first project is more directed at Taiwan where almost no environmental control systems are available and offers a basic very low cost yet full function integrated environmental control system, using wherever possible commercially available products. This design will be implemented when I return to Taiwan. Although environmental control systems are already available in Japan this one may be of some use as it is a very low cost system.
The second project offers a low cost solution to the problem of using the mouse for disabled people and should be of use in both Japan and Taiwan. By using a simple low cost analog joystick the mouse function can be simulated giving more control over mouse movement than normal switch type emulation systems. Again work will begin on the microcode development of this project sometime this year.
The extended period of time needed to build and debug these projects added to the non-availability of an 8-bit microcontroller development system means that no working hardware can be presented. This will be done back in Taiwan, it is assumed within the present year. However, although 2 specified systems have been presented, it is not until the final hardware has been built and debugged that a final detailed design can be specified, a normal practice in engineering. For this project however full block diagrams are offered and will be used to construct the system. Flowcharts were also produced for the projects but are not included in the report due to their handwritten format.
Acknowledgments and Final Word
My thanks also to the product promotion department of Holtek Microelectronics, in particular to Mr. Hans Pao, for their continued support of our centres projects, without their support, none of our technology based projects would ever see the light of day.
My time in Japan has been very fruitfull and I leave armed with many new ideas and motivation. My experience has also highlighted the need for countries within Asia to work more closely together in this field and reduce the traditional dependance we have on Europe and the US. This was a viewpoint I heard mentioned many times from other people within Japan.
Finally I must add that projects like this are very interesting for engineers like myself, and it has been a wonderful experience to come to Japan, however it is important to still remember what the purpose of this work is for. That is for people with disabilities who with a little technology can have a more dignified and independent life. A good way of measuring how civilised we are is to see how we treat the weakest members of our society, and in this objective of social justice and equality, technology and engineering has an important role to play.
References
1. IEE Transactions on Rehabilitation Engineering Vol:3, No.2, June 1995
2. Microchip Embedded Applications Manual
3. Holtek Microelectronics Product Data Sheets Edition 4
Top Page