Capture Systems using PIC Micros
Home Up Other Publications Contact Me About the Author About this Website Prog Organ - a VPO Sitemap

 

  Combination Capture Systems using PIC Microcontrollers 

 

by Colin Pykett

 

Posted: 19 March 2012

Last revised: 8 April 2012

Copyright © C E Pykett 2012

 

Abstract.   The core requirements of a combination capture system are that it must capture and store combinations on demand, and then recall them subsequently as required.  Multiple levels of memory must also be available.  Many ancillary functions also exist, including customising the system for the type of stop mechanisms used and the mix of general and departmental pistons.  Computer control is well matched to the core functions but not necessarily to the ancillary ones.  Although the latter can be configured for a particular organ by customising the software, this is always more expensive than a non-customised product.

 

This article explores a different approach using a computer- controlled hub of deliberately limited scope which implements the core functions only.  In addition there are several such hubs (e.g. one per department), each of which is simple in terms of hardware and software.  Importantly, the software in each hub is identical, and it is also the same across all organs rather than being customised for each one.  This is possible because each hub only implements core functions which are similar for all instruments.  Configuring the system for a particular organ is then done entirely in hardware, simply by wiring it up in the desired manner and by using the correct components.  By this means any form of stop mechanism can be used and any mix of general and departmental pistons can be realised, together with any mix of cancellers, etc.  This results from the separation of ancillary functions from the core functions.  

 

A practical realisation of these ideas is described in which each core hub consists of two cheap PIC microcontrollers executing the same computer program.  This constitutes a ‘logic board’ in which no software customisation is necessary.  A second ‘driver board’ interfaces each hub to the particular type of stop mechanisms chosen, and implements various ancillary functions such as stop cancelling.  This board contains no software, being constructed wholly from readily available components.  Each pair of circuit boards will control up to 16 stops from 16 pistons with 16 memory levels, thus it will often be adequate for a single department of an organ, but larger departments with more than 16 stops would be catered for by using more than one pair of boards. 

 

The approach might attract interest from a craft where the soldering iron is a more traditional tool than a state of the art computer system running customised software.   

 

 

Contents

(click on the headings below to access the desired section)

 

Introduction

 

Microcontrollers - take your PIC

 

System Overview

 

Prototype System

 

Programming the PICs

 

Architecture of a Complete System

 

Concluding Remarks

 

Introduction

 

Capturing or memorising a combination of stops merely by pressing a setter button or piston while seated at the console is something organists enjoy frequently today.  The conventional sequence of operations is first to draw the selection of stops required to be captured on a particular piston, press the setter button and then (while keeping it pressed) the desired piston, finally releasing the piston and then the setter. 

 

A variety of mechanical and pneumatic capture systems were developed in the nineteenth century, both types representing a considerable tour de force of engineering considering that some were fully motorised (i.e. they physically moved the corresponding stops) rather than merely being blind (acting on the internal mechanism only).  With the advent of electricity it was not long before electropneumatic or purely electromechanical analogues appeared, those of Compton, Hill Norman & Beard and Willis in the first half of the twentieth century being typical of the genre.

 

However, a drawback of all capture systems up to about 1970 was that they only boasted a single memory level.  In other words you could only store one setting at a time for each piston.  In the pre-solid state electronics era anything more would have been inconceivably complicated, impossibly expensive and hopelessly unreliable.  But unless precautions were taken, this meant that the humblest pupil practising at a cathedral organ on a Saturday afternoon could wreak havoc with the combinations that had been set carefully by an eminent recitalist for her performance that evening.  The precautions were sometimes quite draconian - in the 1960’s Willis III’s otherwise handsome three manual console in the chapel at King’s College London sported an ugly padlock dangling from the lower keyslip to prevent the setter piston being tampered with!  It is only with the advent of cheap digital solid state electronics that multiple memories have since become available.  In the more elaborate systems groups of these are allocated to different players, who can lock them with a password or a physical key to prevent their combinations being fiddled with by others.  Often there will also be an unreserved group of memories available to all organists.

 

This article outlines how electronics has facilitated all of this by describing an application of computers to combination actions in the form of PIC microcontrollers.  The points are illustrated by referring to a modular and expandable system of my own design. 

 

 

Microcontrollers - take your PIC

 

