Silicon ChipDigital Instrument Display For Cars, Pt.1 - August 2003 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Should we be part of Star Wars II?
  4. Order Form
  5. Feature: OLED Displays: Better Than Plasma Or LCD by Peter Smith
  6. Feature: Home Automation: It's Here by Ross Tester
  7. Project: PC Infrared Remote Receiver by Peter Smith
  8. Project: Digital Instrument Display For Cars, Pt.1 by John Clarke
  9. Project: Home-Brew Weatherproof 2.4GHz WiFi Antennas by Rob Clarke
  10. Project: Fitting A Wireless Microphone To The PortaPAL by Ross Tester
  11. Project: Jazzy Heart Electronic Jewellery by Thomas Scarborough
  12. Product Showcase
  13. Project: The PICAXE, Pt.7: Get That Clever Code Purring by Stan Swan
  14. Weblink
  15. Project: A Digital Timer For Less Than $20 by Ross Tester & Jess Benning
  16. Vintage Radio: The HMV 42-71 migrant special by Rodney Champness
  17. Notes & Errata
  18. Book Store
  19. Back Issues
  20. Market Centre
  21. Advertising Index
  22. Outer Back Cover

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

You can view 31 of the 104 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.

Items relevant to "PC Infrared Remote Receiver":
  • AT90S2313 firmware for the PC Infrared Remote Receiver (Software, Free)
  • PC Infrared Remote Control Receiver PCB pattern (PDF download) [07108031] (Free)
  • Panel artwork for the PC Infrared Remote Receiver (PDF download) (Free)
Items relevant to "Digital Instrument Display For Cars, Pt.1":
  • PIC16F84A-20(I)/P programmed for the Digital Instrument Display for Cars [INSTRUM.HEX] (Programmed Microcontroller, AUD $10.00)
  • PIC16F84 firmware for the Digital Instrument Display for Cars [INSTRUM.HEX] (Software, Free)
  • Digital Instrument Display for Cars PCB patterns (PDF download) [05108031/2] (Free)
  • Panel artwork for the Digital Instrument Display for Cars (PDF download) (Free)
Articles in this series:
  • Digital Instrument Display For Cars, Pt.1 (August 2003)
  • Digital Instrument Display For Cars, Pt.1 (August 2003)
  • Digital Instrument Display For Cars, Pt.2 (September 2003)
  • Digital Instrument Display For Cars, Pt.2 (September 2003)
Items relevant to "Home-Brew Weatherproof 2.4GHz WiFi Antennas":
  • 2.4GHz Biquad WiFi Antenna PCB pattern (PDF download) [06108031] (Free)
Items relevant to "Fitting A Wireless Microphone To The PortaPAL":
  • PortaPAL PCB patterns (PDF download) (01103031-4) (Free)
  • Panel artwork for the PortaPAL (PDF download) (Free)
Articles in this series:
  • The PortaPAL Public Address System (February 2003)
  • The PortaPAL Public Address System (February 2003)
  • 12V SLA Battery Float Charger (March 2003)
  • The PortaPAL Public Address System; Pt.2 (March 2003)
  • The PortaPAL Public Address System; Pt.2 (March 2003)
  • 12V SLA Battery Float Charger (March 2003)
  • Fitting A Wireless Microphone To The PortaPAL (August 2003)
  • Fitting A Wireless Microphone To The PortaPAL (August 2003)
Items relevant to "Jazzy Heart Electronic Jewellery":
  • Jazzy Heart PCB pattern (PDF download) [08108031] (Free)
