revmaster - a simple tachom

32
RevMaster - A Simple Tachometer Tony Jeffree Wednesday, 07 February 2007 Introduction Many of the new machines that are being imported from the Far East come fitted with variable speed drives, and owners are converting old machines fitted with three phase motors to use variable speed 3-phase "VFD" drive systems. These machines give us the ability to in finitely vary the spindle speed without the need to change belts. With some such systems, and my Taig mill with its variable speed spindle drive borrowed from a Sherline mill is a good e xample, the range of useful speeds obtained with a single pulley position is such that it is rar ely necessary to change the belt over to a different set of pulleys even if different speed ranges are available. I have my Taig almost permanently set on the 3rd from slowest of 6 speed ranges, whi ch gives me a useful range of dead slow to 5,000 RPM; I have tried it on its fastest pulley c ombination, which gives in excess of 15,000 RPM with the Sherline motor, but only to demonstrate how fast it will go as the headstock bearings would probably not stand such abuse for lo ng. With most of these systems the common factor is that, although you can adjust the sp indle speed, you no longer have any clear idea of what the actual spindle speed is at any point in time. Hence this project; a simple tachometer or rev counter that can be readily fit ted to a wide range of different machines, and will give a useful range of RPM measurement. An art icle that I wrote on spindle and surface speed measurement for issue 60 of MEW introduced some techniques for measuring spindle speed with the aid of a digital multimeter with a f requency scale; this project makes use of some of the sensing techniques discussed in that ar ticle, but describes a dedicated tachometer unit with its own LCD display. The description that follows should give sufficient information for anyone that has reasonable soldering skills to construct a finished unit entirely from scratch, including etchi ng a board if necessary; however, as the circuit is constructed around a PIC 16F84 single-chip microcomputer, anyone wanting to do the whole job themselves would need access to a PIC development system in order to develop the firmware and program the chip. As this is a non-trivial exercise unless you are familiar with programming languages and their de velopment systems, pre-programmed chips will be made available by L.S. Caine Electronic Services , as well as etched PCBs and component kits of varying levels of completeness. For those constructors that are able to make sense of a "C" program or have the abil ity to programme PIC chips using standard HEX files, the "C" and HEX files are available on this page . For those that want a really easy solution, kits of parts in various stages of com pleteness can be obtained from L.S. Caine Electronic Services (see contact details at the end of the article). RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm 1 of 32 8/28/2010 3:18 PM

Upload: shahultrichy

Post on 08-Apr-2015

126 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: RevMaster - A Simple Tachom

RevMaster - A Simple Tachometer

Tony Jeffree

Wednesday, 07 February 2007

Introduction

Many of the new machines that are being imported from the Far East come fitted with variablespeed drives, and owners are converting old machines fitted with three phase motors to usevariable speed 3-phase "VFD" drive systems. These machines give us the ability to in finitelyvary the spindle speed without the need to change belts. With some such systems, and my Taigmill with its variable speed spindle drive borrowed from a Sherline mill is a good e xample, therange of useful speeds obtained with a single pulley position is such that it is rar ely necessaryto change the belt over to a different set of pulleys even if different speed ranges are available.I have my Taig almost permanently set on the 3rd from slowest of 6 speed ranges, whi ch givesme a useful range of dead slow to 5,000 RPM; I have tried it on its fastest pulley c ombination,which gives in excess of 15,000 RPM with the Sherline motor, but only to demonstrate howfast it will go as the headstock bearings would probably not stand such abuse for lo ng.

With most of these systems the common factor is that, although you can adjust the sp indlespeed, you no longer have any clear idea of what the actual spindle speed is at any point intime. Hence this project; a simple tachometer or rev counter that can be readily fit ted to a widerange of different machines, and will give a useful range of RPM measurement. An art icle thatI wrote on spindle and surface speed measurement for issue 60 of MEW introduced sometechniques for measuring spindle speed with the aid of a digital multimeter with a f requencyscale; this project makes use of some of the sensing techniques discussed in that ar ticle, butdescribes a dedicated tachometer unit with its own LCD display.

The description that follows should give sufficient information for anyone that has reasonablesoldering skills to construct a finished unit entirely from scratch, including etchi ng a board ifnecessary; however, as the circuit is constructed around a PIC 16F84 single-chipmicrocomputer, anyone wanting to do the whole job themselves would need access to a PICdevelopment system in order to develop the firmware and program the chip. As this is anon-trivial exercise unless you are familiar with programming languages and their de velopmentsystems, pre-programmed chips will be made available by L.S. Caine Electronic Services , aswell as etched PCBs and component kits of varying levels of completeness.

For those constructors that are able to make sense of a "C" program or have the abil ity toprogramme PIC chips using standard HEX files, the "C" and HEX files are available on thispage . For those that want a really easy solution, kits of parts in various stages of com pletenesscan be obtained from L.S. Caine Electronic Services (see contact details at the end of thearticle).

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

1 of 32 8/28/2010 3:18 PM

Page 2: RevMaster - A Simple Tachom

