The Beeb Bodybuilding Course Part 116 By Mike Cook Mike packs a punch This month I was watching a video recording of some program I had missed and when it came to an end I found myself watching, like you do, the tale end of some old recording. Well this tale end was of an old Games Master edition from the first series. On it contestants were trying to destroy a meteorite by punching it. Well I know that most computer games require a certain suspension of disbelief but the thought of destroying a meteorite several miles across with a punch did strike me as ludicrous even by standard of computer games scenarios. This of course was an arcade game but it struck me that I could possibly make a home computer version. You see just three weeks earlier I had seen in an electronic suppliers catalogue a new entry for Piezo electric cable. Thinking how useful that would be I had bought some and was wondering just what I could do with it. This seamed the perfect introductory project. Now the Piezo electric effect is one where a mechanical force is converted into an electrical force. This is quite widely used in electronics from the stable crystal oscillators controlling your computer to the hand held spark gas igniters. The trouble with most Piezo electric materials is that they are crystalline and therefore not flexible. However, over the last few years there has been the development of many different Piezo electric materials from glues and resins to rubbers. It is the Piezo electric rubber that makes this cable possible. What you have is a light weight, sensitive, flexible and tough transducer that is well suited to a number of different monitoring situations. This is produced in the form of a coaxial cable of complex construction, see figure I. The secret comes from the flexible Piezo electric rubber, this is made by mixing Piezo electric ceramic powder into conductive synthetic rubber. When there is stress applied between the centre core and outer sheath a voltage is generated. Note that this voltage is only generated while the stress is being applied, that is while the stress is changing so it is ideal as a motion detector. The first problem is to connect the cable up to normal wires and is a little more tricky than you might at first think. The end of the cable needs terminating to prevent the ingress of water and moisture that will, in time, destroy the Piezo electric effect. To do this you need to fill the end with a small bead of epoxy resin or silicon rubber as shown in figure II. Now the other end needs connecting to a normal coaxial cable so the sheath needs to be removed. This is harder than it sounds because the sheath is made of transparent rubber so it is a little difficult to see where you are cutting. To help this the manufacturers suggest that you put a spot of dye on the end of the cable but I managed without, using a sharp art knife. Figure III shows how this is cut but you have to be careful to apply enough pressure to cut the rubber but not enough to cut the braid underneath. Now comes the tricky part, the braid is aluminium therefore you can't solder to it. Yes I know you can get aluminium solder but I don't have any and anyway the centre core is of stainless steel so that defiantly won't solder. Therefore we have to devise a method of making a strong electrical sound connection. The solution I came up with was to use crimped connections. I took a crimp connector socket and cut off the end leaving just the crimping part. I then laid the Piezo electric wire and the normal coaxial wire in the crimp sheath and bent the small flanges over, see figure IV. I did use a crimping tool to do this but if you are careful you can use pliers quite adequately. When crimping the braid it is a good idea to twist them slightly together to keep them in place while you work. To finish the job I enclosed the crimped ends in a small piece of epoxy putty. This comes as a blue and white strip rather like plasticine, you knead it together until it is a uniform colour and then use it like a stiff putty. In 24 hours it has set rock hard giving a good seal and preventing any mechanical strain undoing the crimp connectors. Next we have to arrange this sensor so that it can measure the force of a punch, this I did using the arrangement shown in figure V. The wooden cover to the sensor ensures that the force of the punch is distributed evenly along the length of the cable. What you have to do is punch the top piece of wood but not before you have remembered to put on a boxing glove. If you are making a really good job of this then you might place this arrangement on something that will give a little when hit, like a strong spring. This will make punching a little more comfortable for those who are really good at it. Having set up our transducer we have to make its output suitable for connecting to our computer. What we need first of all is some form of amplifier, as my initial tests showed a pulse of about half a volt when it was hit with a large real of wire. To minimise interference I chose to use a differential amplifier to boost this up to five volts. Now the voltage output is in the form of a very narrow pulse, if it were left like this there would be little chance of the computers analogue input port having time to read it. Therefore what we have to do is to take the peak voltage of the pulse and hold it long enough to take our reading. This peak detector is formed by the diode coming from pin 8 and the capacitor across pin 5. When a pulse comes along the capacitor is charged up to the height of the pulse and the diode prevents it being discharged when the pulse has gone. We then pass this through another amplifier acting as a voltage follower to prevent any discharge. The output of this amplifier is passed through a diode to remove some of the standing DC voltage and into a resistor that gives a low enough impedance so as to prevent any interference to the input of the analogue to digital converters in the computer. We do need to be able to discharge the peak detecting capacitor to prepare for our next punch, and this is where the transistor comes in. This is placed across the capacitor and can short it out when the transistor is turned on. This can be from a push button to +5V or it can be derived from the computer. To make things more convenient we could use the wire normally used as a fire button input as an output. However this will only work with the older 8 bit machines. I tried this on the 32 bit machines but the operating system would not let me write to the correct registers. Therefore I went in at machine code level to write to them. However, I discovered that the interrupt system kept re programming them back to be an input so all I could achieve was a short negative going pulse. This was no use without extra electronics so I decided to use bit 0 from the User Port to achieve the necessary control. The parts to make this are included in Body Build pack No. 84. This includes 3" of Piezo electric cable and some epoxy putty as well as the electronic components vero board and layout. The analogue input port plug and cable is included but you will also need some way to connect the circuit to the User Port. Instructions of how to do this will be included in the pack. Users of the 32 bit machines without an input/output podule can use the I2C interface I designed for the computer. The driving software is nothing remarkable and is given on the subscription disc. It basically reads the analogue input port to establish any DC or residual reading. It then uses this as a reference and continually reads the input. When that input is greater than the reference plus a little for noise immunity the program considers the punch to have occurred. If this is the best so far this is register at the bottom of the screen. If however, the punch reading is equal to 1023 this means that the maximum value has been registered and perhaps the punch was even harder. Therefore you are required to turn down the gain in the amplifier and the best punch value is reset. You can make all sorts of variations on this theme with better and more elaborate software. For example you can have a graphical output like a fair ground "ring the bell" machine, and change the boxing glove for a hammer. Like most Body Build projects this is just the beginning. All for now, but do look in next month when I will present, perhaps the best, Body Build project I have ever seen. ORDER FORM Body Build Pack No. 84 Punch meter kit. £10.00 Pack No. 74 I2C interface Kit £21.00 Assembled £25.00 Name ......................................................... Address ......................................................... .......................................................... .......................................................... Post code ..................... All prices include VAT and P&P