Articles in this series:
  • PICAXE: The New Millennium 555? (February 2003)
  • PICAXE: The New Millennium 555? (February 2003)
  • The PICAXE: Pt.2: A Shop Door Minder (March 2003)
  • The PICAXE: Pt.2: A Shop Door Minder (March 2003)
  • The PICAXE, Pt.3: Heartbeat Simulator (April 2003)
  • The PICAXE, Pt.3: Heartbeat Simulator (April 2003)
  • The PICAXE, Pt.4: Motor Controller (May 2003)
  • The PICAXE, Pt.4: Motor Controller (May 2003)
  • The PICAXE, Pt.5: A Chookhouse Door Controller (June 2003)
  • The PICAXE, Pt.5: A Chookhouse Door Controller (June 2003)
  • The PICAXE, Pt.6: Data Communications (July 2003)
  • The PICAXE, Pt.6: Data Communications (July 2003)
  • The PICAXE, Pt.7: Get That Clever Code Purring (August 2003)
  • The PICAXE, Pt.7: Get That Clever Code Purring (August 2003)
  • The PICAXE, Pt.8: A Datalogger & Sending It To Sleep (September 2003)
  • The PICAXE, Pt.8: A Datalogger & Sending It To Sleep (September 2003)
  • The PICAXE, Pt.8: The 18X Series (November 2003)
  • The PICAXE, Pt.8: The 18X Series (November 2003)
  • The PICAXE, Pt.9: Keyboards 101 (December 2003)
  • The PICAXE, Pt.9: Keyboards 101 (December 2003)

Purchase a printed copy of this issue for $10.00.