Before getting into the detail of the rev counter itself, I have included a bit of b ackgroundinformation on these PIC devices, and some of the development tools that are availab le (atvery reasonable prices) for them. These early sections are probably only of interest to peoplethat feel comfortable enough with electronics and programming to "have a go" at deve lopingsomething themselves, so if you don't find yourself in that category and want to cut to thechase, please feel free to fast forward to the project details, which start with the heading"Circuit Design" below.

Anatomy of a PIC

The PIC micro controller family is very large, and is expanding almost weekly as Mic rochipTechnology, Inc adds new devices to the range. I will not try to get into a descript ion of thefull range, as life is considerably too short for that; rather, I will give a flavou r of what thesedevices can do by using the two examples of the family that I have used so far.

Common to all of the PIC devices are the following basic components and capabilities :

A central processor unit (CPU) that performs programme execution;Some programme memory for storing the device's control programme - generally someform of PROM (programmable read only memory), but many devices use "Flash" memorythat can be erased and reprogrammed electrically, without the need for UV erasers th atare needed for erasing PROM devices. This is non-volatile memory, i.e., the values i nmemory are retained when the device is powered off. Flash programmable devices can b ere-programmed many times (generally up to 1000 erase/write cycles), making them idea lfor prototyping and development work, or for products where it is desirable to be ab le toupgrade the "firmware" in the device in the future;Some RAM (random access memory) for storing the variables used by the programme.This is volatile memory, i.e., the contents of this memory disappears when the devic e ispowered off;Some EEPROM (electrically eraseable PROM); this is non-volatile memory used forstoring variables that are to be retained when the device is switched off - for exam ple,configuration values that the programme can access and change, but that are desirabl e tobe retained during power-off so that the next time the device is used, its configura tion is asit was the previous time it was powered on. This memory area is slower to access tha n theRAM area, and has a limited life (generally around 1 million erase/write cycles perlocation), so it is mostly used for configuration variables that are changed infrequ ently andthat can be read into RAM on programme startup;A number of input/output ports, allowing digital inputs, digital outputs, analogue i nputs,serial data streams, and so on to be handled by the device. The capability of each P ICdevice varies, both in the number of I/O ports and in the capabilities of those port s;Provision for generating the CPU's "clock" oscillator by the addition of a very smal lnumber of external components - one resistor and one capacitor for a simple R/Coscillator where frequency stability is not important, or a quartz crystal and 2 cap acitorswhere it is important for the device to be clocked at a known speed;

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

2 of 32 8/28/2010 3:18 PM

Page 3: RevMaster - A Simple Tachom

Some form of interrupt processing. Computers are serial devices - the CPU processes theprogramme instructions one after the other; this can be inconvenient if you wish to handleexternal events that can happen at any time - and usually, as sod's law dictates, wh en theprogramme is doing something else. Interrupts allow the external event to interrupt thenormal flow of programme control, to invoke an interrupt handler that can process th eevent before resuming the normal programme where it left off;Some means of programming the programme memory and EEPROM areas, by applyingvoltages and serial data streams to appropriate I/O pins of the device. In most case s, it ispossible to programme these devices "in circuit" if need be.

Because all of these features exist in a single chip, it is very easy to build simpl e projectsaround a PIC - literally all that is needed to get a PIC running is a power supply a nd the 2 or 3components required to create the clock oscillator. A small number of additional com ponentswill be needed in order to make use of the I/O capability, and to provide in-circuitprogramming, reset buttons, and the like, as necessary for the particular project.

Peripheral devices

It is a relatively simple matter to interface external, peripheral devices to a PIC, as the I/Olines are able to accept TTL-compatible logic signals. Examples of the kinds of peri pheralsthat can be used with these devices include:

Push buttons, keypads, limit switches and the like, to provide inputs to the PIC. A 16-keykeypad, arranged as a 4 by 4 matrix, can be interfaced to a PIC by using 8 input lin es (4 toaddress the rows, 4 to address the columns), for example.Digital input lines can also be used to deal with pulse trains or serial signals - f or example,counting the number of pulses per second to derive an RPM measurement, or decodingserial data signals received from other devices or computer systems. In the latter c ase,some PICs have their own built in serial I/O processors (known as USARTs) for thispurpose.Relays, stepper motors, activation signals, and the like can be driven by the PIC's digitaloutputs. Stepper motors can be driven by using 4 digital output lines to control ind ividualdriver transistors (or power stages) for each phase of the motor, or 2 outputs can b e usedto control one of the proprietary "step-and-direction" stepper motor controllers. A singleoutput line, driving an "open collector" transistor stage, can switch a relay on and off; inturn, the relay could be used to start/stop a spindle motor, etc.Small LCD displays are available at very realistic prices, and using a widely accept edinterface based on a Hitachi chipset. Interfacing a PIC to the display uses a minimu m ofseven I/O lines, 4 for data, and the other 3 to control the operation of the device.Bitmapped (as opposed to character oriented) LCD displays are also becoming availabl eand are similarly easy to interface.PICs that provide ADC (Analogue to Digital Conversion) capability can be used tomeasure a voltage generated by a transducer of some kind, and convert that voltage i nto adigital form. For example, a temperature or pressure measurement could be made by

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

3 of 32 8/28/2010 3:18 PM

Page 4: RevMaster - A Simple Tachom

