Silicon ChipCourtesy LED Light Delay For Cars - October 2014 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: GPS car navigation still not perfect
  4. Review: Building The Velleman K8200 3D Printer by Alan Ford
  5. Project: Currawong Stereo Valve Amplifier: A Preview by Leo Simpson & Nicholas Vinen
  6. Feature: How To Remove Rust By Electrolysis by Dr David Maddison
  7. Project: Courtesy LED Light Delay For Cars by John Clarke
  8. Subscriptions
  9. Project: Digital Effects Processor For Guitars/Musical Instruments by Nicholas Vinen
  10. Project: Passive Direct Injection (DI) Box by John Clarke
  11. Review: Signal Hound USB-SA44B Spectrum Analyser by Jim Rowe
  12. Project: Create Eerie Music With The Opto-Theremin, Pt.2 by John Clarke
  13. PartShop
  14. Vintage Radio: The Mullard 5-10 Ten Watt Valve Amplifier by Malcolm Fowler
  15. Market Centre
  16. Advertising Index
  17. Outer Back Cover

This is only a preview of the October 2014 issue of Silicon Chip.

You can view 29 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 "Currawong Stereo Valve Amplifier: A Preview":
  • Currawong 2 x 10W Stereo Valve Amplifier main PCB [01111141] (AUD $55.00)
  • Currawong Remote Control PCB [01111144] (AUD $5.00)
  • PIC16F88-I/P programmed for the Currawong Remote Volume Control [0111114A.HEX] (Programmed Microcontroller, AUD $15.00)
  • Front & rear panels for the Currawong 2 x 10W Stereo Valve Amplifier [01111142/3] (PCB, AUD $30.00)
  • Currawong 2 x 10W Stereo Valve Amplifier acrylic top cover (PCB, AUD $30.00)
  • Currawong 2 x 10W Stereo Valve Amplifier top cover cutting diagram (Software, Free)
  • Firmware and source code for the Currawong Remote Volume Control [0111114A.HEX] (Software, Free)
  • Currawong 2 x 10W Stereo Valve Amplifier main PCB pattern [01111141] (Free)
  • Currawong 2 x 10W Stereo Valve Amplifier panel artwork (PDF download) (Free)
Articles in this series:
  • Currawong Stereo Valve Amplifier: A Preview (October 2014)
  • Currawong Stereo Valve Amplifier: A Preview (October 2014)
  • Currawong 2 x 10W Stereo Valve Amplifier, Pt.1 (November 2014)
  • Currawong 2 x 10W Stereo Valve Amplifier, Pt.1 (November 2014)
  • Currawong 2 x 10W Stereo Valve Amplifier, Pt.2 (December 2014)
  • Currawong 2 x 10W Stereo Valve Amplifier, Pt.2 (December 2014)
  • The Currawong 2 x 10W Stereo Valve Amplifier, Pt.3 (January 2015)
  • The Currawong 2 x 10W Stereo Valve Amplifier, Pt.3 (January 2015)
  • Modifying the Currawong Amplifier: Is It Worthwhile? (March 2015)
  • Modifying the Currawong Amplifier: Is It Worthwhile? (March 2015)
  • A New Transformer For The Currawong Valve Amplifier (October 2016)
  • A New Transformer For The Currawong Valve Amplifier (October 2016)
Items relevant to "Courtesy LED Light Delay For Cars":
  • Car LED Courtesy Light Delay PCB [05109141/15109141] (AUD $7.50)
  • PIC12F675-E/P programmed for the Courtesy LED Light Delay for Cars [0510914A.HEX/1510914A.HEX] (Programmed Microcontroller, AUD $10.00)
  • Firmware for the Courtesy LED Light Delay for Cars [0110514A.HEX] (Software, Free)
  • Car LED Courtesy Light Delay PCB pattern (PDF download) [05109141/15109141] (Free)
  • Courtesy LED Light Delay for Cars top panel artwork (PDF download) (Free)
Items relevant to "Digital Effects Processor For Guitars/Musical Instruments":
  • Dual-Channel Audio Delay / Stereo Echo & Reverb / Digital Effects Processor PCB [01110131] (AUD $15.00)
  • PIC32MX470F512H-I/PT programmed for the Digital Effects Processor [0120914A.HEX] (Programmed Microcontroller, AUD $20.00)
  • Extra parts for the Dual-Channel Audio Delay / Stereo Echo & Reverb / Digital Effects Processor (Component, AUD $20.00)
  • Firmware (C and HEX) files for the Digital Effects Processor [0120914A.HEX] (Software, Free)
  • Dual-Channel Audio Delay / Stereo Echo & Reverb / Digital Effects Processor PCB pattern (PDF download) [01110131] (Free)
