Silicon ChipA Tiptronic-Style Gear Indicator - January 2003 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Queensland TV repairs now need an electrical licence
  4. Feature: Receiving TV From International Satellites; Pt.2 by Garry Cratt
  5. Project: Reader/Programmer For Smart Cards by David Freeman
  6. Project: The SC480 50W RMS Amplifier Module by Peter Smith and Leo Simpson
  7. Project: A Tiptronic-Style Gear Indicator by John Clarke
  8. Project: Active 3-Way Crossover For Loudspeaker Systems by Mick Gergos
  9. Feature: Using Linux To Share An Optus Cable Modem: Pt.3 by John Bagster
  10. Weblink
  11. Feature: Chips Monitor Tyre Pressure by Peter Holtham
  12. Vintage Radio: Intermediate Frequency (IF) Amplifiers; Pt.2 by Rodney Champness
  13. Notes & Errata
  14. Market Centre
  15. Book Store
  16. Outer Back Cover

This is only a preview of the January 2003 issue of Silicon Chip.

You can view 20 of the 96 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Articles in this series:
  • Receiving TV From Intenational Satellite (December 2002)
  • Receiving TV From Intenational Satellite (December 2002)
  • Receiving TV From International Satellites; Pt.2 (January 2003)
  • Receiving TV From International Satellites; Pt.2 (January 2003)
Items relevant to "Reader/Programmer For Smart Cards":
  • Reader/Programmer for Smart Cards PCB pattern (PDF download) [07201031] (Free)
Items relevant to "The SC480 50W RMS Amplifier Module":
  • SC480 amplifier module PCB, TO-218 transistor version [01201031] (AUD $12.50)
  • SC480 amplifier module PCB, TO-3 transistor version [01201032] (AUD $15.00)
  • SC480 amplifier module power supply PCB [01201033] (AUD $5.00)
  • SC480 50W RMS Amplifier Module PCB patterns (PDF download) [01201031-3] (Free)
Articles in this series:
  • The SC480 50W RMS Amplifier Module (January 2003)
  • The SC480 50W RMS Amplifier Module (January 2003)
  • The SC480 50W RMS Amplifier Module; Pt.2 (February 2003)
  • The SC480 50W RMS Amplifier Module; Pt.2 (February 2003)
Items relevant to "A Tiptronic-Style Gear Indicator":
  • PIC16F84(A)-04/P programmed for the Tiptronic-Style Gear Indicator [GEAR.HEX] (Programmed Microcontroller, AUD $10.00)
  • PIC16F84 firmware and source code for the Tiptronic-Style Gear Indicator [GEAR.HEX] (Software, Free)
  • Tiptronic-Style Gear Indicator PCB patterns (PDF download) [05101031-3] (Free)
  • Panel artwork for the Tiptronic-Style Gear Indicator (PDF download) (Free)
Items relevant to "Active 3-Way Crossover For Loudspeaker Systems":
  • 3-Way Active Crossover PCB pattern (PDF download) [01101031] (Free)
  • Panel artwork for the 3-Way Active Crossover (PDF download) (Free)
Items relevant to "Using Linux To Share An Optus Cable Modem: Pt.3":
  • Linux firewall files (Software, Free)
Articles in this series:
  • Using Linux To Share An Optus Cable Modem; Pt.1 (November 2002)
  • Using Linux To Share An Optus Cable Modem; Pt.1 (November 2002)
  • Using Linux To Share An Optus Capble Modem; Pt.2 (December 2002)
  • Using Linux To Share An Optus Capble Modem; Pt.2 (December 2002)
  • Using Linux To Share An Optus Cable Modem: Pt.3 (January 2003)
  • Using Linux To Share An Optus Cable Modem: Pt.3 (January 2003)
  • Using Linux To Share An Optus Cable Modem; Pt.4 (February 2003)
  • Using Linux To Share An Optus Cable Modem; Pt.4 (February 2003)
Articles in this series:
  • Intermediate Frequency (IF) Amplifiers; Pt.1 (December 2002)
  • Intermediate Frequency (IF) Amplifiers; Pt.1 (December 2002)
  • Intermediate Frequency (IF) Amplifiers; Pt.2 (January 2003)
  • Intermediate Frequency (IF) Amplifiers; Pt.2 (January 2003)

Purchase a printed copy of this issue for $10.00.