attaching a temperature or pressure transducer to one of the ADC inputs on the PIC, andthe measurement displayed on a screen or used to determine some controlling action(turning on the central heating, turning down the burners on a boiler, etc.). The AD C inputexpects its signal to be presented as a voltage in the range 0-5 volts, so the trans duceroutput needs to be suitably "conditioned" to make it fall within this range.Where the on-chip memory provided for the PIC is a limitation, it is possible to int erfaceadditional RAM and EEPROM devices to the PIC in order to extend its versatility.More complex peripherals can be handled too - one of the electronics hobby magazineshas just recently published an article on how to interface a PIC to an Epson paralle lprinter, in order to use the printer as a data plotter.

This begins to give a flavour of the types of device that can be connected to these microcontrollers, and to give some ideas as to the possible ways that these devices might bedeployed. Motion control applications, home automation, burglar alarms, and so on, a re justthe tip of the iceberg here - the potential uses are limited only by your own imagin ation.

The PIC 16F84

This is the PIC device that I have chosen for the rev counter. It comes in a plastic , 18-pin dualin-line package, so is physically fairly small (see photos of the board layout later ). The 16F84has 1K (1024 words, 14 bits wide) of flash programme memory, 68 bytes of RAM and 64bytes of EEPROM. The chip can be clocked at speeds of up to 10 MHz; I used a 4 MHz c hipfor the rev counter, clocked at 3.27 MHz as this made it easy to divide the processo r clockdown to create a 1-second "tick".

The chip has 13 digital I/O lines; these can be programmed either as inputs or outpu ts, andwith careful design, it is even possible to make a single line do double duty, actin g as an inputat some times and as an output at others. This is a relatively small device, but is still capable ofperforming some fairly complex tasks.

The PIC 16F877

This is one of the larger (although by no means the largest) of the PIC family. It h as 8K of flashprogramme memory, 368 bytes of RAM, and 256 bytes of EEPROM. These devices can beclocked at up to 20 MHz, has 33 digital I/O lines, 8 of which can be used as analogu e inputs tothe chip's 10-bit ADC, and has an on-chip USART.

The additional memory and I/O capability available on the 16F877 lends it to larger and morecomplex projects - hence my decision to use this as the basis of my "Divisionmaster" indexer,where it is dealing with a 16-key keypad, a 2-line by 16-character LCD display, furt her digitalinputs and outputs for stepper control, emergency stop, etc., plus an analogue input to allowLCD display of the current limit (in amps) for the stepper motor driver.

Development and Support

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

4 of 32 8/28/2010 3:18 PM

Page 5: RevMaster - A Simple Tachom

I have included a list of contact addresses, websites and so on at the end of the ar ticle. As withmost things these days, there is a wealth of information and support to be had from the Internet.

Microchip Technology market a variety of development tools for the PIC devices, and there isa very active "after-market" that supplies the hobby trade as well. Everyday Practic alElectronics magazine publishes constructional and tutorial articles on the PIC, and is a goodsource of adverts for development tools. Programme development software is available for useon PCs; there are a wide variety of these to choose from, including assemblers, Basi c compilersand "C" compilers. Unless you are familiar with the peculiarities of assembler levelprogramming, I would recommend starting off with a development system based on "C" o rBasic. It is also worth thinking about what kind of development you are likely to ge t into;some of the Basic compilers have great facilities for handling peripherals, others h ave theability to handle large variables, and so on.

For the work that I have done so far, the following have proved to be extremely usef ul:

Microchip Technology distribute their "MPLAB" software for free; it can be downloade dfrom their website. It includes assembler tools and software to interface to their P ICprogrammers, in-circuit emulators, debuggers, and so on. Their website has a vast st ore ofdatasheets, application notes, and other useful information, as well as links to oth ersuppliers.Magenta Electronics Ltd. sell a variety of PIC-based project kits, PIC programmers,development boards, and in-circuit debuggers. Their kits offer an easy introduction tothese devices, and are keenly priced. One of these kits is called "Icebreaker"; this is adevelopment system aimed at the PIC 16F877, with in-circuit debugging capability, pl usvarious peripheral devices in a "breadboard" arrangement, allowing a prototype to beconstructed very rapidly. The system is driven from a Windows system (95, 98 0r ME; notWindows 2000 unfortunately) via a serial port. The only significant limitation withIcebreaker is that the in-circuit debugging code occupies the top 4K of programmememory, reducing the available memory on the PIC to only 4K. This is probably fine f orassembler programming, but I found it a limitation when using a "C" compiler.Forest Electronic Developments (FED) sell a variety of tools for the PIC. They havedeveloped a "C" compiler system, running on a Windows PC, called "Wiz C", which cangenerate code for most flavours of PIC. This package allows the user to emulate the PICon the PC screen, and even allows the attachment of emulated peripherals (LCD displa ys,keypads, etc.) to the emulated machine. This allows the functionality of the softwar e to beestablished without having to wield a soldering iron; once you have the programmerunning, you can build the circuit up using one of their development boards, or buil d it onstripboard, in order to do final testing. This approach is very effective indeed, an d hasspeeded up the development of my PIC projects quite considerably. Recent versions ofthis system have added rapid application development techniques to the "C" compiler,meaning that you can "drag and drop" peripheral devices into the project, and the sy stemautomatically plugs in the "C" library code needed to support the peripherals concer ned.The latest versions of their "C"-based development systems support 8-bit, 16-bit and

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