Items relevant to "Passive Direct Injection (DI) Box":
  • Passive Direct Injection (DI) Box PCB [23109141] (AUD $5.00)
  • Passive Direct Injection (DI) Box PCB pattern (PDF download) [23109141] (Free)
  • Passive Direct Injection (DI) Box panel artwork (PDF download) (Free)
Items relevant to "Create Eerie Music With The Opto-Theremin, Pt.2":
  • Opto-Theremin PCB [23108141] (AUD $15.00)
  • Proximity Sensor PCB for the Opto-Theremin [23108142] (AUD $5.00)
  • TDA7052A 1.1W audio amplifier IC (DIP-8) (Component, AUD $3.00)
  • MC1496BDG or MC1496DR2G Balanced Modulator/Demodulator IC (SOIC-14) (Component, AUD $3.00)
  • Opto-Theremin top and side panel artwork (PDF download) (Free)
Articles in this series:
  • Create Eerie Music With The Opto-Theremin, Pt.1 (September 2014)
  • Create Eerie Music With The Opto-Theremin, Pt.1 (September 2014)
  • Create Eerie Music With The Opto-Theremin, Pt.2 (October 2014)
  • Create Eerie Music With The Opto-Theremin, Pt.2 (October 2014)

Purchase a printed copy of this issue for $10.00.

