h51wi November 1983 up-to-date electronics for lab and leisure PWM power controller model railways for CPU+VDU= intelligent video terminal Metronome with optional quavers I receiver IC the ZN415 nouember 1983 COPY. selektor 11-21 doorbell — or telephone — operated flash light 11-23 With this flash light you can see when the doorbell or telephone rings: a boon for the hard-of-hearing. power controller for model railways 11-26 Model trains can behave like real trains: build this controller and prove it for yourself. decoupling in digital circuits 11-30 | Decoupling of supply lines is often forgotten in digital circuits and yet it is easily carried out. CPU card 11-32 An independent, single-board computer on eurocard format designed for universal application. decimal-to-binary converter 11-40 Your programmable pocket calculator can be made doubly useful with this converter which provides an eight-bit binary output. missing link 11-41 PC board pages 11 -42 movement detector 11-45 The special feature of this detector is that it is a passive device. Its operation is akin to that of the human eye. electronic two-tone metronome 1148 Indispensable for those who want more complex tones and rhythms than are available from a mechanical metronome. pseudo stereo 11-52 A new chip which gives the FM mono radio receiver featured in the September issue a new dimension! The CPU card described in this issue can be put to many uses. One of the more interesting possibilities is to combine it with the VDU card featured in the September issue to form an intelligent video terminal. This has an RS 232 connec- tion, VT 52 protocol, adjust- able image format and full graphics capabilities. In fact, it provides just about every- thing you are likely to need of a terminal. universal terminal 11-56 Combining the CPU card described elsewhere in this issue and the VDU card published last September can result in a universal terminal with a low cost-to-capability ratio. ultrasonic/infrared barrier 11-58 Piezo ceramic ultrasonic barriers have been largely ignored in favour of infrared ones — yet, they work just as well as their counterpart. trick battery 11-60 A battery so unusual that it will fool most, if not all . . . Crescendo revisited 11-62 Some useful hints for all those who have constructed the Crescendo applicator 11-63 | A new receiver 1C from Ferranti, the ZN415, requires only a small number of external components to make a complete AM radio. market 11-64 switchboard 11-69 EPS service 11-80 advertisers index 11-82 A selection from next month's issue: ■ phaser ■ video amplifier ■ frost warning device ■ 64-way bus expander ■ symmetrical power supply 11-03 elektor november 1983 advertisement ele ’^’ r s tb« N ° ^ 5 $*° CUNARD INTERNATIONAL EXHIBITION CENTRE. CUNARD HOTEL. HAMMERSMITH. LONDON W6. Friday November 25th 10am-6pm Saturday November 26th 10am-6pm Sunday November 27th 10am-4pm Improved Venue Offering improved facilities to the visitor, including car parking and ease of access by rail, tube and car, all in a modern attractive setting. Holiday Weekend Why not bring your partner to the show and enjoy a weekend in London? A complete hotel package is available to our visitors to the exhibition with ail inclusive rail tickets. Send now for details of what we, t he organisers, can offer you . Write to: Breadboard ’83 ASP Exhibitions 145 Charing Cross Road London WC2H0EE This year's features include Kits components and tools to build all sorts of projects Robotic display Components and tools at bargain prices Technical advice on electronics projects and Ham Radio technique Computer Corner -'Try before you buy’ Lectures by professionals covering aspects of electronics and computing Holography and Producing Printed Circuit Boards . Pick of the projects - Demonstration of the best from ELECTRONICS TODAY INTERNATIONAL. HOBBY ELECTRONICS AND ELECTRONICS DIGEST. advertisement elektor november 1983 The NUMBER 1 catalogue forthe electronics, computing, communications, audio and video engineering enthusiasts INTERNATIONAL GET YOURS NOW !! ■=— ambit INTERNATIONAL Telephone: (0277) 230909 Telex: 9951 94 AmbitG 200, North Service Road, Brentwood, Essex CM14 Use the voucher alongside and deduct £ 1 from a prepaid order from the Ambit catalogue where the total value exceeds £ 1 5 (excluding VAT) ★ Alternatively — use it to obtain a FREE COPY of the Ambit Catalogue (minus the discount vouchers supplied to purchasers paying the RRP of 80p) elektor november 1983 advertisement BUILT AND TESTED In the cut-throat world of consumer electronics, one of tilt questions designers apparently ponder over is "Will anyone notice if we save money by chopping this out?" In the domestic TV set, one of the first casualties seems to be the sound quality. Small speakers and no tone controls are common and all this is really quite sad, as the TV compan Given this background a compact and independent TV ^a'cSTh'SU £45.00 ■ NOISE REOUCTION SYSTEM . AUTO STOP • TAPE COUNTER • SWITCMABLE E.O. . INDEPENDENT LEVEL CONTROLS • TWIN V U. METER . WOW & FLUTTER 0.1% • RECORD/PLAYBACK I.C WITH ELEC TRONIC SWITCHING • FULLY VARIABLE RECORDING BIAS FOR ACCURATE MATCHING OF ALL TAPES. Reprint 50p. Free with kit. C31.00 plui C2.7S pBp Efel ■ 1 1 ■■■■ i STEREO STEREO CARTRIDGES PHI LIPS L/AooL 1 1 DECK J AUDAX 40W FERRO-FLUID HI-FI TWEETER as-- „» © All mail to: date their products without notice. All enquiries send 21 K HIGH STREET, ACTON W3 6NG. S.A.E. Note: Goods despatched to U.K. postal addresses only. 11-20 v&Mw When electromagnetic waves came to light by C.L. Boltz Born 1 50 years ago, James Clerk Maxwell made many profound and classical contributions to physical science during his relatively short life. His great mathematical skill, combined with a deep sensitivity of the relationships between physical forces and matter, gave him a remarkable ability to reduce the abstract to logical form. His most important work of all is enshrined in his famous equations which indicated the existence and behaviour of electromagnetic waves, thereby laying the foundation of radio and explaining the nature of light. James Clerk Maxwell was a genius in what he called natural philosophy but today we call physics. Even now we are still reconsidering many of his discoveries. What is known in all the textbooks as the Young- Helmholtz theory of colour vision should now, in some experts' opinion, be the Young-Maxwell theory, and this is but one example from his very wide field of researches. Maxwell's story is not one of rags to riches, for he was a Scot whose father was a laird, a lawyer and Fellow of the Royal Society of Edinburgh. Young James grew up in affluence. Nor was he a child progidy, such as Mozart. Indeed, his fellow pupils at school called him 'dafty'. But only to the age of 13, for then, suddenly, his abilities blossomed and he was consistently first in many subjects. He wrote poetry, including a blank-verse poem about spinning tops, inspired by a quotation from Virgil's Aeneid. He continued to write verse all his life, much of it humorous, for he was a man given to laughter and he never made an enemy. The first hint of his ability in mathe- matics came when he was 14. A well- known artist in Edinburgh wanted to find a way of drawing perfect ovals. An oval is the shape of the longi- tudinal mid-section of an egg, rather like an ellipse but wider at one end than at the other. A method of drawing ellipses by means of a pencil, a piece of string and two fixed centres was already known. School- boy Maxwell went home and dis- covered a way of modifying it to trace out an oval. His father showed this to Scottish physicist Professor Forbes, who had it printed in the Proceedings of the Royal Society of Edinburgh. Maxwell expanded it and Forbes read it to the Society in 1 864, when Maxwell was 15. Early papers At 16 he was at Edinburgh University and soon producing a paper on The Theory of Rolling Curves. Another was on The Equilibrium of Elastic Solids. So far, all his work was mathematical (geometrical). At 19 he was at Cambridge, for most of the time at Sir Isaac Newton's old college. Trinity. He at once produced a paper on The Transformation of Solids by Bending and, significantly, a memoir on Faraday's Lines of Force. Because of his methods, however, it is pointless to pursue his achievements in chronological order. Some six years elapsed between his first and second papers on electricity and some twelve years between his second and third papers on the kinetic theory, so it is simpler to consider his achievements in terms of the subject, though even then we have to leave out many of his original contributions in different fields. Colour perception He first became interested in colour- perception when a schoolboy and was taken to meet William Nicol, a noted Scottish natural philosopher, who gave the boy a couple of the Nicol polarizing prisms. Edinburgh was rich in colour experimenters at the time and Maxwell began serious work in about 1849, at the age of 18, though his first published paper appeared in 1855 as an appen- dix to a work on colour-blindness. According to a recently-published encyclopaedia, James Clerk Maxwell created the science of quantitative colorimetry. He first of all used a spinning top to merge colours together. He also used, as primary colours, red, blue and green (instead of yellow, as so many had done and thereby run into difficulties because they had not distinguished subtrac- tive colour-mixing from additive). By superimposing coloured papers he could get whatever proportions of mixture he wished. In addition he had black and white discs to cover the centre. The procedure was then to vary the proportions of primary colours until they matched the neutral grey of the mixture of black and white. By this technique he obtained equations of the form 0-37R +0-26B + 0-37G = 0-28W + 0-72BI where R, B, G, W, and Bl stand for red, blue, green, white and black. Equations very similar to this are used today in defining colour. Maxwell used many people, including his wife, as subjects to assess colour- matching. He discovered that most of them, though their assessments differed slightly, were broadly in agreement, but a small minority disagreed markedly: they were 'colour-blind'. He found that this minority could match the grey with only two hues, and so he agreed with Young, the English physicist and physician, that there were three receptors in the eye, of which the colour-blind lacked one. He went much further, returning to his prime love, geometry. He de- signed and made a colorimeter - his 'colour box' - using true spectral colours, the purest we know. With this he was able to get finer measure- ments. He then showed that colour- mixing could be shown on a diagram, a triangle in his case, for as all the values of the three primaries must add up to one, a display of only two on a two dimensional diagram would suffice to describe a colour. White was the result of blending the three primaries, so all colour-mixing could be ralted to the white spot. In other words, as he said, it was geometry. This idea, associated with the notion of a 'standard' observer, led in the hands of D.W. Wright of Imperial College, London, and J.Guild of the UK National Physical Laboratory, to the universal CIE (Commission Internationale d'Eclairage) standards now in use, making any colour precisely repeatable anywhere. Maxwell's triangle was what we now 11-21 call a chromaticity diagram. If we use hypothetical colours purer than those obtainable in practice, to get over Maxwell's difficulty that nega- tive values had to be included in the colour equation sometimes, and if we plot on the Cl E x,y axes the values of a series of spectral colours in chroma- ticity, we get the locus in an almost triangular form, familiar to all colour scientists. When we do this we find that the CIE values are extra- ordinarily close to those obtained by Maxwell. That is because Maxwell was abnormally delicate and accurate in all his practical work; he was an artist in his own right. He achieved a great deal more in colour science and in 1860 he was awarded the Rumford Medal by the Royal Society for his earliest papers. This account of his work must be looked on as a brief sketch only. While he was Professor at Marischal College (now Aberdeen University), from 1 856 to 1 860, he spent time on a celebrated work on the rings of Saturn. The topic, investigation of the motions and stability of Saturn's rings, had been set in 1855 at Cam- bridge for the highly prestigious Adams Prize. Maxwell spent a great deal of time and concentrated thought on this over four years and concluded that the rings were com- posed of particles of matter. He won the prize. Theory of gases Two important researches occupied him for some 20 years, appearing in various stages of development in papers to learned societies before they emerged as treatises. One was concerned with the kinetic theory of gases, work that started in 1859 and was not finished when he died in 1879. He was, of course, a leading mathematician and he was concerned, as were several outstanding conti- nental scientists, with the way in which heat travelled and how to bring under mathematical control the problem of millions of molecules in a volume of gas. He knew about the work of Clausius, the German physicist who made important con- tributions to thermodynamics, and that of Stokes, the British mathema- tician and physicist who had pub- lished a great deal on the subject of motion in viscous fluids. But we have to remember that Maxwell, like many others, was breaking new ground (it is impossible now to reproduce the basis of knowledge on which creative physicists then had to begin work, with so little then discovered). He applied statistical techniques for the first time and was an important contributor to what we now know as Boltzmann statistics. Two of the papers he wrote have been described as his greatest. The other major research was that which most students of physics associate with his name under the general title of The Electromagnetic Theory of Light. This title was not Maxwell's. He started out to devise mathematical relationships to satisfy the qualitative insights of Michael Faraday, who, following Ampere's and Oersted's work, had demon- strated for the first time (and thereby founded the whole of electrical engineering) what he called electro- magnetic induction, in the year of Maxwell's birth. Faraday, who knew no mathematics, pictured the phenomenon as due to 'tubes of force’ for he could not conceive of 'action at a distance'. Maxwell was trying to explain how effects could be transmitted through an insulating medium and, as he developed his ideas over the years, he discarded notions of vortices and he applied analogies of dynamics - force, momentum and so on. His progress was charted in five papers starting in 1855 and ending in 1868. By this time, having held a professor- ship at King's College, London University, he had retired to cultivate his Scottish estate and was writing his complete Treatise on Electricity and Magnetism, first published in 1873. He knew that if one set of units was based on an electrostatic charge and another system on the magnetic pole, then the relationship that the unit of, say, current in one system bore to the equivalent unit of flow in the other system had the dimensions of a velocity. Several researchers did experiments to find the size of the velocity. So did Maxwell, and there was strong suspicion that it was the same as that of light in vacuo. Then, in 1865, he excitedly found that the disturbance that caused electro- magnetic induction travelled with the speed of light and was a wave motion. This was the crucial dis- covery. Further work showed also that light would exert mechanical pressure. These were original discoveries. It was not until 1887 that a remark- able young German physicist, Heinrich Hertz, showed experimen- tally that Maxwell was right. In so doing he laid the foundations of all radio science and engineering. In 1900, the Russian scientist Lebedev 3.1 confirmed Maxwell's prediction of a radiation pressure. By this time Maxwell was dead. He had been persuaded out of his laird- like country life in 1871 to take charge of a new laboratory in Cam- bridge. It was the Cavendish Labora- tory, now world-famous as a world- leader for a century. Even in this activity, building up a research laboratory, his ideas were original. In 1878 he became ill with cancer of the abdomen and died in his 50th year. This brief sketch has missed out all the honours that came to him and many of the discoveries he made in various fields, but one important thing needs to be said. It is just this: his wife played an important part in his researches and, therefore, must have been the first woman scientist in the history of the world. Spectrum, No. 176 11-22 It was, of course, known before the outbreak of disco fever that flash-lights can be used in fields other than photography. The following design uses a common-or-garden battery-operated electronic flash to indicate when the doorbell or the telephone rings. doorbell - or telephone - operated flash-light doorbell — or telephone — operated flash-light elektor november 1983 . . . ideal for the hard of hearing The hard of hearing are often unable to hear the doorbell or telephone ringing, but many of us who aren’t can find ourselves in that situation. For instance, when your new, powerful vacuum cleaner is being used, or the radio or TV is a bit too loud. In those circumstances, it is very useful to see when the doorbell or telephone rings. la Figure la. In this part of the circuit diagram can be seen the power supply, the doorbell converter, and the relay for operating the flash-light. b Figure 1b. The circuit corresponding terminals in figure la. In this version, B2 and C3 in figure la are 11-23 electrolytic C3- 10p/25V electrolytic C4 * 100 n ceramic C5- 100(i/16 V electrolytic C6 ■ 4(i7/16 V Semiconductors: IC1 - LM317 (T0-220 plastic package) IC2 = 741 = BC 547B B1 ■ bi B40/C2200 • M/S Compc Heat sink for (T0-220) Optical ‘sound indicators' are, of course nothing new, but they normally have the disadvantage that you must look in their direction before you can see them working. It is hardly likely that you won’t notice a flash-light. So much for the principle of the thing. Next comes the question of cost. Any inexpensive, battery-operated electronic flash-light will do nicely: the rest of the circuit is built from readily available, popular components. Miscellaneous: Trl « mains transformer 10 ... 12 V/2 A LI = telephone pick-up Ui, to about 6 V. Any batteries should, of course, be removed from the flash-light. The unregulated output U2 is used for the telephone-bell converter and will be dis- cussed later. | The circuit diagram ■ Figure 1 shows that the circuit consists of | three distinct parts: the power supply, the converter for the doorbell with relay for operating the flash-light (figure la), and the converter for the telephone bell (figure lb). It is not necessary that, for each appli- cation, all three parts are required, but more about that later. Nothing much needs to be said about the power supply. It is a standard design with an adjustable type LM317 voltage regulator (IC1). The only important point here is that the LM 317 needs to be mounted onto a heat sink. If you use a flash-light which is normally powered by two 1.5 V bat- teries, the output voltage, Ui, of the supply The doorbell converter Figure la shows that a converter need not always be a complicated design: here it consists of just a bridge rectifier, smoothing capacitor, relay, and protection diode. The converter has been designed for use with both a.c. and d.c. operated doorbells: the bridge rectifier ensures that in either case capacitor C3 is charged when the bell is rung. As soon as the voltage across the capacitor exceeds the operating voltage of Rel, this relay operates, contact rel changes over, and the flash-light goes off. In the meantime, C3 discharges through the relay coil until the voltage across it drops below the operating voltage of Rel, which then releases. If, however, the caller keeps his finger on the bell, C3 does not discharge and the relay remains actuated. The telephone-bell converter The terminals @ and (§) shown in figure lb are connected to the corresponding terminals in figure la (more on this under • available from should be set to about 3 V; in the case of ‘construction’). The unregulated output, Bradley Marshall Ltd. I four 1.5 V batteries, set the supply output, U2, of the power supply is stabilized by 11-24 3a zener diode D2 and capacitor C5. From the consequent stabilized voltage level of 8.2 V a reference voltage for the non-inverting in- put of opamp IC2 is derived by potential divider R2/R3. This is also applied to the inverting input via LI and P2 (LI is the inductor attached to the telephone by means of a suction pad). With P2 set correctly, the output (pin 6) of IC2 is low as long as LI is not excited. When the telephone rings an alternating voltage is induced in LI, causing the potential at the non-inverting input of IC2 to periodically exceed that at the inverting input. This results in a square-wave signal at the output of the opamp. The amplitude of this output is limited by zener D3. The square-wave voltage charges capacitor C6: as soon as the consequent voltage level across this capacitor reaches a certain value, T1 conducts. A current then flows through Rel (which, of course, is effectively connected in series with the collector of Tl), contact rel closes, and the flash-light goes off. Construction and presetting If the printed circuit board is used, the construction should give no problems whatsoever. If a doorbell indicator only is required, the lower part of the board is not used and can, if desired, but cut off. In most cases, a 12 V relay will be required, but it may be that your particular doorbell is a 6 V type and then, of course, a 6 V relay must be used. The telephone-bell converter always uses a 12 V relay. In this version, rectifiers B2 and electrolytic C3 are omitted from the printed circuit board. The external connections for the doorbell version are shown in figure 3a, those for the telephone application in figure 3b. In the telephone version it is possible to saw the printed circuit board in two and mount the part containing the telephone converter proper near the telephone and connect it to the other part of the board (which can be mounted anywhere unobtrusively) by means of a 4-way cable. The flash-light itself can be fitted in any required position. Using PI , set the power output to the value required for the flash-light (3 V or 6 V). In the telephone version adjust P2 so that the relay just does not operate. It may, however, happen that because of the off set voltage in IC2 this is not possible. In that case, connect a 1 kfi resistor in series with LI and another of 1 MJ2 between the junction of L1/P2 and U2. Finally, ask a friend to phone you and check that the flash-light goes off. It may be necessary to try out several positions of the suction pad containing the coil on the telephone. re 3. This figure shows versions: 3a for the door- bell and 3b for the telephone. 11-25 paver confrder fa model railu/a/s A power controller is, of course, intended to regulate the speed and direction of a model train. Ideally, it should give continuously variable control from a mere crawl to full speed. Before transistorized circuits became com- monplace, controllers were of two types: the rheostat or variable resistor and the variable transformer. The rheostat, con- nected in series with the locomotive motor, provides some control of the current and therefore of speed. The variable transformer enables the voltage supplied to the loco- motive, and therefore its speed, to be varied. Both types of controller have a specific disadvantage with which you may well be only too familiar. When, with your miniature train standing in the station ready 11-26 to leave, you advance the speed control, initially nothing happens. You advance the control still further: still nothing happens. Suddenly, your train bolts from the station, clearing it in about 60 milliseconds flat! Any illusion of reality has been destroyed! Real trains pull away (relatively? ) smoothly and take time to reach normal cruising speed, an effect which can be simulated in your model railway with our power controller. Strictly speaking, the name ‘power con- troller’ is a misnomer, as the numerous possibilities it offers make it more of a ‘train controller’. Be that as it may, what does the controller do? To start off with, it allows the train to move off as in reality: slowly at first, and gradually picking up speed until the predetermined speed is reached. Then, Since the day that Stephenson began taking an interest in coal, 'model railways' has grown into one of the most popular of hobbies: the creation of a world in miniature that lives and breathes on railway lines. The illusion can be woefully shattered, however, when an engine is actually put in motion. All too often the locomotive takes off like a startled rabbit, much to the consternation of the mini-passengers. If this were to happen in real life, time-tables would become irrelevant. Our power controller shows that it can be different. of course, if something goes wrong during motive is working and adjusts the output of the journey, it offers an emergency brake. the controller as appropriate. A PWM con- Thirdly, the train is made to stop as in trailer delivers a series of pulses of full real life by means of a simple push but- power and the speed is regulated by varying ton. And finally, to make everything as the width of the pulses, real as possible, it provides a ‘dead man’s In our design we have chosen PWM control handle’. As model railway enthusiasts know, in combination with RC time-constants. Not train drivers must keep this handle or foot only does this offer high efficiency, but also pedal pressed down continuously during pretty precise control. Furthermore, it can the journey. If it is released, that means be designed with readily available compo- that something is wrong with the driver. nents, so that its cost is kept relatively low. To prevent accidents, the train then stops During the design planning it was realized immediately. that there are two model railway systems: The dead man's handle does not have to be d.c. and a.c. It proved impossible to design kept depressed continuously in our control- a ‘universal’ controller and we therefore had ler, but it does have to be pressed regularly. to make a choice. As it appears that the The features mentioned are available for d.c. system is by far the most popular, we both forward and reverse movements. opted for this. Also, to keep the controller Modern electronics has made possible great - and therefore its cost - within bounds, advances in electric motor control. Of the we designed it for the control of one train various techniques employed nowadays, two only. stand out from the rest: closed-loop oper- The full-power pulses delivered by a PWM ation and pulse-width modulation (PWM) controller are normally fixed, often at the control. In the former the controller moni- rate of 100 per second (100 Hz) as this is tors the conditions under which the loco- easily derived from full-wave rectified mains. 1 As stated, speed is controlled by changing the width of the pulses: at low setting of the controller, the pulses are short compared with the spaces between them. As the con- troller is advanced, the pulses become wider and the space correspondingly narrower. The circuit diagram The power supply consists mainly of two voltage regulators: a 7815 (IC1) and a 7805 (IC2) as shown in figure 1. The first provides the supply voltage for the model railway and has, therefore, little to do with the circuit of the controller. The +5 V supply for the controller proper is provided by IC2. It is clear that IC1 has the heavier load and it must therefore be provided with a heat sink. It is, of course, also necessary that the supply transformer can cope with its two- fold task. Both regulators are protected against short-circuits and thermal overloads. The sawtooth waveform required for pulse- width control is provided by IC9. It should be noted that this waveform (Ui in figure 2) is not taken from the output of the IC, as that is a square wave, but from the inverting input, pin 2. Opamp 1C8 compares the sawtooth waveform with the d.c. level (U2 in figure 2) at the wiper of P2. This potentiometer therefore makes it possible to set the pulse-width of the square-wave output of IC8 (U3 in figure 2) and therefore the speed of the train. If, however, the con- troller is set to 'automatic', the position of P2 determines only the final speed of the train. The range of speeds is set by PI - maximum - and P3 - minimum. The automatic gradual take-off is achieved as follows. As soon as switch S2 is set to position 'start' (and assuming S3 is closed), capacitor C2 charges slowly via P2 and R5. This causes a gradually rising voltage at the non-inverting input of IC8 via ES4. The pulse-width of the square-wave output of this IC (U3) becomes broader until the maximum width, preset by P2, is reached. Dependent upon the direction of travel, these square waves drive T1 or T2 which in their turn cause darlingtons T3 (T4) or T5 (T6) respectively to conduct. If for one reason or another you want to let the train take off unimpeded, open switch S3 to make the output of gate N10 low. This causes ES4 to open and ES3 to close so that the combination C2/P2 is by-passed and the train will bolt out of the station. Automatic gradual braking of the train occurs in a similar manner: S2 should then be in the position 'stop' with S3 closed. In that situation, the bistable consisting of N1 and N2 changes state so that pin 3 of N1 be- comes low and the output of N9 goes high. This causes ES2 to close and ESI to open. The voltage across C2 then decays slowly until the value preset by P3 is reached. The effect of this is exactly the opposite of that when the train is leaving: the square wave pulses become ever narrower until the train has come to standstill. The emergency brake provided in the con- troller is a combination of two switches: S2 and S3. The brake is operated by setting S2 to position ‘stop’ and closing S3 at the same time. The delay combination C2/P2 is then by-passed and the train comes to an immediate stop. Another way to stop the train is by means of the dead man's handle, without, of course, any positive action on your part. Because, what happens if this handle, switch SI, is not regularly depressed? Capacitor S3 is charged slowly via R6 until the voltage across it reaches the trigger threshold of inverter Nil which causes the output of this gate to become logic low. Consequently, the output of N9 goes high and ES2 closes. At the same time the output of N16 be- comes logic 0 and ESI opens. The non- inverting input of IC8 is then also low. As in reality, the train now comes to a smooth, gradual halt. Finally, switch S4 enables the direction of travel to be reversed. Of course, it is not possible to just reverse the polarity of the supply voltage. First, the train has to gradu- ally slow down, come to a standstill and then, depending on the position of S3, gradually accelerate in the opposite direc- tion. When S4 is closed, the output of N15 becomes logic 1 , which causes the output (pin 1 1 ) of the XOR consisting of N5 . . . N8 to go low. The output of N9 then becomes logic 1, ES2 closes, ESI opens, and the train begins to slow down. At the same time, ca- pacitor C4 is charged via P4 and R 1 1 . This delay is necessary to enable the train to come to a standstill before the direction of travel is reversed. Once the voltage across C4 has become high enough to make the output of N14 logic low, reversal takes place. But, remember that this may only occur when the train stands still! It is therefore im- portant that the stopping time is shorter 2 Resistors: R1 = 220 k R2.R3 = 1 k R4.R6 * 1 M R5.R1 1.R13.R14 = 100k R7 = 10 n R8.R9.R10 = 18 k R12 = 47 k R15.R16 - 4k7 R17.R18.R19- 150 k P2 = 100 k lin. P4 - 1 00 k preset Cl - 47 n ceramic C2.C4.C7.C8- 10 p/1 6 V electrolytic C3 - 100 p/10 V electrolytic C5 - 10 n ceramic C6 - 2200 p/25 V electrolytic CIO - 1 n ceramic Cl 1.C12- 100 n ceramic Semiconductors: D1.02 - 1N4001 IC1 = 7815 IC2 - 7805 IC3 = 4066 IC4.IC5 = 401 1 IC6 = 4023 IC7- 40106 IC8.IC9 = CA3130 B1 =B 40/C 1500 avail able from Bradley Marshall 51 = push button switch 52 = single pole change- S3.S4 - SPST switch S5 - double-pole mains switch Trl = mains transformer 15 V/1.2 A FI = fuse. 100 mA Heatsink for IC1. 35 x 20 x 1 5 mm, 170°C/W Figure 2. The principle of pulse-width modulation (PWM) control. The width of the square-wave pulses, and therefore the speed of the train, is dependent upon the level of U2- [va than the charging time of C4 which depends on the positon of P4. When the output of N14 has become logic 0, the output of the XOR as well as that of N3 will go high. The change of state at the out- put of N5 results in N9 also changing state, so that ES2 opens and ESI closes. At the same time, the output of N4 goes high because the output of N13 has become logic 1. Transistor T1 then conducts hard, but the train none the less leaves slowly because the output of N4, and therefore T2, changes state in the rhythm of the square wave pulses which slowly become wider. The supply current for the locomotive then flows from T4 through the motor to T5. If switch S4 is opened, the same thing happens but in the opposite direction: the current then flows from T3 through the motor to T6. same token, a fully laden goods train just cannot accelerate to the same degree as the London to Edinburgh express. If you want to make everything as realistic as possible, you must, of course, make sure that such disparities cannot occur. Again, the con- troller will help you: both the time required to come to a standstill and that for accel- erating to top speed can be preset to indi- vidual requirements. The determining com- ponents for these are C2 and R5, the values of which can be varied as required. The top speed of the train can be set with P2 anywhere between dawdling and flying. The frequency with which the dead man's handle (SI) must be depressed can also be determined by yourself: the time deter- mining components are R6 and C3. H Figure 3. The layout and track-side of the printed circuit board for the controller. The various switches can be mounted on a small panel so that the 'driver' has all import- ant controls, including the dead man's handle, at his product C2R5: as drawn Different trains, different times It is, of course, nonsense to allow a modem intercity at top speed to be overtaken by an older generation steam locomotive. By the 11-29 One important factor that is often sorely neglected in digital circuit design is decoupling the supply lines. The best known method of decoupling is by means of a small capacitor connected across the power supply pins of an 1C. However, supply lines themselves also play a part in introducing interference, and this is the aspect of decoupling to which this article is dedicated. decoupling in digital elektor november 1983 decoupling in digital drcuifs The power supply voltage in digital circuits must normally lie within fairly narrow limits in order to guarantee correct operation of the circuit. In TTL circuits this is particu- larly critical, and the supply must not devi- ate by more than + or - 5% from the nom- inal value of 5 V. There is no real difficulty in keeping the supply within these 5% limits, but we must also ensure that no voltage peaks greater than this 5% can exist in the circuit. Any wire, power lines included, has a specific self-inductance and a specific resistance. The resistance is usually no prob- lem. The supply lines can easily be made a bit heavier, and that gets around that diffi- culty. The self-inductance is not so easily seen, but it is none the less present. What actually happens in a digital circuit? The power supply lines can be represented here by a self-inductance in series with a resistor, as figure la shows. If the IC in this figure switches it causes an immediate large change in the current flowing through the supply lines. The self-inductance voltage in each line can be calculated from the formula: U = - L(di/dt). Because the switching edges of the IC are quite steep, the current changes very quickly (di/dt is a measure of this change). This also means that the voltage in each line can change a lot (because of the fairly low self-inductance of such a supply line). These voltage vari- ations can have the result that the supply exceeds its permitted limits and the IC does not operate correctly. In order to reduce this problem as much as possible, a decoupling capacitor is often connected across the IC as in figure lb. In this way a transmission line is actu ally cre- ated, with an impedance of Z = \/LIC. This formula indicates immediately how we can reduce the impedance of the line as much as possible: by making C larger and/or L smaller. Bigger capacitors are one solution, but they are not generally cheap. Further- more, these large capacitors are not very good at high frequencies (about 100 MHz). A better idea would be to place smaller decoupling capacitors at various points on the supply line. A further possibility is, of course, to reduce L. This can be done by connecting several supply lines in parallel, as figure lc shows (just to refresh your memory: when coils are connected in parallel the self-inductance is reduced). To achieve this we can use a supply field or supply ‘grid’. When there is more than one IC in question (see figure 2) it does not make the job any easier. The further up the supply line we go from left to right, the worse the interference becomes. Each IC has to contend with not only the interference that it generates itself, but also that produced by all previous ICs as well. Here also a supply grid would be a better solution. The situation then be- comes that shown in figure 2b. This is the way of keeping the self-inductance of the supply lines as low as possible. The diagram of figure 3a shows a well thought-out layout for the supply lines in a digital circuit. This makes use of not one, but two grids, one for the positive supply and one for the ground. In this set-up every IC does not have to have its own de- coupling capacitor. One capacitor every second IC is more than enough. This is shown separately in figures 3b and 3c, for an IC with a capacitor and one without capacitor. The drawing of figure 3b makes Figure la. The supply line in a digital circuit can be considered as a resistance in series with a self-induct- Figure 1b. The supply of an IC can be decoupled here. Figure 1c. The self-induct- ance can be reduced by lines in parallel. 1-30 use of all the points mentioned here: more supply lines to the IC connection and a decoupling capacitor that is almost directly on the supply connections of the IC. In the other situation (figure 3c) we see that the IC without its own capacitor makes use of the capacitors on the four ICs around it. When combined with the multiple supply lines, that also gives excellent decoupling. A somewhat larger capacitor (10 . . . 47 jr) should be placed fairly centrally in each circuit or printed circuit board. This sup- presses low frequency voltage changes that can occur because of the resistance of the supply line to the board. This is nothing to do with HF decoupling, but it is just as important. Another point: in digital circuits there is often a large area where all the sections of supply lines are the same length, as in figure 3a. This means that all the induct- ances are equal. If all the decoupling capaci- tors also have the same value a ladder net- work is set up, and this causes the voltage to rise! So: use different values of capaci- tors. The technique described here is not just so much more theory, to file somewhere ‘for future use’. It does work, and it is definitely worth trying the next time you are building a digital circuit, even if it is only an experimental board. M Figure 3a. This is an extremeiy good set-up, using two supply grids. This layout works so well that we only need one decoupling capaci- tor per two ICs. Figure 3b. This is part of the grid of figure 3a showing an IC with a decoupling capacitor. Figure 3c. This is an IC in the grid of figure 3a without its own capaci- 1-31 The most appropriate description of this new CPU card might well be: an independent, single-board computer in eurocard format. Much effort has gone into ensuring that the card is truly universal. The choice of a 6502 microprocessor is a natural: well- known from the Junior Computer, it has the advantage that a range of well-tried hardware and software is readily available. CPU, card • • This new CPU card may well be considered the most versatile in the Elektor micro- processor programme. And not without reason. However, before we have a closer look at its characteristics, let’s see what applications it offers: that should give you some idea of its versatility. ■ Single-board control computer for: - machine control; - processing guard; - morse decoder; - telephone selector; - simulator or emulator; - PROM/EPROM programmer. ■ In combination with other p P cards: - with VDU card: a universal terminal (see elsewhere in this issue); - with VDU card, dynamic RAM card, and a floppy disk interface: an in- telligent terminal (see the article ‘VDU card' in our September 1983 issue where this set-up was already suggested). . . . based on the 6502 The microprocessor is shown at the left-hand side of figure 1 : it can be either type 6502 or its CMOS low-power version, the 65C02 (see ‘applikator’ in our October issue). The clock generates frequencies of 1, 2, and 4 MHz: the required clock frequency can be selected by means of a wire bridge. The address bus is fully buffered and available either direct or inverted. The data bus is also fully buffered. The control bus is not buffered, but that is, of course, normally not necessary. Then follow two VIAs (Versatile Interface Adapter), type 6522 or 65C22. The ope- ration and construction of these fairly complicated ICs are fully described in our VIA 6522 book. Briefly, this 1C offers two 8-bit bidirectional input/output ports, four handshake lines (by which data interchange is controlled), two programmable 16-bit timers or counters, and an 8-bit serial shift in/out register. Next, the 6551 or 65C51 ACIA (Asynchro- nous Communication Interface Adapter) is also a versatile IC. Here it is used for the RS 232 /V 24 interface (baud rate, serial/ parallel conversion, error detection, and so n other words, the ACIA arranges the data transfer. Some additional gates are connected between the 6551 and the RS 232 connector to provide any necessary level matching (the RS 232 operates from a positive and a negative supply). There is space on the card for one RAM-IC and one EPROM-IC. For the RAM there is a choice between a 2 kbyte and an 8 kbyte CMOS memory. There are also various possibilities for the EPROM: 2, 4, 8, or 16 kbyte. The VIAs and the ACIA have a common address decoder, while the memory-ICs each have their own. Also, all ICs are connected to the address and data buses, and, with the exception of the EPROM, to the control bus. A reset circuit ensures that the computer is automatically reset when the power supply is switched on. Manual resetting is also possible. 1-32 A 64-way connector, into which the control bus, the buffered address and data buses, ±12 V, and +5 V are terminated, is provided for connection to the Elektor bus. Returning to the VIA connections: on the first VIA, port A is used for a parallel key- board connection and port B for a Cen- tronics connection. On the second, ports A and B are both used for the programming (by means of shorting-plugs) of the ACIA, of the image size (only in combination with the VDU card), and some others, all of which are enumerated in table 1. The electrical diagram A look at figure 2 will soon show that there is not all that much to add to the description of the block diagram. At one side there is again the 6502 IC with beside it the three- state buffers Nil ... N58 for the address and data buses. The clock consists of two Features of the CPU card ■ 6502/65C02 CPU ■ 2x6522 VIA ■ 1 x 6551 ACIA ■ 2 or 8 k RAM ■ 2, 4, 8, or 16 k EPROM ■ complete address decoding ■ fully buffered address and data buses ■ 64-way Elektor bus ■ DMA possibility ■ clock frequencies of 1, 2, and 4 MHz ■ four 8-bit ports ■ four 16-bit timers ■ two serial data ports ■ eight handshake lines ■ parallel keyboard connection ■ Centronics connection ■ RS 232 connection ■ all I/O lines terminated into connectors I Figure 1. The block schematic of the CPU card. Note the large number of connections! 11-33 gates, N1 and N2, followed by two dividers, FF1 and FF2. Shorting plug PL14 enables selection of the required clock frequency. If, for instance, you want to use an external clock, dividers FF1 and FF2 can be made inoperative by connecting point M to N. Close to the clock you see the reset circuit consisting of gates N71 . . . N73. When the +5 V supply is switched on, the RC network R17/C1 ensures a half second delay before the reset input of the CPU is actuated. If required, a spring-loaded push-button switch may be connected between points P and Q to provide a manual reset facility. The address decoder for the VIAs (IC2 and IC3) and the ACIA (IC4) consists of gate N59; that for the RAM (IC5) is N60, and for EPROM IC6 it is N61. A crystal is connected to the ACIA for the generation of various baud rates. Gates N62 . . . N68 are level equalizers which translate the symmetrical signals of the RS 232 to asymmetrical 5 V ones for the CPU and vice versa. 11-34 When bipolar ICs are used, power dissi- single-board computer? you will say. Well, pation amounts to 100 mA at ±12 V and unfortunately, because of our determination 1 . . . 1.5 A at ±5 V. If, however, CMOS to make the card truly universal (which circuits are used, current consumption drops made necessary the use of shorting plugs to about 100 mA overall, so that it is then to pre-program the card) we just could not possible to supply the CPU from primary get the whole CPU on one board of eurocard cells or rechargeable batteries. format, and in the end we had to compro- mise on one large (eurocard) and one small _ board. Construction Both boards are double-sided, so, before The printed-circuit boards for the CPU card mounting any components, check with a are shown in figures 3 and 4. Two for a multimeter that all through-plated holes are sound. If so, solder all resistors, capacitors, crystals, IC sockets, and connectors in their respective positions. Apart from the 64-way connector, which should be a DIN 41612 male, it is recommended to use terminal strips for which shorting plugs are available: examples are shown in the parts list. Once everything is soldered in place, insert the ICs into their respective sockets. If a 2716 or 2732 EPROM is used, the 24-pin 11-36 C2, C7 . . . C25 = 100 n IC7 - 74LS04 ceramic IC8 = 74LS74 C3 . . . C6 - 1 n ceramic IC9 - 74LS01 IC10 . . . IC13 - 74LS240 Semiconductors: IC14-74LS245 D1 .. . 016 - 1N4148 IC15-74S133 IC1 - 6502 (65C02) 174 A LS1 331 IC2, IC3 = 6522 (65C22) IC16 - lc17 * 74LS30 Cl = 47 ill 6 V electrolytic 27128 32, 2764, IC2 ° = 74I -S06 Miscellaneous: XI - crystal, 1.8432 MHz X2 = crystal, 4 MHz 64-way connector to DIN 41 61 2, male 2 off terminal strip 40 x 2 8624-A°i02 • (10-89-18011 1 off terminal strip 16x2 pins, e.g, Molex parallel-keyboard connect | Centronics-connection ACIA-programming 5. 6, 7 or 8 databits I 1 , 1 .5 or 2 stopbits ACIA-programming enable/disable-interrupt enable/disable IRQ-line | normal/echo-mode | even/odd/no parity mark/space-parity PL9 dependent upon PL10 application PL13 IC is inserted so that its pin 1 mates with pin 3 of the socket. Then, depending upon your individual requirements, and with the aid of Table 1, place the shorting plugs as appropriate. Next, using three spacers, mount the small board onto the larger one. The necessary connections betw een th e tw o - D0 . . . D7, A0 . . . A3, CS 0, CS1, CS2, 2', R/W’, RES, ITU?, +12 V, -12 V, +5 V, and ■^6oftoooaoft6ft»gii RS 232, may be added as required. Do not forget to connect the address decoder N59 by means of short wires. This completes the CPU card. The choice of memory capacity of EPROM and RAM, as i - should then be made with short lengths of wire. Finally, mount the ICs onto the smaller board and place shorting plugs as appro- priate. Suitable connectors, like that for the dosed) 0 0 well as of the program the EPROM shall tion to Table 1 . This table shows clearly contain, is, of course, dependent upon the which connections have to be made for application and size of the system in which specific applications and its importance to the CPU card is to function. such a versatile circuit as this CPU card Lastly, we would draw your special atten- cannot be overstated! H Table 2. Expansion of ACIA programming by means of short-circuits connectors PL3and PL decimal-to-binary elektor november 1983 ... for programmable pocket calculators Table 1 2nd Lbl 1 2nd x > t GTO 2 GTO 1 2nd Lbl 2 2nd x = t GTO 3 STO 2 GTO 4 2nd Lbl 3 STO 3 2nd x > t GTO 5 2nd n 2nd Pause EE CLR GTO 6 2nd Lbl 5 RCL 4 RCL 3 STO 1 2nd Lbl 6 ► RCL 2 2nd INV x - t GTO 4 R/S RST LRN decimal-to-binary converter... ; The home-made converter described in this article will make your programmable pocket calculator doubly useful by providing an eight-bit binary output which, for instance, may be loaded into a computer. Moreover, the output can be readily extended to 16 or 24-bit. Principle As pocket calculators invariably have no factory-fitted interface facility, one had to be designed. In an analogy to photo- couplers, light-dependent resistors (LDRs) were chosen which are fastened light-tight with thick, black insulating tape onto two digits of the calculator display. The basis of the converter is, of course, the translation of decimal numbers into binary ones. True, it is quite simple to do this with any calculator (and pen and paper), but here it is achieved automatically by suitably programming the calculator. The program for a TI 57 is given in Table 1. Although the article is written around the TI 57, it is equally applicable to any pro- grammable calculator though some minor details may have to be changed. The TI 57 will give a clock pulse on the exponential digit and the logic state at the right-hand digit. At logic ‘1’, the display is dark, while at ‘0’ ‘it’ is displayed. The circuit diagram The (low) output of the LDRs is amplified in simple, single-transistor stages to ensure correct drive to the memory and display ICs (see figure 1). The remainder of the circuit is simplicity itself. An eight-element shift register type 74LS164 is used which can store up to 255 binary numbers. If larger numbers are required, the memory can be extended as often as possible: the capacity of the computer sets, of course, a limit in practice. With extensions, it may be necessary to make the transistor stages more sensitive. The monoflop type 74LS121 is the most effective guard against display jitter. Additional gates may be connected in place of the LEDs which draw a current of only 15 mA. Construction and adjustment Except for the LDRs, the converter may be constructed on a piece of VERO or other prototyping board: it is not critical. The LDRs are, of course, mounted onto the calculator display (LDR1 over the exponential digit and LDR2 over the right- hand digit) with thick, black tape to ensure absolute light-tightness. Even then, the 1 converter should not be used in locations where the ambient light is subject to large variations. Correct operation of the converter can be checked as follows: ■ arrange for the program to convert a relatively large number, say, 1024, so that it runs for a measurable period. ■ Using a universal meter, measure the voltage at the collector of TI - this should be about 2 V, if not, adjust PI to obtain this voltage. ■ Next, measure the voltage at pin 6 of IC1: this should always be 0, except at the moment a pulse is received when the meter briefly deflects. Readjust PI carefully so that the meter gives a deflec- tion for every clock pulse. ■ Finally, adjust P2 to obtain 2 V at the collector of T2. The LEDs should now indicate the logic levels of the decimal number converted: for instance, 253io = 11111101. If not, readjust P2 slightly. Final note In addition to the possibility of feeding the eight-bit word to a computer, an additional electronic circuit can further process the binary numbers. By means of extra gates, it is then possible to control, for instance, the turnouts of a model railway. With a little skill and thought it is also possible to devise other applications. Happy experimenting! H 11-40 lovember 1983 Floppy-disk interface for the Junior (December 1982, page 12-48) Figure 3 contains an error (see page 12-50). Pin 7 of ground. Upper and lower case on the Elekterminal (January 1983, page 1-56) Figure 1 (page 1-57) fails to show that the CE of the 2716 which replaces IC11 must be connected to ground. If this is not done, the EPROM remains in the three-state mode. Drum interface (November 1982, page 11-20) The connections to pins 6 and 7 of IC2 (see figure 2) must be interchanged: the junction R9-C4 must be connected to pin 7 and the other side of C4 to pin 6. If for each drumbeat a number of trigger pulses are generated, connect a 50 k preset in series with R8. In-car ionizer (December 1982, page 12-45) The value of PI is given as 47 k in the parts list; its correct value is 10 k as shown in figure 1. Single-channel infra- red remote control (January 1982, page 1 52) In figure 2 on page 1-52, FF1 is shown as a flip-flop, whereas it should be a monostable. This can be corrected by connecting pin 11 of IC2 to ground. Music quantisizer (October 1983, page 10-33) The type numbers of IC4 and IC7 in figures 4 and 5 respectively have been in- terchanged: IC4 - 74LS377 and IC7 - 74LS373. The parts list is correct. 11-41 PC board pages The following pages contain the mirror images of the track layout of the printed circuit boards (excluding double-plated ones as these are very tricky to make at home) relating to projects featured in this issue to enable you to etch your own boards. ■ To do this, you require: an aerosol of ‘ISOdraft’ trans- parentizer (available from your local drawing office suppliers; distributors for the UK: Cannon & Wrin), an ultraviolet lamp, etching sodium, ferric chloride, positive photo-sensitive board material (which can be either bought or home made by applying a film of photocopying lacquer to normal board material). ■ Wet the photo sensitive (track) side of the board thoroughly with the transparent spray. ■ Lay the layout cut from the relevant page of this magazine with its printed side onto the wet board. Remove any air bubbles by carefully ‘ironing’ the cut-out with some tissue paper. ■ The whole can now be exposed to ultra-violet light. Use a glass plate for holding the layout in place only for long exposure times, as normally the spray ensures that the paper sticks to the board. Bear in mind that normal plate glass (but not crystal glass or perspex) absorbs some of the ultra-violet light so that the exposure time has to be in- creased slightly. ■ The exposure time is dependent upon the ultra-violet lamp used. the distance of the lamp from the board, and the photo-sensitive board. If you use a 300 watt UV lamp at a distance of about 40 cm from the board and a sheet of perspex, an exposure time of 4 ... 8 minutes should normally be sufficient. ■ After exposure, remove the layout sheet (which can be used again), and rinse the board thoroughly under running water. ■ After the photo-sensitive film has been developed in sodium lye (about 9 grammes of etching sodium to one litre of water), the board can be etched in ferric chlo- ride (500 grammes of FeCl3 to one litre of water). Then rinse the board (and your hands!) thoroughly under running water. ■ Remove the photo-sensitive film from the copper tracks with wire wool and drill the holes. 1-42 1-43 The special feature of this movement detector is that it is a passive device: it does not use a transmitter like a light barrier. The fundamental principle of its operation is very similar to that of the human eye. movement detector optical guard transistors T1 and T2 is taken to earth via capacitors Cl and C2 respectively. Correct design of these stages ensures sufficient suppression of mains hum and similar inter- ference. The d.c. outputs of the filters are applied to differential amplifier IC1. As long as nothing moves in the space being monitored, the voltages at the two inputs of IC1 are virtually equal and the output of the ampli- fier is therefore very small. Even a slight difference between the outputs of the diodes, caused by a movement within the field of the lens, leads to a rapid and unmistakable change in the output voltage of the differential amplifier. The amplifi- cation factor of the next stage, IC2, is about 20. When a distinct, strong movement is observed by the lens, IC2 goes into saturation. The output signal of IC2 is passed through an additional filter. This is a low-pass filter with a cut-off frequency below 50 Hz so that it prevents any hum or other very low frequency signals from being passed on to the following amplifier stages consisting of op-amps A1 and A2. At this point we are able to detect move- ments in the area under surveillance. As we have seen, any movement results in a rapid rise of the output level of A1 while inter- ference is kept to a minimum by the filter. There is, however, a problem still remaining. The somewhat unusual configuration at the input of A2 is necessary because the output of IC1 is, in fact, a d.c. level - even with the The sensor consists of two photo diodes which have the same task as the rods in the retina of the human eye. These diodes are mounted close together in a light-proof box and a lens in the box projects an image of the space being watched onto the diodes (see figure 1). When the brightness of the environment changes, for instance, through increasing clouds, twilight or the like, the light falling onto both the diodes is reduced equally. If something moves within reach of the lens (and it may only be the budgerigar), the light onto the diodes is reduced in dis- similar proportion. The circuit is extremely sensitive to very small differences in light intensity. In view of this characteristic, the device is particularly useful as a guard against theft and break-in, for instance, as supplement to the burglar alarm. It is for that reason that an alarm-tone generator has been included. Apart from that, the device is very useful wherever it is difficult to provide a source for a light barrier. It is, for example, possible to use the circuit to control a mechanically operated door so that it opens on the approach of a person. The circuit of the detector is shown in figure 2a. The cathodes of the photo diodes are at +15 V, while the anodes are fed via simple active filters, which provide a (first) protection against interference. The diodes should be connected to the rest of the cir- cuit by as short a length of coaxial cable as possible. Any a.c. appearing at the bases of Figure 3. Output of the differential amplifier: the amplitude depends upon the amount of move* 11-46 circuit in the quiescent state! This rules out the use of a simple comparator to provide us with an unambiguous output signal. Op-amp A2 is therefore used as a slightly modified differential amplifier. The signal is passed directly to its inverting input, but is filtered by C5 and R16 at its non -inverting input. This additional low-pass filter does not introduce a noticeable time delay. With a constant input level, the output of A2 will be 0 V. However, a rapid rise in input level will produce an output which is similar to that shown in figure 3. The trip threshold of comparator stage A3/A4 can be set with PI and P2. A3 and A4 change state when the positive or nega- tive threshold respectively is exceeded. The outputs of the two comparators rise to +15 V in either case. Diodes D3 and D4 form an OR gate for the output of both triggers. Figure 3 shows why this apparently complicated design was chosen. On a rela- tively strong start signal, the output of A2 decays very rapidly. On a relatively weak movement in the area and a consequent negative-going output of A2, the positive trigger threshold may not be reached. The chosen design ensures better sensitivity and improved protection against interference. Construction Construction of the case should be carried out rather more carefully than is usually required: it must be absolutely light-tight, with the exception of the lense, of course. If it is not, you might as well have saved 3 uiv) yourself the trouble of ensuring that the circuit has such a high sensitivity! With this point in mind, it is advisable to mount all the electronics in the case. Figure 1 shows how a case can be constructed from two sheets of aluminium. The best method to ensure light tightness is to seal the small gaps where the sheets of aluminium meet with thick, wide, self-adhesive tape. A very neat solution for the lens is to take one from and old camera: you must, of course, remove the diaphragm or make sure that it is permanently open! It may also be possible to purchase a second-hand one very cheaply. Before removing the lens from your new SLR camera, look through the catalogues of electronics surplus suppliers: they often include lenses. The two photo diodes are mounted close together on a piece of Vero board (see figure 4). As shown in figure 1 it should be possible to move the board within certain limits. The correct distance between the diodes and lens is found as follows: hold a piece of white paper as close as possible in front of the diodes and move the board until the image of an object at the required maxi- mum surveillance distance is sharpest. The board can then be fixed in place. As sharp- ness of image is not too critical, the board can be fixed for 'infinite' distances as on a camera: the effective operating range then extends from about 6 feet to infinity in front of the lens. In practical tests the device reacted on slight movements at a distance of up to 30 feet. Crawling into the area proved impossible without detection as was proved one Monday morning at the entrance to the editorial office! The device worked equally well in neon light, daylight and twilight. Only in absolute pitch darkness did it stop working, although the photo diodes are sensitive to infra-red radiation. Unfortu- nately, the heat radiation from the human body lies in a part of the infra-red spectrum to which the photo diodes are not sensitive. If required, however, the surveillance area may be 'lighted' by invisible infra-red light. The coverage area of the prototype extended over an angle of 30° only, but this can, of course, be improved by the use of a wide- angle lens or by using more than one pair of diodes. For each pair of diodes the circuit up to and including R9 must be duplicated. IC2 can then be connected as a summing amplifier. Figure 4. The photo diodes must be mounted close together on a small piece Alarm-tone generator The circuit of the alarm-tone generator as shown in figure 2b must be taken as an example only, as the output pulse of the detector can be used to drive a horn loud- speaker. Gates N1 and N2 form a mono- stable which streches the input pulse from A3 or A4 to about 1 second. Gates N3 and N4 form an astable which oscillates only when pin 8 of N3 is low: its operation thus depends on the inverted output signal of Nl. The output of the astable drives a loud- speaker via amplifier T3. The tone can be altered within narrow limits by changing the value of C7. Power supply (figure 2c) The power supply is conventional but for one aspect: the supply for the alarm-tone generator has been provided separately. This was found necessary to prevent feedback between the two parts of the device. If a different alarm-tone generator with its own supply is used, IC5.C10 and Cll in figure 2c can be omitted. H footnote Although the circuit was designed to be as sensitive as possible, it regretfully failed to detect any signs of movement in the staff of the editorial office between the hours of 08.30 and coffee-break! This problem was effectively cured by recalibrating the coffee- break to 08.32! 1-47 A metronome is of vital importance in, among others, the study and practice of music, dance, and the morse code. Some people have a natural 'feel' for rhythm; others have to work at it. But without a metronome that would be a very difficult task indeed. A metronome is an apparatus for fixing the tempo (Italian for speed) of a composition (music) or of a regularly recurring series of tones (morse, for instance). The commonest form in use is still the clockwork one of Maelzel who invented it in the early part of the nineteenth century. The indication at the head of a piece of music, M.M. = 100, for instance, means that the beat is to be taken at the speed of Maelzel's Metronome set at 100 beats to a minute. However, such a metronome produces but a simple 'tick tack' at speeds between 40 and 208 times per minute and is, moreover, relatively expensive. The electronic metronome we have designed has a two-tone output and can produce rather more complex rhythms than its mechanical counterpart. electronic two-tone metronome allegro ma non troppo (al tempo giusto) A metronome has two functions: first, it should produce a regular rhythm and, second, it should indicate the beat of a composition. Maelzel’s metronome consists of a clockwork-driven pendulum of which the period is adjustable by means of a small weight. One of the problems of the aspiring musician is the recognizing of accents, another that of dividing beats into strong | and weak, and yet another that of the structure of the beat, and so on. In these, the mechanical metronome is not of much help. Our electronic metronome gives two percussive sounds of adjustable frequency and timbre and of which the rhythm can be freely set by means of switches. The circuit diagram It will not surprise many that the design is given rhythm by a clock, Schmitt trigger N5 at the top left-hand of figure la. Poten- I tiometer PI controls the speed of the beats. The clock pulses are applied to pin 14 of IC1, a binary counter with eight outputs type 4022. Outputs Q0 . . . Q7 become logic high sequentially in the rhythm of the clock frequency. The enable input (pin 13) of the counter is connected to ground and is therefore permanently logic low. Reset input (pin 15) is, however, used to modify the number of pulses per measure or count-cycle, which is how the various time-signatures are derived: 7/8, 3/4, 5/8, and 4/4 (the signature 3/4 also enables 6/8 to be obtained). As shown in figure la, these time-signatures are selected by selector switch S9. The Q-outputs of IC1 are connected to a double matrix of 2 x 8 diodes, D1 . . .D16, and 2x8 switches, SI . . . S8. Depending on which of the switches are closed, one or more of the output pulses of IC1 are applied to the rest of the circuit. This symmetrical arrangement enables two dif- Figure 1«. The clockwork ferent, but synchronous, series of pulses to be obtained which are then used to produce two different tones. The tones are actually damped oscillations generated by band-pass filters IC4 and ICS at the leading edge of the incoming pulse at their inverting input (pin 2). To prevent the trailing edge of the pulse also causing the generation of a - different - tone, two monostables, N1/N2 and N3/N4, precede the band-pass filters. The result is a clean- sounding tone without a hint of stutter. As it is, of course, possible that two or more outputs of IC1 are selected, it could happen that the logic high at the input of one of the monostables lasts for two or more clock pulses, as shown in figure 3. The monostable is, of course, not able to separ- ate two sequential pulses. For that reason, Schmitt triggers N6 and N7, preceding N1 and N3 respectively, shorten the pulses emanating from the diode matrices and superimpose them on the clock pulses in a NAND-function. That the pulses are inverted and become phase-shifted does not detract from the proper operation of the circuit. We now have two separate pulse-sequences derived from the same clock frequency, and this takes us to the analogue part of the metronome. The values of capacitors C4/C5 and C7/C8 (note that C4 = C5 and C7 = C8) together with those of presets P2 and P3 determine the centre frequency of band-pass filters 3 number ’ 7 3 4 5 6 rr 8 switches A ✓'o • — 5 ✓'o •""■ft /. o'** ✓'o ✓"o ✓'o w-a inn J J } 7 } 1 instrument B IE 7 } 7 I > 7 count E I « d 4 and Figure 3. If two adjacent switches are closed, one ber of terminals which are intended for connection to external equipment. These are the output of counter IC1, the clock frequency, the outputs of the monostables (S and Q), and the inputs of the two band- pass filters (T and R). More about this external equipment in a later issue . . . Table 1. Possible scale division for potentiomete PI which is identical to that used on traditional 46 50 52 54 56 58 60 63 66 72 76 80 84 88 92 96 100 104 108 176 192 200 IC4 and IC5 respectively, and therefore the tone and timbre of the percussive sounds generated. The higher the value of the capacitors, the lower the tone. For instance, with a value of 330 n, the sound is like that of a kettle-drum, provided the remainder of the design (loudspeaker!) can reproduce such low notes. Resistors R8 and R13 determine the damping factor: the higher their value, the higher the damping - from the sound of a snare-drum to the boom of a kettle-drum. Presets P2 and P3, apart from setting the centre frequency of the band-pass filters, determine together with resistors R14 and R15 the mixing ratio of the two tones as required. To facilitate easy recognition of the preset rhythm, an LED, D17, is controlled from output Q0 of IC1 via N8 and Tl. This LED thus lights at every first tone of a sequence. To make the metronome self-contained, an a.f. power amplifier, built around a TDA2003, has been provided as shown in figure lb. The power supply, as shown in figure lc, is a simple circuit based on a type 7815 regu- lator. As the metronome itself does not draw more than about 10 mA, and IC2 in quiescence not more than 200 mA, it might appear as if the mains transformer is overrated at 1A secondary current. This is, however, not the case, because at each ‘tick’ or ‘tack’ the current passing through IC2 may well reach a value of 1 A, de- pending upon the setting of the volume. This also explains why IC1 and IC2 should be mounted onto a common heat sink. Extension possibilities It will not have escaped the attentive reader that the diagram in figure la shows a num- Construction and calibration The use of the printed circuit boards shown in figures 4 and 5 makes construction of the metronome a fairly simple matter. The metronome proper is contained on one of the boards, the power supply and power amplifier on the other. The most compli- cated part of the construction is perhaps the wiring of the eight switches which, together with the LED, the potentiometer PI, and selector switch S9 are mounted on the front panel of the box. Terminal S should be connected to T, and Q to R, by means of a wire bridge. Terminals Q0 . . . Q7 and CLK are not used - for the time being . . . The connection between the output of the metronome and the a.f. amplifier should preferably be made with screened audio cable. The loudspeaker leads need not be screened, but should be of sufficient diameter (say, 0.25 mm 2 ). Calibration consists merely of finding the right balance of the amplitudes of the two signals (by means of P4 and P5) and their timbre (by means of P2 and P3). Guide- lines for these cannot be given, as they are entirely a matter of personal preference. When turning P3, it may happen that hum suddenly becomes audible: this occurs when the centre frequency of one of the band-pass filters is 100 Hz (twice the mains frequency). The remedy to this is simply turning P3 a little back or on. 1 and 2 and 3 and 4 and . . . We have now come to operating the metro- nome. A simple example of a programme is shown in figure 2: switches SIB, S3B, S5A, S6A, S7B, and S8A are closed, all the others are open. Selector switch S9 is in position ‘D’, that is 4/4. You then count 1 (and) 2 (and) 3 and 4 and 1 (and) 2 (and) . . . Potentiometer PI can, as in a traditional metronome, be provided with a calibrated scale - a suitable scale division is given in Table 1. M 1-50 for the personal FM The personal FM radio receiver published in the September 1983 issue was based on the TDA 7000 from Philips and has proved to be very popular. The good news is that this 1C has been followed by another from the same source, the TDA 3810, and this can be used to put the personal FM receiver in an entirely different light. We know that the TDA 7000 is for mono reception only and therefore stereo reception is out of the question . . . almost! If not actual stereo, how about a 'pseudo stereo'? This is where this article and the TDA 3810 come in! Shortly after the introduction of the ‘TDA 7000 single-chip FM receiver’ IC, Philips follow it up with another new chip which, even though it is hardly likely to cause an uproar in ‘The House’, is still a very nice ‘first’ in many respects. It is, in fact, an interesting 18 pin IC, the TDA 3810, which converts a normal mono signal into a pseudo stereo signal, or a normal stereo signal into so-called spatial stereo. This ‘spatial’ possibility (also called ‘super stereo’) is, of course, for enthusiasts, but pseudo stereo is, certainly when combined with the TDA 7000, a very interesting idea. This is all the more so as the ‘stereo’ effect is very good (we have already heard it!) and this also completely avoids the noise problem associated with true stereo personal receivers. Above all, this pseudo stereo IC is a lot cheaper than a full stereo decoder! The design The block diagram for the TDA 3810, along with the external components that are needed, is given in figure 1. It shows that the pseudo stereo circuit splits the incoming mono signal (connected to pins 2 and 17) into two channels. One channel goes straight to the output. In the second, however, all frequencies between 300 Hz and 2 kHz are delayed. The value of this delay is frequency dependent (for example, at 800 Hz it is 500 /rs), and that gives the listener the illusion of stereo. Frequencies below 300 Hz and above 2 kHz from the second channel are passed unchanged to the output so that one speaker does not have a wider frequency range than the other. Because the effect is a matter of personal taste, the low-pass filter used has been kept off the chip to enable each user to set it to suit himself. 11-52 In stereo there is a difference of 60 dB be- tween the channels. The spatial stereo effect is achieved by adding an anti-phase cross-talk between the channels. This ‘anti-cross-talk’ (about 50%) increases the apparent distance between the two loudspeakers. Because using the TDA3810 means that there is an extra element in the path of the audio signal, no effort was spared when the IC was designed to ensure that the figures for signal/noise ratio and distortion are as good as possible. The end result is a signal/ noise ratio of 70 dB, which is quite good, and the harmonic distortion measured in the prototypes was less than -80 dB. Stereo noise is totally unknown to the TDA3810, as is annoying ‘switching noise’ that occurs if a stereo receiver tuned into a weak stereo signal constantly switches between mono and stereo. There are two switches connected from pins 11 and 12 to ground and these are used to switch between mono and pseudo stereo and between ordinary stereo and spatial stereo. Two LEDs can be directly driven from pins 7 and 8, by means of built in driver stages, to indicate whether the circuit is in pseudo or spatial stereo mode. The IC needs a voltage supply of between 4.5 and 16 V and has a current consumption of about 7 mA. The three tables give the specifications for the TDA3810. Table 1 is the maximum ratings, table 2 the normal specifications, and table 3 is a sort of truth table for how the various functions relate to the positions of the switches and the indications on the LEDs. The stereo extension The TDA3810, with its pseudo stereo capa- bility was developed with the intention of combining it with the TDA 7000 to provide a very small FM receiver with a ‘better than mono' sound at a relatively low cost. The printed circuit board for the stereo extension is fully compatible with the personal FM receiver, the full details of which was published in our September issue. The added circuit effectively replaces the volume control of the FM receiver so that the TDA 3810 decoder is connected between the receiver 1C and the LF amplifier. Apart from that the only addition now required is an extra LF amplifier since we now have two channels. Because the complete extension circuit, including the added LF amplifier, is con- tained on one printed circuit board, con- verting our personal FM from mono to pseudo stereo is straightforward. Now, of course, the case we built for the original receiver is no longer big enough but the whole assembly can still remain a very compact receiver. 11-53 The current consumption increases by about 5 ... 9 mA, so the total consumption for the pseudo stereo personal FM radio is about 24 ... 30 mA, depending on the volume. The circuit The circuit for the extension is shown in figure 2. The heart of the circuit is the TDA 3810 and the external components needed by this IC to convert mono into pseudo stereo. The mono signal comes into this IC at pins 2 and 17 and is thus split into two channels. One channel goes straight to the output, but in the second one all frequencies between 300 Hz and 2 kHz are subject to a frequency-dependent delay. Other frequencies pass unchanged to the output. The phase shifting needed for the pseudo stereo effect is achieved with the circuitry between pins 6, 14 and 16. The output of the TDA 7000 has to be brought to a suitable level so that the pseudo stereo decoder gives the best possible signal/ noise ratio, and for this a voltage amplifi- cation of about forty times is needed. This is exactly what the input stage of T1/T2 provides, and it also ensures that the de- emphasis network at the output of the TDA 7000 is not loaded. After the signal is amplified by the T1/T2 stage it enters IC1 and when this IC has done its thing the processed signal appears at pins 6 and 13. The signals then go via a voltage divider and stereo pot PI to the two LF amplifiers, one on the extension board (IC2 and the associated components) and the identical one already on the board of the personal FM. One final point about the circuit. There is, as we have already pointed out, a facility in the TDA 3810 for driving a LED to indicate when this IC is operating in pseudo stereo mode. However, as LEDs consume a fair amount of current, we decided to do with- out it and avoid wasting any of the 9 V battery’s power. We have included a switch (SI) to change from mono to pseudo stereo, as the mode depends only on whether pin 1 1 is connected to ground or not. Construction The printed circuit board for the pseudo stereo extension (figure 3) is near enough exactly the same size as that of the personal FM. Depending on the case used, the two boards can be mounted side-by-side or they can be made into a ‘sandwich’. Part of the reason that the board is so small is that all the resistors are mounted vertically. This means that locating everything correctly before soldering requires more care than It is quite easy to check if the circuit is correct on the basis of the test voltages given. If some of the voltages measured differ from the stated values then obviously something is amiss. Most likely this is due to some resistors being interchanged, but it could be something else (you never can tell, what with Murphy hovering in the back- ground). The voltage at the base of T 1 should be about 1.1 V. However, as this is the output of the TDA 7000, there may be some Table 3 MONO j H (off) j PSEUDO I L (on) I H (off) | SPATIAL I H (off) STEREO | L (on) | - I X off on off off L = LOW =0 to 0.5 V H = HIGH = 2 V to Vp X = state is immaterial deviation in this value so a better checkpoint is the collector of Tl. If the voltage here deviates by more than 1 V from the antici- pated value of half the supply voltage (i.e. 4.5 V) then R16 must be changed. Connecting the pseudo stereo board to the personal FM board is no problem. The volume control pot (P2) on the radio must be removed and a 22 kfi resistor is soldered between points 3 and 5. Also C18 must be replaced by a wire bridge. The input to the pseudo stereo board is now connected to point 3 on the radio board and the output for the left channel (the wiper of PI) to point 4. Now only the two power supply lines have to be connected and the job is A final note: if the pseudo stereo extension is to be used separately from the personal FM then obviously the input level will have to be adapted. This can be done using the small interface circuit shown in figure 4. H Capacitors: Cl = 470 n C2.C3.C7 = 10 n C4 = 22 n C5 = 100 p/25 V C6= 12 n C8 = 220 n C9.C11 = 4p7 /63 V CIO = 47 p/25 V Cl 2 = 22 m/10 V tantalum C13 = 100 m/10 V C14 = 47 n ceramic Cl 5 = 47 m/2 V tantalum Semiconductors: Tl ,T2 = BC 550C IC1 = TDA 3810 IC2 = LM 386 : single pole toggle itch Two loudspeakers. 8 n. 11-55 &