5 of 32 8/28/2010 3:18 PM

Page 6: RevMaster - A Simple Tachom

32-bit integer variables, and also support floating point variables; this, along wit h theirgood support library and their emulation system, makes a very powerful combination.FED also supply PIC programmers and an in-circuit debugging system that integrate wi ththeir software development tools.PIC devices and associated components and development systems can be obtained fromMagenta, FED, and the usual electronics components houses, such as Maplin and RS.

Circuit design.

Three prototypes for this tachometer were designed and constructed in 2001 using str ip board,and they have been in use in my workshop since that time. However, as strip board is a pain touse, I have laid the circuit out in a form that can readily be etched onto copper cl ad board - Iwill describe a simple process for etching boards later in the article that can prod uce usableboards at minimal cost.

Figure 1 shows the schematic for the tachometer and for two alternative sensing devi ces. The7805 chip, IC2, and its attendant capacitors, C1 and C2, provide the board with a st abilised 5volt supply to drive the logic circuitry; any spare "wall wart" power supply that pr ovides anunregulated output of between 10 and 20 volts DC will work just fine as the power su pply forthe circuit. I seem to accumulate surplus "wall warts" from defunct bits of electron icequipment and so finding suitable ones wasn't an issue for me; they are also readily availablefrom supply houses such as Maplin and RS Components. However, be sure that the one y ou areusing gives a smoothed DC output; I found that one of mine have an AC output and so I had toadd a bridge rectifier and smoothing capacitor to make it usable.

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

6 of 32 8/28/2010 3:18 PM

Page 7: RevMaster - A Simple Tachom

Figure 1: Schematic

Increasingly, the world seems to be moving over to using switch-mode power supplies for thiskind of application, as the older style linear power supplies consume more current f or a givenpower output; if you are able to find a 5V switch-mode supply, or a regulated 5V sup ply, thenyou may be able to dispense with the on-board regulator circuitry.

The main bulk of the circuit is taken up with IC1, the PIC 16F84, and its attendantcomponents. This chip does two jobs; firstly, it counts the pulses generated by the sensorcircuit, and calculates from the number of pulses per second the speed in RPM of the shaft, andsecondly, it performs the necessary interfacing functions that are needed to drive t he LCDdisplay that will show the operator the results of the RPM calculations.

C2, C3, and X1 form a crystal oscillator that generates a 3.27 Mega Hertz clock to d rive thePIC chip. By dividing down the processor's clock signal, the software is able to gen erate aninternal 1-second clock "tick"; in the interval between successive "ticks", the soft ware countshow many times it sees a 5V pulse on the "clock in" pin of the sensor socket (pin 2) .

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

7 of 32 8/28/2010 3:18 PM

Page 8: RevMaster - A Simple Tachom

Two further inputs to the PIC allow the user to set links to determine how many puls es will begenerated for a complete revolution of the shaft. If neither input is connected to g round, R2and R3 hold the inputs "high" (+5V), and the software assumes that one input pulse f rom thesensor equals one full revolution of the shaft. If the link connected to R3 is short ed to ground,then the software assumes 6 pulses per rev (PPR); if the other link is grounded, the n thesoftware assumes 60 PPR.

VR1 and the 10 active pins of the LCD display connector form the interface to a "sta ndard"LCD character display. These are readily available in a variety of formats, based ar ound aHitachi display driver chipset. I have used two variants in this project; one is a 1 6 character by2 line display, the other is a 20 character by 1 line display. Both are available fr om MagentaElectronics. As the 20 character display is internally constructed as two lines of 1 0 charactersjoined end to end, it actually behaves from the software point of view as if it is a 2 line display,so I have arranged the firmware in the PIC to be able to drive either variant interc hangeably.Which one you choose is a matter of price and performance; the 16 X 2 display costs more,and has better contrast and viewing angle than the 20 X 1 variant.

VR1 allows adjustment of the contrast setting on the display for optimum viewing. Ph otos 1and 2 show these two display circuits; Photo 1 is the 2-line display version. For th ose that areinterested in looking at the electrical and command characteristics of these devices in detail,there are data sheets on the Magenta website, and much useful information can be had via theWeb.

Photo 1: 2 line by 16 character LCD display

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

8 of 32 8/28/2010 3:18 PM

Page 9: RevMaster - A Simple Tachom

Photo 2: 1 line by 20 character LCD display

The sensing devices are supplied with 0V and 5V lines from the main board, and use t wo typesof infra red detector to generate a 0 to 5 volt "clock" signal to the PIC. The first of thesesensors is a SY-CR102 device from Maplin; this is a "reflective" sensor that generat es an infrared light beam from an LED in one half of the device, and the other half of the devi ce is aphoto transistor that detects received infra red light. If you bring the device to w ithin a coupleof millimetres of an IR-reflective surface, such as a piece of white paper, then it will generate asignal. This device can be used very readily to "sense" a shaft's rotation if altern ating black andwhite patches are painted on the shaft, or a printed black and white sensor disk is printed onpaper and stuck onto the face of a pulley, for example. Photo 3 gives an example of one ofthese sensors being used with a pattern of black and white patches painted onto the face of aMyford lathe pulley. I have found that Humbrol black and white enamel paint works ve ry wellwith this sensor. Interestingly, aluminium, steel and cast iron don't seem to be par ticularly IRreflective in my experience, even when shiny, so you generally can't get away with j ustpainting/sticking on the black bits, you have to add the white bits too.

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