Microcontrollers are physically small computers made in the form of a single but internally complex integrated circuit or silicon chip.  They are offered with a range of capabilities by several firms, from tiny things costing almost nothing which are programmed to emit jingles when you open your birthday card, to larger and elaborate 32 bit processors intended for high speed digital signal processing (DSP) applications.  The range of PIC microcontrollers from Microchip Technology Inc is as well known as any, partly because they are firmly established as a mainstay of electronic engineering degree courses.  The acronym means Peripheral Interface Controller, and it is a trade mark which is acknowledged as such throughout this article.  But any PIC is actually a computer with considerable capabilities, and the data sheets of the simplest ones run to over a hundred pages.

 

Neglecting the extremes of the product spectrum, mid-range PIC chips come in a variety of product families in packages with 8 to 28 pins.  They are very cheap, the 18 pin 16F648 device discussed in this article costing typically £1.20 at the time of writing (2012).  Therefore one can sprinkle them liberally throughout a system, indeed spending too much design time attempting to reduce the number employed is utterly self-defeating.  The 16F648 is pictured in Figure 1 against a dimension scale which organ builders will understand.

 

 

 

 

Figure 1.  Typical mid-range 18 pin PIC microcontroller (Microchip Technology’s 16F648)

 

Why was this particular device chosen from the huge variety available?  Because it has sufficient capability to form the nucleus of a modular and easily expandable capture system without being over-complicated and too expensive for the job.  The system to be described is itself mid-range in that it is aimed more at small to medium sized organs rather than the largest and grandest ones.  For example, while it does not incorporate the hundreds of memory levels and other facilities which the most elaborate systems offer, it is nevertheless flexible and configurable.

 

Although the system is software controlled by means of the program within the PIC chips, much of its flexibility is realised at a hardware level rather than requiring customised software to implement the smallest changes.  Therefore it is well matched to the demands of practical organ building in the field, where I venture to suggest that the soldering iron is a more acceptable tool than a computer.  An example is the way the system is configured for various mixes of departmental and general pistons, which are determined by how the pistons are wired to the circuit boards rather than by changes to the program within the PICs.  Another feature is that the system can control any type of stop mechanism, either magnetically operated ones or those using lamps.  This is defined by the type of circuitry chosen to drive the stops, so again it does not require changes to the software.  Yet another aspect concerns stop cancelling - any mix of general, departmental or second touch cancelling can be accommodated merely by wiring the cancel contacts directly to the stop driver circuits in various ways to suit the application.  Similar remarks apply to options such as piston couplers (e.g. ‘great and pedal pistons coupled’).  And stops such as couplers which are to remain ‘neutral’, i.e. not controlled by the system, will simply not have their action magnets connected to it at all, or they can be configured to be 'neutral' or 'non-neutral' by a simple switch.

 

 

System Overview

 

Before describing the system in more detail, it is necessary to discuss issues of memory because these dictated its architecture.  An important aspect of the 16F648 is that it has 256 bytes of non-volatile data memory, meaning that the data captured when setting combinations will not be lost when the organ is switched off.  Nor does the memory depend on backup batteries.  It uses ‘flash’ EEPROM technology (electrically erasable programmable read-only memory) similar to that in USB memory sticks.

 

A byte comprises 8 bits, and each stop in a combination action requires one bit to control it.  This applies whether the stop mechanisms are magnetically operated drawstops, stop keys or luminous versions thereof.  If a captured bit is ‘0’ the stop will be turned off when the bit is recalled from memory by pressing a piston, whereas a ‘1’ will turn it on.  (The opposite convention can of course be used equally well, though it is intuitively less appealing).  Thus a byte will capture the settings of up to eight stops.  With 256 bytes of memory it is therefore possible to control these 8 stops from 16 pistons, and to store different settings of each piston in up to 16 memory levels (because 16 x 16 = 256). 

 

To summarise, a single 16F648 PIC in this system will therefore control a capture system with the following features:

 

- up to 8 stops, which can use any type of mechanism (magnets or lamps)

 

- up to 16 pistons, any of which can be general or departmental

 

- up to 16 memory levels

 

- any mix of general, departmental and second touch cancelling

 

- configured by hardware (the way the system is wired up) rather than by software

To expand the system in blocks of 8 stops it is therefore only necessary to add sufficient PICs.  But because 8 stops is a rather meagre number, the basic controller module actually accommodates two PIC chips, which together control up to 16 stops.  This will suit a large number of instruments which often will have no more than 16 stops per department, and in these cases only a single controller board is required (containing two PICs) for each one.  Each department will then have its own complement of up to 16 pistons and 16 memory levels for these 16 stops.  If a department has more than 16 stops, additional controller modules can be added as necessary.

 

