Project Beyond Games Into Micro Applications

About three-quarters of the individually-owned micro-computers in the U.K. are used wholly or predominantly for playing games. That is a shame — games deny users the rich variety of experience a computer can generate. In the first part of a new series, John Dawson looks at applications which will carry your micro beyond recreation into the realm of computer control.

The games people play tend to involve little more than packaged software and interaction between the computer user, the visual display unit, VDU, screen and the computer key-board. Microprocessors can, however, be put to any task for which a program has been written. This series is about extending the input and output devices which can be attached to an ordinary, domestic micro-computer to explore the uses of the computer for control purposes.

Some of the extensions are likely to take the form of electro-mechanical devices, such as the pen recorder described in this article, and these will be built in what may be best described as prototype form. The pen recorder, for example, produced good results when used with a certain amount of care and attention by the builder. It is not, however, suitable for use in a rugged environment or by anyone who does not understand the construction and the limitations.

There is all the difference in the world between the working robot arm which can be used to lift and manipulate objects in a reasonably well-controlled domestic environment and the multi-purpose robots marketed for arc welding and other purposes. The amount of development work necessary to allow a robot to operate reliably when it is close to the massive power surges generated by arcs of several hundred amps’ intensity must be colossal, the electro-magnetic disturbances generated by arc welding can cause transient interference to even well-protected micro-electronic equipment throughout an entire neighbourhood.

This series will be the record of several amateur experiments — some involving hardware and others the development of software, a control-orientated interpreter, for example, for a Tangerine Microtan computer. Targets for the series are the development of an intelligent vacuum cleaner, an electronic-scanning camera and the other projects set out in table 2. On the route to those targets I hope the series will enter some curious byways of control electronics.

Table 2

  • Development of consistent, stable control pathways using radio transmitters and infra-red light.
  • Use of digital-to-analogue and analogue-to-digital converters for controlling devices.
  • A pen recorder for plotting data from the computer against time. An X-Y pen plotter with both axes controlled by the CPU.
  • Signal averaging to extract information from a noisy background.
  • A printing digital voltmeter and as an extension of this the development of automatic test routines for electrical equipment.
  • Long-term monitoring of a solar panel to assess its heat gathering effectiveness.
  • The outline development of a remotely-controlled arm for lifting and manipulating small objects.
  • Development of an intelligent vacuum cleaner with software protocols for action after encountering obstacles and to avoid tangling the mains cable. Also the problems of switching mains voltages.

The general principle of using a computer to control a process is shown diagrammatically in figure 1. Instructions are sent from the computer to the output device and the controlled process is altered in some way. For example, an actuator may open a skylight in a greenhouse to increase the ventilation. An input sensor, an electronic thermometer in the greenhouse, monitors the air temperature and data from the thermometer is read by the computer so that the skylight can be opened further if necessary, or closed when the air temperature drops in the evening.

Figure 01

A system in which some quantity in a process is measured so that a controlling influence can be applied to the process to keep it within desired limits is a closed-loop feed-back system.

Life is a closed-loop system. The organisation in a plant which makes the tip grow towards a source of light is a biochemical closed-loop system and there are examples in all the animals from the simplest invertebrates the most sophisticated mammals.

Figure 8 illustrates a simplified human nerve pathway from the spinal cord to a fibre in a muscle. The contraction of the “A” muscle fibre is controlled by impulses travelling from the spinal cord down the alpha nerve, 3. Impulses that arrive at the muscle make the muscle shorten and that reduces the tension in the “B” fibres.

Figure 08

There is a sensor for stretch in the middle of the “B” fibres which sends fewer nerve impulses, 1, to the nervous system when the tension in the “B” fibres is reduced. The synapse is a connection between the incoming increases the tension on the stretch receptor which initiates activity in the sensory nerve. The “A” muscle fibre is then forced to contract by impulses travelling down the alpha motor nerve.