9 of 32 8/28/2010 3:18 PM

Page 10: RevMaster - A Simple Tachom

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

10 of 32 8/28/2010 3:18 PM

Page 11: RevMaster - A Simple Tachom

Photo 3:Reflective sensor mounted on a Myford headstock

The second sensor is based around a slotted infrared sensor supplied by RS Component s - partnumber 303-1192. This again consists of an IR-emitting LED and a phototransistor; th is timethough, the LED is pointed straight at the sensor, so the light beam has to be inter rupted togenerate a signal. Typically this is done by taking a disc of opaque material (metal or plasticfor example), cutting a number of slots or holes in its periphery, and attaching thi s to the shaft;the sensor is then positioned to straddle the edge of the disc so that the beam is a lternatelyallowed to shine through or is interrupted. Photo 4 gives an example of one of these sensorsbeing used on my Taig (Peatol) mill, with a slotted disc attached to one face of the headstockpulley. The platters salvaged from defunct PC hard disk drives can be useful as a st arting pointfor making a suitable slotted disk.

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

11 of 32 8/28/2010 3:18 PM

Page 12: RevMaster - A Simple Tachom

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

12 of 32 8/28/2010 3:18 PM

Page 13: RevMaster - A Simple Tachom

Photo 4: Slotted sensor mounted on a Taig mill headstock

If you already have a sensor that can be made to generate a stream of 0-5V pulses, t hen this canbe substituted for the ones described.

PCB layouts

I have laid out four sets of single-sided PCBs and silk screens for this project tha t can be foundhere ; two are laid out to the same dimensions as the single line display, the other two the samedimensions as the two line display. There are two variants in each case, the only di fferencesbeing the lead pitch chosen for the slotted sensor board. The two figures in each ca se give thetrack layout, and the "silk screen" information that shows where the various compone nts fit,both arranged as they appear from the non-copper side of the board. The track layout istherefore a mirror image of the layout as you would see it when looking at the coppe r side.

Apart from the dimensional differences, the two boards (and the two displays) differ in thearrangement of the connection points for the connections between board and the displ ay; the2-line display has a single row of connecting pads (numbered 1 through 14, but note that pins15 and 16, which can be used for backlighting, appear just to the right of pin 1 and should beignored) whereas the single line display has 2 rows of 7 connections (again, numbere d 1through 14). Consequently, on the two PCBs, I have provided corresponding connection pointsin the same format, laid out so that when the LCD is placed above the component side of thePCB, the correspondence of the connections is direct and obvious.

Both board layouts include layouts for the two variants of the sensor circuit; these differ onlyin their dimensions, and which you choose to use is dependent upon the physical spac e thatthey will occupy on the machine rather than which display you are planning to use.

Etching the PCBs

When printing out the PDFs of the board layouts, be sure that you choose appropriate printoptions in Adobe Acrobat Reader that ensure the layout is printed without any scalin g;otherwise you will end up with boards that are the wrong dimensions for the componen ts.

Those of you that are familiar with the use of UV equipment for PCB production, and haveboards coated with UV sensitive resist, can probably skip the following description. However,as the equipment needed for this is expensive for making a one-off board, I decided to try atechnique that I had heard of but hadn't used before, which makes use of the propert ies of thetoner used in laser printers and photocopiers (NOT ones based on inkjet technology t hough!)to create a usable resist for etching.

Laser printers and photocopiers use a black powdered "toner" that is fused onto the paper bymeans of a heated roller. This toner is basically pigment held in a plastic matrix; it can becaused to melt again with the application of heat, and can be made to stick onto the copperface of the board where it will resist the etching chemicals.

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

13 of 32 8/28/2010 3:18 PM

Page 14: RevMaster - A Simple Tachom

First, you need to prepare a piece of copper clad board to receive the toner resist. Suitablematerial can be had from Maplin, RS, and so on; it is worth getting good qualityfibreglass/epoxy based board rather than the older "paxolin" style board, as the epo xy/glassboards tend to stay flatter and are much stronger. Cut a piece that is the right siz e for theboard(s) you want to lay out, and clean the surface with fine wet & dry paper or a S cotchbritepad so that it is uniformly bright and clean. This process will get rid of any tarni shing if theboard has been stored in less than perfect conditions. Clean the board thoroughly, f inishing offwith a clean piece of kitchen paper dipped in meths to get rid of the dirt; use a se cond one if alot of muck came off onto the paper. Avoid handling the board by anything other than its edgesor the non-copper side from now on.