At this point a block diagram is called for before going further, and this is at Figure 2.

 

 

Figure 2.  Block diagram of the PIC-based capture system for one department of up to 16 stops

 

The basic 16-stop system module consists of two printed circuit boards (PCBs), one called the ‘logic’ board and the other the ‘driver’ board.  The logic board will accommodate two PIC chips, though only one need be used if a small group of up to 8 stops is to be controlled (e.g. a bank of couplers).  All PICs contain exactly the same computer program.   This board takes inputs from all the pistons for this group of stops, regardless of whether they are departmentals or generals because the digital logic on the board does not distinguish between them.  It also requires inputs from each stop contact so that it knows whether a stop is on or off when setting a combination.  In addition it is supplied with inputs from some form of memory switch, and the setter button is also wired to this board.  When a piston is pressed, the necessary combination is recalled from memory (its address depending on the current piston and current memory level) and put onto the 16 output lines to the driver board as a pattern of 1’s and 0’s.  The ‘enable’ line is then briefly pulsed to instruct the driver board to transfer this on-or-off pattern to the stop mechanisms.

 

The driver board takes the 16 outputs from the logic board and converts them into a form suitable for controlling the stops.  As just mentioned, each output from the logic board is in binary form, meaning that if a high level (logic ‘1’) appears on it, the corresponding stop will be switched on.  Conversely, a low level (logic ‘0’) switches it off.  The driver board shown here contains circuits suitable for operating 32 stop action magnets (16 stops), though depending on the type of stop mechanisms in use it could equally well control 16 lamps using different circuitry.  If magnetically operated stops are used, the driver board has to be supplied with substantial power from the usual type of heavy duty power supply used in combination actions.  The driver board also accepts inputs from all the cancellers relevant to its group of stops, such as departmental, second touch and general cancels.  If there is only a single general cancel on the entire organ, then this input will merely be a single wire daisy-chained in parallel to all driver boards.

 

 

Prototype System

 

A photo of the prototype system used for software development and validation is shown in Figure 3.  The two boards described above are visible at the bottom of the picture, the white one being the logic board and the green one (underneath the stop tabs which are raised above it) the driver board.  Only one PIC is used in this prototype because it only controls 8 stops, but a second one can be accommodated in the unused area at the top right hand corner of the logic board if it is to control 16 stops.  Because high speed is not required of the electronics in a capture system, most of the logic can be implemented using diodes (as in ‘diode keying’ systems) and these can be seen on the lower half of the board.  However an additional logic chip (not a PIC) is also used and this is at bottom left.  The dimensions of the logic board are 100 by 160 mm, a standard Eurocard size.

 

 

Figure 3.  Prototype capture system controlling 8 stops.

(The right hand stop key has second touch cancelling)

 

Apart from the two small green boards at the top left of the picture, which are low voltage regulators delivering 12 and 5 volts DC, everything else is conventional and common to any other type of combination system.  The Kimber Allen stop key units are obvious, the only point of note being that the right hand one is fitted with second touch cancelling.  Depressing the tab slightly beyond its ‘on’ position cancels all the other stops.  By suitably selecting the components controlling the ‘off’ magnet of this stop key on the driver board, it can be made to follow your finger up afterwards (thereby cancelling itself as well) or to remain in the ‘on’ position.  The latter might be chosen if the tab controlled a solo stop for example.  Note yet again that this optional feature is configured by minor changes to the hardware of the system rather than to its software.

 

A full complement of 16 pistons is not fitted to this prototype as its main purpose is to validate changes to the software.  However the setter piston can be seen, together with the memory level selector.  This is merely a 16 position rotary switch for convenience, but its outputs are on 4 BCD (binary coded decimal) lines as this is more convenient than handling the 16 wires suggested in Figure 2.  Alternative switches can of course be used, such as thumbwheel switches which can also be obtained in BCD variants.  Or a more sophisticated system with an LCD or similar type of display could be incorporated, provided its outputs appear on no more than 4 BCD lines so that it remains electrically compatible with the logic board.

 

The main power supply comfortably delivers about 5 amps at around 18 volts for operating the stop action magnets.  Although it is a matter peripheral to this article, my preference is to derive the power for an organ action from several small power supplies rather than using just one delivering a very large current.  Not only is it potentially safer, but often it will be cheaper as well because industry standard components can be used.  This particularly applies to the transformers, which are relatively inexpensive when small or medium sized but disproportionately pricey when purchasing the large ones specially made in small quantities for the organ market.

 

 