* Use it to show fuel oil pressure or * level, engine temperature Suitable for use with a variety of sensors * Display auto-dims * at night Alarm output Digital Instrument Display For Cars Based on a PIC microcontroller, this simple project lets you convert the analog instruments in your car to a digital display. It’s suitable for use with fuel gauges, oil pressure gauges and temperature gauges, and even features an alarm output. Pt.1: By JOHN CLARKE I N THE PAST, SILICON CHIP has described an array of digital instruments for use in cars. These include a Speed Alert (with speedometer), a Tachometer, a Voltmeter, an Ammeter, a Thermometer and an Air/ Fuel Mixture Display. However, that line-up by no means exhausts the potential for other digital readouts in a car. For example, most cars have analog readouts for displaying fuel level and 34  Silicon Chip engine temperature. Similarly, the oil pressure is either shown on an analog gauge or more commonly, there’s no gauge and just an “idiot” warning light instead. Of course, there’s nothing wrong with analog gauges – it’s just that some drivers would rather have these outputs displayed in digital format instead. That’s where this Digital Instrument Display comes in – it’s designed to operate with any sensor or sender unit which varies its resistance or voltage signal output and display the result on a 3-digit LED readout. Basically, it’s ideal for use with sender units that have relatively slow changing values; eg, as found in fuel level, oil pressure and temperature gauges. In operation, the unit can be calibrated so that the dis­play will show any value in the range from -99 through to 999. The decimal point can be also be placed in one of two positions, so that the values can be from -.99 to 9.99 or from -9.9 to 99.9. In addition, the unit can be calibrated to display metric or imperial units. Alternatively, the values do not need to relate to any particular unit and could refer to percentages instead – eg, 100% for full. Of course, fuel and temperature gauges don’t usually show precise values. Instead, they give a general indication of how things are going – siliconchip.com.au eg, remaining fuel level somewhere between full and half-empty, or temperature midway between hot and cold. By contrast, you can calibrate this digital display unit to show the actual values – eg, fuel remaining in litres (or gallons if you prefer) or engine temperature in °C or °F, or some other function. In practice, the Digital Instrument Display is calibrated at two values and the instrument calculates the remaining values from these in a linear fashion. For example, if the unit is to be used as a fuel gauge, it is best calibrated when the fuel tank is full (eg, 55 litres fuel) and then calibrated when the tank is close to empty (eg, 10 litres). The display will then subsequent­ly be able to show the remaining fuel in the tank (in litres) over the complete range from full to empty. Alarm output An alarm output is available to warn of impending “doom”. For example, it could be set to trigger an alarm when the fuel tank approaches empty. Alternatively, it could be used to alert the driver if the engine is overheating or if the oil pressure is too low. In operation, the unit is set up to trigger the alarm when the display reading goes above or below a particular value. Under alarm conditions, the righthand decimal point lights as a visual indication. In addition, the alarm output can also drive a low-current piezo siren if an audible indication is required or it can be used to trigger an external relay-driver circuit. Presentation As might be expected, this new unit matches the appearance of our previous digital instruments for cars. It’s housed in a small plastic case, with the display showing through a trans­par­ent red Perspex or acrylic window. There are no user controls on the front panel. Instead, the three calibration switches (Mode, Up and Down) are hidden behind the front panel as they are not needed once the unit has been calibrated. Different modes The Mode switch is used to display the calibration values. On the first press, the display initially goes blank and then shows the first calibration siliconchip.com.au MAIN Features • • • Suitable for connection to variable resistance or vol­tage output sensors. • • • • • • Adjustable alarm level. Programmable display values; shows readout on a 3-digit LED display. Alarm output signal with visual alarm output indication at righthand decimal point. Can be set to alarm either above or below set value (optional). Displays values from 999 maximum to -99 minimum. Decimal point selection at x.xx or xx.x position (optional). Automatic display dimming in low light levels. 2-second display update period. value. This value is initially set at “0” and can be changed to any number up to 999 (disregarding the decimal point) using the on-board Up and Down switches. Pressing the Mode switch again then brings up the second calibration value. This is initially set at 100 but again can be set to any number from 0-999 using the Up and Down switches. Similarly, pressing the Mode switch a third time brings up the alarm value and once more, this is adjusted using the Up and Down switches. The sense of the alarm can also be set – ie, so that it is either on for values above the alarm setting (and off for values below this) or on for values below the alarm setting. The required alarm sense is selected at power up. Pressing the Mode switch when power is first applied will keep the display blank and upon release the display will show either AL or AL-. An “AL” display indicates that the alarm will be on for values above the alarm value and off for values below the alarm value. Con­ versely, an “AL-” display indicates that the alarm will be off for values over the alarm setting and on for values below this. To change from one to the other, you simply switch off the power and then hold down the Mode switch and apply power again. The display will now show the alternative setting when the switch is released. Returning now to the normal Mode switch operation, the fourth press of this button displays the actual measured value of the voltage applied to the input of the unit. This is to allow the unit to be set up correctly – ie, it allows you to ensure that the applied input voltage is within the permissible range. The fifth pressing of the Mode switch brings up three dashes (- - -) for a short period, after which the unit returns to the “normal” display mode. In this mode, it displays the calcu­lated value, which is based on the input voltage and calibration values. In this mode, the alarm LED will either be lit or unlit, depending on the alarm setting and the input signal level. In summary, at power up, the display is in its normal mode. Repeatedly pressing the Mode switch then brings up the following modes: 1 – First Calibration Value; 2 – Second Calibration Value; 3 – Alarm Threshold; 4 – Measured Input Level; and 5 – Normal Mode again. Modes 1-4 are all indicated with a flashing alarm LED. Circuit details Fig.1 shows the circuit for the Digital Instrument Display. It’s dominated by IC1, a PIC16F84-10P microcontroller. This monitors the input signal voltage via comparator stage IC2a, processes the information and drives the three 7-segment LED displays (DISP1-DISP3). And yes, it’s all very similar to our previously published digital car instruments. That’s the beauty of using a PIC proces­sor – we can use similar circuitry but get it to do what we want by writing new software to control the device. OK, let’s start with the input sensing circuit. In opera­ tion, the incoming analog signal from the sensor (or sender) is filtered using a 10kΩ resistor August 2003  35 Parts List 1 Microcontroller PC board, code 05108031, 78 x 50mm 1 Display PC board, code 05108032, 78 x 50mm 1 front panel label 80 x 53mm 1 plastic case utility case measuring 83 x 54 x 30mm 1 Perspex or Acrylic transparent red sheet, 56 x 20 x 3mm 1 10MHz parallel resonant crystal (X1) 1 LDR (Jaycar RD-3480 or equivalent) (LDR1) 3 SPST micro tactile switches (Jaycar SP-0600 or equivalent) (S1-S3) 5 PC stakes 3 7-way pin head launchers 1 DIP18 socket for IC1 2 DIP14 low cost IC sockets with wiper contacts (cut for 3 x 7-way single in line socket) Screws & spacers 1 9mm long x 3mm ID untapped brass spacer 1 10mm long x 3mm ID tapped Nylon spacer (can be made from 2 x 6mm spacers with one cut to 4mm) 2 6mm long M3 tapped Nylon spacers 2 M3 x 6mm screws 1 M3 x 15mm brass screw 1 M3 x 15mm Nylon screw Wire & cable 1 300mm length of 0.7mm tinned copper wire 1 2m length of red automotive wire 1 2m length of yellow automotive wire 1 2m length of black or green automotive wire (ground wire) and 100µF capacitor and fed to pin 2 of comparator stage IC2a. Note that provision has been made for a pullup resistor directly at the input, since this will be necessary with some sensors. Similarly, resistor R2 can be used to attenuate the input signal if necessary (more on this later). In operation, IC2a compares the voltage on its pin 2 input with a DC voltage on its pin 3 input. This DC voltage is derived by applying a pulse36  Silicon Chip Semiconductors 1 PIC16F84-10P or PIC16F84-20P microcontroller programmed with INSTRUM.HEX (IC1) 1 LM358 dual op amp (IC2) 1 7805 5V 1A 3-terminal regulator (REG1) 3 BC327 PNP transistors (Q1-Q3) 1 BC547 NPN transistor (Q4) 2 BC337 NPN transistors (Q5,Q6) 3 HDSP5301, LTS542A common anode 7-segment LED displays (DISP1-DISP3) 1 3mm red LED (LED1) 1 LM336-2.5 reference diode (REF1) 1 16V 1W zener diode (ZD1) 4 1N914 switching diodes (D1-D4) Capacitors 2 100µF 16V PC electrolytic 3 10µF 16V PC electrolytic 1 390nF (0.39µF) MKT polyester 2 100nF (0.1µF) MKT polyester 2 18pF ceramic Trimpots 1 20kΩ horizontal trimpot (code 203) (VR1) 1 250kΩ horizontal trimpot (code 254) (VR2) 1 500kΩ horizontal trimpot (code 504) (VR3) Resistors (0.25W, 1%) 1 1MΩ 1 1kΩ 0.5W 1 200kΩ 3 680Ω 7 10kΩ 9 150Ω 2 3.3kΩ 1 10Ω 1W Miscellaneous Automotive connectors, heat­ shrink tubing, cable ties, etc. width modulated (PWM) square-wave signal from the RA3 output of IC1 to a 390nF capacitor via a 200kΩ resistor and trimpot VR2. As a result, pin 1 of IC2a switches low when ever the vol­tage on its pin 2 input is greater than the voltage on pin 3. This signal is then fed via a 3.3kΩ limiting resistor to the RB0 input of IC1. This resistor limits the current from IC2a when its output switches high to a nominal 12V, while internal clamp diodes at RB0 limit the voltage on this pin to 5.5V. A-D converter Among other thing, IC1 functions as an analog-to-digital (A-D) converter. In operation, it converts the comparator signal on its RB0 (pin 6) input to a digital value which is then used to drive the 3-digit LED display. The A-D converter used here operates by using a series of successive approximations and involves just two external connec­tions to IC1. As mentioned above, IC1 produces a PWM signal at its RA3 output and this operates at 4.882kHz with a wide-ranging duty cycle. Note that a high output from RA3 is at 5V while a low output is at 0V. The RC network on RA3 filters this PWM waveform to derive a DC voltage that is the average of the PWM waveform. This means that if the duty cycle is 50% (ie, a square wave), the average at RA3 will be 50% of 5V or 2.5V. Varying the duty-cycle either side of 50% produces higher or lower DC voltages accordingly. Operation of the A-D converter is as follows: initially, the RA3 output is set to a 50% duty cycle and this sets the voltage at pin 3 of IC2a at 2.5V. At the same time, an 8-bit register inside IC1 has its most significant bit set high so that its value will be 10000000. During this process, the comparator’s output is monitored by IC1’s RB0 input. If the measured voltage is lower than 2.5V, IC2a’s output is high and the PWM output at RA3 is reduced to a 25% duty cycle to produce an average of 1.25V. The internal register is now set to 01000000. Alternatively, if the measured voltage is above 2.5V, corresponding to a low comparator output, the RA3 output is increased to a 75% duty cycle to provide an average of 3.75V. The register is thus set to 11000000, with the most significant bit indicating a 2.5V 50% duty cycle and the next bit indicating the 1.25V 25% duty cycle (adding the two bits gives us the 3.75V). The comparator output is again checked, after which the microcontroller adds or subtracts a 12.5% duty cycle (0.625V) and compares this against the input voltage again. The register is then set to X1100000 (with X a 1 or 0 as determined by the previous operation) if the input voltage is higher siliconchip.com.au siliconchip.com.au August 2003  37 Fig.1: the PIC microcontroller (IC1) does most of the work in this circuit. It accepts inputs from the sensor (via IC2a) and drives three 7-segment LED displays. Table 2: Capacitor Codes Value 390nF 100nF 18pF 9.76mV, 4.88mV and 2.44mV – so that we obtain an 11-bit A-D conversion. The A-D conversion thus has a resolution of around 2.44mV at the least significant bit. The possible number of values for the 11-bit register is from 00000000000 (0) to 11111111111 (2048). In practice, we are limited to a range from about 152 to 1848 because the software must have time for internal processing to produce the waveform at the RA3 output. This means that the input signal can only be measured over a particular range of voltage corresponding to the 152 minimum count and the 1848 maximum count. This corresponds to about 373mV minimum and 4.5V maximum. However, it’s quite common for automotive sensors to pro­duce signals all the way down to 0V, so we need to cater for this type of sensor. That’s done by applying a negative voltage to pin 3 of IC2a, to offset the 375mV minimum from the A-D convert­er. This offset voltage is derived from voltage reference REF1, diodes D1 & D2 and transistor Q6 and its associated components. Q6 is driven by the RA0 output of IC1. When the RA0 output is low, Q6 is off and capacitor C1 charges via a 1kΩ resistor (which connects to the 12V supply) and via diode D1. When the RA0 output subsequently goes high, Q6 turns on and connects the positive side of C1 to ground. As a result, the Fig.2: install the parts on the PC boards as shown here . In particular, be sure to install the 7-segment LED displays with their decimal points at bottom tight and take care not to get the transistor types mixed up. than the PWM waveform. Conversely, if the input voltage is lower than the PWM voltage, the register is set to X0100000. This process continues for eight cycles, the microcon­troller progressively adding or subtracting smaller amounts of voltage (ie, 0.312V, 0.156V, 0.078V, 0.039V and 0.0195V) and the lower µF Code EIA Code IEC Code 0.39µF 394 390n 0.1µF 104 100n 18pF   18   18p bits in the 8-bit register being either set to a “1” or a “0” to obtain an 8-bit A-D conversion. Further resolution is obtained by altering the counter that’s used to generate the PWM output. By adding or subtracting a number to the count, we can alter the filtered PWM signal by a small amount – corresponding to Table 1: Resistor Colour Codes o No. o  1 o  1 o  7 o  2 o  1 o  3 o  9 o  1 38  Silicon Chip Value 1MΩ 200kΩ 10kΩ 3.3kΩ 1kΩ 680Ω 150Ω 10Ω 4-Band Code (1%) brown black green brown red black yellow brown brown black orange brown orange orange red brown brown black red brown blue grey brown brown brown green brown brown brown black black brown 5-Band Code (1%) brown black black yellow brown red black black orange brown brown black black red brown orange orange black brown brown brown black black brown brown blue grey black black brown brown green black black brown brown black black gold brown siliconchip.com.au other end of C1 goes negative and this charges ca­pacitor C2 via diode D2. C1 is again charged when Q6 turns off, while D2 now becomes reverse biased and prevents C2 from discharging via this path. Instead, the negative voltage across C2 is applied to voltage reference diode REF1 via a 3.3kΩ resistor to produce a fixed -2.49V refer­ence voltage, This voltage is then applied to pin 3 of IC2a via VR1, a 10kΩ resistor and a 1MΩ resistor (R3). In practice, VR1 is adjusted so that the applied voltage offsets the 390mV minimum output from the A-D converter. LED displays The 7-segment display data from IC1 appears at outputs RB1-RB7 and these directly drive the cathodes of the three LED dis­plays (DISP1-3) via 150Ω current limiting resistors. Note that the segments common to each display are connected together – ie, the “a” segment cathodes are all connected together, as are the “b” segments and so on. The displays are driven in multiplex fashion, with IC1 switching its RA0 & RA1 lines low in sequence to drive transis­ tors Q1 & Q2. For example, when RA0 goes low, Q1 turns on and applies power to the common anode connection of DISP1. Any low outputs on RB1-RB7 will thus light the corresponding segments of that display. After this display has been on for a short time, the RA0 output is taken high and DISP1 turns off. The 7-segment data on RB1-RB7 is then updated, after which RA1 goes low to drive Q2 and display DISP2. Transistor Q3, which switches power to DISP3, is driven in a different manner to Q1 & Q2. This transistor is off when ever either RA0 or RA1 is low (ie, if one of the other displays is on). That’s because a low on RA0 or RA1 holds LED1’s anode low (ie, at 0.6V) via either diode D4 or D3. As a result, LED1 cannot con­duct and so Q4 is off. However, when RA0 and RA1 are both high, D4 and D3 are reverse biased and Q4’s base is pulled high via the 10kΩ resistor on LED1’s anode. This turns Q4 on which in turn pulls Q3’s base low via a 680Ω resistor. And that, in turn, turns Q3 on and lights display DISP3. Of course, in practice, DISP1, DISP2 & DISP3 are switched on and off at a siliconchip.com.au The display board (shown in the case at top) plugs directly into the pin header sockets on the processor board (above), eliminating wiring connections between the two. Notice how the electrolytic capacitors on the two boards are bent over (see text), to prevent them fouling other parts. very fast rate, so that they appear to be contin­uously lit. Finally, note that the decimal point (pin 5) of DISP3 is connected to IC1’s RA2 output. RA2 is the alarm output and it normally switches low and turns on DP3 under alarm conditions. It can also be used to activate a low-current piezo siren which has its other side connected to the +5V rail. Display dimming Op amp IC2b is used to control the display brightness. This stage is wired as a unity gain amplifier and drives transistor buffer stage Q5 which is inside the negative feedback loop. Light dependent resistor LDR1 varies the voltage on pin 5 of IC2b according to the ambient light level. In daylight, the voltage on pin 5 (and thus on pin 7) is close to +5V because the resistance of the LDR is low. This means that Q5’s emitter will also be close to +5V and so virtually the full supply rail is applied to the emitters of transistors Q1-Q3 and the displays operate at full brightness. As the ambient light falls, the LDR’s resistance increases and so the voltage on pin 5 of IC2b decreases. And when it’s completely dark, the voltage on pin 5 is determined by the set­ting of trimpot VR3 which sets the minimum August 2003  39 used to power the microcontroller and display circuitry, while IC2 and Q6 are pow­ered directly from the decoupled ignition supply. OK, that completes the circuit description. Of course, most of the clever stuff takes place inside the PIC microcontroller under software control. You can download the source code (in­strum.asm) from the SILICON CHIP website. Construction The pin headers are installed on the track side of the display board using a finetipped soldering iron. Note that it will be necessary to slide the plastic spacers along the leads to allow room for soldering. This view shows how the two boards are stacked together in “piggyback” fashion to make a compact assembly. Make sure that none of the parts on the processor board contact the back of the display board. brightness level. As before, the voltage on pin 5 appears at Q4’s emitter and so the displays operate with reduced brightness. Mode switches Switches S1-S3 are all monitored using the RA4 input which is normally at 5V due to a 10kΩ pullup resistor. The other sides of S1 and S2 are connected to the RA0 and RA1 outputs respectively, while S3 connects to Q4’s col­lector. This means that pressing S1 will pull RA4 low when RA0 is low. Similarly, S2 can pull RA4 low when RA1 is low, while S3 can pull RA4 low when both RA0 and RA1 are high. As a result, the microcontroller can determine which switch has been pressed when RA4 goes low, by checking the status of both RA0 and RA1. 40  Silicon Chip Clock signals for IC1 are provided by an internal oscilla­tor circuit which operates in with crystal X1 (10MHz) and two 18pF capacitors. The two capacitors provide the correct loading for the crystal and ensure that the oscillator starts reliably. The crystal frequency is divided down internally to produce clock signals for the microcontroller operation and for the display multiplexing. Power Power for the circuit is derived from the vehicle’s igni­tion supply line. A 10Ω 1W resistor and a 100µF capacitor decou­ple this supply line, while 16V zener diode ZD1 protects the circuit against transient voltage spikes. The decoupled ignition supply is then fed to regulator REG1 which provides a +5V rail. This rail is then All the parts are mounted on two PC boards: (1) a microcon­troller board coded 05108031, and (2) a display PC board coded 05108032. These boards are stacked together using pin headers and sockets to make the interconnections, so there’s no external wiring (apart from the power supply and sensor connections). Fig.2 shows the assembly details. Begin by checking the PC boards for shorts between tracks and possible breaks and undrilled holes. That done, install all the wire links on both boards. It is important that these be installed now, as other parts mount over the top of some of the links. You can now concentrate on building the microcontroller board. Begin by installing all the resistors using Table 1 as a guide to determining the correct values. It’s also a good idea to check them using a digital multi­meter, just to make sure. Note that some of the resistors including the 7 x 150Ω units at top right, are mounted end-on to save space. Leave out R1 and R2 for the time being but be sure to install R3 (1MΩ) as shown. Next, install a socket for IC1 (taking care with its orien­tation), then install IC2, zener diode ZD1 and diodes D3 & D4. That done, install REG1 by bending its leads down by 90° so that its metal tab sits flat against the PC board. Make sure that the hole in the metal tab lines up with the hole in the PC board before soldering the leads. Trimpots VR2 & VR3 can go in next (don’t get them mixed up), followed by the capacitors. Note that the two electrolytic capacitors near the regulator must be mounted so that their bodies lie flat against REG1’s leads (see photo). Similarly, the 100µF capacitor near VR2 must be mounted so that it lies between the adjacent 200kΩ and 680Ω resistors (see photo). In practice, this simply involves siliconchip.com.au bending the capacitor leads down by 90° before installing them on the board. Note that the two electrolytic capacitors near REG1 are oriented in op­posite directions. Next, install three PC stakes at the external wiring points, then install the transistors. Q1-Q3 are all BC327s (PNP), while Q5 is a BC337 NPN type so don’t get it mixed up with the others. The remaining transistor on this board (Q4) is a BC547. Crystal X1 also mounts horizontally on the PC board. It is secured by soldering a short length of tinned copper wire between the end of its metal case and an adjacent PC pad. Finally, the three 7-way in-line sockets can be fitted. These are made by cutting two 14-pin IC sockets into single in-line strips using a sharp knife or a fine-toothed hacksaw. Clean up the rough edges with a file before installing them on the microcontroller board. Display board Now for the display board. The wire links should already be in place but if not, install them now, followed by the resistors, diodes and trimpot VR1. At this stage, you can also decide if you want the decimal point showing. Install R4 if the display is to show x.xx, or R5 if the display is to show xx.x instead. Alternatively, do not install either resistor if the decimal point is not required. Next, install the three 7-segment LED displays with their decimal points at bottom right. REF1, Q6 (BC337) and the two electrolytic capacitors can then be installed. As before, the two electrolytics are installed so that their bodies lie fat against the PC board. The LDR is mounted so that its top face is about 3mm above the displays (it can go in either way). Install it now, followed by the three pushbutton switches. Finally, complete the display board assembly by installing the pin headers. These are installed from the copper side of the board, with their pins protruding about 1mm above the top sur­face. You will need a fine-tipped iron to solder these pin head­ers. Note that you will also have to slide the plastic spacers along the pins to give sufficient room for soldering. Preparing the case Work can now begin on the plastic siliconchip.com.au Fig.3: follow this diagram when stacking the boards together and be sure to use plastic spacers where indicated. case. First, use a sharp chisel to remove the integral side pillars, then slide the micro­controller board in place and use it as a template to drill two mounting holes in the base – one through the hole in REG1’s tab and the other immediately to the left of R3. In addition, you will have to drill a hole in the back of the case to accept the power leads, plus an extra hole for the input signal lead. Once that’s done, plug the display board into the microcon­troller board and secure them together using machine screws and spacers as shown in Fig.3. Check that the leads from the parts on the display board do not interfere with any parts on the micro­ controller PC board. If necessary, trim the leads of the display board parts to prevent this. The front panel artwork (to be published next month) can now be used as a template for marking out the display cutout and the position of the hole for the LDR. That done, drill the LDR hole and drill a series of closely-space holes around the inside perimeter of the rectangle for the display cutout. The centre-piece can then be knocked out and the job filed to a smooth finish. Be sure to make the cutout just large enough, so that the red Perspex or acrylic window is a tight fit. This window can then be further secured by applying several small dabs of super glue along the inside edges. micro­controller board, apply power and use a multimeter to check that there is +5V on pins 4 & 14 of IC1’s socket (use REG1’s metal tab for the GND connection). If this is correct, disconnect power and insert IC1 in place, ensuring that it is oriented correctly. That done, plug the display board back in and apply power with the input lead con­nected to ground. The display should light and show three dashes (- - -). After about two seconds, the display should then show a number. Our prototype showed -4, but this will depend on the settings of VR1 and VR2. Now press the Mode switch – the display should now show “0” and the alarm LED should flash. Pressing the Mode switch again should now cause the display to show “100”. Press it again and the display should show 50, while the fourth press should bring up the current input reading. Our prototype showed 97 but this will again depend on the settings for VR1 and VR2. Now test the dimming feature by holding your finger over the LDR. Adjust VR1 until the display dims. Note: this trimpot is best adjusted in the dark to set the minimum brightness. Finally, check that there is -2.5V at the negative terminal of voltage reference REF1. Note, however, that this voltage could vary from this value by about 200mV due to tolerances in the reference. Testing Next month It is best to check the power supply before plugging the microcontroller IC into its socket. To do this, first unplug the display board and put it to one side. That done, connect the +12V and GND leads to the That’s all we have space for this month. Next month, we will describe how to connect different sensors to this display unit and describe the calibration procedure for these various SC sensors. August 2003  41