• • • • • • Indicates up to 9 gears • Display dimming Neutral indication Reverse indication Easy gear calibration Adjustable parameters Adjustable reverse gear switch level A “Tiptronic-style” Gear Indicator Do you know what gear your car is in at any given time? “Just look at the gear stick”, you say. Actually, it’s not that easy, especially if you have a 4-speed automatic or a 5 or 6-speed manual gearbox. And what if you ride a motorbike? So you need the Gear Indicator – it will give you the answer on a digi­tal readout. By JOHN CLARKE I F YOU’RE DRIVING in traffic, it is quite easy to be in the wrong gear, especially as the noise of the traffic can drown out the engine. And if you have your stereo system blaring as well, then what chance have you got? Yes, you can deliberately look at the gearstick but you’re not likely to do that unless you suspect you might be in the wrong gear. 34  Silicon Chip Why would you be in the “wrong gear” in the first place? If your car is stuck in heavy traffic you might easily continue on for some time in 2nd or 3rd after the traffic clears, particu­larly if your engine is not noisy. Much the same can happen with an automatic, if you are in the habit of “flicking” back to 3rd or 2nd (eg, when going up a hill or for engine braking downhill). It’s all too easy to forget to flick it back into Drive later on. As a result, you could finish up driving quite some distance in a low gear and that’s not good for fuel consumption. The same problem can happen if you ride a motorbike. Wouldn’t it be nice to have a digital display to show the gear you’re in? In fact, when driving an automatic it can still be useful to know which gear you are in, even if Drive is correctly selected. Modern automatics are so smooth that it can be difficult to “pick” the changes. Now you can “see” what the transmission is doing. This idea is not new, of course. All cars with Tiptronic transmissions and the latest Honda Jazz with its 7-speed gearbox have a digital gear indicator on the dashboard. Main features Basically, the Gear Indicator consiliconchip.com.au sists a small box which incorporates a single-digit LED display. This can show gear selections from 1-9, Neutral (which is shown on the display as a dash; ie, “-”) and Reverse (which is shown as an “r”). Inside the case are several switches which allow the unit to be calibrated and set up for best gear detection results. Once it’s all set up, that’s it – there are no user controls on the front panel to fiddle with. As presented, the unit is designed to be mounted on the dashboard. Alternatively, you could hide the unit under the dashboard and mount the LED display separately, if space is a problem. A 9-strand cable (eg, rainbow cable) would then be re­quired to connect the display back to the main circuit. The right gear The Gear Indicator works by monitoring both the speed of the vehicle and the engine RPM. It then decides which gear has been selected by feeding the results into a lookup table that’s programmed into an internal microcontroller. And that means that the unit must first be calibrated, so that it knows what the results are for each gear. Note, however, that neutral (-) is always shown when the unit is first powered up and also if the vehicle is stationary (or almost stationary) while the engine is running. By contrast, reverse (r) is shown when ever the vehicle’s reversing lights are activated. One thing you should note is that the Gear Indicator does not work by detecting gear changes – eg, by fitting switch actua­tors to the gearstick. This method would not only be unreliable but would also be a mechanical nightmare to set up. What’s more, the position of the gear selector in an automatic car doesn’t tell you which gear the transmission is in (unless 1st gear is manually selected). That’s because the transmission can still select any one of the lower gears in the remaining positions. For example, if the gear selector is set to 3rd, 2nd and 1st can also be selected. Of course, it is conceivable that the signals from an elec­ tronically controlled automatic transmission could be used to drive a gear display. However, we have not provided for this in the Gear Indicator because these signals would be different on each siliconchip.com.au Fig.1: block diagram of the Gear Indicator. It works by counting the number of ignition pulses that occur during a fixed number of pulses from a speed sensor and comparing the result with a “lookup” table that’s stored in memory. type of vehicle and may be difficult to utilise effectively. Block diagram Fig.1 shows the basic operation of the Gear Indicator. There are three external inputs: speed sensor pulses, ignition coil pulses and the reversing switch input. The speed sensor pulses can be obtained from a rotating magnet and coil assembly mounted on the tailshaft. Alternatively, you can use the digital speed signal that comes from the vehi­cle’s engine computer, if this can be identified (and accessed). The ignition pulses can either be obtained from the ignition coil or you can use the low-voltage tachometer signal from the engine management computer if this is available. The reversing input is obtained, naturally enough, from the reversing switch. When this switch is closed (ie, when reverse gear is selected), the display will show an “r” for reverse as indicated previously. Conversely, when the switch is open, the display will show either neutral (when the unit is first powered up or if there are no pulses) or a gear number. If the vehicle is moving, the circuit counts the number of ignition coil pulses that occur during a fixed number of speed pulses. If a low gear is selected (eg, 1st gear), it follows that there will be more ignition pulses counted for a given speed compared to those counted at the same speed in a higher gear. The gear selection number is shown on the 7-segment LED display. This number is obtained by comparing the number of ignition pulses counted with the stored values (in a microcon­ troller). These stored values are obtained during calibration of the Gear Indicator. Fig.2 shows how the Gear Indicator compares the ignition pulse counts with the calibration values. These calibration values are different for each gear and are obtained by driving the vehicle in each gear during the initial setup. This means that comparing the counted pulses with the cali­bration values should give the correct gear number. However, in practice, the calibration number may differ from the value ob­ tained during driving. That’s because the number of ignition pulses counted may vary by up to several counts for the same number of speed pulses, depending on the phase difference between the two. To counter this effect, a set amount of hysteresis is added to each gear range – see Fig.2. This can be varied to suit the vehicle during calibration and also corrects for any slippage in the transmission – either in the clutch or in the torque converter. As a further refinement, a slight January 2003  35 IC2a’s output is fed to pin 6 of IC1 via a 3.3kΩ resistor. The signal on pin 6 is then clamped by pin 6 (via internal diodes) to 0.6V above IC1’s supply rail (5V), as before. In operation, IC1’s pin 6 input is set as an interrupt – ie, the microcontroller’s embedded software increments the count each time pin 6 goes low. Display brightness Fig.2: a small amount of hysteresis is added at the end of each gear range to correct for phase errors and transmission slippage. This is set to suit the vehicle and is one of several parameters that are adjusted during the setup procedure. delay is added between each display update. This delay prevents the display from behav­ing erratically during gear changes, when clutch slippage and changes in engine RPM could otherwise produce an incorrect gear indication. Circuit details Refer now to Fig.3 for the circuit details. As indicated above, it’s based on a PIC microcontroller (IC1). This device accepts inputs from the various sensors and switches and drives the 7-segment LED display. OK, let’s start with the speed sensor circuit. This con­sists of a sensing coil which mounts on the chassis, plus four magnets which mount on a drive shaft (or tail shaft). As the magnets spin past, they induce a voltage into the coil and this is detected by comparator stage IC3. One side of the speed sensing coil connects to a 2.5V sup­ ply, derived from a voltage divider consisting of two 2.2kΩ resistors between the +5V rail and ground. This 2.5V rail is decoupled using a 47µF capacitor and biases pin 3 (the non-in­verting input) of IC3 via a 22kΩ resistor. It also biases pin 2 of IC3 via the coil and a series 1kΩ resistor. Diodes D1 & D2 clamp the input signal from the coil to 0.6V, while the asso­ciated 10nF capacitor filters the pickup signal. IC3 is wired as an inverting Schmitt trigger comparator. Its hysteresis is set by a 1MΩ positive feedback resistor, which prevents false triggering due to noise. The output signal from the speed sensor is a 250mV peak-to-peak pulse waveform and this is fed to pin 2 of IC3. Each time the input swings nega36  Silicon Chip tive, IC3’s output (pin 1) goes high (ie, to about 10V). This output is fed to pin 12 (RB6) of IC1 via a 3.3kΩ cur­rent limiting resistor. The internal diodes at RB6 then clamp the signal voltage to about 5.6V. Note that the feedback signal for IC3 is derived from this point to ensure a consistent hysteresis level, regardless of the 12V supply level. Ignition coil pulses As shown, signals from the ignition coil are first fed to a voltage divider consisting of 22kΩ and 10kΩ resistors. The asso­ciated 68nF capacitor then shunts any signals above 700Hz to ground to eliminate noise. From there, the signal is AC-coupled via a 1µF capacitor to diode D3 and thence to pin 2 of op amp IC2a. Zener diode ZD2 limits the signal amplitude at D3’s anode to 20V, while D3 prev­ ents negative signals from being fed into IC2a. The associated 10kΩ resistor pulls pin 2 low in the absence of a signal input via D3. A low input (LOW IN) has also been provided at the junction of D3 and ZD2. This input allows the tacho­meter signal from an engine management computer to be applied instead of using the ignition coil input. The signal level at this input can be any­ where from 2.3V up to a maximum of 20V. IC2a is wired as an inverting comparator with hysteresis. Its pin 3 input is nominally biased to about 1.6V via a voltage divider connected to the 5V rail, while the 47kΩ feedback resis­tor provides the hysteresis to set the high and low trigger points (1.7V and 1.5V respectively). The resulting square-wave signal at Trimpot VR1, light dependent resistor LDR1 and op amp IC2b are used to control the display brightness. As shown, IC2b is connected as a voltage follower and this drives buffer transistor Q1 (which is inside the negative feedback loop) to control the voltage applied to the anode of the 7-segment LED display. When the ambient light level is high, LDR1 has low resist­ance and so the voltage on pin 5 is close to the +5V supply rail. As a result, the voltage on Q1’s emitter will also be close to +5V and so the display will operate at full brilliance. As the light level falls, the resistance of the LDR in­creases and the voltage on pin 5 of IC2b decreases. As a result, Q1’s emitter voltage also falls and so the display operates with reduced brightness. When it’s completely dark, the LDR’s resistance is very high and the voltage on pin 5 of IC2b is determined solely by VR1. This trimpot is adjusted to give a comfortable display brightness at night. The 7-segment LED display is driven via the RA1, RB1-RB5 and RB7 outputs of IC1 via 470Ω resistors. A low output on any one of these output lines lights the corresponding display seg­ment, with the output at RA4 controlling the decimal point. Switch inputs Pushbutton switches S1, S2 and S3 are monitored using the RA2 and RA3 inputs. These two inputs are normally tied high via 10kΩ resistors and are only pulled low when the switches are pressed. When S1 (Mode) is closed, RA2 is pulled low and this is recognised as a closed switch by the software. Similarly, when S2 (Number) is closed, RA3 is pulled low, while pressing S3 (Store) pulls both RA2 & RA3 low to ground (via diodes D4 & D5). As a result, the software can recognise which siliconchip.com.au Fig.3: the complete circuit of the Gear Indicator. The PIC microcontroller (IC1) processes the signals from the various inputs and drives a single 7-segment LED display (DISPLAY1) to show the result. IC2b, Q1 & LDR1 automatically dim the display at night, so it is not too bright. switch has been pressed and respond accordingly. Clock signals Clock signals for IC1 are provided by an internal oscilla­tor and a 4MHz siliconchip.com.au crystal (X1) connected between pins 15 & 16. The two associated 22pF capacitors are there to provide the correct loading and to ensure that the oscillator starts reliably. The crystal frequency is divided internally to produce clock signals for the internal circuitry and the various parame­ters used in the software. It is also used to give a precise time period to count the speed pulses. Power Power for the circuit is derived from the vehicle’s battery via a fuse and the ignition switch. This supply line January 2003  37 Table 2: Capacitor Codes Value 100nF (0.1µF) 68nF (.068µF) 10nF (.01µF) 22pF (22p) IEC Code EIA Code 100n 104   68n 683   10n 103   22p   22 to power IC1. IC2 and IC3 derive their power directly from the de­ coupled +12V rail. Construction Fig.4 shows the assembly details. Most of the work involves building two PC boards: a microcontroller board coded 05101031 and a display board coded 05101032. These two boards are then stacked together piggyback fashion using pin headers and cut down IC sockets, so that there is very little external wiring. Begin by carefully checking the PC boards for defects, by comparing them with the published patterns. It’s rare to find problems these days but it doesn’t hurt to make sure. The microcontroller board can be assembled first. Install the three wire links first, then follow with the resistors and diodes. Table 1 shows the resistor colour codes but we also recommend that you check each value using a digital multimeter as some colours can be hard to decipher. Note that the six 470Ω resistors are mounted end-on to save space. Take care when installing D1 & D2 as they face in opposite directions. Similarly, watch the orientation of ZD1. REG1 can go in next. It is mounted with its metal tab flat against the PC board. As shown, its leads are bent Fig.4: install the parts on the two PC boards as shown here. Note that all the electrolytic capacitors must be mounted so that their bodies lie parallel to the board surfaces (see photos), so that the boards can later be stacked together. is decoupled using a 10Ω 1W resistor and filtered using a 47µF electrolytic capacitor. ZD1 provides transient protection by limiting any spike voltages to 16V. It also provides reverse polarity protection – if the supply leads are reversed, ZD1 conducts heavily and “blows” the 10Ω resistor. The decoupled supply is fed to 3-terminal regulator REG1 to derive a +5V rail. This rail is then filtered using 10µF and 100nF capacitors and used Table 1: Resistor Colour Codes o No. o  1 o  2 o  2 o  5 o  2 o  2 o  3 o  2 o  7 o  1 38  Silicon Chip Value 1MΩ 47kΩ 22kΩ 10kΩ 4.7kΩ 3.3kΩ 2.2kΩ 1kΩ 470Ω 10Ω 4-Band Code (1%) brown black green brown yellow violet orange brown red red orange brown brown black orange brown yellow violet red brown orange orange red brown red red red brown brown black red brown yellow violet brown brown brown black black brown 5-Band Code (1%) brown black black yellow brown yellow violet black red brown red red black red brown brown black black red brown yellow violet black brown brown orange orange black brown brown red red black brown brown brown black black brown brown yellow violet black black brown N/A siliconchip.com.au down at right angles so that they pass through their respective mounting holes. This is best done by slipping an M3 screw through the hole in the device tab, positioning it on the PC board and then gripping one of the leads with a pair of needle-nose pliers, just before it reaches the mounting hole. The device is then lifted clear of the PC board and the lead bent down at right angles, after which the procedure is repeated for the next lead. Next, install a socket for IC1, taking care to ensure that it is the right way around. Don’t plug the microcontroller in yet – that step comes later, after you’ve checked out the power supply. IC3 can then be installed, followed by the capacitors. Note that the 47µF capacitor near the speed sensor input must be installed so that it lies parallel with the PC board – see photo. Similarly, the adjacent 47µF & 10µF capacitors below REG1 lie over the regulator’s leads. In each case, it’s simply a matter of bending the capacitor’s leads at right angles before installing it on the PC board. Crystal X1 mounts horizontally on the PC board and can go in either way around. It is secured by soldering a short length of wire between one end of its case and an adjacent PC pad. Finally, you can complete the assembly of this board by fitting PC stakes to the external wiring points and fitting the 7-way single in-line (SIL) sockets. The latter are made by cut­ting down two 14-pin IC sockets into in-line strips using a sharp knife or fine-toothed hacksaw. Clean up any rough edges with a file before installing them on the PC board. Checking the supply rails Before plugging in IC1, it’s a good idea to check the supply rails (note: you don’t need to have the display board connected to do this). All you have to do is connect a 12V supply to the board and check that there is +5V on pins 4 & 14 of the socket (use the metal tab of REG1 for the ground connection). If this is correct, plug IC1 in as shown in Fig.4 – ie, pin 1 to­wards bottom right. Display board Now for the display board. Install the wire link first, followed by the resistors, diodes D3-D5, ZD2 and transistor Q1. The three capacitors can siliconchip.com.au This is the fully-assembled microcontroller board. Note particularly how the three electrolytic capacitors are mounted – ie, so that they lie horizontally across other components. The pin headers on the underside of the display board plug into the in-line sockets on the microcontroller board. Take care to ensure that the 7-segment LED display is correctly oriented. then be installed, along with trimpot VR1 and the 7-segment LED display. Note that the 1µF bipolar capacitor is installed so that it lies across ZD2 – see photo. Watch the orientation of the LED display – its decimal point goes towards bottom right. LDR1 can go in next. It’s mounted so that its top face is about 3mm above the face of the 7-segment display. Once it’s in, you can install switches S1-S3 and PC stakes at the external wiring points. The three 7-way SIL pin headers are installed on the copper side of the PC board with their leads just protruding above the top surface. You will need a fine-tipped soldering iron to in­stall them. Note that you will have to slide the plastic spacers along the pins to allow room for soldering, after which the spacers are pushed back down again. Final assembly Work can now begin on the plastic case. First, remove the integral side pillars with a sharp chisel, then slide the micro­controller board into place. That done, mark out the two mounting holes on the base – one aligned with the hole in REG1’s metal tab and the other diagonally opposite on the lefthand side. Now remove the board and drill January 2003  39 Parts List 1 microcontroller PC board, code 05101031, 78 x 50mm 1 display PC board, code 05101032, 78 x 50mm 1 plastic utility case, 83 x 54 x 30mm 1 dark red transparent Perspex or Acrylic sheet, 14 x 16 x 2.5mm 1 4MHz parallel resonant crystal (X1) 1 LDR (Jaycar RD-3480 or equivalent) 4 or 6 button magnets 1 coil former, 15mm OD, 8mm ID x 7mm 1 20m length of 0.18mm enamelled copper wire 1 6mm x 25mm steel bolt, 2 washers and nut 6 PC stakes 3 7-way pin head launcher 2 DIP-14 low-cost IC socket with wiper contacts (cut for 3 x 7-way single in-line sockets) 3 PC-mount tactile membrane switches (S1-S3) (Altronics S 1120 or equivalent) 2 6mm long M3 tapped spacers 1 10mm Nylon spacer or 2 x 6mm spacers with one cut to 4mm 1 9mm long untapped metal spacer 2 M3 x 6mm countersunk screws 2 M3 x 15mm brass screws 1 100mm length of 0.8mm tinned copper wire 1 2m length of single core shielded cable 1 2m length of 7.5A mains rated wire 1 2m length of red automotive wire 1 2m length of black or green automotive wire (ground wire) 1 2m length of white automotive wire these two holes to 3mm. Once drilled, they can be slightly countersunk on the outside of the case to suit the mounting screws. In addition, you will have to drill two holes in the back of the case to accept the power leads, the shielded cable from the speed sensor, the ignition coil and the reversing switch. These 40  Silicon Chip 1 200kΩ horizontal trimpot (VR1) Semiconductors 1 PIC16F84P microprocessor programmed with gear.hex (IC1) 2 LM358 dual op amps (IC2,IC3) 1 7805 or LM340T5 5V 1A 3-terminal regulator (REG1) 1 BC337 NPN transistor (Q1) 1 HDSP5301, LTS542A common anode 7-segment LED display (DISP1) 5 1N914, 1N4148 signal diodes (D1-D5) 1 16V 1W zener diode (ZD1) 1 20V 1W zener diode (ZD2) Capacitors 2 47µF 25VW PC electrolytic 1 10µF 16VW PC electrolytic 1 1µF bipolar electrolytic 3 100nF MKT polyester 1 68nF MKT polyester 1 10nF MKT polyester 2 22pF ceramic Resistors (0.25W 1%) 1 1MΩ 2 3.3kΩ 2 47kΩ 3 2.2kΩ 1 22kΩ 2 1kΩ 1 22kΩ 1W 7 470Ω 5 10kΩ 1 10Ω 1W 2 4.7kΩ Alternative speed sensor 1 PC board, code 05101033, 14 x 30mm. 1 UGN3503 Hall senosr 1 100nF MKT polyester capacitor 1 2m length of twin-core shielded cable 3 PC stakes Miscellaneous Automotive connectors, heatshrink tubing, aluminium brack­et, self-tapping screws holes should be located so that they line up with the relevant PC stakes. The display PC board can now be plugged into the microcon­troller board and the assembly fastened together and installed in the case, as shown in Fig.5. Once it’s all together, check that none of the leads on the display board short against any of the parts on the microcontroller board. It may be necessary to trim some of the pigtails on the display board to prevent this. The panel artwork can now be used as a template for marking out and drilling the front panel. You will need to drill a hole for the LDR plus a series of small holes around the inside peri­ meter of the display cutout. Once the holes for the display cutout have been drilled, knock out the centre-piece and clean up the rough edges using a small file. Make the cutout just big enough so that the red Perspex is a tight fit. A few spots of superglue along the inside edges can be used to ensure that the window stays put. That done, you can affix the front panel label and cut out the holes with a utility knife. Testing Now for the smoke test! First, apply power and check that the display shows “-”. If it doesn’t, switch off immediately and check for wiring errors and solder faults. Assuming that everything is OK, you can test the dimming feature by holding your finger over the LDR. Adjust VR1 until the display dims to the level you want at night. Next, connect the leads from the ignition coil (or low level input), the reversing switch and the speed sensor. These leads all connect to the underside of the PC board and the igni­tion and reversing switch wires pass through to the base of the case via notches cut in the side of the microcontroller PC board. These notches are located on either side of the adjacent 7-way socket and their positions are marked on the PC board using a fine track outline. Speed sensor Two different speed sensors can be made up, one based on a coil pickup and the other using a Hall sensor pickup. However, both rely on the use of an adjacent rotating magnet assembly . The coil pickup is likely to be more rugged and less prone to water damage but the Hall sensor will allow for very low speed operation. That’s because its output voltage doesn’t depend on the speed at which the magnets rotate past the sensor. It’s just a matter of waterproofing it correctly, using heatshrink tubing and silicone sealant. The coil sensor version is shown in Fig.6. It is made by winding about 400 siliconchip.com.au Fig.5: this diagram shows how the two PC boards are stacked together and secured to the bottom of the case using screws, nuts and spacers. Be sure to use nylon spacers where specified. Fig.6: the pickup coil used in the speed sensor is mounted on a L-shaped bracket that’s secured to the vehicle’s chassis. Position the coil so that it is no more than 10mm away from the magnets as they pass, to ensure sufficient signal pickup. Note that the magnets must all be installed with the same pole facing outwards – either North as shown here or South. turns of 0.18mm enamelled copper wire onto a plastic bobbin measuring 15mm OD x 8mm ID x 5mm. Use electrical tape to secure the turns and leave about 10-20mm of lead length at each end. Once the coil has been wound, solder its leads to a suit­able length of shielded cable – ie, one lead goes to the shield wire and the other goes to the core. Secure this lead to the side of the coil with some tape, then cover the coil with silicone sealant (preferably the non-acid type such as roof and gutter sealant). Finally, cover the coil with a short siliconchip.com.au Fig.7: the alternative speed sensor uses a Hall effect device mounted on a small PC board. This is the completed PC board assembly, ready for mounting in the plastic case. Note that the various external leads are all soldered to PC stakes on the copper side of each board, with the leads from the display board resting in small grooves cut into the microcontroller board. January 2003  41 Adjustable Parameters For The Gear Indicator Because each vehicle is different, the Gear Indicator must be correctly set up in order to obtain the best results. Consequently, the unit has been designed to cater for up to nine gears and there are various parameters that can be adjusted to control its operation. Table 3 shows the details of the various parameters. These are as follows: (1) The first parameter that can be set is the number of speed pulses used to gate the ignition pulses. This is adjustable from 4-36 pulses in increments of 4, using numbers from 1-9. The initial setting is for 12 pulses but this may have to be varied to cater for various speed sensor characteristics. (2) Next is the amount of hysteresis for each gear compari­son. In practice, this value is made just large enough so that the display does not sometimes briefly show the next highest gear number. The default value is 6% of the ignition pulse count and this should be suitable in most cases. This value will have to be increased if the display shows a tendency to occasionally jump to the next highest gear. Converse­ly, it should be made length of heatsh­rink tubing and shrink it into place using a hot-air gun The sealant should now be left to dry for about eight hours. A 100mm-long cable tie can be placed around the coil to secure the lead in place. The alternative Hall sensor is assembled on a small PC board coded 05101033. Fig.7 shows the assembly details. Apart from the Hall sensor itself, there’s just a single 100nF capacitor to be installed. Note that the UGN3503 Hall sensor is mounted flat against the PC board with the label side up. The connecting lead to the main unit is run using twin-core shielded cable. Installation Be sure to use proper automotive cable and connectors when in­stalling the unit into a vehicle. The +12V supply is derived via the ignition switch and the fusebox will provide a suitable 42  Silicon Chip Table 3: Adjustable Parameters Display Value Speed Puls- Hysteresis es (S) Delay (d) Timeout (-) Reverse (r) Clear (C) 1 4 2% 0.1s 0.5s 12V = r* - 2 8 4% 0.2s* 1s 0V = r - 3 12* 6% 0.3s 1.5s 12V = r* - 4 16 8% 0.4s 2s 0V = r - 5 20 10% 0.5s 2.5s* 12V = r* - 6 24 12% 0.6s 3s 0V = r - 7 28 14% 0.7s 3.5s 12V = r* - 8 32 17% 0.8s 4s 0V = r - 9 36 20% 0.9s 4.5s 12V = r* - Note: an asterisk (*) denotes the default value. lower if this tendency is not apparent and then adjusted back the other way until the effect disappears. In practice, you can adjust the hysteresis over a range from 2-20%. The lower the value the better, since this gives the greatest range of ignition pulses that are counted for each gear. The third parameter is the delay between gear changes. Without this delay, the display could show the incorrect number since the engine RPM can vary widely when changing gears. The initial setting for this is 0.2s which should be suit­able for most cars. However, depending on the driver, the 0.1s setting may be better for cars with manual gearboxes. Conversely, a longer delay may be needed for cars with automatic transmis­sions. You can set the delay to any value between 0.1s and 0.9s. The fourth parameter is the timeout connection point. Be sure to choose the fused side of the supply rail, so that the existing fuse is in series. You should also be able to access the reversing switch connection at the fusebox. The ground connection can be made by connecting the lead to the chassis using a solder eyelet and self-tapping screw. Fig.6 shows the mounting details for the speed sensor. Note that the four magnets must all be installed with the same pole facing outwards – ie, they must all have either their north pole facing outwards or their south pole facing outwards (it doesn’t matter which). This is done by attaching the magnets together in a stack. This will either give an N-S-N-S, etc stack or an S-N-S-N, etc stack. You then mark the outside face of the top magnet and remove it from the stack, then mark the next magnet and remove it and so on until all the magnets are separate. The magnets can then be attached to the driveshaft with the marked faces on the outside. The magnets should be equally spaced around the driveshaft and can be affixed using builder’s adhesive (eg, Liquid Nails, Max Bond, etc). Covering the magnets with some neutral cure silicone sealant will protect them from damage due to stones and other debris thrown up by the wheels. Mounting the pickup coil The pickup coil can be secured by bolting it to an L-shaped bracket which is then fastened to the chassis. Position it so that there is about a 10mm maximum gap between it and the magnets as they pass. Alternatively, you can use a Hall sensor instead of the pickup coil, as shown in Fig.7. The ignition coil input is connected siliconchip.com.au period. Normally, the ignition pulses are counted during a set number of speed pulses. However, if the vehicle is moving very slowly or is stopped, the speed pulses may not reach the count setting. Instead, the time­out stops the count and places a neutral (-) reading on the display. The timeout parameter is initially set at 2.5s but can be set anywhere in the range from 0.5-4.5s, using numbers from 1-9. Its setting is a compromise between showing neutral only when stopped or at a very low speed (long timeout) and getting a fast neutral indication after coming to a stop (short timeout). The next parameter is the reversing switch sense. Setting an odd number between 1 and 9 (1, 3, 5, 7 or 9) will cause the display to show reverse when the reverse input goes to +12V. Conversely, setting an even number (2, 4, 6 or 8) will cause reverse to show when the reverse input goes to 0V. This selection is simply made so that the unit shows re­verse (“r”) when the reversing lights come on. The final parameter is “clear”, which clears all the gear calibration values. The gear ranges will then need to be recalibrated. This “clear” operation should be carried out if the unit is fitted into another vehicle. directly to the switched (negative) side of the ignition coil using a 250VAC rated cable. Using computer signals As mentioned earlier, instead of making you own speed sen­sor, you may be able to obtain the speed signal from the engine management computer. This signal is simply fed to the 1kΩ resis­tor at the speed input. If the car’s speedometer stops operating after connecting the Gear Indicator, increase the 1kΩ resistor on the speed input to 10kΩ and remove the 10nF capacitor. Similarly, you can use the low-voltage tachometer signal from the computer instead of ignition coil pulses if this is available. In fact, it will be necessary to do this if your car uses several double-ended coils to fire the spark plugs, rather than a single coil. The low-voltage tachometer signal siliconchip.com.au Setting The Parameters The various parameters are set by first pressing (and hold­ing down) the Mode switch while the Gear Indicator is powered up. The display decimal point then lights to indicate that the unit is in the “setting mode”. The first parameter shown is an “S” which refers to the speed pulses. If the Mode switch is then released, the display will show the value stored (from 1-9) after 1s. Conversely, if the Mode switch is held down, the other parameter indicators will appear in succession, at a 1s rate. The parameter values are altered by pressing the Number switch. Each press increments the number by one, while holding the Number button down causes the value to automatically increase at a 1s rate – ie, the numbers cycle from 1-9 and then back to 1 again. When the required value is selected, you simply release the Number switch and press the Store switch to store the value in memory. Once the “S” (speed) parameter has been set, the other parameters are selected and set in turn. These are “H” (hystere­ sis; “d” (delay); “-” (timeout) and “r” (reverse). These are all modified and stored exactly as before. Note that no changes are stored until the Store switch is pressed. This enables you to cycle through the parameters to check their values without making any changes. The last parameter to be selected simply shows a “C” on the display, without any value. Pressing Store will clear all the gear settings. Finally, you exit from the Param­ eter Mode, by switching off and then reapplying power. The display will then show a “-” (ie, the neutral gear indication) and the decimal point will be off. Gear Calibration Pressing the Mode switch after the unit has powered up places the unit into the “Calibrate Mode”. The decimal point will light to indicate this mode and the number shown initially will be a “1” (ie, 1st gear). To calibrate the unit, just follow these step-by-step instructions: (1) Drive the vehicle at light throttle with 1st gear selected (for automatics, you have to select 1st gear rather than Drive). After a few seconds, press the Store button and the calibration for 1st gear is saved. Note that it may be necessary to drive relatively fast in 1st gear to ensure that the speed pulses are counted within the timeout period. Also, with an automatic, be sure to drive along a flat section of road without accelerating to eliminate torque converter slip. (2) Next, press the Number button so that the unit shows a “2” (ie, 2nd gear). Now drive at light throttle in 2nd gear for a few seconds and press the Store switch to calibrate the 2nd gear. Note that it is not necessary to drive at a fast speed in this gear to achieve calibration. If the car is an automatic, be sure to select 2nd gear and drive fast enough to ensure that the car is in this gear (ie, not 1st). The remaining gears are calibrated in exactly the same manner. (3) Once you have calibrated all the gears, press the Mode switch again and the decimal point will extinguish. The unit will now revert to the “Gear Indicator” mode. If you make a mistake during cal-ibration, or if the unit is to be used in a different vehicle, the data should be cleared using the “C” parameter before re-calibrating the unit. Note too that if you subsequently change the speed pulses parameter after calibration, the gears will need to be recal­ibrated. Also, if you don’t obtain a successful 1st gear calibra­ tion, this gear can be recalibrated after extending the timeout delay. In that case, the Store button should be pressed after about 10 seconds to ensure a suitable count for the ignition pulses. Note that some automatics start in 2nd gear rather than 1st when light throttle settings are used. January 2003  43 Fig.8: this full-size artwork can be used as a drilling template for the front panel. You will need to make cutouts for the LDR and the 2-segment LED display. Fig.9 (right): check your etched PC boards against these full-size patterns before any of installing the parts. The smallest board (ie, 05101033) is for the optional Hall speed sensor. The corners of the two PC boards must be cut away to clear the mounting pillars inside the case. This should be done before any parts are installed. should be applied to the low input terminal on the Gear Indicator (not to the ignition coil terminal). On-road testing Once fitted to the vehicle, the various parameters can be set and the unit calibrated as described in the 44  Silicon Chip accompanying panels. The speed pulses setting for the parameters can be made a larger value as described earlier. This will give more ignition pulses to be counted and give a better resolution for the differ­ences in counts for each gear ratio. The larger value will also pro­vide less tendency to show a lower gear due to clutch or torque converter slippage. The compromise is that the time required to count the pulses will be longer and the display will have a tendency to show the neutral (-) indication at a higher speed compared to using a smaller speed pulses number. This is because the timeout period will occur before the pulses are count­ed at slower speeds. Gear change response will also be slower with a higher speed pulse count number. In general, use 16 or more speed pulses if you use four magnets on the tailshaft and use 12 or less if you use magnets on the wheel shaft. Use of the speedometer sensor signal should require 28 or more speed pulses but this may need to be smaller if the response at slow speeds is too long, causing neutral indica­tion at not so slow speeds. Note also that using magnets and a coil pickup will not provide gear indication at very slow speeds since the output from the sensor will be too low to register. The Hall effect pickup will be much better at slow speeds and will provide gear indication down to where the speed pulse count takes SC longer than the timeout. siliconchip.com.au