Programming the PICs

 

Each PIC in the system has to have exactly the same set of instructions loaded into it in the form of a small computer program.  There are many ways to program a PIC but I will describe briefly the method I use.  A simple program of the sort used here can be written in assembler language fairly easily, and then converted into PIC machine code (assembled) using Microchip Technology’s MPASM free assembler.  MPASM also forms part of a sophisticated development and testing suite called MPLAB which again is available free of charge from the firm’s website.  MPLAB enables a wide range of tests to be conducted on your program before you commit it to actual PIC hardware because it can emulate any type of PIC chip as if it was running your program.  All this is done on an ordinary PC.

 

When you are ready to test it for real, the machine code version of the program is ‘flashed’ into the program memory of the PIC chip itself using a hardware programmer connected to one of the ports of the PC.  Once there it stays there for ever unless erased or modified.  Again, there are many programmers available, but one I have used for some years is the Velleman K8048.  Illustrated in Figure 4, it is simply a well made circuit board connected to a low voltage power supply as well as to a serial port of the PC.  (As serial ports are a vanishing breed on more recent PC’s, a programmer driven from a USB port might be a better bet today.  But whatever you buy, you can be sure it will be obsolescent shortly afterwards).  Also seen is a ZIF (zero insertion force) socket in which the PIC chip sits while it is being programmed.  The use of the ZIF socket is optional because the PIC can just as easily be inserted into one of the ordinary sockets on the programmer board itself.  However ZIF sockets are easier on the fragile pins of the chip, bearing in mind that PICs only have a limited physical life if they are moved too often between the programmer and the target circuit.  In my system the ZIF socket is mounted on the yellow prototyping board, with room for several other similar boards (not present when the picture was taken).  This enables simple PIC-controlled circuits to be put together and tested without having to remove the PIC from the circuit each time it is re-programmed.  However this approach could not be used here on account of the rather complex nature of the system, which required the prototype to be constructed properly in the more robust form shown in Figure 3.

 

 

Figure 4.  Velleman K8048 PIC programmer with external ZIF socket.

 

 

 

Architecture of a Complete System

 

One of many possible architectures for a complete system applied to an organ with three departments (e.g. swell, great and pedal organs)  is sketched in Figure 5.  Each department has one logic and one driver board as shown previously in Figure 2, and each can therefore have up to 16 stops with 16 pistons.   Two PIC chips are required for each department.  For purposes of illustration, the 16 pistons for each department are partitioned into 8 departmentals and 8 generals though any other arrangement could be used within the total of 16.  The general pistons are simply wired in parallel across all departments, as are the memory selector inputs and the setter piston.  A general cancel piston is wired similarly in parallel to all driver boards, and individual cancels to each department could also be included if required.  No power supplies are shown to reduce the complexity of the diagram, but either one large one or several smaller ones can be used as suggested above.

 

There is also another group of up to 8 stops labelled "other" using only one PIC.  In this example these are not controlled by the departmental pistons, only by the generals.  Thus they might be couplers, the great/pedal piston coupler, etc, and as far as the departmental pistons are concerned these stops are therefore 'neutral' - they are only affected by the general pistons, not the departmentals.  Note that these stops could nevertheless be grouped physically with the departments they control even though they are functionally and electrically distinct as shown in the diagram.  This example illustrates an aspect of the flexibility of this system which is achieved simply by wiring it appropriately rather than requiring customised software.

 

 

 

Figure 5.  One possible system architecture for an organ with 3 departments   

 

A photograph of an instrument with exactly this arrangement is shown in Figure 6, which shows the development console built for my Prog Organ virtual pipe organ system which simulates many different instruments (more information).  Each manual department has five thumb pistons and the pedals have four toe studs.  None of these affect the 'other' group of stops on the right hand side of the stop panel, which are controlled only by the five general pistons seen at the left side of the upper keyslip.  In Prog Organ these 'other' stops have been used for couplers, tremulants, tonal and non-tonal percussions in theatre organs, cymbalsterns and even Hope-Jones's Stop Switch registration aid!  The two red buttons on the lower keyslip are the setter piston and the general cancel.  The memory level is selected using the thumbwheel switch placed centrally below the stop keys.

 

 

Figure 6.  Prog Organ console with the combination system architecture sketched in Figure 5

 