When the feedback in the closed loop is disturbed in some way, the system becomes uncontrollable and the muscle, the actuator, may become almost rigid, may lose its tone and become limp or may alternate between the two producing jerky, oscillatory contractions.

Feedback and control systems are found at all levels of organisation from single nerves to entire populations. Figure 2 illustrates a closed loop formed by a person playing a game on a microcomputer. When the program has been loaded from the tape the computer, CPU, displays information on either the VDU or another output device.

Figure 02

The information is absorbed visually by the user and after some internal processing an appropriate response is put into the computer by way of the keyboard. Space Invaders is a classically simple example; the required quantity to be measured is the side-to-side alignment of a laser gun with an alien space-ship and when the operator perceives that this condition has occurred, a key is pressed on the keyboard to make the gun fire.

It would be possible to put a microprocessor on to a vehicle but that will tend to restrict the power of the computer and inhibit the development of flexible general-purpose software. For these and other reasons I decided to use standard microcomputers such as the Nascom 1, Tangerine Microtan or Sharp MZ-80K for writing software and control purposes, and to evolve methods of transmitting commands and data to a comparatively “dumb” remote device with a corresponding transfer of sensory information from the device back to the computer.

Figure 3 shows the principles of a closed-loop telemetry system. Microcomputers based on popular CPUs such as the 6502 and Z-80 chips carry data along eight parallel wires, the data bus, and this is a very inconvenient form in which to transmit the information outside the computer case. Many microcomputers have parallel-to-serial converters and the serial output — typically configured to RS232 standards — can transmit digital data using only two wires.

Information in serial form can be sent over considerable distances using a MODEM and Post Office telephone lines. Such a system will not be helpful for the purpose of controlling our vacuum cleaner. However, a MODEM is simply a black box — a modulator/demodulator which changes the digital signal into a form suitable for transmission down a telephone line, recreating the original signal at the far end in another MODEM.

Digital signals can be transmitted just as easily by radio, infra-red or ultra-sonic sound. This series will use radio-control transmitters and receivers as simple and effective MODEMs for sending information to devices which need to be controlled at distances up to 300 to 400 yd. from the computer. An infra-red system will probably be used at some stage for transmission to a device that will stay within the same room as the control computer.

Figure 3 shows how information passes from the CPU to a digital-to-analogue converter, D-A, and from there to the radio control transmitter, Tx. A coded stream of pulses, varying according to the analogue input to the transmitter, is broadcast and received by a miniature receiver mounted on the device to be controlled.

Figure 03

On its own, that is a blind process — the CPU cannot know whether or not its commands have been executed. Nor, at anytime, can the CPU know what is the current status of the device. It is the second stage, the transmission of information from the device back to the computer which closes the loop.

The remainder of this article deals with details of a radio-control system, its connections to the microcomputer and subsequent testing of the first stage of the The Acoms AP-435 radio-control system is one of many now available in High Street model shops. Integrated circuits have changed the nature of radio control out of all recognition in the last few years and two- or four-channel digital proportional control is a standard configuration rather than an esoteric dream.

Since January 1981, the Home Office no longer requires a user of radio-control equipment to buy a licence and has opened a new 35MHz band for model-aircraft control only to avoid interference from citizens’ band transmitters operating in the 27MHz frequency allocation.

Figure 9 illustrates the Acoms AP-435 digital proportional radio-control system. Technical data from the information supplied with the system is most intriguing and the most remarkable data revealed is that a servo weighing only 45 gm. can generate a torque of not less than 3 kg. cm.

Figure 09

Used as an ordinary radio-control system, up-and-down or side-to-side movement, W, of the joystick arm, a, is translated into a varying DC potential at the wipers of the potentiometers connected to the joysticks and this is reproduced as a rotary movement, X, of the servos, b. There are a number of unused pins on the IC encoder in the Acoms transmitter which could accommodate two or more miniature push switches.

The identifying numbers on the encoder chip are shown in figure 10 and if you find such a chip in a two-channel transmitter, it is probable that the system can be expanded at the transmitter at least to provide four digital proportional channels and perhaps some other switched on/off channels.