Now, print out a copy of the PCB track layout(s) on your photocopier or scanner/lase r printerusing 1:1 or 100% scaling. Choose a printing paper that has a shiny surface suitable for inkjetphoto printing; these types of paper have a layer of water soluble gum or similar on the surfacethat helps to release the paper from the toner later on. I found that "PC Line Class ic GlossyPhoto Paper" from PC World worked well for me. If you have control over the darkness of theimage, print it with the highest quality and darkest setting that you can use that i s consistentwith the image not being degraded by darkening of the white areas. Trim the paper to size.Photo 5 shows two pieces of prepared board, plus the laser printed "transfers", read y for thenext stage.

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

14 of 32 8/28/2010 3:18 PM

Page 15: RevMaster - A Simple Tachom

Photo 5: Copper clad board and "transfers" ready to be ironed-on

Next, borrow a domestic iron, switch off the steam, and set the thermostat as high a s it will go.Give it as long as it needs to thoroughly warm up.

Now, place the board copper side up on a wooden board that you don't mind damaging ( theiron will be hot enough to darken wood significantly in this process, so best not do ne on thework surfaces or the dining table!), and lay the photocopy of the tracks print-side down on thecopper, making sure that it is properly aligned with the board.

Place the iron on top of the paper, making sure that the contact between the base pl ate of theiron and the paper is even, and press down hard. The toner will start to stick prett y quickly;however, in order to get complete and even adhesion, you will need to maintain the h eat, and

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

15 of 32 8/28/2010 3:18 PM

Page 16: RevMaster - A Simple Tachom

the pressure, for some while; moving the iron about will help, particularly with ste am ironsthat have holes in their base plates. The length of time needed will be something of a suck-it-and-see exercise; my first attempts at 2-3 minutes were patchy, my second attempts a t 5-7minutes were usable.

Allow the board to cool down completely, and then soak it in hand-warm water for a f ewminutes. If the process has worked, you will be able to carefully peel off successiv e layers ofpaper, soaking between each peel, until there is no paper left and all you can see i s black lineson the copper where the toner has adhered to the board. If the adhesion is partial, then go backto the board cleaning stage to remove the toner and start again, this time "cooking" the transferfor longer and with more pressure.

You should now have a board that will etch in the usual etchants used for PCB produc tion; themost common of these is Ferric Chloride solution. I bought this from RS in granule f orm (partnumber 237-5413); it comes in a plastic bottle that you simply top up with warm wate r tomake up a stock solution at the right strength; Maplin also supply suitable etchants . All that isneeded is to find a plastic container large enough to hold the board when laid flat; an oldplastic ice cream container, or an old microwave tray, is perfect for this. Lay the board in thecontainer copper side up and cover it with about ½" of etchant. If the solution is f resh, itshould munch its way through the exposed copper pretty quickly - mine was done in ab out15-20 minutes. Don't leave the board in longer than needed to clear the unwanted are as ofcopper; the etchant will undercut the copper at the edges and thin the tracks if you leave it toolong, and is perfectly capable eventually of removing all vestiges of copper from th e board.

Finally, a going over with the wet & dry or Scotchbrite will take off the black resi st leavingclean, bright copper tracks that will take solder very readily.

Drilling and populating the boards

The tracks contain obvious circular "pads" with central holes where component leads passthrough the board from the component side for soldering to the tracks; all of these pads need tobe drilled with a 1mm drill. This is probably the most tedious bit of the process; I used aDremel-style high speed drill fitted with a HSS drill bit.

The components can now be inserted in their appropriate positions on the component s ide, asseen on the "silk screen" layout and soldered to the tracks; any excess lead length is trimmedoff afterwards. A DIL socket to match the PIC chip is soldered in place rather than solderingthe PIC directly to the board; this allows the chip to be readily removed and re-pro grammedlater on if you need to make changes to the firmware. Take note of the orientation o f the PICchip as indicated on the silkscreen drawing; the DIL socket has a notch at one end t hatcorresponds to a similar notch on the top surface of the chip.

There is room to fit the voltage regulator device so that it lays flat on the board; it should notbe necessary to fit a heatsink to this as the circuit is not very power hungry.

With either board, only pins 1-6 and 11-14 of the LCD display need to be connected t o the

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

16 of 32 8/28/2010 3:18 PM

Page 17: RevMaster - A Simple Tachom

corresponding pins on the main board. This can be done using lengths of stranded con nectingwire, or ribbon cable, depending on what you have to hand. On the single line displa y versionof the board, I used a 14-pin "header" soldered to the board, and an IDC connector o n the endof a short ribbon cable, so that the display could easily be detached from the board andswapped for the 2-line display during testing; however, this is an unnecessary elabo ration formost purposes.

Note that there are wire links that need to be soldered in place on both main boards ; one linkon the single line display version, four links on the two line display version. The positions ofthese links are shown on the silk screen layouts.

Populating the two sensor boards is pretty straightforward. The reflective sensor is rectangular,but has one corner chopped off; this is oriented as shown in the silk screen layout, with theactive surface pointing away from the board. The slotted sensor also has to be corre ctlyoriented; the LED is translucent, whereas the phototransistor is solid black.

Photo 6 and Photo 7 show the main board of the single line display version, with allcomponents inserted; Photo 8 and Photo 9 show the top and bottom views of the two ve rsionsof the sensor board (reflective and slotted sensors). You will notice from the photo s that I havecoated the copper tracks and component leads on the two sensor boards with epoxy res in("Araldite" Rapid) to protect them from physical and electrical damage.

