November 1982 up-to-date electronics for lab S j janior goes floppy guitar tuner realistic railway lighting Cerberus , watch-dog fed' ■ Sorry folks , This was delivered wet by the postman ©in a rainy day. MAIL ORDERS TO: l7 BURNLEY ROAD, LONDON NW10 1ED SHOPS AT: 17 BURNLEY ROAD. LONDON NW10 (Tel: 01-452 1500, 01-4506597. Telex: 922800) 305 EDGWARE ROAD. LONDON W2 contents 1982 - 11-03 selektor 11 -18 drum interface 11-20 G. Lausberg The synthesizer is probably the best source of 'electronic sounds' in con- tempory music and it/is usually played with the traditional keyboard. However, almost any, instrument can be used to play a synthesizer, includ- ing a drum, as this article shows. talking dice 11-24 Once upon a time, dice were just dice. They rolled and had spots. Then along came electronic dice, no rolling, no spots, just LEDs! Now we have the ultimate - talking dice. It does everything except laugh when you lose . . . and even that can be arranged! model train lighting 11-28 Lighting in the carriages of model trains is very desirable and realistic - until the train stops! The two-rail constant lighting control in this article will be well received by the mini-travellers. guitar tuner 11-33 Many guitarists have realised that by far the best way to tune a guitar is by means of a visual electronic tuning aid. The tuning aid in this article is elec- tronic but, more important, it is very accurate. cerberus 11-38 Sophisticated alarm systems tend to be expensive. What the average house- holder needs is a simple, good quality, low cost system which detects entry and then scares the living daylights out of the intruder! floppy disk interface for the junior 11-42 G. de Cuyper The hardware for this floppy disk interface has been designed to be univer- sal. The owners of a KIM SYM, AIM-65, ACORN, as well as the Junior and other computers can use this low-cost interface to extend their com- puter to a real personal compu-e- An interface for connecting the EPSON printer is also provided. cubular bell 11-54 K. Siol Cubes are attractive to the human mind, a fact well proved by Rubik. Take a cube, add sound and it becomes quite fascinating. Once picked up it be- comes difficult to put down. mini-organ extension ... 11-56 Those of you who built the mini-organ last year will welcome this exten- sion circuit. It brings the mini-organ half-way to being a synthesizer. kitchen timer 11-58 A versatile timer with the facility of four separate preset time periods available at the touch of a button. market 11-59 A lab power supply is only one of the projects that will arrive with the December issue. A look at digital filters and the world of robotics will also appear together with the software for the floppy disk interface. And then there is. . . but we keep that a secret until next month. Breadboard ’82 10-14 November Royal Horticultural Halls Central London Britain’s best known amateur electronics exhibition Features . . . Free Seminars . . . Competitions . . . and the leading companies in this industry. Admission is only £1 at the entrance for adults, Discount tickets are available in Hobby and 50 pence for OAP’s, children and group Electronics and Electronics Today ; the parties. leading magazines from Argus. For exhibitor information contact Colin Mackenzie on 01 -286 91 91 For tickets and all other information contact Peter Evans on 0747 840722 ANTEX Soldering Irons & Accessories Books Bulbs Buzzers Capacitors Chokes Circuit Etchant Components Diodes Etching Transfers Fuses Heat Sinks I.C.’s (CMOS, TTL, Linear) Knobs L.E.D.'s Multimeters Presets Project Boxes Resistors Speakers Cable Microphones Sound to Light Audio Plugs & Sockets Aerials(T.V.andFM) MAINS and AUDIO LEADS (If not instock, made to order) etc etc etc!! REPAIR SERVICE SEND S.A.E. FOR LEAFLETS & PRICE LISTS Access and Barclaycard Welcome 90 Wellington Street, Stockport, Cheshire. SKI 3AQ . Tel:061-480 8971 €l£CTRONIC HOBBI€S?FfMR Alexandra Pavilion London November 18 -21 1982 The biggest and best event ever to be staged for the electronic hobbies enthusiast! walk into a whole world of electronic equipment. - Everything from resistors, IC'S to home computers, transmitting and receiving units, citizens band radio and peripheral equipment, video games, musical instruments, radio control models. . . . In fact whatever your particular electronic hobby you II find this show will be the most interesting and informative way to discover all the latest developments in your particular field. Other attractions will include radio and TV transmission, electric vehicles, radio controlled models, and demonstrations by local and national organisations This is the age of the train - British Rail are offering a cheap rate rail fare from all major stations in the country direct to Alexandra Palace - a bus will be waiting on your arrival to take you to the show. Ticket price also includes admission to the exhibition - so let the train take the strain to the Electronic Hobbies Fair. Ticket prices at the door are £2 for adults, £i for children but party rates are available for 20 people or more. TO find out more, contact the Exhibition Manager, Electronic Hobbies Fair, IPC Exhibitions, Surrey House, 1 Throwley way, Sutton. Surrey SMI 400. Tel: 01 -643 8040 Electronic Hobbies Fair is sponsored by Practical Electronics, Everday Electronics and Practical Wireless and is organised by IPC Exhibitions Ltd. OPENING TIMES Thursday 18 Nov. - 10.00-18.00 Friday 19 Nov. -10.00-18.00 Farming solar energy ' The biggest european solar power station with a 300 kW capacity is being built on the North Sea island of Pellworm in Schleswigholstien, Germany. The station is scheduled for completion in July 1983 and will provide the energy requirements for the convalescent home that is a feature of the island. The solar panels cover an area of roughly 16000 square metres which is equal to about two football pitches. The entire project is being developed by AEG Telefunken of Germany. The generator directly converts solar energy into electrical energy. Since the plant is built on farm land, and the land is still required, the total solar array is raised about one metre above ground level allowing the area to continue to be used for sheep grazing. The three million pound project is financed primarily by the German Ministry for Technology and the E.E.C. The entire project is being treated as an experiment and if it is successful the lessons learned will be used in the construction of further solar power stations with power outputs up to 2 MW. Long term reliability with low mainten- ance costs are the prime objectives being sought. The solar experts of AEG have gained considerable experience in the third world countries where energy from solar sources is extremely im- portant. The island of Pellworm is the site of a large convalescent centre and for this reason solar energy is well suited. Paradoxicaly, the energy requirements of the hospital is greater in the summer months than in the winter. Battery storage units are used to cater for energy use at nights and periods of poor weather. The solar farm is capable of providing more energy than is required and the surplus provides assistance to the regional grid system. Today the cost of 1 kWh of solar energy is about £ 0.50 and AEG consider that this could be reduced by 1986-88 to about 7 p per kWh, a very considerable saving. This is not the first venture of this type that AEG have developed in Europe. Two others, both 50 kW instal- lations, are a milk farm in Ireland and a naval college in Holland. One aim of these developments is to be sure of an energy supply to provide an export potential to areas like the third world countries. It is believed that by the year 2000 a good proportion of the worlds power will be provided by solar Storage capacity of 6000 Ah The construction of the present solar farm used standard industrial compo- nents. The solar generator itself consists of 15840 modules which are divided into 22 switchable sub groups. The solar panels are mounted at an angle of 40 by a framework consisting of zinc plated steel and tropical hardwoods. The rated output of 48 modules in series is 346 V and each subgroup of modules can be switched onto 2 d.c. busses by computer control. Each bus is connected to a battery having a storage capacity of 3000 Ah. During normal use half of the battery provides the power supply to the hospital while the other half is being charged by the solar array. When the level of the battery being charged reaches a maxi- mum, the solar energy is diverted into the section which is in use. This is illustrated in figure 1. The graph in figure 2a shows the average sunlight levels recorded during 1972-1980 in the The batteries are of sufficient size to cater for the eventuality of a number of consecutive days when the sunlight is not enough for the energy require- ment. Hence 6000 Ah batteries. In the worst situation the drain would still not exceed 70% of the capacity. The battery packs are built using very high quality industrial accumulators each having a 10 hour capacity of 1500 Ah with a rated 2 V. To achieve this four groups each with 173 cells in series are needed which in effect cover an area of 1000 square metres and having a total weight of 120 tons. Although the batteries are highly efficient in order to ensure a long life span, they are treated very gingerly by the computer control and as a result maintenance is virtually zero. Another reason for less maintenance is the use of recycling caps fitted to the top of each cell, which means no topping up with distilled water is ever necessary. These caps contain a catalyst which cause the separated gasses (hydrogen and oxygen) to recombine to form water again, returning it to the elec- The d.c. output of the system is fed to the regional a.c. grid via a mains static converter. This converter is only oper- ational when the solar source is con- nected to the mains grid. In the case of a power failure in the regional grid the solar source is inherently protected by the mains coupling. In effect if the mains source fails, the converter is automatically switched off preventing the heavy drain which would occur, therefore 'spark suppression' is also catered for in the event of deshort- circuiting. Because the converter is mains controlled the normal synchron- isation problems are not encountered. The converter is designed to handle 300 kW. Another function of this converter is to charge the batteries should a break- down occur to the 'solar system', or if insufficient power is produced due to continual poor weather. Obviously the hospital also requires an a.c. supply, therefore 2 inverters are used through which the solar d.c. supply is fed. These are rated at 75 kVA. The result is a usable 220 V 50 Hz supply. Inverters as opposed to other types of conversion are used simply because they are very efficient. At low consumption times like night time and the off peak season only 15% of the total rated power supply is normally needed, but even at these levels the inverters operate at 87% efficiency. The facilities which are supplied by this system include a restaurant, sauna, physiotherapy installation and indoor swimming pool. The inductive load is created by several 5.4 kW motors and the resitive load by the sauna heating system which is rated at 18 kW. The control, data collecting and handling and recording centre uses a micro- processor. This is because, as the devel- opment is an experimental one, as much flexibility as possible is required. One of the targets of the program is to optimise the efficiency and therefore the economics of the complete system. The processor also controls the switching of the static converter and determines the nominal energy level which is supplied to the regional grid. Basically this experimental development is a good way for amassing data in order to plan future systems capable of delivering power within the mega watts range. 11-20 — elektor i 9r 1982 interface a drum instead of a keyboard for synthesizers Why must a synthesizer always have a keyboard? Musicians asked this question of synthesizer manufacturers some time ago. In the meantime there is a considerable number of 'controllers' which allow synthesizers to be played without a keyboard. In addition to the ribbon controllers, with which a steel string determines the pitch (similarly to playing a violon), the percussion controllers are amongst the best known: these are drums with internal electronics which convert the pulses of the drumstick into control signals for the synthesizer. The drum interface is the electronic circuitry for this type of percussion controller. As pop music specialists know, such controllers have been frequently used in recent recordings. 'Disco drums' would be difficult to imagine without this effect. The most complicated part of a drum controller is the drum itself; the elec- tronic circuitry could almost be accom- modated in a matchbox. This compact circuit, however, produces astonishing results: staccato synthesizer sounds in a drum rhythm allowing wide variation. "Playing" the synthesizer with a drum makes the synthesizer far more access- ible to many more people: instead of a keyboard there is only one, albeit some- what unusual, "key" - the drum and a drumstick. This key can be played with great sensitivity. The drumbeat rhythm delivers the triggering pulses and hence the rhythmic structure of the synthe- sizer action. The dynamic (variable) component is the drumbeat intensity which the drum interface converts to a proportional voltage. This voltage can be applied with great versatility: to control the pitch, filter frequency or amplitude of the synthesizer, depen- ding on whether the drum control voltage drives VCOs, VCFs or VCAs. Apart from the fact that the drum makes the synthesizer accessible to everyone (playing it becomes fun), different and tightly controlled sounds can be obtained from the synthesizer with a little practice. Simple electronics There is nothing secret about the way the drum interface operates, on the contrary it is refreshingly simple. The interface begins with a transducer in the form of a microphone or loud- speaker which converts the sound in the drum (or in its immediate vicinity) into an electrical signal. This signal exhibits the characteristic of a damped sinusoidal oscillation whose frequency depends on the drum and whose ampli- tude depends on the drumbeat inten- sity. The purpose of the circuit in the block diagram of figure 1 is to act as an interface by processing this signal for the synthesizer. Required at the output are a triggering pulse (gate pulse) and a variable control voltage. First the signal from the microphone or loudspeaker is greatly amplified. A trigger circuit at the amplifier output generates triggering pulses from the negative half-waves of the signal; these pulses can already be used as gate pulses. However, they also trigger two monostables in the interface which control an analogue memory (sample and hold). This analogue memory accepts the maximum amplitude of the positive half-waves and holds it until the next drumbeat. Thus each drumbeat provides a triggering pulse and a new control voltage. What could be better? The circuit Figure 2 shows the practical implemen- tation of the principle sketched in the vember 1982 - 11-21 1 Figure 1. Block diagram of the drum interface. The transducer is a loudspeaker or microphone. From the drum signal obtained in this way. a triggering circuit delivers a trigger pulse with each drumbeat. An analogue memory holdsthe maximum amplitude of the signal with each beat. The result is a control voltage whose amplitude depends on the drumming intensity. 2 Figure 2. The circuit of the drum interface is simpler than the block diagram implies: the main components are only two low-cost ICs. block diagram (figure 1). The compo- nents required are basically only two ICs: IC1 contains four operational amplifiers, only three of which are utilized; IC2 provides the two mono- stables. The first operational amplifier serves as an amplifier for the drum signal from the pick-up (loudspeaker or microphone). The amplification is fixed art 10 x, by means of the negative feed- back loop R1/R2. It can be varied by using a trimmer potentiometer instead of R2. The low-impedance input of the circuit is intended for connecting loud- speakers and low-impedance micro- phones (dynamic or electret with integral impedance converter). At the output of A1, two diodes (D1, D2) split the signal path: one for positive and one for negative half-waves. The negative half-waves are fed via D1 to another amplifier A2, which overdrives on account of its very high amplifica- tion (100 x) and delivers square-wave pulses at its output. At output TR these pulses have an amplitude of + 15 V and at output TR their amplitude is + 5 V. Thus suitable gate levels are provided for all common synthesizers. The fact that a whole train of pulses appears at the gate output for each drumbeat does not normally cause any problem, because the envelope generators of the synthesizer only trigger on the first leading edge and then allow their envelope to develop without being affected by subsequent triggering pulses. Should there be a problem, however, the signal at pin 9 or pin 13 of IC2 can also be used as the + 5 V gate pulse. As shown in the pulse diagram of figure 3, a longer pulse is present at these points, which only appears once per drumbeat. IC2 is a TTL dual-monostable. The first monostable triggers on the pulse from output TR + 5 V, which is connected to pin 10 of IC2. This first monostable generates a short pulse at its output pin 5 which turns on transistor T1 . This causes capacitor C2 to discharge with the first half-wave of the drum signal. When this discharge pulse has ended, T1 turns off again; capacitor C2 is now ready for charging and accepts cia diode D2 the peak voltage of the next positive half-wave from the output of the input amplifier. D2 prevents a discharge of the capacitor and the voltage is maintained until the next drumbeat. The high input impedance of the operational amplifier A3, which is utilized as a buffer for capacitor C2, caters for adequate stability of the storage stage. A buf- fered control voltage (CV) is present at the output of A3. The second monostable with the longer pulse ensure that the first monostable only responds to the first pulse at its input with each drumbeat. This rejec- tion of subsequent pulses is explained by the pulse diagram: the first mono- stable pulse is present in inverted form at pin 12. This output is connected to input pin 2 of the second monostable, which therefore triggers on the trailing 1982 3 “ v ' J1 ; TL a. The drum signal, a damped sinusoidal oscillation. b. Triggering pulses at the gate output. These are produced by limiting (clipping) the negative c. Output of monostable 1. These pulses discharge the capacitor of the storage stage before d. Output of monostable 2. This pulse blocks monostable 1 when the first pulse has elapsed, in order to prevent retriggering by subsequent gate pulses (b). edge of the signal of monostable 1 and then supplies a longer pulse at output pin 13. Via pin 9, this pulse inhibits the first monostable which can only be triggered again when this pulse time has elapsed. The circuit requires a symmetrical supply voltage of ±15 V which can be taken from the synthesizer power supply. Otherwise a small power supply unit would be needed. A 5 V regulator on the printed circuit board (IC3) generates +5 V for IC2 from the +15 V supply voltage. The current consumption is approximately 16 mA for + 15 V and 8 mA for — 15 V. Practice Figure 4 shows a suggested track pattern for the drum interface. All that is missing is a suitable percussion instru- ment. We found a very simple solution in the Elektor Laboratory: a stan- dard, round loudspeaker of 18 cm in diameter was put to use; plastic foil was stretched over it as a drumskin. With this arrangement the output voltage at the CV output was between 1 and 5 V, depending on the drumming intensity; it was played with the palms of the hands like a conga or bongo drum. The circuit could also be in- stalled in a "proper" drum with a microphone in the immediate vicin- ity of the drum. It may be necessary, however, to adapt the amplification of the first operational amplifier to the particular arrangement. Resistors: R1.R5.R9 = 10 k R2= 100k R3.R4 - 2k2 R6 = 1 M R7 - 1 k R8 a 22 k Capacitors:, - C1.C4 = 100 n C2 = 390 n C3 ■ 4p7/10 V Semiconductors: T1 - BC547B D1.D2 = 1N4148 D3 = 4V7/400 mW zener diode IC1 = TL084 IC2 - 74LS221 IC3 = 78L05 Figure 4. A suggested printed circuit design. nber 1982 - 11-23 Methods of playing As with a keyboard, the control signals "CV" and "gate" can be used with great versatility for producing sound with the drum interface. In the follow- ing section we would therefore like to present in diagram form some of the methods of playing that were tried out (see figure 5). The drum interface can be connected to the synthesizer instead of the key- board. If the synthesizer has terminals for external gate pulse and external control voltage, these can also be used; in this case the keyboard can remain connected. With the drum interface instead of a keyboard, all adjustments can be tried out on the synthesizer which more or less apply to the keyboard. Driving the VCO with the "CV" of the drum inter- face (figure 5 a) results in a new pitch with every drumbeat. The effect ob- tained is similar to that with a sample and hold circuit (random value gener- ator 1). The "disco drums" effect is achieved by driving as shown in figure 5 b: the triggering pulse from the drum interface triggers an ADSR gener- ator which, in turn, drives a VCF; the latter is adjusted as an oscillator with natural oscillation. The ADSR is ad- justed as follows: attack, zero; decay, any; sustain, maximum; release, any. The effect is a sudden sinusoidal sound with decreasing pitch and amplitude during the decay. If a non-oscillating VCF is available, the same effect can be obtained by driving the VCO with the envelope curve, as shown in figure 5 c. Figure 5d shows another interesting variation. As one can see, the drum interface offers many creative possibilities at a low cost. We can also assure you that "drumming" with the synthesizer is a lot of fun. M : igure 5. Examples for using of the drum interfac (modular) synthesii 1982 11-24 -elektor november hear spots before ( one ) your eyes Dice are not just old, they are positively ancient! Their origin must lie somewhere in the mists of antiquity. Roman soldiers used them; gamblers from all over the world use them; even Chancelors of the Exchequer use them. Well, at least it seems that way! Over all this time dice have hardly changed. They are still cubes with spots. With the advent of speech synthesisers, however, the road lies open to revolutionary dice: talkers! So far we have not found an argument to justify the existence of talking dice. So what! They make an ideal Christmas gift, 'some- thing for the man or woman who has every- thing'. We are not going to bore you with the finer details of the theory behind speech synthesis. Anyone who is inter- ested can refer to back issues of Elektor. A list of the more useful ones is given at the end of the article. The TMS5100 is a sophisticated 'Voice Synthesis Processor (VSP)'. In a nutshell, it generates human speach and other sounds by digitally processing encoded data, which has been stored in non-volatile memory. The processed data is converted into an audio signal by the on-chip D/A converter and push- pull amplifier. The circuit Figure 1 shows the circuit diagram of the complete unit. Starting with the section around the VSP: T1 and T2 form an audio ampli- fier. This is necessary because the internal amplifier of the 1C delivers in- sufficient power to drive a loudspeaker. C2 acts as a ripple filter. Potentiometer P2 adjusts the volume. The TMS5100 contains an oscillator that provides the necessary clock pulses ( 1 60 kHz at pin 3 of IC1). Only three external components are required (R5, Cl and PI). The set- ting of PI determines the clock fre- quency. The rest of the circuit consists of a con- trol interface ( I C 2) ; the memory that contains the vocabulary (IC5); the address decoder/counter IC4; and finally the counter IC6 and the data selector (the actual number generator) IC7, Counting and initialisation As a result of depressing S2 a sequence starts, as shown in figure 2a. First IC1 is initialised by pulses coming from IC2. IC2 is reset (line Q0 becomes logic 1). The pulse from S2 is inverted by T3 (logic 0) and fed to the Cl input of IC6. This 1C now 'selects a random number' by counting the pulses supplied by the ROM/CLK output of IC1. Releasing S2 stops IC6, since the 'carry in' input of IC6 (pin 5) is returned to logic 1. Now we come to the second phase. This starts with the initialisation of IC1 by the combined pulses supplied by IC2 (see figure 2a). Two PDC pulses are followed by a third, and between the second and third pulse IC4 is reset to zero. Going back to the circuit, the address counter IC4 is reset as a result of a logic 1 at pin 1 1 caused by a pulse from line Q5 (pin 1) of IC2. Output Q9 of this 1C is connected to its clock enable input. As a result when Q9 goes 'high' IC2 stops counting, until S2 is pressed again. Now you're talking So far so good, but the VSP is still at loss for words. At this point, the I/O output from IC1 sends a 'burst' of pulses to IC4; the latter then outputs a series of addresses to the EPROM. This EPROM contains the data shown in table 1 : all speech information for the six words in a kind of 'parallel serial' format. Line D0 gives data for the word 'one', D1 corresponds to 'two' and so As described earlier, the outputs of IC6 specify the desired number. The demultiplexer IC7 now selects the cor- rect data output line from IC5 and passes this bit stream to output X. The VSP receives this data on line ADD8, whereupon it pronounces the random number. We have made repeated references to the fact that the number is picked at random. The reason for this is that IC6 is counting the clock frequency (160kHz). which is high enough to deter would-be cheaters. The counter is set to count from 2 to 7, as shown in figure 2b. When output Q3 (pin 2) of IC6 goes 'high', the preset enable input (pin 1) is activated. Preset inputs P0 . . . P3 are wired in such a way that T3 = BC 547 IC1 = TMS5100 IC2 = 4017 IC3 = 4072 IC4 = 4040 IC5 = 2716 IC6 - 4029 IC7 = 4051 IC8 = 7805 IC9 * 7905 SI ,S2 - pressbuttons S3 = 2 pole - 2 way FI - 1 00 mA slow-blow fuse Trl ■ transformer 2 x 6 ... 8 V/2 x 0,4 A loudspeaker 8 ohm/0.5 W the counter always returns to the num- ber two. This method using a synchron- ous counter, ensures that all numbers have an identical (one in six) chance of occuring. Say that again I If in the heat of the moment (while playing), someone does not hear the answer from the dice, simply depress SI and the number just 'thrown' will be repeated. In effect, SI does the same job as S2, as far as IC2 and the speech synthesiser are concerned. However, D3 prevents it from enabling T3, so the Power supply Figure 3 shows the power supply, using a normal three-pin voltage regulator. The CMOS ICs and the EPROM only require a positive 5 V supply, but the TMS5100 needs a negative supply as Construction and calibration Hguie 4 shows the printed circuit board fot the complete circuit. No provision has been made for mounting the trans- former, switches SI . . . S2 and the volume control. We suggest that con- structors start with mounting the power supply components, checking that the voltages and polarities are correct before going further. If you use a transformer with two secondaries, ensure they are connected the correct way round. Calibration is a straightforward case of simply adjusting PI (the clock fre- quency) until the pitch of the voice sounds human. Alternatively, you can have a 'donald duck’ sound if you To make life easier a loaded EPROM is available from Technomatic Ltd (see their advertisement). One suggestion put forward for a suit- able case is to construct a cube from perspex. As the saying goes 'the die is cast'. Useful back issues for the theory of speech synthesis. September 1981 Talking chips. December 1981 Talking board. February 1982 Talking board interface. 11-28 — ele Dvamber 1982 model train lighting What is actually involved? Well, the lighting for the railway itself can be provided quite simply by means of a "lighting transformer". Stations, houses and signals then become part of a realistic environment, for the railway. However, the bulbs in the carriages are powered from the "train transformer" via the rails. So, there is no problem with lighting as long as the train is travelling. But when the train stops, the lights go out because power is no longer applied. If the locomotive supply volt- age is not constant the bulbs flicker. What we need is a method of operating the train lighting independently of the locomotive supply voltage. modd train lig h ting "Murder on the Orient Express!" The train enters a tunnel. The lights go out. A blood-curdling scream is heard and the famous detective Hercule Poirot has another assignment. Things are not usually so dramatic amongst model train enthusiasts and one cannot normally look into the tunnel of a model railway. But when the train stops and the internal lighting goes off, it is not very realistic. What we need is a circuit that will keep the lights on, even when the train stops. A look at various solutions One could, for example, construct a multiple rail system which would carry both the locomotive supply voltage and the lighting supply voltage; that would surely be too expensive. An overhead line plus one of the two rails could also be used for the lighting supply voltage. This method is less complicated, but the overhead line is usually employed for independent operation with two trains. The same applies to any third rail in the system. It is also possible to use dry batteries but this method must be ruled out because of the cost. Rechargeable NiCd batteries cannot be employed on account of their price, shape and weight. Furthermore, that method would require a bridge rectifier. Half-wave operation is worth consider- ing. A sinewave can be divided into two half-waves. The motor is activated for the duration of one half-wave and the lighting for the duration of the other. This method can be applied quite simply using properly rated diodes. It is a purely electrical solution without any mechanical modifications. The disad- vantage is that half-wave operation requires four times the power output for normal operation. Moreover, this method only works for one direction of travel although it is possible to operate two trains independently in this way. Our solution A sinewave power generator. Ad- mittedly, it is not new but no changes need to be made to the railway and the circuit can be constructed with simple electronic components. These are advan- tages that will particularly be appreci- ated by model constructors who have not had too much electronic experience. Let us examine the situation on the basis of the block diagram in figure 1. The first item we notice is the "train transformer". We have used quotation marks because this transformer also con- tains a rectifier. This block powers the motor. The choke represents a negligible resistance for d.c. The bulbs are isolated from the d.c. supply by capacitors C2 and C3. The generator supplies the lighting voltage for the bulbs instead. The a.c. voltage is applied via * blocking capacitor Cl to the tracks from there to the bulbs via capaci- C2 and C3. But what is the purpose of the choke and the capacitors? The choke presents sinewave power generator for hi-fi train lighting alektor november 1982 - 11 29 model train lighting the a.c. voltage with a very high im- pedance so that the sinusoidal power is not lost in the low-impedance secondary side of the train transformer. Blocking capacitor Cl isolates the d.c. train volt- age from the power generator. Only in this way is it possible to superimpose the a.c. voltage on the d.c. voltage for our purposes. One disadvantage should be pointed out, however. Although the motor represents a load for the a.c. volt- age it is so small it can be discounted. Two questions that might be raised with respect to the power generator are: why a sinewave and why 20 kHz? Wouldn't a square-wave generator be much more efficient? The answer is yes, but the harmonics would cause severe interference to other equipment! We have chosen 20 kHz because the circuit and the locomotives start buzzing at lower frequencies and because this fre- quency allowed us to choose smaller values for the choke and capacitors. But we will go into this in more detail later. The power generator Before the system can be extended as shown in figure 1, we must first build the power generator and ensure that it is operating. First we shall have a look at the circuit. Figure 2 mainly contains two functional parts: the sinewave generator using IC1 and the output stage consisting of T1 . . . T10. Choke LI can also be seen, together with the power supply unit for the power generator with trans- former, rectifier B1, and smoothing capacitor C14. A no-load d.c. voltage of 42 ... 51 V is present at C14, depending on the transformer used. The sinewave generator is configured as a Wien-bridge oscillator with IC1, D1, D2, Cl, C2 forming a symmetrical power supply for the operational am- plifier from the "asymmetric" operating voltage. This method also provides decoupling from the operating voltage of the output stage. R2, C3, C4, R5 are the generator components that determine the frequency. The oscillator frequency obtained purely by calcu- lation is 19 kHz. The two germanium diodes provide coarse stabilisation of the output voltage. The gain (onset of oscillation) is adjusted with PI, and P2 is used to attenuate the amplitude of the generator (bulb brightness). The distortion factor of the sinewave oscil- lator is only 0.05%. It therefore emits practically no harmonics to cause distortion in the power generator. The next item is an old friend (as far as Elektor staff are concerned): EDWIN the output amplifier. This was first published way back in the seventies. In the meantime it has probably become the favourite and mostbuilt amplifier from the Elektor Laboratory. It is characterised by good reproducibility in construction, requires no alignment and the output transistors can now be procured at very low cost in most electronic component shops. The values of a few capacitors were reduced from those of the original circuit, because the amplifier is only needed to provide gain at 19 kHz. The output capacitor must be a bipolar type. Two polar electrolytic capacitors were connected back-to-back here. The output stage is shortcircuit- proof but not in continuous duty I We also thought that the finger-type heat- sinks would be very practical for cir- cuit constructors and they are quite adequate in this application. We shall discuss the assembly in more detail later. Choosing the components Before you pick up your soldering iron, here are a few useful comments con- cerning the components. Choke L 1: The choke must withstand a bulb current of about 2 A. With a total bulb power rating of 25 W maximum at 12 V the load current is 2 A. Suitable (mains) chokes must exhibit an induct- ance of 10 ... 20 mH. The d.c. re- sistance at a frequency of 19 kHz is I 1 k2 . . . 2k4. The choke with its im- pedance of 3 ... 6 ohms is practically a shortcircuit for mains frequency voltages. A mains choke from an old TV set is just as good as one of the new commercially available types. Coils from loudspeaker cross-over networks may also be employed if they meet the requirements. Mains transformer: Using a transformer with a secondary voltage of 33 V, the output stage delivers about 25 W (at Urms = 12 V). This is where term hi-fi the scene. Hi-fi means "high fidelity" and here we are referring to realistic lighting in the train. The lighting voltage is adjusted so that the bulbs are operated at less than their rated voltages. In this way we achieve two things: the bulbs are not unrealistically bright (in keeping with our "hi-fi") and they last much longer than their rated service lives. For example, 14 V bulbs can be connected to the 1 2 Vrms output voltage or a 30 V transformer could be used to give an output voltage of 10 ... 1 1 Vrms. 1 R2,R5,R6,R19.R22 = 8k2 R8 = 82 k R9 - 100 k RIO = 68 0 R11 = 6k8 R12.R18 " 220 Si R13.R14 = 680 Si R1 5 - 330 Si R17 * 1k5 R20.R21 - 100 Si R23 . . R25- 10n R26.R27 = 0,1 5 n/5 W PI - 10k trimmer P2 - 25 k lin. pot. C1.C7- 10 p/40 V C2- IOp/16 V C3.C4 = 1 n C5 - 47 n C6- 100 p/63 V C8- lOp C9 = 10 p/63 V CIO -220 p/63 V C11.C12- 470p/40V C13 - lOOn C14 - 2200 p/63 V Semiconductors: 81 - B80C3200/2200 D1.D2- Z-Diode 12 V/0,4 W 03,04- AA 119 D5- 1N4001 T1.T2.T4.T5- BC547B T3.T8 - BD 138 or BD 140 T6- BC557B T7 - BD 137 or BD 139 T9.T10- 2N3055 IC1 - 741 i transformer 30 . . . 36 V/2 A In any case, the full output power of 25 W will never be required from the output stage. That would be sufficient to illuminate 25 carriages! The maxi- mum output voltage will therefore be somewhat higher than indicated, on account of the lower load. Since the bulbs are operated at less than their rated voltage, their full power ratings are not reached either. This means that bulbs with a total power rating of more than 25 W can be connected. Blocking capacitors: The capacitors in series with the bulbs are installed in the carriage together with the bulbs. A 220 nF capacitor is sufficient for a 1 2 V/50 mA bulb. If only one capacitor is connected in series with several bulbs of this type, its value must be increased proportionally. The exact voltage being dropped over a capacitor is not par- ticularly critical, because the bulbs are being operated at less than their rated voltages. However, it is possible to arrange for "emergency lighting” in a sleeping car, for example, by selecting an appropriate value for the blocking capacitor. Those who would like to experiment can calculate the required series reactance according to the formula X C° 2 , n \ f Zq x C should be at least 80% less than the bulb resist- ance (e.g. 240 ft at 12 V/50 mA). Construction and alignment Construction of the sinewave power generator should present no problem using the ready made printed circuit board (figure 3). T7 . . . T10 are fitted with heatsinks. In the case of T7 and T8 they are bracket- type heatsinks which are simply in- stalled on the cooling surfaces of the transistors with M3 bolts. Do not forget the heat-conducting paste and ensure that there is no contact with any bare 11-32 1982 model train lighting wires. T9 and T10 are fitted on the printed circuit board together with heatsinks. Sleeving should be slipped over their pins to prevent any short- circuits. The contact surfaces for the collectors are first tinned on the solder- ing side. The transistors and heatsinks are then bolted to the printed circuit board. Use washers to keep them firmly in place. Remember the heat-conducting paste here too! Finally, the insulated terminals are soldered to the tracks. Once the components have been fitted to the printed circuit board, the system can be expanded as shown by figure 1. Please observe the comments in the section entitled "Choosing the com- ponents". Ready-made lighting systems are available commercially, but it is cheaper to examine the mail-order ad- vertisements for subminiature bulbs and order the required quantity. Chokes and other special components are usually cheaper from those sources too. It may also be necessary to replace plastic wheels by metal wheels which are mounted on the axles in an insulated manner. Your local model shop can advise you on this. Once the circuit is completed in ac- cordance with figures 1 and 2, switch SI can be actuated for the first time with the hope that there will be no smell or smoke! Set P2 to maximum output and adjust PI so that the bulbs are lit. The output voltage can be measured with a multimeter set to the a.c. range. It must not exceed 12 V. The setting can also be made by eye: rotate PI so that the bulbs light up at the desired brightness. Those model constructors who own an oscilloscope can make "professional" adjustments. With the load connected. PI is set to a point just before the "clipping" of the displayed sinewave, (with no limiting of the amplifier). Brightness of the bulbs can now be adjusted as desired with P2. Another important comment: In this form the circuit is only suitable for d.c.- driven trains. A combination with pulse- controlled systems is possible. If the lights should go out in the tunnel and a blood-curdling scream is heard: call Hercule Poirot! M iber 1982- 11-33 guitar tuner Tuning a guitar by ear is not too diffi- cult provided you can hear what you are doing. In a crowded room or on stage, with everybody else running about with all sorts of equipment, tuning 'by eye' is definitely to be preferred. It is not surprising therefore, that electronic guitar tuners are quite popular with professionals. Amateurs (and novices) would also like to have one of these units, but th.ey soon discover that the 'real thing' tends to be expensive. A home-con- struction design would be ideal, pro- vided it works properly, and is easy to use. In other words they are looking for the circuit described here! guitar tuner tuning by eye The problem with guitar tuning is very rarely the guitar itself. It is usually the surrounding noise and confusion that seems to reach a peak just at the wrong moment. Many guitarists have realised that these problems can be overcome with a visual tuning aid. The circuit described here is purely electronic and, most important, it is very accurate. Most commercial units use a moving coil meter to indicate the tuning accu- racy. When the string is too 'low' or too 'high', the needle moves to the left or right respectively. The string is in tune when the needle is centred. This is a good system, so our circuit operates the same way. The scale is calibrated from — 20Hz . . . +20Hz. Furthermore the design allows the tone of the string plucked to be retained, so that the indication changes slowly and pro- gressively. This means that plucking each string once is often sufficient to tune it. The meter shows exactly what is going on while you turn the tuning key. Finally the height of sophistication: the circuit is suitable for both electric and acoustic instruments! The circuit The principle behind a tuning aid is relatively simple. The guitar supplies a tone, which is compared with a reference. For obvious reasons, the reference frequency oscillator must be accurate and stable. The circuit descri- bed here uses a crystal oscillator and a top octave synthesiser, to provide refer- ence frequencies that are accurate to within 0.07%. Simple frequency comparison would seem to be the next step, but there is one further problem. The tone of each guitar string is rich and full, due to the large number of harmonics produced. Before any comparison can be made, these 'confusing' frequencies must be filtered out. The reference tone Figure 1 shows the circuit diagram of the complete guitar tuner. The crystal oscillator uses an easily available and cheap 4MHz TV type crystal. Cl is used to trim the crystal frequency. The signal from the oscillator is buffered (N2) and fed to the input of a flip-flop, FF1. This acts as a frequency divider, so that the output to IC3 is at 2MHz (or 2000240Hz to be exact) . The top octave synthesiser, IC3, is an ion-implanted P-channel MOS synchron- ous frequency divider, TOS for short. Each output frequency is related to the others by a multiple of y2, providing a full octave plus one note on the equal tempered scale. This is illustrated in figure 2. The S50240 was used in the prototype, in preference to the MK50240 because of the difference in current consumption (14mA as oppo- sed to 24mA). Even so, the total con- sumption of the circuit with the S50240 is about 20mA from each of the 9V batteries, and this is the reason for including a battery check facility (S3). Going back to the circuit, the output of IC3 is passed to a seven stage binary counter IC4. Each stage is in effect a flip-flop. In principle therefor, all the tones of 8 full octaves (1 ... 8) can be produced (see figure 3). For practical reasons, unfortunately, the division ratios in the top octave synthesiser cannot be more than good approxi- mations, and so the actual frequencies produced are a maximum of ± 0.07% I out. The frequencies within the darker rectangles in figure 3 are the actual tones for each string of a normally strung standard 6 string guitar: E2 or bottom E (sixth string), A2, D3, G3, signal to IC4. The outputs of this 1C not connected, but it can be used for B3, and E4 or top E (first string), cover a total of three octaves, to enable tuning bass guitars. With Sib and Sic Sib selects one of the five desired the tuner to be effective for a six string connected as shown, the desired tones notes in the top octave and passes this guitar. Output Q6 (octave 1) of IC4 is are produced in their correct octaves. alektor rember 1982 - 11-35 Figure 2. The block diagram of the top octave synthesiser, used to generate the basic reference The input stage As already mentioned, the harmonics produced by the guitar can pose a major problem. The best solution is to provide adequate filtering at the input. At the same time it is useful to set a fairly high gain in the input stage, so that the guitar signal can be measured well into the decay time. This makes tuning that much simpler, since you do not have to pluck the string so often. In the actual circuit, opamp A1 is set to a gain of 100X. C3 and C4 have been included in the network around A1 as a general band-pass filter, to get rid of some of the 'dirt' in the guitar signal. The input impedance is 100 kS2, which should cater for nearly every guitar. Quite a narrow band-pass filter is con- structed around A2. The band-width is only 40 Hz, effectively eliminating the harmonics and passing the fundamental only. The basic principle is shown in figure 4. The centre frequency is deter- mined by R6 to R11, as selected by SI a. It should be noted that the resis- tors correspond to R3 in figure 4, so they have no effect on the gain or bandwidth. As a matter of interest the gain of the network is about 5X. Note that if other tones are selected (for tuning bass guitars), the values of R6 . . . . R11 must be modified accord- ingly! A3 and N4 act as a schmrtt-trigger, converting the output signal from A2 into a square wave. The hysteresis is 110 mV. The comparison We now have a reference frequency at the output of N3 and the guitar fre- 3 tone and frequency tor musical instruments octave tone 0 i H 2 3 4 5 6 7 8 C 16.3516 32.7032 65.4064 130.813 261 .626 523.251 1046.50 2093.00 4186,01 C* 17.3239 34.6478 69.2957 138.591 277.183 554.365 1108.73 2217.46 4434.92 D 18.3540 36.7081 73.4162 1 46.832 293.665 587.330 1 174.66 2349.32 4698.64 D# 19 4454 38.8909 77.7817 1 55.563 622.254 1244.51 2489 02 4978.03 E 20.601 7 41.2034 82.4069 164.814 329 628 659.255 1318.51 2637.02 5274.04 F 21,8268 43.6536 87.3071 174.614 349.228 698.456 1396.91 2793.83 5587.65 F# 23.1 247 46 2493 92.4986 184.997 369 994 739.989 1479.98 2959.96 5919.91 G 24.4997 48.9994 97.9989 195.998 391 995 783.991 1567.98 3135.96 6271,93 G# 25.9565 51.9131 103.826 207.652 415.305 830.609 1661.22 3322.44 6644.88 A 27.5000 55.0000 110.000 220 000 440.000 880.000 176000 3520.00 7040.00 A# 29.1352 58.2705 116.541 233082 466.164 932.328 1864.66 3729.31 7458.62 B 30.8677 61.7354 123.471 246 942 493 883 987.767 1975.53 3951 .07 7902.13 frequency in Hz Figure 3. The frequencies of the tones in each octave. The 'blocked' frequencies are the ones used for the guitar tuner. 11-36 -i quency coming from N4. The next and final step is to compare these two fre- quencies, and display the result. One RC network (C7.C8, R1 4), together with diode D1, passes the positive going edges of the square-wave to IC5. Similarly C9, CIO, R15and D2 pass the negative going edges of the guitar signal. These two sets of very short pulses (one positive-going and the other negative) are added, amplified and inte- grated, so that the output from IC5 (pin 6), is at 0 V when both incoming signals are at the same frequency. Alternatively, when the guitar tone is lower than the reference, less negative pulses reach IC5 and its output swings negative. In general the output voltage from IC5 depends upon the difference between the two tones. The circuit is arranged so that the meter will indicate left of centre if the guitar is too low, right of centre if too high, and dead centre when the instrument is accu- rately tuned. The trimmer CIO, is used to calibrate the circuit for 0 V at the output (when both tones are identical). Resistor R17 and potentiometer PI set the meter range (—20 Hz . . . +20 Hz). Diodes D3 and D4 and resistor R18are included to protect the meter. The supply voltage can be fed to the meter via R19 and S3, to give an indi- cation of the battery condition. If the meter reads less than 40 pA (corres- ponding to 7.2 V), replace both batter- Construction and calibration The printed circuit board is shown in figure 5. No provision has been mad. for mounting resistors R6 to R1 1 on the board, since we found it easier in practice to wire these onto switch Sla. The components are all fairly common, but, even so, a few practical comments are in order. In the first place a good quality meter is a wise investment, as R6 = 390 n R7 - 680SJ R8- 1k2 RIO* 4k7 R11 = 15k R13.R20 = 1 M R14,R15 = 470k<475 kl R17,R18= 3k9 R19- 180k PI = 25 k preset Cl - 2 . . . 22ptr C5.C6 « 82 n C7 = 22 p C8.C9 ■= 470 p CIO- 4 . . 40 4013 MK 50240 (Mostek). S50240 (AMI) 4024 3130 X * 4MHz cry SI = 6 way dc S2= double p ible decked wafer le two way on (two way) 0 . . .+50pA) socket (6.3 mm) 1982 - 11-37 calibrate the scale of the meter. Ad- just PI so that the meter reads +50 nA. This calibrates the meter to ± 20 Hz. some of the cheaper variety are not sufficiently accurate. Then although the prototype used a double decked wafer switch for SI a . . . Sic, it is also possible to use one of the new multi- position slide switches that are avail- able. The size of the case depends on the components used for the meter and switches, but we found a plastic box (Vero) size 15x8x5 cms was just right for the items we used (see photo). Bear in mind that the meter should be in a vertical position (not laying down), otherwise the accuracy is impaired. The case should be reasonably stable, so that it is not easily pulled over and onto the floor by the weight of the guitar lead. For the same reason, make sure that the case is robust! There is nothing critical about the mounting of the components onto the printed circuit board, only that care should be taken in handling the ICs. Note that the resistors are mounted vertically. The calibration of the circuit is equally straight- ward' * * Practice The tuner was tested 'on stage', where it performed perfectly (which is more than could be said for the musicians who tried itl). Its ability to display tones either one semitone above or below standard tuning was also found useful, especially for some fingerpicking techniques. It had the same no-nonsense operation as the expensive commercial models. The tuner also works very well with acoustic guitars. A good quality con- densor microphone can be plugged into the standard jack socket of the tuner. However it is better to provide a second input, with R2 replaced by a 10 k resistor and C3 increased to 220 nF. This is because the microphone signal is not as high as that of the guitar and therefore the gain of A1 has to be increased to 1000 X. These modified values can also be selected by means of a small changeover switch at the input. e filtered signal which can be handled easily. Photo 1: 330 Hz: Photo 2: 82 Hz Final note Constructors not wishing to use a bat- tery supply can utilise the power supply of the Elektor Artist guitar pro-amp, published in our May 1982 issue. The positive rail can be taken from the positive side of C67 (refer to the circuit diagram of the Artist), the 0 from the negative side of C67, and the negative rail from the negative side of C68. This gives a supply of ±8 V, which is ideal for our purpose. S3 and R19 will not be required in this case. Have a good tune up! M a wire between points V and W, as shown in the circuit diagram in figure 1, and set PI toits mid position. • beg, borrow, or steal a high quality frequency counter — a model with 7 digit accuracy. Do we hear panic in the ranks? Fear not, dear majority- just skip the next sentence. If one is lucky and has a counter, simply connect it to point TP (the output of FF1) and adjust Cl for a reading of 2000240 He, If no frequency counter is available, just set Cl to its mid position. The fre- quency will never be more than 0.03% out, a mere trifle which can be discoun- ted. • Switch SI to E4 and adjust trimmer CIO so that the meter is zeroed. • remove link W-V and insert link W-U (the final situation). • plug in a guitar and tune in E4: the first string open. Make sure the needle of the meter is exactly at 0 (string perfectly tuned) before going on any further. • once open E (first string) is tuned, play the note F4 (349 Hz), which is first fret, first string. This is 20 Hz above and can therefore be used to 11-38 - ele A large majority of petty crime is committed by what the criminal fra- ternity describe as ‘amateurs'. The amount of damage they do is often much more serious than the value of the goods actually stolen. Sheer vandalism to say the least. So what do we do to keep them out. The cheapest method is to make entry as difficult as possible for the thief, and locking the door is a good start. 'Opportunity makes the thief', as the Earl of Essex said four hundred years ago. However, his solution is not really viable in this day and age. Putting bars across windows and so on is not really nice and would probably send the local fire chief into fits. So what do you cerfoerus electronic watchdog We live in violent times. The crime rate is on the 'up and up', especially burglaries. More to the point is the fact that petty 'break-ins' are now almost common place. Sophisticated alarm systems exist, but they tend to be expensive and are meant to keep out the professional. What the average householder needs is a simple, good quality, low cost device which detects 'entry' and then scares the living daylights out of the intruder. given area. These are very complex af- fairs, often based on some kind of radar. In general they are too sensitive and expensive for normal home use. Finally, semi-passive systems are not really alarms in the true sense. They simulate the presence of an accupant by turning lights on and off, opening and closing curtains in a true to life sequence. Hopefully they scare off the amateurs. The quality of alarms How sophisticated should a domestic alarm be? This is not an easy question to answer. The better the quality, then normally the higher the price. If you want value for money the points to consider can be itemised as follows. • Reliability. It must always work at the right time, and never 'for no apparent reason'. Some of the expensive models have been known to be triggered by a fly hitting the window. • Simplicity. This applies both to installation and operation. • Economy. It must be independent of the mains supply, but the batteries must last a reasonable length of time. The last thing you want to do is to change them every time you go out. • Effectivity. In other words, the thief must be made to panic and the neigh- bours and police should be able to hear it going off. • Anonimity. The unit should blend in with the decorations and be unobtru- sive, while at the same time being ac- cessible to the user. Some kind of electronic alarm system is required. For instance, a cated' version of the Auto Alarm published in the March issue of Elek- tor. In fact the basic principles used in that circuit are ideal for tf The circuit allows a short time to elapse between activating it and then leaving the house. Returning and open- ing the door will after a very shori the lawful owner it, before the 'balloon goes up'. Failure to get to the control panel quickly enough, or punching in the incorrect code, will give any in- truder an undesirably noise wel- Before we go any further it is a good idea to look at what types of system are available. Home security systems come in three main categories. The first two are 'active', whereas the third is best described as semipassive. The most simple alarms are which are set-off by a break in a circuit. These can use light (either visible or infrared). The second category detect Hence Cerberus ! A circuit with the added facility of 'barking' every time someone arrives at the door. Working principles The alarm is switched on by means of a pushbutton (S2). When it is armed, operating a further pressbutton (S3) has the effect of temporarily disabling it for a period of 10... 15 seconds. This allows you to leave the house without waking the dead. Once the door is closed behind you the alarm is reacti- vated. Opening the door triggers a second timer, again giving a delay of 10 to 15 seconds. This is sufficient for you to punch in the correct code (using S4 ... SI 3) to deactivate the alarm. If you do not get to the box in time or enter the wrong code, the alarm will sound. Another function of the system is to announce the arrival of visitors. In this mode it gives a short bleep when- ever the door is opened, in much the same way as the bell that rings when someone enters your local store. oscillator The circuit Figure 1 shows the circuit in block diagram form. The control panel of the system consists of a keyboard with 12 keys (S3...S14). The only other controls are the pushbutton S2 and the function selector SI (Alarm or visitor arrivals). The heart of the circuit is the 'logic and control' section, which consists of a single 1C. The starter is used to arm the system; the delay circuit allows the user to leave Figure 2. The complete circuit. As drawn here, the code for deactivating the alarm is 3058; this can be changed to any other four-digit number. • Switching over to position 'a' puts the circuit in 'doorman' mode (arrival announcer). Every time the door is opened the alarm will sound for one second. This will happen irrespec- tive of whether the alarm is activated or not (S2 depressed). With SI in position 'a' and an activated alarm, both func- tions are combined: first the buzzer will sound for one second and then 12 seconds later, the actual alarm signal will be emitted. 51 4 has two purposes. The first, already described is to deactivate the system (after entering the code). The second is a system check. When SI 4 is operated to shut down the alarm, LED D2 should light briefly to indicate that the battery is still good. If nothing happens press 52 to make sure the alarm is on, wait a few seconds and then try S14 again. Still nothing? Then what we have is a dead battery or broken LED. Construction The printed circuit board is shown in figure 3. Any type of keyboard will do, as long as it is possible for all the keys to be connected to a common rail (see figure 2). For this reason a so called matrix keyboard is unsuitable. The code given by the connections shown in figure 2 is merely a guide line. Any four digit code can be pro- grammed by connecting the appro- priate keys to the II ... 14 inputs of IC5. Remember to connect all the other keys to the reset pin (E). Potentiometer PI is used to set the frequency of the buzzer tone, to obtain maximum output. Should you wish to extend the time allowed for entering the code and depressing SI 4 (to deactivate the alarm), then this can easily be achieved by increasing the value of CIO. The delay times of MMV1 and MMV2 depend on the values of capacitors C4 and C5. Installation The complete circuit including batteries can be mounted in a small box (12x6x4 cms). This makes it suitable for mounting just about anywhere. The important thing is to camouflage the unit reasonably well without making it inaccessible, so that you can get to it during the critical first 10 seconds. The best position for the reed switch (SI 5) is in the doorjamb, but, no matter where it is positioned remember to discreetly hide the connection wires. The distance between the reed switch and the magnet should be around 6 mm with a maximum of 8 mm. The consumption of the circuit in a 'stand-by' situation is around a few -21029J liconductor 4013 LS7220 double pole switch (PB271 11-42 — ' iber 1982 floppy-disk ir i for the Junic G. de Cuyper Computer fever broke out here in Europe about eight years ago. The first 8-bit processors were even available at a hobbyist's budget. The great change, however, came in 1976 when Shugart brought the first 8-inch drive onto the market. Until then computer data had to be stored on punched paper tape or inconveniently on magnetic tape at speeds that are considered extremely slow today. The floppy disk revolu- tionized rapid data interchange be- tween the computer and an external mass storage device. Rapid paper tape readers only achieved rates of up to 15 kilobaud (baud = bit/second) at best. Paper tape punches were barely able to exceed 700 baud. Unless the user is to go to great expense with magnetic tape recording using a cassette recorder, the upper limit is 1200 baud at a tape speed of 4.75 cm/s. floppy- disk iiiKrfhec Km* die Ju nio r . . . and other 6502 computers was decided to save costs in another area when implementing a DOS (DOS = disk operating system) for the Junior Computer. We had to make a choice between employing a floppy disk controller and a controller using a few TTL ICs and some software. The 1771 or 1791 from Western Digital or the Motorola 6843 are suitable as controllers. These chips have the dis- advantage that they cost between 17 and 35 pounds. A further disad- vantage is that not much 6502 soft- ware is available on the software market for these controller ICs. Our objective was to equip the Junior Computer with a powerful disk oper- ating system, without forgetting the KIM, SYM and AIM-65 friends. Hard- ware for the floppy disk interface was not to exceed the 35 pound limit. We made the following demands of a DOS: 1. The programmer should no longer have to be concerned with absolute addresses in the computer. 2. The DOS should operate together with a Microsoft BASIC. The BASIC interpreter should understand DOS macro commands. 3. The DOS should operate with a convenient debugger. A debugger is a program which allows software to be generated in machine language and tested. It should also be possible to place break points at any locations. 4. An assembler and editor should also be provided and should understand various DOS macro commands. 5. If the programmer makes an incor- rect input, the computer should enable immediate analysis of the syntax and operating errors with precise error i At present the floppy disk is the most significant mass storage medium | for the computer. Considering the method used for recording, it is I almost incredible that computer data can be stored on a simple plastic disk at such speed and with such precision. This article will point out everything that has to be taken into account before one single bit can be stored on the plastic disk. The hardware of the floppy disk interface is designed to be universal. Not only Junior Computer fans, but also the owners of a KIM, SYM, AIM-65, ACORN and other computers can use this low-cost interface to extend their computer to a real personal computer. Even an interface for connecting the EPSON printer is provided. But even floppy disks have their disad- vantages. Although the round plastic disks do not cost more than good chrome-dioxide cassettes, the drive unit for floppy disks is fairly expensive. The computer user will have to pay about 120 to 190 pounds for a floppy disk drive. If one considers that two drives are required for convenient operation with a computer, the investment is quite substantial. The price barrier Since the prices for floppy disk drives are not likely to drop much lower, it messages. 6. There should be a lot of good and cheap software available on floppy disks for the DOS: • Games programs • Bookkeeping programs • Programs in BASIC and Assembler 7. The DOS must be easily adaptable to any 6502 computer. 8. The DOS must be capable of generat- ing random files. Random files are data files on the floppy disk into which data are written and which are produced during execution of a BASIC program. As can be seen from these requirements, we made high demands of the disk operating system. For this reason we chose an operating system that is widely used in the USA and Europe: the DOS is from Ohio Scientific and is known as the 'Ohio Scientific OS-65D Operating System'. Ohio Scientific also supplies the popular computers 'superboard C1P, C4P and C8P'. The software developed for these computers (and there is a good deal of it) can be easily adapted to the Junior Computer and other 6502 systems by modifying a few bits in the DOS main program (called KERNEL). Two ver- sions of Ohio's DOS are available at present: 1 . OS-65D V3.1 consisting of floppy -di - The price of OS-65D V3.1 in- cluding manual is approximately 30 pounds — relatively inexpensive. 2. OS-65D V3.3 consisting of — Five 5-inch diskettes accommo- dating various user-support pro- grams (more than 17 utility pro- grams altogether, which greatly facil- itate programming). All programs are written in BASIC and can thus be easily modified by the user if necessary. — A fresh diskette — A 250-page manual and detailed instructions for working with the DOS, BASIC and Assembler. Also eluding all manuals is approxi- mately 60 pounds. Considering the expensive documentation of OS-65D V3.3, this price is certainly justified to say the least. We adapted both versions to the Junior Computer and both versions have been working for many months without any problems and to our full satisfaction. Before being able to work with the extensive DOS from Ohio Scientific, however, a good deal must be known about the operating system. The Ohio manuals are very well written, but one must be familiar with computer techniques to understand the manuals. concerning a oisk operating system, step by step. First we shall generally describe the manner in which the data are stored on a floppy disk and will then discuss the recording method of Ohio Scientific. A functional description of the mech- anical aspects of a floppy disk drive will also be included. As shown in figure 1, each floppy disk drive has a door at the front. This door must be opened to insert or remove a diskette. The door should not be closed until the deskette has been fully inserted into the drive. Otherwise there is a risk of damaging the diskette. Fitted to the door of the drive is a switch which closes a contact when the door is closed. Thus the computer can only write data onto the diskette or read data from it when the door is closed. Diskettes can be protected against accidental overwriting. As can be seen in figure 2, there is a notch in one side of the diskette. An optoelectronic device in the floppy disk drive monitors this notch to establish whether it is open or covered. If the notch is covered the diskette is protected against acci- dental overwriting. If the programmer attempts to write data onto a write- protected diskette the DOS issues an error message. Any floppy disk drive can be utilized in principle. The only condition is that the input/output connector of the drive must be Shugart -compatible. Most 5 1/4- inch drives meet this requirement. We have tested the DOS both with Shugart and BASF drives. The only difference between the two drives is that the read / write head with Shugart is positioned by means of a spindle drive, whilst BASF use a helix. Figure 3a shows the mechanism of a Shugart drive and figure 3b shows that of a BASF drive. Both drives are equipped with two motors: — a drive motor and — a stepper motor. The drive motor rotates the floppy disk at a constant speed of 360 rpm. The drive motor is connected to an elec- tronic regulator which keeps the' rotational speed of the diskette constant, even in the event of load variations. The rotational speed of the diskette can be varied within certain limits on both floppy-disk interface for the Junior drives. The second motor is a stepper motor which handles the positioning of the read/write head of the drive. This motor is also connected to electronic control circuitry. The control circuitry is fed with pulses by the computer. Each pulse switches the stepper motor one step further. Another line is connec- ted between the computer and the control circuitry of the stepper motor. The potential on this line determines whether the stepper motor is to move the read/write head outwards from the interior or vice versa. The drive chassis also contains three other electromechanical components: As its name implies, the task of the head-load solenoid is to lower the read / write head onto the magnetic surface of the diskette. If the head-load solenoid is not activated, the read/write head is raised from the surface of the diskette by a spring. On the BASF drive the head is rigidly mounted. A felt pressure disk presses the magnetic surface of the diskette against the head. Two optoelectronic sensors are located on the drive chassis. One of these sensors emits a pulse when the read/ write head is over 'track zero' (de- scribed in more detail at the end of the artirlpl Trark 7Prn k a snprial rpmrrlinn hole which is punched in the diskette. The index hole (see figure 2) is the absolute zero mark of the diskette or, to put it another way, the 'zero degree mark' on the round plastic disk. The index hole serves to inform the com- puter when the diskette has made a full revolution. Thus at 360 rpm an index pulse is emitted every 166.66 ms. To summarize, therefore, a floppy disk drive consists of the following compo- - A stepper motor for positioning the read/write head - A drive motor to rotate the diskette at a constant speed - An optoelectronic sensor that checks whether the read/write head is pos- itioned over track zero - An optoelectronic sensor that estab- lishes whether the diskette is write- protected - An optoelectronic sensor that monitors the index hole and emits a pulse every full revolution - A head-load solenoid that lowers the read/write head onto the magnetic surface of the diskette. Clearly, a good deal of electronic circuitry is required to control all the electromechanical components on the drive chassis. Read/write amplifiers are the recording and playback amplifiers in a conventional tape recorder. However, the read/write amplifier in the drive must be able to process frequencies of approximately 125 kHz, because the baud rate for our floppy disk interface is 125 kilobaud. All this extensive circuitry is installed in a floppy disk drive and obviously contributes to its high cost. Usually the electronic circuitry in the drive is prealigned. There is therefore no diffi- culty involved in connecting a drive to the Junior Computer. Figure 4 shows the printed circuit board for a BASF drive. Only two connectors are import- and to the user: J1 and J5. Connector J1 is the Shugart -compatible connector of the drive. All control signals of this connector have TTL levels. All control signals emitted by the floppy disk interface are fed to the electronic circuitry in the disk drive via J1. Connector J5 is also Shugart -compatible and is utilized for the supply of power. The disk drive requires two voltages: 12V/800mA and 5 V/300 mA. Since the power consumption of a DOS computer is fairly high, we shall examine the question of power supplies in a future issue of Elektor. 11-46 — elektc ember 1982 floppy-disk interface for the . take into account connector JJ1 and the terminator chip: The terminator chip contains eight pull-up resistors and is always located in the last drive, when more than one are connected. When two drives are connected to the Junior Computer, drive A (the first one) has no terminator chip whilst drive B (the last one) con- tains the termi nator chip. If , for example, four drives are to be connected to the Junior Computer, drives A . . . C contain no terminator chips whilst drive D (the last one) contains a terminator chip. The drive designated as A, B, C or D is selected on JJ1 with the shorting plug. Drieve A is selected with the position shown. The following plug positions are assigned to drives B and C. Drive D does not require a shorting plug because it is clearly identifiable by the termina- tor chip. Resistor R69 is for fine adjustment of the read amplifier. This resistor should never be readjusted. The quality of the read signal depends on it (freedom from jitter). Drive mechanism Figure 5 shows a sketch of a drive | mechanism. The floppy disk is rotated | by the drive motor like a record. The head makes contact with the surface of the diskette and converts the magnetic field fluctuations in the gap to an elec- trical signal. Recording on the diskette and playback from it ('writing and reading') are accomplished using the same principle as for a tape recorder or cassette recorder. Since there are no grooves on the magnetic surface of the diskette, the head cannot follow a groove as on a music record. The head is therefore positioned over the desired track by a stepper motor. The stepper motor moves the head, which is mounted on a carriage, from track to track. The head can be moved over the surface of the diskette from the exterior to the interior or vice versa by means of the carriage. Since the surface of the diskette becomes worn fairly rapidly, the head is raised from the surface after every read or write operation. If the head is positioned on the surface of the diskette the term used is 'loaded head'. If it is not on the surface, this condition is an 'unloaded head'. The head can be lowered onto the surface of the diskette or raised from it by means of a spring and the head-load solenoid. If the head is continuously positioned on the surface of the diskette, the track will be de- stroyed after approximately 50 hours of operation. Since the head is normally only loaded for a short period, the service life of a diskette extends to several years. 6 tracks. Each track has a number. A diskette usually accommodates 40 tracks. The tracks can be subdivided into groups known as sectors. The index hole is the start mark for all sectors of a Sectoring of a floppy disk We shall now describe the way in which the data are stored on a diskette. With Figure 7. With soft-sectoring, the sectors can be of different lengths. In the extreme case a track consists of one or eight sectors. Track 12 is reserved for the directory with the Junior Computer. floppy-disk interface for ■ 11-47 juuULJjiJlJijiJuU ST B = START BIT SP B ■ STOP BIT PARITY = EVEN PARITY BIT C = CLOCK PULS D - DATA PULS BYTE = 8 BITS IBB ... B7) floppy disks of the type used for the Junior Computer, the data are stored on 40 concentric rings. The width of one ring is only 0.2 mm. The outermost ring of the diskette is track zero. With most disk operating systems (including the OS-65D) this is a reference track for the other tracks on the diskette. Figure 6 shows that the diskette is further subdivided. In addition to the 40 tracks, the diskette is subdivided into sectors. For the sake of simplicity, we have used eight sectors in the example. Sector 1 always comes soon after the index hole. With OS-65D there is always a wait of 1 ms until the index pulse has decayed. Only then are the data written into the corresponding sector of the track. There are very many formats for sec- toring a diskette. The best known format is the IBM-3740 format which is not employed by Ohio Scientific. For this reason we shall not discuss the IBM format but will deal only with Ohio's own format. The track number and sector number allow a data block written on a diskette to be clearly identified. The diskette in figure 6 has sectors of the same lengths. It is possible, however, to place sectors of different lengths on one track. The minimum data length ac- commodated in one sector with Ohio Scientific is a 6502 page or 256 bytes. Thus the track number and sector number are the coordinates with which a data block can be found on the diskette in fractions of a second. Figure 7 shows the sectoring of a diskette with variable sector lengths. This format is also used by the DOS which we have adapted to the Junior Computer. Track zero, the outermost track of the diskette, has a particular write format which will be explained later. Track 1 is subdivided into several sectors: sector 1 contains two pages, i.e. 2-times 256 bytes. A 45-degree rotation of the diskette corresponds to a data block of 256 bytes or one page. Sector 2 on track 1 is only half as long as sector 1 and only contains 256 bytes. Sector 3 on track 1 contains 5 pages. Thus 5-times 256 bytes are stored in sector 3 on track 1 . It is possible, however, to place only one sector on a track. This is the case with track 2 in figure 7. If only one sector is placed on a track, a maximum of eight pages can be stored per track, i.e. 2048 bytes. Since specific formatting information per sector, i.e. additional bytes which require space, is written on the diskette it is advisable for safety reasons not to write more than seven sectors per track on the diskette. Track 12 has a special function. This track holds the directory of the diskette. By means of the BASIC interpreter it is possible to store a file in the computer (for example, a BASIC program, a shopping list or a love letter). A file is created in the computer when the programmer presses keys on a terminal and the computer files the information in the memory, key by key. For any programmer it is difficult or even impossible to make a note of the track and sector in which the program or file is stored on the diskette. For this reason the Ohio DOS offers the facility for assigning names to the programs. A program name or file name may have a maximum of six alphanumeric characters and the first character must be an alphabetic character (A . . . Z). If, for example, you have written a BASIC program for calculating a circle and wish to store this program on a diskette, you can assign the program a name. You could use the name 'Cl RCA L' for instance, as an abbreviation for circle calculation. You write the name 'CIRCAL' onto the diskette quite simply by typing: DISKI 'PUT CIRCAL'. The computer then 'puts' the program on the diskette. The inverse of the PUT command is the LOAD command: DISK! 'LOAD CIRCAL'. This causes the file to be loaded into the computer. We shall explain the com- mands of the disk operating system later. Before the computer can write a file onto the diskette or read one from it, the file name must exist in the directory. Ohio supply various system service routines on diskettes to be able to generate file names in the directory. Data pulse to the floppy disk drive At the end of this article we will demon- strate the electrical signals which the computer sends to the disk drive. Ohio use a very simple transfer format. The data are transferred asynchronously, as with the printer interface of the Junior Computer. Although the printer inter- face can only handle a maximum of 2400 baud, the floppy disk interface can transfer at 125000 baud. An MC 6850 ACIA, which costs less than 2 pounds, allows this high transfer rate. The serial data delivered by the asyn- chronous interface adaptor (ACIA) have the following format: - One start bit - Eight data bits - One even-parity bit - One stop bit The even-parity bit is a check bit with which any transfer errors can be traced. This bit is set when the number of set bits in the transferred byte is an even number. Unfortunately the electronic circuitry in the disk drive cannot process the serial signal of the ACIA. For this reason the serial data signal must be converted to a frequency- modulated signal. Figure 8 shows how this conversion takes place. At the start of each data bit, a narrow clock pulse of only a few hundred nanoseconds is generated. If the transmitted bit is a floppy-disk interface for the . logic 1, a data pulse 'D' is modulated between two clock pulses 'C'. If the transmitted bit is a logic zero no data pulse 'D' is modulated between two clock pulses 'C'. As can be seen from figure 8, the electronic circuitry of the disk drive is presented with a frequency- modulated voltage for transmitting the data. The time elapsing until a bit has been transmitted is only 8 microseconds. For receiving data from i ~ disk drive the frequency-modulated signal must be converted back to a serial data signal. This task is performed by a data separ- ator which is located in the floppy disk interface. This brings us to the floppy disk inter- face itself and we will describe its hardware in detail. The following summary indicates everything that is needed to convert a Junior Computer or any other 6502 computer to a DOS computer: • At least two dynamic RAM cards are needed (see ELEKTOR, April 1982). To develop large programs, three RAM cards are required. • A Junior Computer, consisting of the basic printed circuit board, interface card and a bus PCB with five connectors. • A floppy disk interface card con- taining a few TTL ICs, an MC 6850 and an MC 6821. • One or two (if possible) floppy disk drives which have Shugart-compatible connections: For example the 5 1/4 inch disk drive from BASF, Shugart, TEAC, etc. Low-cost, surplus disk drives can also be utilized. • A power supply unit which delivers the following voltages: +5 V/5 A +12 V/2.5A +12 V/400 mA -5 V/400 mA — 12V/400 mA Hardware of the floppy disk interface A brief study of the circuit diagram of the floppy disk drive (figure 9) shows that only standard, commercially avail- able components have been utilized. We think we have reason to be pleased with this circuitry: this universal floppy disk interface is the lowest-cost interface available on the market at present. All KIM-1, AIM-65 and SYM owners can upgrade their computers from cassette to floppy disk system. However, before the floppy disk interface can be con- nected to the computer the user should know how the hardware functions. We shall now turn our attention to these interesting technical details. Data transfer between computer and floppy disk drive The principle of data transfer between the computer and floppy disk drive can be described as follows: • The STEP and the DIR line (outputs) Via the peripheral interface adapter (PIA) IC5 the read/write head of the disk drive is placed on the desired track. The computer emits stepper-pulses via PB3 which are matched to the elec- tronic circuitry of the drive by driver N18. The read/write head is shifted one step inwards or outwards with each pulse. PB2 of the PIA (IC5) and N19 generate the DIR signal. The logical level on the DIR line determines whether the stepper pulses shift the read/write head outwards from the interior or vice versa. • The TRO line (input) The TRO line is an acknowledge line from the drive to the computer. The logic level on this line indicates whether the read/write head is placed over track • The INDEX line (input) The Index line is an acknowledge line from the drive to the computer. As explained at the beginning of this article, the index hole on the diskette is a zero mark for a soft-sectored diskette. Whenever the index hole passes a light barrier in the drive a pulse is produced on the Index line. • The WR.PROT line (input) The logic level on the WR.PROT line informs the computer whether it is allowed to write on the diskette in the selected drive, or whether the diskette is write-protected. The computer only writes on the diskette when the WR.PROT line is inactive. • WRITE line (output) The WRITE line switches the electronic circuitry in the disk drive from the read mode to the write mode. Before this line become active, the computer checks via the WR.PROT line whether the diskette is write-protected. If this is the case, the WRITE line can never become active. • The SEL1, SEL2, SEL3 and SEL4 lines (outputs) The computer selects one of four drives via the SEL lines. Normally only SEL1 and SEL2 lines are utilized. Line SEL1 controls drive A and lineSEL2 controls drive B. When Ohio software is used a floppy disk drive must always be connected to SELI. • The SIDE SEL line (output) The SIDE SEL line is not used with the Junior Computer and is intended for later extensions. Special drives con- taining two read/write heads can be controlled via this line. These drives can write on both sides of a diskette and read back the stored information from both sides. • The WDA (output) and RDA (input) The computer writes the data in serial form into the electronic circuitry of the drive via the WDA line. The com- puter reads the serial data from the drive via the RDA line. The baud rate on these lines is 125 kilobaud. The data transfer from the computer to the drive can be compared to a simple V24/RS232 serial interface. We be- came acquainted with this interface in the Junior Computer 3 and 4 books. In that application the data are transferred from the computer to the ELEKTERMINAL or from the ELEKTERMINAL to the computer. The serial data transmitted by the computer to the drive are written in parallel into the ACIA (IC11) and transmitted serially at the TxD output at a rate of 125 kilobaud. The serial data from the ACIA cannot be directly written onto the diskette. This requires modulation of the serial data with clock pulses which initiate the start of a data bit, as shown in figure 8. Between two clock pulses, a data pulse is then modulated or not, depending on the logic level of the current data bit. When the computer reads data from the WRITE DATA ENCODER diskette the clock pulses must be separated from the data pulses. This task is handled by a data separator consisting of components N13 . . . N17, the two monostables MF1, MF2 and flip-flop FF2. The clock pulses for the ACIA are at output Q of MF1 and the serial V24/RS232 data are at output Q of FF2. The data signal that was previously in serial form can be read out of the ACIA (IC11) in parallel form by the computer via the data bus. Since the I/O chip used for serial data transmission between computer and drive is normally employed for V24/ RS232 interfaces, a number of known characteristics are found in the trans- mitted data pattern: 1. Each byte to be transmitted begins with a start bit and ends with a parity bit. 2. A stop bit is located between two bytes. The stop bit is the inverse of the start bit. Eleven bits are required to transfer one byte: One start bit, eight data bits, one parity bit and one stop bit. If no data are being transferred, only stop bits are present (logic 1). By using pseudo-FM-encoding, 22 pulses are written onto the diskette during the transmission of one byte (= 8 bits), which only consists of logic ones (=$FF). The reason is that each bit to be transmitted consists of a clock pulse and a data pulse. The clock pulse is always present, whilst the data pulse is only present when a logic one is being transmitted (see figure 8). This format allows eight pages of 256 bytes each to be stored on one track, i.e. 8-times 256 bytes = 2 kilo- bytes. Since a few tracks are required for the directory and system program Figure 11. READ DATA SEPARATOR diagram. Here are the pulses arriving from the drive and which are than separated by the data separator. (= DOS program and BASIC), only 35 tracks available to the programmer on a diskette with a total of 40 tracks. Thus approximately 2 kilobytes times 35 = 70 kilobytes can be stored on a diskette. This is more than adequate for a hobby computer system. The circuit diagram in detail The circuit diagram of the floppy disk interface can be subdivided into seveiai groups which we shall now examine: a. Address decoding and data buffet The outputs of address decoder IC7 change their states in 8-kilobyte steps. Output Y6 drives IC1 (N1 . . . N4) which decodes the rest of the address lines. If all inputs of gate N5 are logic ones, its output (pin 6) becomes a logic zero. This output always remains a logic zero be- tween addresses SC000 . . . SCOFF. This signal is needed lo activate the data bus buffei in IC13. Additionally, (he output is wired to pin 6c or ous connector K1. 1982 floppy-disk interfa The direction of the data bus buffer is governed by the R/W signal which is buffered by drivers N8 and N9 on the floppy disk interface PCB. The 02 or E-signal is buffered by drivers N10 and Nil. The inverse COXX signal activates the PIA (IC5) via the CSO pin. The other chip select signals are connected with address lines A4 and A5, so that the PIA has a base address of SC000. b. Lines between drive and interface The outputs to the floppy disk drive are buffered by drivers N18 , . . N26. These drivers have an open collector output. The pull-up resistors are always in the last drive (terminator), as explained at the beginning of this article. The drive is also controlled by the floppy disk interface via drivers with open collec- rs. The pull-up resistors are R1 . . . R4 and R6. IC15 multiplexes lines PA6 and PB5 of the PIA, so that four drives can be operated using one 34-way cable. A small modification on the interface allows two doublesided drives to be connected to the computer. This is achieved by connecting the input of N26 to PB5. The connection between PB5 and pin 2 of IC15 must be discon- nected in this case. Multiplexer I Cl 5 is activated via N7. The inputs of N7 are controlled by the head-load output of the PIA (PB7) and the Q-output of FF1. FF1 is set by the step pulse and reset by the leading edge of the head-load pulse. N7 and FF1 are not absolutely necessary. We have made provision for them, however, on the interface PCB because the Ohio software for 8-inch drives has been applied and requires a separate head-load line. Mini-disk drives utilize the select lines to activate the read/write head. To prevent the head from continuously rubbing the surface of the diskette, the select line is activated by the head-load line. This ensures proper treatment of the d iskette in the drive. The port lines of the PIA The port lines of the PIA are used as follows: A-side: Address SC000; Disk status Port PAO: Drive 0 ready Input PA1: Track 0 Input X PA2: Fault Input PA3: Free for user PA4: Drive 1 ready Input X PA5: Write protect Input X PA6: Drive select L Output X PA7: Index pulse Input X B-side: Address SC002; Disk control Port PBO: Write enable Output X PB1 : Erase enable Output PB2: Step direction Output X PB3: Step pulse Output X PB4: Fault reset Output PB5: Drive select H Output X PB6: Low current Output PB7: Head load Output X All I/O lines are active at logic zero. 'X' = I/O line used. The electronics for data transmission Data transmission is primarily handled by the 6850 ACIA (IC1 1). The computer writes the byte to be transmitted into the transmit register of the ACIA via the data bus. IC11 then shifts the word written in parallel form to the TxD output in serial form. The ACIA re- ceives the serial from the diskette at the RxD input. The clock input for the serial receive signal is designated CRx. If a serial word is read into the ACIA the computer can read it out of the receive register in parallel. We will discuss the register structure of the ACIA in the December issue. The data to be transmitted are presen- ted to input D4 of data selector IC4 in inverted form (N12). All other data inputs except for DO, are ground- ed. The select input of IC4 selects the 'E' or 02 signal. Synchronous counter IC3 divides the clock signal by eight and sequentially addresses data selec- tor IC4 with outputs QA, QB, QC. Output 6 of the data selector must always be a logic zero when the 'E' signal is a logic zero and when data input D4 is a logic one. This means that a pulse is always produced at address zero. This pulse is the clock pulse which is repeated every eight microseconds. When the ACIA (IC11) transmits a logic one, TxD is a logic one and D4 of the data selector (IC4) is a logic zero. The result is as follows: floppy-disk interface for the Junior • During transmission of a logic one, no data pulse appears at the 'W' output of the data selector (IC4). • During transmission of a logic zero, one data pulse appears be- tween two clock pulses at the "W' output of the data selector (IC4). • Each clock or data pulse has a length of only 500 nanoseconds. The signal at the W output of the data selector forms the coded FM signal which is transmitted via buffer N21 to the floppy disk drive. The WRITE DATA diagram for the write encoder is shown in figure 10. To be able to read back the data from the diskette, the clock and data pulses must be separated again. After separa- tion, the clock pulses are utilized to shift the serial data pulses into the ACIA at a rate of 125 kilobaud. The separating of clock and data pulses is performed by a data separator con- sisting of N13, N14...N17, MF1, MF2 and FF2. Incoming data from the floppy disk drive are inverted by N13. The NAND port N16 is enabled by NAND N17, so that the first clock pulse can trigger both monostables MF1 and MF2. MF1 triggers on the negative edge of the clock pulse whilst MF2 triggers on the positive edge. The Q-output of MF2 should be at logic zero for about 5.5 microseconds, so that N14 is enabled and N16 is disabled. As soon as a data pulse is present between two clock pulses, flip-flop FF2 is set via N14. The Q-output of monostable MF1 emits a clock pulse of about 1 micro- second to the CRx input of the ACIA. The leading edge of the clock pulse transfers the data bit currently being transmitted to the serial input register of the ACIA. The data bits come from the Q-output of flip-flop FF2. A data pulse on the preset input sets flip-flop FF2. The Q-output then goes to logic zero. The subsequent clock pulse transfers this zero into the ACIA. When MF1 toggles back to the stable state, it clears flip-flop FF2 via the clock input. Figure 1 1 shows the timing diagram of the READ DATA separator in detail. Construction and alignment Construction and alignment of the floppy disk interface are quite simple. All wire links should first be connected on the printed circuit board (figure 12). Since some tracks are very close to each other, soldering requires great care. 13 Figure 13. When connecting an EPSON printer with a serial interface, a V24/RS232 to-TTL level converter is required. This little circuit can be wired on the Junior interface PCB in self-supporting fashion. PB5 of the 6532 on the basic PCB of the Junior Computer is used as the BUSY line for the elektor november 1982 - 11-53 The resistors, capacitors, diode D1 and the two connectors are then fitted to the board. Trimmer potentiometers PI and P2 are rotated to their midpoints arrd soldered into the board. If new ICs are inserted, they can be soldered indirectly without sockets. Good sockets should always be employed for the 6850 (IC11 land the 6821 (IC5). The floppy disk interface should nor- mally work immediately if the two trimmers are set to their midpoints. If, however, fine alignment is still required, the procedure is as follows: 1. Remove the plug from connector K2. 2. Jumper the WDA output to the RDA input on the soldering side of the board using a wire link. 3. Align output Q of monostable MF2 to 5.5 microseconds using an oscillo- 4. Monostable MF1 is non-critical and can be aligned to a time of about one microsecond. However, the ACIA and the PIA must then be initialized with a short program. We will go into this in more detail when we discuss the soft- ware for the floppy disk interface in the December issue. EPSON interface In the Elektor laboratory the Junior Computer operates with an EPSON printer and has therefore been equip- ped with an interface for the EPSON dot-matrix printer. The following is a description of the necessary interface, for those readers who employ one of these printers. For connection to the Junior Computer, the EPSON requires a serial interface adapter and not the usual Centronics interface. The commercial price for the serial interface adapter for the EPSON is approximately 23 pounds. The baud rate must be set to 1 200 baud by means of the digiswitch provided on the printed circuit board. The ELEKTERMINAL should also run at this rate. The EPSON is connected in parallel to the V24 / RS232 output of the ELEKTERMINAL. The EPSON uses the BUSY line to inform the computer whether data can be transmitted to the printer or not. Since cassette control is no longer necessary on the DOS computer, we have used PB5 of the 6532 on the basic PCB of the Junior Computer as the BUSY input. Relay Re2 on the Junior interface PCB can thus be discarded. The green LED (D5) can continue to be used as a transmit data indicator. Since there is also a V24/RS232 signal level on the BUSY line, conversion to TTL level is required. Figure 13 shows a circuit which can be wired in self- supporting fashion on the component side of the Junior interface PCB. If no EPSON printer is connected to the Junior, PB5 of the 6532 must be grounded otherwise the computer cannot transmit data. M K. Siol To answer the first question, what have the pyramids got to do with cubes? It came to pass that El Pharina, a well known tomb designer of that era, was attempting to revolutionise the current tomb designs of the period for a wealthy and influential customer. On the way to the office one morning he happened to stub his toe on a gold inlayed ebony block that was used to keep his garage door open (hence the origin of base- over-apex doors, better known lately as up-and-over). He thus hit upon the idea of using a cube as the basis for his next tomb. It was duly constructed in the grand manner. However, the foun- dations were contracted to an outside construction company and this is where the troubles began. The dead weight of the gigantic tomb cube was far greater than the foundations could stand and the tomb toppled over at an angle of 45°. Pharina sued of course, putting the mining company out of business. Th? disaster became known locally as Pharina's yonder ruination of Achmed Mining in the desert, or 'pyramid' for short. All was not lost however, since all the other tomb designers adopted the resultant shape as the state of the art thus creating numerous legends and tall stories, of which, this is one! History will probably show that Rubik has done more for todays cube than all nihiiL’ir bed Cubes are attractive to the human mind, a fact well proved by the pyramids and the popularity of Rubiks cube. The cube described here contains an electronic 'bell' with a tone that is dependant on how the cube is picked up. Each face of the cube has a touch switch on its surface and contact with one or more of these will cause the cube to produce a sound. However, the sound will vary depending on how many and which of the faces are touched. The Cubular Bell is quite fascinating to all ages and, once picked up, becomes very difficult to put down. the other ancients put together and it is entirely possible that our Cubular Bell will not reach the same degree of fame. However, it is musical and therefore not really in the same class. That is not to say that it is a musical instrument, more a musical game. In effect, the cube will produce a tone whenever a side is touched. Each side has its own individual tone but this will be changed if two or more sides are touched at the same time, when picking it up for instance. Replacing the cube on the table will immediately silence it. This could all work out to be a very complex circuit but a glance at the circuit diagram will show this not to be the case. It will be obvious that the heart of the circuit must be an oscillator and this is formed by the two inverters N7 and N8. The timing components of the oscillator are capaci- tor Cl and the resistor chain con- sisting of R7 to R13. Six electronic switches (ESI to ES6I placed across the resistors are controlled from a touch plate in each face of the cube. If touch switch SI is bridged by a finger then ESI will be activated effectively taking R8 out of circuit. The frequency of the oscillator is determined by the total value of the resistors that are in circuit. Which face operates which electronic switch is left up to the constructor, some combinations may be better than The output of the oscillator is fed via a buffer, N9, to our 'audio stage', transistor T1 and the speaker. The type of speaker used is not critical providing it is 8 A. The available space will probably be the determining factor! The one essential point of the cube is that all the faces appear to be identical in order that its orientation remains a mystery. This causes a major problem when a on/off switch is to be fitted. To overcome this we have included an elec- tronic power switch consisting of gates N10 and Nil together with ES7. Briefly, if no touch switch (SI to S6) is bridged the electronic switch ES7 becomes open circuit thus switching off the oscillator. The use of CMOS ICs ensure that power consumption is kept to a very low level therefore the 9 volt battery should last for quite Construction Manufacturing a cube is on a par with making four chair legs independantly — only three legs will ever touch the ground at any one time. Murphy's Law definitely states that the final face of a cube will not fit its alloted space when completing the cube and you can bet your reel of solder on that! For this reason another source of cubes would be a major advantage. Toy shops for the young are a cubic paradise and should provide one or two ideas. Another cube to check out are the 'picture cubes' from that well- known High Street store that don't, in fact, sell footwear. It is well worth shopping around for ideas before aquiring your cube because a good cube is an anonymous cube and very few fit into this category. Bear in mind that each face of the cube must contain a touch switch in one form or another. Figure 2 illustrates how this can be achieved by means of a printed circuit type of switch. If these can be made and fitted onto each face of your selected cube your problems are almost over. The final problem is that of getting the circuit, the speaker and the battery inside the cube — we have to leave that one with you! Don't forget to make some holes in each face to let the sound out or you will have a mute cube on your hands. Two points that may make for a more appealing cube. The sensitivity of the touch switches can be increased by raising the values of resistors R1 to R6 to about 22 MS2. Finally, the tone range can be varied by changing the value of Cl to taste. Now, if you can get your cube to stand unsupported on one corner, just let us know how .... M 11-56- 3r 1982 The heart of the mini-organ is the SAA 1900 integrated circuit. This 1C contains almost the complete elec- tronic circuitry required for an elec- tronic organ. All 56 key contacts of the keyboard are directly connected to the 1C via a 7 x 8 matrix. This means that 15 1C pins are already assigned. 4 pins are needed for the audio-fre- quency outputs, 2 pins for the power supply, 1 pin as a clock input, one more pin as a modulation input and, finally, a pin for the mode. The total is 24 pins which is the full extent of the IC’s terminals. It offers full polyphonic per- formance and good sound, but that is all. This extension changes the whole mini-organ extension synthesized sounds with the mini-organ Those of you who built the mini-organ last year will have had plenty of time to practise on the instrument and will no doubt have far surpassed its capabilities. The mini-organ is an electronic organ consisting of one single 1C and a keyboard. Since an organ 1C of this type only has a limited number of terminals, registers and the like cannot be incorporated. The extension presented here, however, brings the mini-organ half-way to being a synthesizer. picture. The extension consists of a VCF with attack and decay generator. These three terms will be familiar to synthesizer enthusiasts, but there is a brief explanation for strangers to the field: a VCF is a voltage controlled filter. "Attack" is the phase in which the note of a musical instrument in- creases in volume or tone from zero to its maximum value. In the decay phase this value drops from its maximum to a particular level, whilst the key remains pressed. The VCF To avoid having to employ expensive, special ICs as in the polyphonic syn- thesizer, the VCF was designed to a well-proven and well-known format. It is a lowpass filter with a skirt of 18 dB/octave. Three active lowpass filters, each with 6 dB/octave, are connected in series to achieve this filter characteristic. Each of these filters consists of an OTA (CA 3080 in figure 1). a capacitor and an opera- tional amplifier as an output buffer. The control current at pin 5 of each OTA determines the basic frequency of the filter, when combined with the capacitor (e.g. C9 in figure 1). These control currents are supplied from a current source, consisting of A1 1 and T1, which is also controlled. The basic frequency of the entire filter thus depends on the setting of P1 1 . Attack! Purely manual adjustment of the basic frequency (with P 1 1 ) is not sufficient. An organ note filtered in this way still sounds too much like an organ!. What is needed is an attack/decay generator. This type of generator makes the filter Figure 1. The circuit diagram of the extension. 8 integrated circuit: lowpass filter with a skirt of 18 dB/octave. and a voltag oiled attack/decay ger attack-dependent and opens the way to many possibilities in sound exper- imentation. The status of a key, i.e. whether it is pressed or not, unfortunately cannot be indicated by the keys themselves. This would require a second row of contacts and would be very expensive. However, there is another inexpensive method: if Parts list Resistors: R1 ,R4,R7 ■ 4k7 R2,R3 = 1 M R5,R6,R24 -47 k R8,R9= 33 k R1 0 = 100 k R1 1.R14.R1 5.R1 8.R19.R22 = 27 k R1 2.R13.R16.R1 7.R20.R21 = 100 n R23 = 3ks R25 . . . R27- 22 k R28 “ 2k2 R29.R30- 10 k R31 ■ 6k8 PI ,P2,P6 * 1 00-k-pot. log. P3 . . . P5.P9- 10-k-pot. lin. P7.P8 = 1-M-pot. lin. C1.C2.C4- lOOn C3.C5 . . . C8 - 1 M foil type C9 . . . Cl 1 = 330 p Cl 2. . . C14 = 330 n Semiconductors: D1 . . . D4= 1N4148 T1 = BC557B IC1.IC3.IC4-TL084 IC2- 741 IC5 . . . IC7 - CA3080 IC8 - 4001 SI - single-pole changeover switch the organ is emitting a note, a key must be pressed. It is therefore only necessary to know that a note is present. This task is performed by A1 ... A3. A1 picks off the note at a high impe- dance at terminal A of the organ PCB. A2 amplifies this buffered signal by a factor of 200, i.e. it limits it. D1 and D2 produce a positive DC voltage from the limited square-wave and, based on the level of this voltage, comparator A3 decides whether a note is present or not. D2, P7, C3 and A4 form the attack section. If a key is pressed the voltage at the output of A3 jumps to + and C3 charges up, depending on the setting of P7. At the end of a keystroke C3 is discharged over R4 and D3. The voltage jump of A3 triggers the monostable consisting of N1 whose output pulse charges C5 very rapidly. P8 determines the discharge time of C5. This decay voltage is now buffe- red by A5. Either an attack or decay voltage can be applied to the control current source by means of SI . P3 determines the modulation depth. Sounds At point A on the organ PCB, the mini- organ delivers an asymmetrical square- wave signal which is rich in harmonics. This signal serves two purposes: firstly, it triggers the attack/decay generator; secondly, it is applied via P2 as the signal intended for filtering. The signal from point B of the organ PCB, which is one octave lower, can be mixed in by means of PI . Depending on the Q of the filter adjus- ted with P5, sounds can be produced which vary from very dull to very bright. Furthermore, P5 can be used to make the filter oscillate. The result is a sinewave oscillator with which widely varying sound effects can be generated via the attack/decay gen- erator and any key of the upper part of the keyboard. If S2 is in the attack position, P3 and P4 can be adjusted to obtain a sound reminiscent of brass instruments. In the decay position, a piano-like sound can be produced. Since the output of the filter is fed back to the output stage of the joy- organ, the unfiltered signals can be added to the filtered signals by mixing. The phase shift of the filter produces a phaser-like sound, by eleminating individual, narrow frequency ranges. Construction and connection The entire extension circuit can be built on Vero board. It requires some care in construction because 8 ICs and some passive components need to be mounted. The terminals of each control are identified with letters which also appear in the wiring diagram (figure 2). The power supply for the extension is obtained at the appropriate points on the organ printed circuit board. The only output missing is for the — 1 5 V and this must therefore be picked off the wire link between Cl 7 and R20 on the organ printed circuit board. S2 of the mini-organ is discarded. Instead, points S2a and S2c are connected with a wire link. As a general precaution, signal lines should not be too long nor be arranged in the vicinity of the mains transformer. kitchen tinier accurate timing up to 15 minutes Most modern cookers are equipped with a cooking timer but this invariably has some limitations when the accurate timing of short periods is called for. The circuit described here has excellent resolution up to 1 5 minutes and is very easy to set. The end of the preset time period is announced by an electronic gong rather than the usual buzzer. The timer is completely self-contained and is ideal for short cooking periods where accuracy is required. M.R. Brett The two most critical parameters in cooking are expertise and timing. We have to admit that our knowledge of the first (and foremost) require- ment could be written on the outside of a 2716. However, the second point is a different kettle of fish. If elec- tronics is good at anything at all it surely must be period timing. The circuit here allows four independant time periods to be preprogrammed and selected when required. A further asset of the circuit is the absence of any display that requires watching. The end of the time period is given by an audible 'gong'. The circuit diagram shown in figure 1 can be broken down into four main parts, the counter (IC1), a comparator (IC2), a memory (IC3) and the sound generator (IC4). The presetting of time periods is carried out by means of the 16 switches at the right of the diagram. The use of quad DIL switches would be ideal for this purpose. The function of the circuit is fairly straightforward. With the circuit in the quiescient state the 53 output of FF2 will be at logic 1 thus the counter IC1 will be inhibited via the reset input. Its outputs will be held low. The A=B output of the compara- 1 Figure 1. kitchen tir tor (IC2) will also be low and the memory (IC3) will receive a reset pulse via the gate N2. The compara- tor is now ready to accept data rela- tive to the required preset time period. This is preset in BCD format on one set of four switches of SI to SI 6. Once selected, the time code is entered into the memory by pressing the relative switch from SI 7 to S20. There is now data in the memory and this is presented to the comparator causing the AB output will revert to logic 1. This will provide a pulse via T2 to the sound generator, IC4, and the gong will sound to signal the end of the time period. By this time of course, the A