Figure 10

It would be possible to use the computer to mimic the information leaving the encoder chip, using a UART to modulate the transmitter directly. However, the easiest way to control the transmitter, in both hardware and software terms, is to build a simple digital-to-analogue converter taking the analogue output from the CPU to the input on the transmitter encoder chip that was previously connected to the wiper on the joystick potentiometer.

I started to explore the Acoms AP-435 system by separating the two halves of the transmitter case. I mounted two double change-over switches so that the input to the radio control encoder chip could be connected to either the slider on the joystick potentiometer or to a socket which I attached to the back cover of the transmitter.

After carefully invalidating the guarantee on a new piece of equipment, it is important to have a base line for the performance of the equipment to which you can refer at any time and after re-wiring the connections to the encoder chip, the transmitter still worked faultlessly on manual control using the joysticks.

I was prepared for the transmitter to cause interference to the television set used as a VDU for the Nascom but it was not serious. However, when I connected the input to the encoder chip to the D-to-A converter on a Nascom 1, several unexpected things happened.

The voltmeter attached to the D-to-A converter to measure the analogue voltage at its output started to register strange readings. The servos at the far end of the whole radio-control link became wildly erratic and super-imposed on the large movements of the servo was a much faster jitter — perhaps due to the internal operation of the ZN-425E chip.

The strong radio frequency signal from the transmitter was being picked up in the connecting lead between the computer and the transmitter, rectified at some stage and producing spurious DC input signals to the transmitter. When the computer was switched off and disconnected from the transmitter, the servos could still be made to move by touching the input lead to the encoder chip.

Connecting the capacitor C4 — 0.1 micro-Farad — and the resistor R7 — 56K — to the far end of the input lead to the transmitter solved the problems. Cx is a small capacitor mounted tightly against the input to the encoder chip.

The circuit diagram for a digital-to-analogue converter is shown in figure 10 and is based on the circuit information supplied with the Ferranti ZN-425E converter. The op amp — ZN 424P — is a proprietary Ferranti make and can be replaced with a standard 741. Some minor changes may be necessary to the associated circuit. Although I intend to tidy the construction up at a later date, the tracings and figures in this article were produced by connecting the output of the D-to-A converter directly to the transmitter encoder chip at point W.

Table 1 is a printout of the analogue voltage from the D-to-A converter produced by a digital number typed in on the Nascom keyboard. The maximum output was approximately 2.05 volts and this was generated by the maximum input possible using an eight-bit D-A converter — 255 decimal, FF Hex.

Table 01
Keyboard Input D-A Output
255 207 Volts
000 - Volts
010 - Volts
020 005 Volts
030 015 Volts
040 022 Volts
050 030 Volts
060 039 Volts
070 047 Volts
080 055 Volts
090 063 Volts
100 071 Volts
110 080 Volts
120 089 Volts
130 096 Volts
140 105 Volts
150 113 Volts
160 121 Volts
170 130 Volts
180 138 Volts
190 146 Volts
200 155 Volts
210 163 Volts
220 172 Volts
230 180 Volts
240 189 Volts
250 198 Volts
255 204 Volts

Figure 5 shows the deviation on the pen recorder produced by manual control of the RC transmitter. The voltages marked on the trace were measured at the wiper of the joy-stick potentiometer at the centre position, and at each end of the joystick travel.

Figure 05

I have included outline details of the construction of the pen recorder only as the machine is not perfect and can be improved without difficulty in a second-generation model. The principle is that a pen is made to move across a sheet of paper in one axis while another axis is produced by drawing the paper past the pen at a constant speed.

If the pen is mounted on an arm and swung across the paper, the resulting trace will be curvi-linear in form. If a sufficiently long arm is used to reduce the distortion to an acceptable amount, the angle through which the pen will swing will be very limited and will fail to exploit the potential of the radio-control servo.