Photo 6: Track side - main board

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

17 of 32 8/28/2010 3:18 PM

Page 18: RevMaster - A Simple Tachom

Photo 7: Component side - main board

Photo 8: Track side - sensor boards

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

18 of 32 8/28/2010 3:18 PM

Page 19: RevMaster - A Simple Tachom

Photo 9: Component side - sensor boards

The following table shows the parts list for the project:

Componentnumber Value Comments

R1 1K Ohms ¼ Watt

R2 10K Ohms ¼ Watt

R3 10K Ohms ¼ Watt

R4 270 Ohms ¼ Watt (Reflective sensor)

R5 10K Ohms ¼ Watt (Reflective sensor)

R6 330 Ohms ¼ Watt (Slotted sensor)

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

19 of 32 8/28/2010 3:18 PM

Page 20: RevMaster - A Simple Tachom

R7 1k Ohms ¼ Watt (Slotted sensor)

IC1 PIC 16F84 Pre-programmed from L.S. CaineElectronics

IC2 78055V linear voltage regulator

C1, C2 22 pico Farads

C3, C4 100 nano Farads

X1 3.27 MegahertzQuartz crystal

DO NOT substitute a differentfrequency, as this will make thereadings inaccurate!

VR1 4.7K Ohms Miniature PCB mounting type

Q1 Maplin SY-CR102 Reflective IR sensor

Q2 RS 303-1192 Slotted sensor

LCD Display 16 chars X 2 linesor 20 chars X 1 line Magenta

Box RS 281-6829 For two-line display

Box RS 281-6835 For single-line display

Final assembly

I found that RS make a range of plastic boxes that are about the right size for this project; partnumber 281-6835 is suitable for the (longer) single line display, and part number 28 1-6829 is

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

20 of 32 8/28/2010 3:18 PM

Page 21: RevMaster - A Simple Tachom

suitable for the two-line display.

I used 20mm long, hexagonal section, 3mm tapped chromed brass pillars as stand-offs toassemble the single-line display to its board - these are available from RS, part nu mber222-424, but could easily be made from lengths of 5mm AF hex Brass bar axially drill ed andtapped M3 (Here at last is the metalworking content of this project!). The assembly thendropped nicely into the base of the plastic box, as shown in Photo 10. The PCBs have beenlaid out so that the tracks keep well clear of the four corner mounting holes; howev er, with theLCD display boards, this is not the case. This means that if you use metal pillars a nd screws asI have done, you will need to fit Nylon insulating washers under the screw heads and betweenthe display board and the pillar in order to ensure that you don't inadvertently sho rt out trackson the display board. The display dimensions are such that the complete circuitry wi ll besupported on the "fins" at each end of the box, at just the right height for the dis play to beviewed through the lid.

Photo 10: Unit installed in a box

Note that I used a standard mini stereo jack socket for the sensor connection; if yo u areplanning to use the unit with a specific sensor, then hard-wiring the sensor to the board is an

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

21 of 32 8/28/2010 3:18 PM

Page 22: RevMaster - A Simple Tachom

alternative, but I wanted to be able to swap sensors for testing purposes. A cut-out in the boxlid to reveal the display, and a decorative "window" attached to the outside to prot ect thedisplay and cover up the gaps, and the end result is as shown in Photo 11.

Photo 11: Lid and display window fitted

Photos 12 and 13 show the equivalent arrangement for the two-line display version. I n thiscase, shorter pillars are needed (around 16mm if I recall correctly), and I found th at the mostconvenient mounting strategy was to make a cutout in the lid and then stick the disp lay into thecutout using Pritt double sided foam "sticky pads".

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

22 of 32 8/28/2010 3:18 PM

Page 23: RevMaster - A Simple Tachom

Photo 12: 2-line display version - interior view

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

23 of 32 8/28/2010 3:18 PM

Page 24: RevMaster - A Simple Tachom

Photo 13: 2-line display version - display window

Mounting the rev counter on a mill

As my X3 mill, recently converted to CNC (the conversion featured in MEW issue 113), has avariable speed spindle motor, I decided to fit a rev counter to it, using a reflecti ve sensor withblack and white marks painted on an exposed area of spindle (see Photo 14). Fitting the sensoris pretty straightforward - I made a simple right-angle bracket from some thin steel strip,attached the sensor to that with a M3 screw and nut, and attached the bracket to the undersideof the mill head so that the sensor could be brought into close proximity with the r otating blackand white patches (see Photo 15). The circuitry in its box was attached to the front of the headusing more double sided sticky pads, as shown in Photo 16.

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

24 of 32 8/28/2010 3:18 PM

Page 25: RevMaster - A Simple Tachom

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

25 of 32 8/28/2010 3:18 PM

Page 26: RevMaster - A Simple Tachom

Photo 14: X3 mill spindle with markings for reflective sensor

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

26 of 32 8/28/2010 3:18 PM

Page 27: RevMaster - A Simple Tachom

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

27 of 32 8/28/2010 3:18 PM