Courtesy LED Lights Delay For Cars Most modern cars have a courtesy light delay but older vehicles do not. This new circuit is specifically designed to suit LED lamps but will also work with conventional filament lamps. It keeps the interior lights of your car lit for a preset time after you shut the car doors. The lights will also turn off if the exterior lights or ignition are switched on during the time-out period. I F YOU BUILD this courtesy light delay unit, you will be able to upgrade your vehicle to LED interior lighting (see SILICON CHIP, December 2013). LEDs give much improved lighting compared to the yellow of incandescent lamps and the bulb diffusers will not discolour with age. We previously published a Courtesy Lights Delay unit in June 2004 and this has proved surprisingly popular. And while that project is still fine for 12V filament bulbs, it won’t work with LED lighting unless you have at least one filament bulb connected; not the best compromise. Just why our previous Courtesy Light Delay from 2004 doesn’t work with LEDs can be understood by look- Main Features •  Adjustable delay (1-133s) •  Works with both 12V LED lamps and incandescent/halogen filament lamps •  Low standby current drain •  Works with positive and negative door switch configurations •  Interior lamps go off when exterior lights or ignition are switched on 34  Silicon Chip ing at Fig.1 which shows the earlier design concept. It’s based on a Mosfet (Q1), two capacitors (C1 & C2) and a 1MΩ discharge resistor. When the door switch is closed, the interior lamp(s) light and the capacitors are discharged. The instant the door switch opens, the two capacitors charge via the filaments in the interior lighting. Due to the different values of the two series-connected capacitors, the 47µF capacitor (C2) will charge to a voltage that’s about 10 times higher than the voltage across the 470µF capacitor (C1). So with a 12V supply and taking into account the 0.7V drop across diode D1, the 47µF capacitor will have about 10.2V across it and the 470µF capacitor about 1.02V. The 10.2V across C2 becomes the gate voltage for the Mosfet which then drives the lamps. After a short time, the gate voltage discharges via the 1MΩ resistor and the lamps go off. As shown in Fig.1, a few refinements were also included. These include adding a short time delay to prevent Mosfet Q1 from switching on instantly when the door switch opens. This is to allow time for capacitors C1 & C2 to charge sufficiently before the Mosfet switches on and shunts the door switch. This delay is achieved using transistor Q2, which is momentarily switched on at power-up (ie, when the door switch opens) due to base drive through the 100nF capacitor and 10kΩ resistor. When Q2 switches on, it momentarily shunts Q1’s gate to ground. This prevents Q1 from conducting until the 100nF capacitor charges. The duration is only 1ms and any tendency for the lamp to briefly flicker off as the door switch opens is virtually unnoticeable. The full circuit published in June 2004 also included additional circuitry to switch off the Mosfet (and thus turn the interior lamps off) if the tail lights were activated (ie, if the parking lights or headlights were switched on). As stated, this circuit doesn’t work with LED lighting. That’s because the circuit relies on current flowing through the lamp filaments, just after they are switched off, to charge capacitors C1 & C2. Typically, a 5W lamp filament will have a resistance of about 29Ω when it is hot and so the 47µF capacitor takes much less than 1ms to charge. However, interior lighting often uses more than one lamp and so the charging resistance is usually much lower than 29Ω. By contrast, typical 12V LED lamps incorporate two or three white LEDs siliconchip.com.au + DOOR SWITCH 100nF C1 470 µF 10k D1 1N4004 A 100k K B C2 47 µF 470Ω 1M 22k D Q1 G S C Q2 E – DOOR SWITCH By JOHN CLARKE Fig.1: the basic design concept of our 2004 Courtesy Light Delay. It relied on current flowing through the lamp filaments to charge capacitors C1 & C2 immediately after the door switch opened. Other Uses This PCB module is not just confined to vehicle use. Its circuit can also be used for timed lighting, such as in a hallway, provided you use 12V LEDs run from a 12V DC supply. A pushbutton momentary switch would be used to switch the lights on and they would then turn off automatically at the end of the preset period. This would also be ideal for a stairwell with one or several pushbutton start switches (eg, one on each floor). With a 12V supply, up to 36W (3A) of lighting can be controlled and these could be powered from a 3A 12V power brick or similar (or use a 2A plugpack for up to 24W of lighting). Note that the pushbutton switch needs to be rated for the total current drawn by the LED lighting. connected in series with a currentlimiting resistor. The voltage drop across each LED is typically 3.5V for a white LED and so the total voltage drop is around 7V with two in series or about 10.5V with three in series. So there is not much left of the 12V supply to charge the capacitors shown in Fig.1. When twin-LED lamps are used in this circuit, the resulting gate voltage will be around 2.9V when using a standard diode for D1 and 3.13V when using a Schottky diode. We do not get the expected 3.8V because of the voltage drop across the current-limiting resistor in the LED lamp. Now 3.13V is too low to fully switch on most Mosfets, including typical logic level types that can conduct (at least partially) with a 3V gate-to-source siliconchip.com.au +12V +12V + + DOOR SWITCH – λ LAMP + LED LAMP λ + LAMP – DOOR SWITCH – λ LED LAMP λ – (a) (b) Fig.2: the door switch can either be on the chassis side of the interior lamp (a) or on the +12V side (b). Both the June 2004 circuit and the new circuit described here work with either configuration. voltage but switch off below 2.5V. This means that LED lamps will not be correctly switched on by the circuit of Fig.1. Even if we substitute a Mosfet with a very low on-threshold voltage, it would be difficult to get a consistent delay period due to the low capacitor voltages compared to this threshold. It’s unfortunate that this circuit doesn’t work with LED lighting because it has several desirable features. First, there’s no need to connect it directly to the vehicle’s 12V supply; you just connect across a door switch (in a vehicle with incandescent interior lamps) and it works. In addition, the circuit will operate regardless as to whether the door switch is on the negative side of the lamp (Fig.2a) or the positive side (Fig.2b). Provided it’s connected with the correct polarity across the door switch, the circuit works in exactly the same manner for both ‘high side’ and ‘low side’ switching. So how do we design a circuit to operate with LEDs? In this case, we need to connect our new circuit directly to the 12V supply as well as to a door switch. And if we want the interior lamps to switch off when the parking lights or ignition are turned on, then these too need to be monitored by the circuit. LED version Our new Courtesy LED Lights Delay circuit is shown in Fig.3. Unlike the June 2004 circuit, it also monitors the ignition as well as the exterior lights. Monitoring the parking lights or tail lights is only useful for night-time driving, since you are unlikely to use the lights during the day. By monitoring the ignition line, the courtesy lamps will immediately go out if the car is started rather than having to wait for the delay period to expire. As with our previous circuit, the Courtesy LED Lights Delay operates with the door switch in either configuration (ie, high-side or low-side). Again, it’s only necessary to wire the circuit to a door switch with the correct polarity. It’s not necessary to know how the door switch is connected in the vehicle; you just have to identify its positive and negative leads. October 2014  35 C E 1 µF 1 µF 1k K B D5 Q3 BC337 C E A 7 2 GP5 GP0 Vss 8 IC1 PIC12F675 –I/P COURTESY LED LIGHTS DELAY CON1 7 LIGHTS 6 LIGHTS – BR1 W04 1k IGNITION 20 1 4 ~ ~ B 10k 5 4 0V SC  4 4.7k 2 1 + E C Q2 BC337 A 5 6 OPTO1: 4N25 VR1 100k TIME OUT 100nF 30V 1W λ 10k 1nF 6 4 AN1/GP1 MCLR/GP3 1 Vdd GP4 GP2 5 3 100nF +5V 10 µF GND K ZD1 Fig.3: the circuit uses PIC microcontroller IC1 to set the delay period. It also monitors the door switches, exterior lights and ignition. When a door switch is opened, IC1’s GP4 output drives Mosfet Q1 (and thus the lamps) via transformer T1 and bridge rectifier D1-D4 for the delay period, as set by VR1. If the ignition or exterior lights are switched on, GP5 is pulled low (either by Q2 or OPTO1) and this immediately puts the micro to sleep and turns the interior lamps off. S D G IN 10k OUT GND LM2936 D1 D3 9T 1k 100nF T1 A 24T K K A D2 K A K A K A D4 1 µF A B 1M G K BC 33 7 S D D STP60NF06 Q1 STP60– NF06 2 +~~– W04 SWITCH – SWITCH + CON1 1 D5, D6: 1N4004 D1–D4: 1N4148 OUT IN REG1 LM2936-5.0 K D6 A +12V 3 100Ω 36  Silicon Chip The other connections to the circuit are to +12V, chassis (0V), ignition and the switched supply for the vehicle’s exterior lights. The lights connection can be regarded as optional; in many cases, it will be sufficient to simply monitor the ignition line to automatically turn the interior lamps off before the delay period has ended (ie, when the car is started). The lights input connects across the parking lights or tail lights (but not the stop lights) and can be connected with either polarity. If the courtesy lights use a low-side switching arrangement, Mosfet Q1’s source terminal will be connected to ground via SWITCH-. But this won’t be the case with high-side switching. You might expect that this could be solved by driving Q1 with an IR2125 (or similar) Mosfet driver which could produce a suitable gate drive above the Mosfet’s source voltage, whether that rises to the 12V supply (for a high-side connected Mosfet) or 0V (for a low-side connected Mosfet). However, in the high-side config­ uration, this scheme relies on a lowimpedance source load such as a light bulb to charge the boost capacitor during the Mosfet’s off-time. This capacitor is subsequently used to generate a voltage above the 12V supply when the Mosfet switches on, so that it remains in conduction. Once again, using LEDs for the load will mean that the capacitor will only charge to 12V minus the voltage drop of the LEDs. Ultimately, we would still be restricted to only a couple of volts for the Mosfet gate supply, so it won’t work for the same reasons outlined earlier. Another problem is that the IR2125’s quiescent current is rather high, at up to 1.2mA. To get around this problem, our circuit is based on a PIC12F675-I/P microcontroller (IC1) and this drives Mosfet (Q1) via transformer T1. IC1 produces a 1MHz square-wave to drive the transformer and it provides a timing function to switch off this signal after a set period (the delay). This delay period can be adjusted using trimpot VR1. In operation, microcontroller IC1 detects when a door switch is opened to start the delay period. It also monitors when the ignition or lights are switched on to cancel the delay period. Because the circuit is always connected to the vehicle’s 12V battery, siliconchip.com.au Specifications Delay period: adjustable from 1-133 seconds Dim down period: 1s (can be extended by changing 1µF gate capacitor on Q1) Quiescent current: 17µA maximum, 9µA typical, 7.6µA measured (sleep mode, lamp off) Current when running: 36mA plus LED lamp current it’s vital that microcontroller IC1 has a low quiescent supply current. As a result, IC1 is normally in ‘sleep’ mode and draws negligible current (up to 2µA maximum). In fact, most of the quiescent current is drawn by 3-terminal regulator REG1, as described later. IC1’s GP2 input indirectly monitors the door switch which is wired across the Mosfet. As shown, Q1’s drain connects to the positive side of the switch, while its source connects to the negative terminal. GP2 is normally held high via an internal pull-up resistor. When the door switch is in the ground side (see Fig.2a), a closed switch pulls GP2 low via a 1kΩ resistor and diode D5. At the same time, transistor Q3 will be off since Q1’s source is at ground and so Q3’s base is held at 0V. Alternatively, if the door switch is connected in the positive side of the supply as in Fig.2b, a closed switch drives Q3’s base via a 10kΩ resistor. As a result, Q3 turns on and pulls GP2 low. In this case, diode D5 is reverse biased as Q1’s drain is connected to the positive supply. So, for either connection of the door switch, IC1’s GP2 input is high when the switch is open and goes low when the switch closes. IC1 is configured to generate an interrupt on a positive edge at input GP2 and when the door switch subsequently opens again, this interrupt wakes IC1 from its sleep mode. The microcontroller’s firmware then starts an internal oscillator and this produces a 1MHz clock output at pin 3. This then drives transformer T1 via a 100nF capacitor. Diodes D1-D4 rectify the voltage from T1’s secondary and the resulting DC is filtered by a 1µF capacitor. This in turn switches on Mosfet Q1 to drive the interior lights, just as if a door switch was closed. Note that D1-D4 are 1N4148s since a standard bridge rectifier would not work at 1MHz. The end result is that Q1’s gate is charged sufficiently above its source to ensure it switches on, regardless of siliconchip.com.au whether the source voltage is actually 0V or 12V. This configuration is known as a ‘floating gate supply’. At the same time as Q1 is switched on, IC1’s GP0 output is taken low (to 0V) and this connects a 5V supply across trimpot VR1 (100kΩ). The setting at VR1’s wiper is then read via IC1’s AN1 input. The GP0 output is then taken high to stop the current flowing through VR1 and this is done to minimise the current drain, particularly during sleep mode. IC1 goes to sleep again at the end of the time-out period, as set by VR1. This stops the 1MHz drive to transformer T1 and Mosfet Q1 then quickly dims the interior lights over a nominal one second period as its 1µF gate capacitor discharges via a parallel 1MΩ resistor. Basically, the Mosfet’s internal impedances rises in response to decreasing gate voltage, thereby dimming the lights until they are ultimately completely off. Interrupting the delay IC1 monitors the ignition and taillights circuits via its GP5 input at pin 2. If either the ignition or lights are switched on during the time-out period, the PIC immediately goes to sleep and the interior lights go out. In greater detail, GP5 is normally held high via an internal pull-up resistor. If the ignition is switched on (eg, when the car is started), it drives the base of Q2 via a 10kΩ resistor. Q2 thus turns on and pulls GP5 (pin 2) of IC1 low to put the micro to sleep. Alternatively, if the external lights are switched on, the resulting 12V DC supply is fed through bridge rectifier BR1 and drives the LED in optocoupler OPTO1. This in turn switches on OPTO1’s output transistor, again pulling GP5 (pin 2) of IC1 low and putting the micro to sleep. BR1 and optocoupler OPTO1 ensure that the lights circuit will work regardless of how they are switched in the vehicle. It doesn’t matter whether the lights are ground connected and Parts List 1 double-sided PCB, code 05109141, 71 x 47mm 1 UB5 jiffy box, 83 x 54 x 31mm 1 panel-mount cable gland for 6.5mm diameter cable 1 ferrite toroid ring core, L8 material, 18mm OD, 10mm ID, 6mm high (Jaycar LO-1230) 1 8-pin DIL IC socket 1 3-way PCB-mount screw terminal block (5.08mm spacing) (CON1) 2 2-way PCB-mount screw term­inal blocks (5.08mm spacing) (CON1) 1 M3 x 6mm tapped Nylon spacer 1 M3 x 12mm machine screw 1 M3 nut 2 100mm cable ties 1 700mm length of 0.8mm enamelled copper wire 1 100kΩ miniature horizontal trimpot (VR1) Semiconductors 1 PIC12F675-I/P microcontroller programmed with 0510914A.hex (IC1) 1 4N25 or 4N28 optocoupler (OPTO1) 1 LM2936-5.0 low dropout 5V regulator (REG1) 1 STP60NF06 60V N-channel Mosfet or similar (Q1) 2 BC337 NPN transistors (Q2,Q3) 1 W04 400V 1.2A bridge rectifier (BR1) 4 1N4148 diodes (D1-D4) 2 1N4004 1A diodes (D5,D6) 1 30V 1W zener diode (ZD1) Capacitors 1 10µF 16V electrolytic 1 1µF 16V electrolytic 2 1µF monolithic multi-layer ceramic 3 100nF MKT (code 100n or 104) 1 1nF MKT (code 1n or 102) Resistors (0.25W, 1%) 1 1MΩ 3 1kΩ 2 10kΩ 1 100Ω 1 4.7kΩ Miscellaneous Automotive wire, crimp connectors, quick splice connectors switched to positive or connected to positive and switched to ground. Power supply Power for the PIC microcontroller is derived from the vehicle’s 12V supply October 2014  37 D5 4148 4148 4004 1nF 100nF IC1 PIC12F675 9T 100nF 1k 1k Q2 10k 100k T1 24T BC337 VR1 ~ BC337 BR1 1 µF Q3 C 2014 30V 4004 ZD1 ~ – ~ – 4N28 4.7k W04 OPTO1 1 + TIMEOUT 4148 4148 10k 1k 100Ω D6 ~ LIGHTS LIGHTS 100nF REG1 14190150 IGN. IGNITION Q1 10k 0V + -ST H GIL N GI V 0 V 2 1 + H CTI WS +12V 1 µF + SWITCH +12V 0V SWITCH – 10 µF D3 D1 D2 D4 1 µF 1M + SWITCH + CON1 Fig.4: follow this diagram and the photo at left to build the Courtesy LED Lights Delay. The connection to the exterior lights circuit is optional. LEADS BENT DOWN BY 90° M3 NUT Q1 M3 x 6mm NYLON SPACER M3 x 15mm SCREW PCB Fig.5: Mosfet Q1 is mounted horizontally, with its tab secured to an M3 x 6mm Nylon spacer. Be sure to feed the M3 x 15mm screw that secures Q1’s tab to the spacer up through the bottom of the PCB. via an LM2936 5V automotive regulator (REG1). This regulator can handle a reversed supply input and has voltage transient clamping. Diode D6, zener diode ZD1 and the 100Ω resistor are included to add extra protection. The overall quiescent current of the circuit is very low at around 9µA typical and is mainly due to the minimum current drawn by REG1. Software Not much is required in the way of software for IC1. As stated, it includes a rising edge interrupt handler that wakes the PIC from sleep whenever a door switch is opened from its closed position. The PIC’s internal oscillator is then automatically started and it generates the 1MHz clock signal at pin 3. The delay counter is set from 1-133s, depending on the 8-bit ADC reading from AN1 and this period is timed using the overflow period of the internal 16-bit timer (timer 1), which occurs every 524ms. When the delay counter reaches zero, the PIC is placed back into sleep mode so that it draws minimal power and the 1MHz clock signal ceases. During the delay period, the GP5 input is monitored and if this goes low, the processor is immediately placed in sleep mode and the LED lights quickly dim to off. make sure that the diodes and zener diode go in with the correct polarity. The zener diode is a 30V type and will probably be marked as a 1N4751. OPTO1, the 4N25 optocoupler, is installed next, along with an 8-pin DIL socket for IC1. Be sure to orientate these parts as shown on the overlay (ie, pin 1 at top left). Transistors Q2 & Q3, regulator REG1 and bridge rectifier BR1 can now go in. Check that the LM2950-5.0 device goes in the REG1 position and check that BR1 is correctly orientated and sits flush against the PCB before soldering its leads. The capacitors are next on the list. Watch the orientation of the electrolytics and make sure that their tops are no more than 12.5mm above the PCB, otherwise they will later foul the lid of the case. The parts list shows the codes used for the 100nF and 1nF capacitors. Connector CON1 is made up using one 3-way and two 2-way screw terminal blocks. These should be dovetailed together to form a 7-way block which is then mounted on the PCB with the wire entry holes facing towards the adjacent edge. Make sure that this 7-way connector sits flush against the PCB before soldering the pins. Mosfet Q1 is mounted horizontally on the PCB with its metal tab secured to an M3 x 6mm Nylon spacer. To do this, first bend the Mosfet’s leads down through 90° about 1mm from its body, Construction The Courtesy LED Lights Delay is built on a double-sided PCB coded 05109141 and measuring 71 x 47mm. This clips neatly into the side channels of a UB5 plastic case and there is sufficient room to install a cable gland at the terminal block end. Fig.4 shows the parts layout on the PCB. Install the resistors first, followed by diodes D1-D6 and zener diode ZD1. Check each resistor with a multimeter before soldering it in position and Table 1: Resistor Colour Codes   o o o o o o No.   1   2   1   3   1 38  Silicon Chip Value 1MΩ 10kΩ 4.7kΩ 1kΩ 100Ω 4-Band Code (1%) brown black green brown brown black orange brown yellow violet red brown brown black red brown brown black brown brown 5-Band Code (1%) brown black black yellow brown brown black black red brown yellow violet black brown brown brown black black brown brown brown black black black brown siliconchip.com.au then fit the Mosfet in position and slide the Nylon spacer into position under its tab. The assembly is then secured to the PCB using a M3 x 12mm screw and nut – see Fig.5. Note that this screw must be inserted from the underside of the PCB, so that the nut goes on top of Q1’s tab. That’s because the screw head is small enough not to foul adjacent PCB tracks, whereas the larger nut would run the risk of shorting out an adjacent 1µF capacitor. Do the screw up firmly to secure the assembly, then solder the Mosfet’s leads to the PCB. Winding T1 The PCB assembly can now be completed by winding and installing transformer T1. This transformer consists of two windings on a ferrite ring core, as shown in Fig.4. The first winding consists of nine turns of the 0.8mm enamelled copper wire, while the second consists of 24 turns of 0.8mm enamelled copper wire. They are wound on opposite sections of the core and it doesn’t matter in which direction they are wound. Once the windings are in place, position the toroid on the PCB. The 9-turn winding goes through pads at the lower righthand side of the PCB, while the 24-turn winding goes to a pad just to the right of Q3 and to a pad at top right. Push the toroid all the way down onto the PCB, the secure it in position using a couple of cable ties. These pass through the centre hole of the toroid and through adjacent holes on either side. Note that the enamel coating will need to be scraped off the wires before soldering them to the PCB. Testing Before installing the PIC micro, connect a 12V supply to CON1 and check that there is about 5V (4.85-5.15V) between pins 1 and 4 of IC1’s socket. If this voltage is correct, disconnect the power and install IC1 with its pin 1 to the top left. If the voltage is incorrect, check the orientation of D6, the value of the series 100Ω resistor and that REG1 is an LM2936-5.0. If you have a spare 12V LED lamp, this can be used to test the circuit before installing it in the vehicle. Do not use a white LED on its own. It must be a LED lamp with a limiting resistor to keep the current to a safe level for the LEDs. siliconchip.com.au Assuming you have a spare LED lamp, connect it between the switch minus terminal (pin 2 of CON1) and 0V (pin 4 of CON1). Note that the polarity is important here – the anode or positive side of the LED lamp must go to the switch minus terminal. Now reapply power – the LED lamp should light for a second or so, then quickly dim to off. If that checks out, momentarily bridge the switch terminals on CON1 (pins 1 & 2). The LED lamp should now light for the length of time set by trimpot VR1 (note: timing begins when the door switch opens; ie, when the door is closed). Assuming it works as expected, VR1 can now be adjusted to set the required delay. This ranges from 1-133s but note that the circuit’s response to the trimpot setting is non-linear. The fully anticlockwise to mid-position setting has the range of 1-33s, while the next half of the travel is divided into two equal sections. The first section has a range from 33-66s, while the remaining clockwise section sets the delay from 66-133s. Having set the delay period, you can test that the ignition input works. That’s done by first triggering the delay period, then connecting the ignition input (pin 5 of CON1) to +12V using a wire link. When you do this, the lamp should extinguish after one second or so. Note that you will need to set a reasonably long delay time for this test, to give yourself time to connect the ignition input to the +12V terminal. Similarly, you can check that the lights inputs work by triggering the delay and connecting either pin 6 or pin 7 of CON1 to +12V and the other pin to ground. Again, the LED lamp should turn off after a second or so. If you wish, you can increase this 1s dim-down period by increasing the 1µF electrolytic capacitor value at the Q1 gate. It will be around 10s with a 10µF capacitor. Note that this dimming period is additional to the time-out or delay period. So if the time-out is set at 15s, the overall LED ‘on-period’ will be 15s plus the dimming period. For 1s dimming, the total time-out will be 16s. Final assembly If it all works as expected, drill a 12.5mm hole in the end of the UB5 box for the cable gland. This hole should be positioned 13mm down from the top 0.0006% DISTORTION! Perfect match for our new Majestic speakers! It’s yours with the 200W Ultra Ultra LD LD Amplifier Mk3 Amplifier from from SILICON CHIP It’s easily the best class A-B amplifier design we’ve ever published – and we believe it’s the best ever published ANYWHERE! Outstanding per formance, easy to build and get going . . . If you want the ultimate in high-power amplifiers, you want the Ultra LD! Want to know more? Go to: siliconchip.com.au/Project/Ultra-LD+Mk.3 PCBs & special components available from PartShop LOOKING FOR A PCB? PCBs for most recent (>2010) SILICON CHIP projects are available from the SILICON CHIP PartShop – see the PartShop pages in this issue or log onto siliconchip.com.au/PCBs You’ll also find some of the hard-to-get components to build your SILICON CHIP project, back issues, software, panels, binders, books, DVDs and much more! Please note: the SILICON CHIP PartShop does not sell kits; for these, please refer to kit supplier’s adverts in this issue. October 2014  39 This is the view inside the completed Courtesy LED Light Delay. It’s best to make the external wiring connections to CON1 with the PCB out of the case. The wires are then pushed back out through the cable clamp as the PCB is clipped into position. of the box and centred horizontally. Drill a small pilot hole to begin with, then carefully enlarge it to size using a tapered reamer and mount the cable gland in position. The assembled PCB is now simply clipped into the UB5 box with CON1 adjacent to the cable gland. This gland clamps the external wiring cable to prevent the connecting wires from being pulled out of CON1. Installation To connect the unit, you will need to access one of the door switches, +12V power, the ignition line and either the tail light or parking light connections. Alternatively, you may wish to just use the ignition input and not bother with the lights input. Note that some door switches will have two wires while others have only a single wire connection. In the latter case, one contact is connected directly to chassis at the switch mounting position. It’s important to get the door switch connections to the unit the right way around. The positive door switch connection must go to the switch positive of the Courtesy LED Light Delay. You can quickly determine which is the positive door switch connection by using a multimeter to measure the voltage across the door switch when it is pushed open. Note that if there’s only a single wire running to the switch, this will be the positive (assuming the chassis connection is negative). 40  Silicon Chip For the +12V supply rail, you will need to find a source of +12V that remains on when the ignition is off. This +12V supply rail must be protected by a fuse in the vehicle’s fusebox and is best derived at the fusebox itself. The 0V lead can be run to an eyelet connector that’s screwed to the chassis. The lights terminals on the Courtesy LED Lights Delay are connected across one of the tail lights or parking lights. You can access this wiring either directly at the lights socket wiring, at the lights switch or in the fusebox. It doesn’t matter which way around you connect them, since the bridge rectifier automatically caters for both polarities. Once you have found the relevant wiring points, it’s a good idea to disconnect the vehicle’s battery before running the wiring, to guard against any inadvertent short circuits. Note that all wiring should be run using proper automotive cable and connectors. Once the wiring is complete, reconnect the battery and check that the courtesy lights remain on after the door is closed. Now turn the ignition (or the exterior lights) on and the courtesy lights should quickly dim to off (over 1s or so). Finally, the unit can be mounted in any convenient location under the dashboard. It’s up to you how you secure it, since a suitable position will vary from vehicle to vehicle. Existing delay circuit What if your vehicle already has a courtesy lights delay? This may work fine if you substitute LED interior lamps for your car’s original incandescent lamps but there’s always a possibility that it may not. In that case, you may wish to use the SILICON CHIP Courtesy LED Lights Delay instead. One problem here is that the door switches will probably be connected to the existing delay circuit rather than directly to the interior lamps. Bypassing this delay circuit will therefore involve disconnecting all the door switches and wiring them directly to the interior lamps instead. That’s too complicated (and time consuming) to be practical in most cases but there is a way around this – keep the original delay circuit and simply add the SILICON CHIP Courtesy LED Lights Delay unit to the existing installation. That’s done by connecting the SILICON CHIP delay unit in parallel with the existing unit across one of the door switches. There’s just one wrinkle to watch out for here – the original delay circuit may pull one side of the door switch to +5V rather than +12V. This should be checked using a multimeter and if it does go to +5V, the 1kΩ pull-down resistor connected to Q3’s base will have to be increased to 10kΩ (otherwise the transistor won’t turn on). Note that, depending on the circuit used, the original delay period may be added to the delay introduced by the SILICON CHIP unit. That won’t be a problem, however, since the Courtesy LED Lights Delay period can be adjusted down to as low as 1s. Note also that connecting the Courtesy LED Lights Delay in parallel with an existing delay circuit may not work in all cases. It will very much depend on the vehicle and the circuit used. Troubleshooting If the courtesy lights are always on, the door switch terminals have probably been connected to CON1 (at pins 1 & 2) with reverse polarity. If that happens, the courtesy lights turn on via the intrinsic reverse diode inside Mosfet Q1 and simply swapping the leads to the door switch will fix the problem. Finally, if the interior lights switch off immediately after the door is closed (and the connections are correct), check that there is no voltage applied to either the lights terminals or the ignition terSC minal on CON1 (pin 5, 6 & 7). siliconchip.com.au