Figure 4 illustrates the difference between a curvi-linear trace and one formed by moving a pen across a band of paper at right angles to the paper’s direction of travel. The trace, B, is more distorted. The easiest way — figure 6 — to produce the required linear travel, A, from rotation of the servo arm, A, is to wrap a string round a drum on the servo and use this to pull and push a pen along a rigid, straight guide rail.

Figure 06

The photograph shows how I translated the theory into practice. Figure 7 illustrates the principle of the paper drive. Scrap aluminium — approximately 16 SWG or 2-2.5mm. thick — was used for the paper holder and the mounting for the rollers which form the paper drive.

Figure 07

The base-board was also aluminium but could be made of wood, preferably chip board which is less likely to warp, and I used a cheap mirror, or an equivalent piece of glass, to give a smooth, flat surface for the pen to rest against. After building the recorder, I took the following measurements which may be of help to other constructors:

Dimensions
Paper Width 57mm 2.2in
Roll diameter 70mm 2.8in
Servo drum Diameter 43mm 1.7in
Circumference 135mm 5.3in
Pen drive frame Width 160mm 6.3in
Tyre Diameter – uncompressed 60mm 2.4in
Alternative drive cord 10lb. monofilament nylon fishing line 0.30mm. diameter.

Thin cord was used to drive the pen and some tension was provided by a spring tied into the line. Small brass bottlescrews for yacht rigging are sold in model shops and one of these would keep the drive cord taut while causing less friction when the pen is accelerated by the servo. Nylon fishing line might produce still less friction but may also stretch more.

The pen holder is an adaptor for Rotring drawing pens to allow the nib and ink reservoir to be plugged into a drawing compass. There is a small nut and screw which attaches the metal plug to the plastic body of the holder and that can be screwed directly on to an ordinary 6 BA solder tag which is soldered in turn to the sliding collar on the pen guide rail.

I used the Rotring 0.35mm. Isograph as these pens are much less susceptible to blocking than the older Variant version. The Rotring pens are comparatively expensive and could be replaced by a fine fibre-tip pen.

Fibre-tip pens are used by Hewlett Packard for at least one of their flat-bed plotters. The only complaint I have heard is that in the course of producing several graphs or drawings, the width of the line produced by the fibre tip tends to increase slightly.

Most of the other components in the pen recorder were from a local model shop — the servo drum to which the drive cord is anchored is part of a plastic, model-car wheel from a Tamiya kit and the frame for the pen drive is constructed from thin square section brass tube for the sides with smaller diameter round brass tube for the pen guide rails uprights.

The frame was soft-soldered using an instant-heat solder gun. Most model shops sell double-sided sticky tape for mounting model control servos into aeroplanes, cars or boats. Provided the surfaces to be joined are clean and dry, double-sided sticky tape makes a bond which can be regarded as permanent for all practical purposes. The joints between the servo, the bracket and the pen-recorder base-plate were all made with double-sided tape and the mirror was mounted in the same way.

The rollers which grip the paper are sponge neoprene tyres for model racing cars on strong plastic wheels. The wheels mount directly on to 0.25in. steel axles and tension between the
two wheels is provided by a rubber band. The paper is a roll for ordinary calculating machines from WH Smiths.

I bought a DC model motor with a variable gear set — Ripmax models M – EM141P; Monoperm Super five pole, made by Marx, 6volt, gear ratios from 3:1-360:1 — to drive the paper and I shall probably use the same motor in a later project. However, there is no need to go to that expense as there are many small-geared mains motors on the market which will do at least as well.

I have replaced the DC motor shown in the photograph with a 2.5rpm 240volt AC motor. The speed of the mains motor is a little slow giving a theoretical paper speed of 470mm./minute — 0.3 in./second — but produces very good results for less than £3.

The speed is, of course, immaterial below a limiting value as the rate at which data is output from the computer can be easily controlled by altering the software. The speed at which the pen recorder plots data does not limit the system in any way provided that the application allows data to be acquired quickly by the computer and then output slowly from either the computer’s main memory or back up storage at a rate that suits the plotting device.