Page 28: RevMaster - A Simple Tachom

Photo 15: Sensor installed on X3 mill head

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

28 of 32 8/28/2010 3:18 PM

Page 29: RevMaster - A Simple Tachom

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

29 of 32 8/28/2010 3:18 PM

Page 30: RevMaster - A Simple Tachom

Photo 16: Display unit installed on X3 mill head

You will find with this sensor that it needs to be approximately 1mm from the surfac e it issensing; too far and it doesn't pick up a signal, too near, and the device shields i tself from itsown light source. However, once the right positioning has been found, they seem to w orkpretty reliably.

Choosing a sensor and a measuring range

The SY-CR102 reflective sensor device seems to be capable of generating up to 1400 p ulsesper second, although according to the Maplin catalogue the rise and fall times for t hephototransistor are both 1ms, which would equate to around 500 pulses per second. So , takingthe middle ground and assuming that it is realistic to expect up to 1000 pulses per second fromone of these devices, a measuring range of 1-1000 RPM would result if you had 60 pai rs ofmarks (60 black, 60 white) on the shaft. This would be suitable for measuring RPM on a slowturning shaft, but not for the more general application of measuring RPM on a lathe or millspindle. Reducing the number of black (and white) segments to 6, the measuring rangebecomes 10-10,000 RPM, which is a more generally useful range for workshop machinery . Forreally high-speed measurement, a single black (and white) segment allows the measure mentrange to extend to a terrifying 60-60,000 RPM.

The slotted sensor (RS part number 303-1192) quotes rise and fall times of 5 microse conds, soappears to be capable of generating pulse trains of the order of 100KHz or so; I hav e not yetmanaged to generate more than 14KHz in my tests to date, but this is a reflection on the slowrotational speed of the machines in my workshop rather than the capability of the se nsor. Thissignificantly increases the range of RPM that the meter can measure; with 60PPR, themeasuring range is a very respectable 0-14,000 RPM, rising to a bone-jarring 60-840, 000RPM if the slotted sensor was to be used with a single slot.

The choice of which sensor is appropriate will depend on the physical layout of the machineconcerned and what kind of measuring range is desired. Significant issues here inclu de:

Size of black/white marks - it is difficult to get to 60 marks onto a small shaft an d stillhave them large enough for the reflective sensor to "see" them - they need to be at least2mm wide. So in general if you want to use the 60PPR range, you will need to use theslotted sensor and a disk with 60 slots or holes in it.Oil contamination can be a problem with the black and white marks used for the refle ctivesensor; you need to choose a location where they won't get covered with oil.Slotted disks can be difficult to attach in some circumstances; similarly, in others , theremay not be an obvious place where you can paint on suitable reflective marks.Experimentation will be needed to choose the right paints to create a reflective sen sorarrangement; Humbrol enamels have worked well for me.If you use the slotted sensor, note that the disk also needs to be painted black to benon-reflective, otherwise it can give spurious signals.The reflective sensor needs to be very close to the shaft it is sensing - 1-2mm or s o. The

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

30 of 32 8/28/2010 3:18 PM

Page 31: RevMaster - A Simple Tachom

width of marks must be larger than the size of device, so a minimum width of 2mm is arequirement here.Mounting the sensor in a place where it will not suffer physical damage is essential !So far, I have not tested the circuit of the meter itself to determine what the uppe r limit ofthe counting mechanism is, although I have demonstrated that it can count at least 1 4,000pulses per second. In the current software configuration, the count of pulses is hel d in aninteger variable that can hold a maximum count of 32,767, so this represents a theor eticalmaximum even if the counting mechanism can handle higher rates.

Suppliers and other contact details:

1. For copies of the "C" code and HEX files for this project, or for PDFs of the PCB layoutdiagrams, see this page

2. "C" development systems and PIC programming tools used by the author can be obtai nedfrom Forest Electronic Developments (FED), 12 Buldowne Walk, Sway, Hampshire,ENGLAND, SO41 6DU, Tel: 01590 681511, Website: http://www.fored.co.uk

3. RS Components. Tel: 01536 201201 Website: http://rswww.com/

4. For pre-programmed PIC chips, circuit boards, and complete kits contact Model Eng ineersDigital Workshop (L.S. Caine Electronic Services), 25 Smallbrook Road, Broadway, Wor cs,WR12 7EP. Tel: 01386-852122 Website: http://medw.co.uk/

5. Maplin Customer Service: 0870 429 6000 Website: http://www.maplin.co.uk/

6. Magenta Electronics Ltd., 135 Hunter Street, Burton-on-Trent, DE14 2ST U.K., Tel: 01283565435 Website: http://www.magenta2000.co.uk

7. Microchip Technology Inc website: http://www.microchip.com

RevMaster - A Simple Tachometer

© Tony Jeffree 2007

All Rights Reserved

Email me at this address...website ({at}) jeffree.co.uk

Return to Model Engineering Activities page...

Return to Home Page...

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

31 of 32 8/28/2010 3:18 PM

Page 32: RevMaster - A Simple Tachom

RevMaster - A Simple Tachometer http://www.jeffree.co.uk/pages/revmaster.htm

32 of 32 8/28/2010 3:18 PM