Figure 7 shows another of my consoles in which the 'other' stops such as couplers are grouped instead with their respective departments.  This instrument also features two sets of stops, one using drawstops to control classical organ voices and the other using stop keys for theatre-style ones.  All stop movements are motorised (magnetically operated) using a single combination system which can be immediately transferred from one set of stops to the other using a rocking tablet.  This is situated on the white plate which can be seen on the left hand drawstop jamb, and this plate also contains the memory level selector switch.  Independent sets of memories are available to the 'classical' and 'theatre' stops.

 

 

Figure 7.  A dual purpose (classical and theatre) console with a capture system transferable to either mode via a rocking tablet

 

It should be reasonably clear from this article and these examples that the system is expandable to an organ of any size, and that it has considerable flexibility.  If more than 16 stops are required for a department, one would use more than one logic and driver board in that case.  No changes to the software are required regardless of the size of the system or the way it is configured to suit the application, as this is achieved simply through the way it is wired. 

 

 

Concluding Remarks

 

Two core requirements of a combination capture system are that it must capture and store combinations on demand, and then recall them subsequently as required.  A third is that multiple levels of memory must be available.  Related ancillary functions include customising the system for the type of stop mechanisms used (magnetically operated or luminous); general, departmental and second touch cancellers; and the desired mix of general and departmental pistons.  Others are the provision of piston couplers (great to pedal pistons coupled, etc) and the ability to add reversers to certain stops.  Although these ancillary functions are not part of the capture and recall process itself, they are so intimately connected with the control of the organ that they cannot be divorced readily from the core functions.  Thus any system must implement both core and ancillary functions if it is to be useful.

 

The only practical way to implement the core functions is to use computer control.  However, given the flexibility of software, it is understandable that a system designer will also be tempted include provision for a range of ancillary functions, perhaps an excessively wide range.  These can then be configured for a particular organ by customising the software for that instrument.  Nevertheless there are some downsides to this approach.  Customised software is always more expensive than a non-customised product which suits all applications, because the client must first specify his needs and the supplier must then test and validate the software properly.  If the client’s original specification was flawed, if it changes or if the software is buggy the whole process has to be repeated, and this costs money and time.  Sometimes it can result in conflict.  Furthermore, issues of premature obsolescence can arise if the customised software is no longer available when repairs or upgrades to the system are necessary during the lifetime of the organ.  This results in more expense if a complete new system has to be procured.  None of this sits well with the dignified longevity and conservative technology expected of a pipe organ.

 

Thus the approach outlined in this article is different.  It proposes a computer controlled hub of deliberately limited scope which implements the three core functions only.  Moreover, the processing power is distributed among several such hubs (e.g. one per department), each of which can therefore be relatively simple in terms of hardware and software.  Most important of all, the software in each hub (its computer program) is identical, and it is also standardised across all organs rather than customised for each one.  This is possible because each hub only implements the three core functions which are similar for all instruments.

 

Configuring the system for a particular organ is then done entirely in hardware, literally by wiring it up in the desired manner and by using the correct components.  By this means any form of stop mechanism can be used and any mix of general and departmental pistons can be realised, together with any mix of cancellers, etc.  This is achieved by separating ancillary functions such as these from the core functions.  As just mentioned, the ancillary functions are implemented in two ways - by simply wiring the system appropriately, and by providing a range of interface circuits which can be chosen to suit the system.  For example, different hardware driver circuits are necessary for magnetically operated stop actions as opposed to luminous ones.

 

A practical realisation of these ideas has been described and demonstrated.  Each core-function hub consists of two cheap 18 pin PIC microcontrollers running the same computer program.  No customisation whatever is necessary.  A small amount of additional hardware is required, mainly in the form of diode logic, and all is contained on a small printed circuit board called a ‘logic board’ in this article.  A second circuit board, the ‘driver board’, interfaces each logic hub to the particular type of stop mechanisms chosen.  It also participates in implementing various ancillary functions such as stop cancelling.  This board contains no software, being constructed wholly from readily available industry standard components.

 

Each pair of circuit boards will control up to 16 stops from 16 pistons with 16 memory levels, thus it will often be adequate for a single department of an organ.  Therefore an organ with N departments will require N logic boards and N driver boards.  Larger departments with more than 16 stops would be catered for by using more than one pair of boards.

 

As well as the advantages outlined above, a further one is that this approach might attract interest from a craft where the soldering iron is a more traditional tool than a state of the art computer system running customised software.  It is also worth remarking that the obsolescence problem can be minimised by simply purchasing, at the outset, as many backup PIC chips (pre-programmed) as required so that spares of this essential component will be available during the lifetime of the system.