A Nascom 1 computer running under the Duncan interpreter will acquire data at the rate of one reading in under 2mSec. and when the sampling process is completed, the data can be stored either on cassette tape or in the computer memory until it is plotted. Similarly. 24 hours of meteorological data can be gathered very slowly. For example, one reading every three minutes produces 480 values in 24 hours, and then recorded on the pen recorder in less than one minute. Another experiment running on a long time scale maybe the solar panel investigation listed in table 2.

I carried out some initial tests on the radio-control system using a protractor mounted on the servo to measure the number of degrees of rotation produced by varying input voltages to the transmitter. Comparison of figure 5 and table 1 shows how the voltage produced by the D-A converter and the manual potentiometer overlap. The results of the first test using the pen recorder are set out in test 1, which consisted simply of a small Duncan program, a, to take a value from the keyboard and put it out to the PI/O.

In Test 2, I used the computer to generate a sawtooth wave-form by incrementing a base value of 90 until the program reached 255. The program then re-set the pen recorder to the base value and the process was repeated. The computer would loop through this program far too quickly for the pen recorder to follow unless each cycle had a built-in delay and the length of the wait state in the Duncan interpreter was adjusted by trial and error until an optimum value was found.

The results of the test are shown in the trace and it is clear that over the part of the range of the servo used for the test, there is a linear relationship between the input voltage to the transmitter and the rotation produced by the servo.

After producing a sawtooth wave-form, the changes in acceleration necessary to produce a smooth sine wave are a good complementary test of a recorder’s abilities and test 3 gives the details of a program to load integer values for a sine wave into the data log before continuing to plot them using the pen recorder. The values for the sine wave were calculated using a programmable calculator and multiplied by 80 so that at sine 90° = 1, the maximum value output to the D-to-A converter is the mid-line value of 175 + 80 = 255.

The values for 180° only are entered into the data log and the sine wave is plotted by first adding the values in the data log to the base value and outputting the result to the D-to-A converter and then by re-cycling to the beginning of the log and subtracting each value in the data log from the reference value. The trace “B” shows the result I achieved using 90 two-degree increments and the second trace “D” a far better result with 180 values each incremented by one degree.

Conclusions
Model radio control using digital data transmission can be used as a stable and effective signal pathway from a microcomputer to a remote device. The range of the transmitter/receiver combination used is in excess of 200yd.

The mass-produced servos sold for radio control should not be under-estimated – the power to weight ratio, for example, is excellent. Each servo costs about £12.50 and the low price is the result of IC technology and clever production engineering.

The pen recorder described cost around £25 to build, excluding the RC transmitter and receiver, and, even in its crude prototype form, gives useful results. The design is sound and could be tidied up and constructed easily in school workshops or at home.

The pen recorder will be used in other applications — for example, to plot the changing light intensity during each sweep of the scanning electronic camera and, perhaps, to record the data acquired from a solar panel.

The next stage will probably involve the start of a program similar to Duncan for the Tangerine Microtan computer and some thoughts about a mobile trolley — could a inexpensive gyroscope be built for navigation using an ordinary DC model motor? How fast does a gyroscope need to rotate to form a fixed reference? Is the weight of the fly-wheel important and what is the speed/weight trade-off?

Further reading

Byte, February 1981, volume 6, number 2, page 44. A computer-controlled tank. Steve Ciarcia.

Byte, July 1980, volume 5, number 7, page 22. Hand-held remote control for your computerised home. Steve Ciarcia.

Dr Dobbs Journal, September 1979, volume 4, issue 8, page 4. An electromechanical household servant. F G Reynolds.

Practical Computing, May 1981, volume 4, number 5. Duncan — a high-level control-orientated interpreter for the Nascom 1. John Dawson.

Practical Computing, volume 3, issue 7. Lowcost printer interface for the Nascom 1. John Dawson.

Byte, January 1978. The brains of men and machines. E W Kent.

Home
Contents and Editorial for this issue of Your Computer

Tags: , , , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: