Silicon ChipULTRABRITE LED PUSHBIKE LIGHT - September 2020 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Subscriptions: PE Subscription
  4. Subscriptions: PicoLog Cloud
  5. Back Issues: PICOLOG
  6. Publisher's Letter
  7. Feature: The Fox Report by Barry Fox
  8. Feature: Techno Talk by Mark Nelson
  9. Feature: Net Work by Alan Winstanley
  10. Project: ULTRABRITE LED PUSHBIKE LIGHT by Daniel Doyle Nicholas Vinen
  11. Back Issues: LFSR Random Number Generator Using Logic ICs by Tim Blythman
  12. Project: The Micromite Explore-28 by Geoff Graham
  13. Project: Three Stepper Motor Drivers by Jim Rowe
  14. Feature: Cheap and easy compact speaker enclosures by Julian Edgar
  15. Feature: Circuit Surgery by Ian Bell
  16. Feature: Make it with Micromite by Phil Boyce
  17. Feature: Max’s Cool Beans by Max the Magnificent
  18. Feature: PICn’Mix by Mike Hibbett
  19. Feature: AUDIO OUT by Jake Rothman
  20. PCB Order Form
  21. Advertising Index

This is only a preview of the September 2020 issue of Practical Electronics.

You can view 0 of the 72 pages in the full issue.

Articles in this series:
  • Techno Talk (September 2020)
  • Techno Talk (October 2020)
  • (November 2020)
  • Techno Talk (December 2020)
  • Techno Talk (January 2021)
  • Techno Talk (February 2021)
  • Techno Talk (March 2021)
  • Techno Talk (April 2021)
  • Techno Talk (May 2021)
  • Techno Talk (June 2021)
  • Techno Talk (July 2021)
  • Techno Talk (August 2021)
  • Techno Talk (September 2021)
  • Techno Talk (October 2021)
  • Techno Talk (November 2021)
  • Techno Talk (December 2021)
  • Communing with nature (January 2022)
  • Should we be worried? (February 2022)
  • How resilient is your lifeline? (March 2022)
  • Go eco, get ethical! (April 2022)
  • From nano to bio (May 2022)
  • Positivity follows the gloom (June 2022)
  • Mixed menu (July 2022)
  • Time for a total rethink? (August 2022)
  • What’s in a name? (September 2022)
  • Forget leaves on the line! (October 2022)
  • Giant Boost for Batteries (December 2022)
  • Raudive Voices Revisited (January 2023)
  • A thousand words (February 2023)
  • It’s handover time (March 2023)
  • AI, Robots, Horticulture and Agriculture (April 2023)
  • Prophecy can be perplexing (May 2023)
  • Technology comes in different shapes and sizes (June 2023)
  • AI and robots – what could possibly go wrong? (July 2023)
  • How long until we’re all out of work? (August 2023)
  • We both have truths, are mine the same as yours? (September 2023)
  • Holy Spheres, Batman! (October 2023)
  • Where’s my pneumatic car? (November 2023)
  • Good grief! (December 2023)
  • Cheeky chiplets (January 2024)
  • Cheeky chiplets (February 2024)
  • The Wibbly-Wobbly World of Quantum (March 2024)
  • Techno Talk - Wait! What? Really? (April 2024)
  • Techno Talk - One step closer to a dystopian abyss? (May 2024)
  • Techno Talk - Program that! (June 2024)
  • Techno Talk (July 2024)
  • Techno Talk - That makes so much sense! (August 2024)
  • Techno Talk - I don’t want to be a Norbert... (September 2024)
  • Techno Talk - Sticking the landing (October 2024)
  • Techno Talk (November 2024)
  • Techno Talk (December 2024)
  • Techno Talk (January 2025)
  • Techno Talk (February 2025)
  • Techno Talk (March 2025)
  • Techno Talk (April 2025)
  • Techno Talk (May 2025)
  • Techno Talk (June 2025)
ULTRABRITE LED PUSHBIKE LIGHT This tiny (22 × 12mm) circuit board is a high-efficiency LED driver that delivers a constant 1A or 2.2A. You can use it with a 12V white LED array to make a (very!) bright bicycle light, a torch or another light source. It can be powered from a lithium-ion or LiPo battery pack but there are other options. It also has brightness control and a flashing function. It’s a very compact and modern design, for advanced constructors. Design by Daniel Doyle – words by Nicholas Vinen T here are plenty of bicycle lights and LED Operating principle torches on the market, but there are certain advantages This LED driver is a ‘buck’ step-down DC/DC converter with to building your own. You get to choose the battery, so current regulation. It efficiently reduces the 15-21V battery you could use a high-capacity rechargeable lithium-ion or LiPo supply voltage down to around 12V, as required by the LED battery that would last for many hours of use. These are not array. The LED voltage is not regulated directly; rather, the terribly expensive, and can last for many years if treated well. circuit attempts to maintain 1A through the LED array, at You also get to choose the LED(s), so you can use a really whatever voltage is required, from virtually nothing up to the full input voltage. efficient one for maximum battery life and brightness. Fig.1 shows the basic configuration of a buck regulator. And you can also tailor the optics to suit your needs. You can build it with a tight, bright beam or a wider beam to im- Switch S1 is electronically toggled on and off rapidly to control the current through inductor L1. When S1 is on, the prove your visibility to objects not directly in front of you. You don’t necessarily have to use this driver board for a current flowing through L1 increases at a rate determined bike light or torch. It could be used for caravan lighting, to by its inductance and the voltage across it. Some of this current may flow through the load while the light the bed of a utility vehicle or the cargo area of a van, in a shed, or wherever you need a bright light but don’t have rest charges up capacitor C1. L1’s magnetic field also charges ready access to mains power. The driver board is tiny, so it up as the current flows. When S1 switches off, the magnetic field starts to colcan be tucked away just about anywhere. Add an LED and a lapse and this forces current to continue to flow into the battery, and away you go. load and C1, although at a It has a flashing mode and reducing rate. two reduced brightness opSWITCH S1 INDUCTOR L1 Since current can no longtions that you can use for + + er flow through S1, it must longer battery life. You can iL PATH 1 instead come from the ciralso build a higher-power cuit ground and through diversion of the circuit to suit VIN C1 VOUT LOAD D1 ode D1, effectively flowing more powerful LEDs. PATH 2 in a loop through D1, L1 and It’s a generally useful deC1/the load, and then back vice. It’s also a good way to to ground. learn about switchmode powIt is the energy stored in the er supplies and LED driving. Fig.1: the general configuration of a step-down switching And while it’s designed to DC/DC converter, also known as a ‘buck’ converter. When S1 is magnetic field which makes drive LEDs, it isn’t necessar- on, current flows through it and inductor L1 to the load, charging this an efficient circuit, as the ily limited to only doing that. up both capacitor C1 and L1’s magnetic field. When S1 switches voltage drop across L1 is not With a few small changes, off, the magnetic field starts to collapse, which forces current to dissipated as heat; most of this board can be used as a continue to flow. This must come from ground, via D1, which that energy is stored while S1 along with the charge in C1, causes the load voltage to drop is switched on, and recovered constant current source for a slowly until S1 switches on again. when it switches off. variety of applications. 16 Practical Electronics | September | 2020 By controlling the duty cycle of S1, we can control the current through L1 and thus the average voltage across C1. Circuit description Fig.2 shows the LED driver circuit, including the internal details of the LM3409MY controller. In this case, the switch shown in Fig.1 is actually a MOSFET (Q1). You should be able to see all the other components from Fig.1 in this circuit, with the addition of a 0.22Ω currentsense resistor between the supply bypass capacitors and the source of Q1. Q1 is a P-channel MOSFET, which means that the controller IC can switch it on hard by pulling its gate down to 0V without needing a boosted gate-supply rail. That means if the battery is almost fully discharged, the highest possible LED brightness can still be maintained, as there will be a minimal voltage drop in the circuit (around 0.25V, mostly due to the current-sense resistor). IC1 is powered from pin 10 (VIN ) and it has an internal regulator (VCCREG.) producing a voltage at pin 9, labelled VCC. This is a ‘negative’ regulator which produces a voltage rail that is relative to VIN, but about 6V lower. The external 1µF capacitor filters this rail. Internally, VCC is fed to the MOSFET gate driver, and this provides the voltage that the MOSFET gate is pulled down to (via pin 6) to switch it on. This gives the MOSFET a gatesource voltage of −6V, more than enough for Q1 to be fully in conduction. To switch it off, pin 6 is pulled up to VIN, so the gate-source voltage is reduced to 0V. The benefit of this scheme is that it allows VIN to be higher than it otherwise could be. A typical MOSFET has a maximum gate-source voltage rating of ±20V. If the MOSFET gate were pulled to 0V to switch it on, that would mean that VIN could not exceed 20V. Our recommended 5-cell Lithium-ion battery has a fully charged voltage of 21V, and the circuit can operate to at least 30V thanks to this internal regulator. When S1 is on, the current flowing through it and inductor L1 is sensed via the voltage developed across the 0.22Ω resistor. Both ends of this resistor are connected to a differential amplifier within IC1. The regulated current is determined by the value of the current-sense resistor, and the value connected from the IADJ pin (pin 2) to ground, if any. In this application, no such resistor is fitted. If a resistor is fitted there, it changes the 1.24V reference voltage which controls the voltage divider formed by the internal resistors labelled ‘R’ (at pin 8) and ‘5R’. This photo of a ‘naked’ bike light really doesn’t do the LED justice! It is so bright that you risk temporary vision impairment from looking into it – trust us, that is from experience, so DO NOT do it! You can also see just how small the controller board is from this pic. The LM3904 on this board may get quite warm at higher currents, especially if it’s in close proximity to the LED and/or if in a small housing. In this case, a small heatsink is suggested. The battery is a 5-cell, 18.5V, 5000mAh high discharge Li-Po by Turnigy. Practical Electronics | September | 2020 Features and specifications • Can power a 12V LED array from a 5S (18.5V) lithium-ion/LiPo battery • Operates from 5-25V (minimum LED operating voltage + 2V) • Delivers 1A (12W for 12V LED) or 2.2A (26W for 12V LED) • Can be used with a wide variety of highbrightness LEDs, including 6V and 12V (nominal) types • Three brightness settings plus flashing mode with pushbutton on/off and mode control • Low quiescent current when off (around 1mA) • Under-voltage lockout • Overheating protection • High efficiency; typically more than 90%. With no external resistor, 1.24V appears across the ‘5R’ resistor, meaning that 0.248V (1.24V ÷ 5) appears across the upper ‘R’ resistor. Therefore, a similar voltage must be developed across the external sense resistor for the current amplifier’s output to change polarity. This sets the peak current to 1.13A (0.248V ÷ 0.22Ω), resulting in an average LED current close to 1A. IC1 uses a ‘controlled off-time’ scheme for regulation. With standard PWM, the pulses applied to the gate of Q1 would be at a fixed frequency but with a varying duty cycle. With the controlled off-time scheme, Q1 is switched off for the same time after each pulse; the on-time varies to control the duty cycle. This results in a variable switching frequency. The advantage of this scheme is that it’s easier to stabilise the feedback loop to prevent sub-harmonic oscillation. This avoids the need for external loop-compensation components. The combination of the 15.8kΩ resistor from the output to pin 4, and the 560pF capacitor from pin 4 to ground, sets the fixed off-time to be very close to 1µs. So with a 50% duty cycle, the switching frequency will be around 500kHz. Diode D1 is a 1.5A schottky diode with an especially low forward voltage of 0.43V at 1.5A, for maximal efficiency. The resistive divider at pin 1 (UVLO) sets the input supply under-voltage lockout threshold to 5V (=1.24V × [1 + (49.9kΩ ÷ 16.5kΩ ]). The internal switched 22µA current source adds 363mV (16.5kΩ × 22µA) of hysteresis, so that the switch-off threshold is 5.363V. This was chosen to shut down the circuit before the external control circuitry no longer has enough voltage to run, and to allow lower-voltage batteries and LEDs to be used. It is expected that your battery will have built-in over-discharge protection and so will cease supplying current before it is damaged. If not, you would have to change these divider values to protect your battery. For example, a 5S Li-ion or LiPo battery should not normally be discharged below 3V per cell or 15V total. So you could change the 49.9kΩ resistor to 183kΩ 16.5kΩ × [(15V ÷ 1.24V) – 1]) (180kΩ would do) and the LED drive will automatically shut off when your battery drops below 15V. 17 , REG1 LM3480IM3-5.0 IC1 OUT IN GND 100nF 5V 4 COFF GND GND 1 2 4 1 VDD GP2 GP0 IC2 PIC PIC10 1 0 F202 -E/OT VSS CON3 1 2 2 OFF TIMER GP1 GP3 LM3409MY 3 + VCC UVLO R CSP 8 R CSN 7 35V TANT. 0.22 S Q1 Si4447DY Start CONTROL LOGIC 3 EN K IADJ + 22 A 1.24V 10 F          GND PAD 5 TANTALUM CAPACITORS 1 3 0 5 6 V GND LM3840IM3 3 K A + – 2 5R 15MQ040 20 1 9 35V TANT. A WHITE LED ARRAY + – THERMAL PAD UNDERNEATH CONNECTS TO GND 10W+ LEDLED Driver and SC 10W+ DRIVER & Flasher FLASHER 1 L1 33 H DR74-330-R D1 15MQ040 2 1.24V 49.9k 1 UVLO CON2 D 5 A 6 S1 On/Off/Flash/ 16.5k Brightness 10 F 1 F PGATE 6 G Finish 560pF 5 VCC TS1 5 TC6502 TOVER P095VCT VCC VCC REG. 15.8k 4 9 VIN 100nF – 3 HYST 10 + 12-30V DC IN CON1 + 1 Si4447DY LM3409MY 10 2 1 DD 6 S 5 S S G PIC10F202/OT 65 DD 1 2 3 TC6502VCT 5 4 1 2 4 3 Fig.2: this circuit diagram also shows the internals of the LM3409 IC. It’s a constant off-time switchmode current regulator driving a P-channel MOSFET. The internal negative regulator (Vcc REG.) takes the supply between pins 10 (VIN) and 5 (GND) and produces a third rail at pin 9 (Vcc) which is around 6V below VIN. This determines the low (on) voltage for the MOSFET gate, allowing a supply voltage higher than its gate-source rating. Note the 1µF filter capacitor between VIN and Vcc. The LM3409 IC does get quite warm during operation – heatsinking may be required, especially in a small housing. Control circuitry Pin 3 (EN, enable) of IC1 is driven from the GP1 digital output (pin 3) of 6-pin microcontroller IC2. This pin is driven high to light the LED or low to shut it off. It can be modulated (eg, using PWM) to provide dimming. Microcontroller IC2 provides seven different modes: light off, low, medium or high brightness (continuous) or low, medium or high brightness (flashing). These are all achieved by pulse-width modulating or switching the GP1 output state. The onboard temperature sensor (TS1) has a digital output at pin 5 (TOVER) which feeds digital input GP2 (pin 4) on IC2. This pin is driven high if the board gets too hot (over 95°C) and IC2 responds by slowly reducing the LED brightness. Its pin 3 hysteresis (HYST) input is connected to Vcc to provide 10°C of hysteresis, so when the sensor temperature drops below 85°, pin 5 goes low again, and the LED brightness slowly ramps back up. This prevents damage to the whole unit if operated for long periods at high brightness in hot weather. If the sensor is at 95°C, the LED array is likely to be well above 100°C, as there will be some distance between them, and no direct path for heat conduction. The various modes are selected using external momentary pushbutton S1, which connects between GND and the GP0 digital input (pin 1) of IC2. IC2 has an internal pullup current to keep this pin high when the button is not pressed. It detects when the button is pressed as that pin is then pulled low. Scope1: the yellow trace (bottom) is the PWM control signal from pin 3 of IC2 to pin 3 (EN) of IC1, while the green trace above is Q1’s gate. The blue trace above that is at Q1’s drain while the mauve trace at top is the voltage across the LED array. The time-base for this grab is fast, at 2µs/div, so you can see the switchmode operation at 568kHz, with around 100mV of ripple appearing across the LED. Scope2: now we’ve switched the LED to medium brightness and slowed the time-base to 1ms/div, while keeping the same traces and voltage scaling as in Scope1. You can see that the duty cycle is around 80% and the frequency is 200Hz. When the PWM control signal goes low, the LED drive is cut and the LED filter capacitor discharges until the switchmode driver is re-enabled. 18 Practical Electronics | September | 2020 IC2 and TS1 are powered from a 5V rail developed by low-power regulator REG1. This regulator can withstand input voltages up to 30V (it is the limiting factor in this design), can deliver up to 100mA and has a quiescent current of around 1.9mA. As it is not a micropower regulator, an external power switch is recommended to avoid discharging the battery when the light is not in use. Scope grabs Scope1-Scope4 below show the voltages at four points in the circuit during different phases of operation. See the captions for an explanation of what each trace represents. Scope1 Close-up of the switching waveforms, demonstrating how the LED current is regulated. Note how the gate pulses in green all have the same positive width (off-time) while the on-time varies. This is due to switchmode controller IC1 varying the ontime in an attempt to keep the current through the LED at the target level. Scope2 Shows how the 200Hz PWM brightness control from IC2 causes the LED driver output to switch on and off rapidly, reducing both the light output and power consumption. Scope3 The same effect but on a lower brightness setting, with a duty cycle of around 40%. Scope4 Operation of the unit in flashing mode (4Hz), at a much longer time scale, corresponding to a whole second of operation. Increasing its current delivery While the ~1A current delivery of this design can give you a really bright light (around 2100 lumens), it is capable of delivering more than twice that with a few minor changes, for a theoretical output of around 5000 lumens, with the right LED(s)! Replacing the 0.22 0.75W resistor with a same-size 0.1Ω 2/3W resistor will set the average current to around 2.2A. You also need to make the following two substitutions. Replace D1 with a 3A schottky diode in the same size package, eg, Comchip CDBA340L-G, Diodes Inc B340LA13-F, On Semi NRVBA340T3G or Micro Commercial SL34A. Replace inductor L1 with Panasonic ETQ-P5M470YFM, with a current rating of 2.9A and a saturation current of 4.1A, in a package about the same size as the specified DR74-330-R inductor. Two other possible inductor options which are slightly larger are the Murata DD1217AS-H-330M=P3 and Bourns Scope3: this scope grab was taken under the same conditions as Scope2, but now the driver is in low brightness mode, with the PWM duty cycle reduced to around 40%. Practical Electronics | September | 2020 SRN8040TA-330M, both 8 × 8mm. They will be a tight fit on the existing footprint, but it should be possible to solder them to the board without modifications. Both have slightly lower current ratings than the Panasonic part though; adequate, but barely so. Construction Fig.3 shows both sides of the assembled board at actual size; it’s tiny! The double-sided board is coded 16109191 and measures just 22 × 12mm. We built our prototype by hand with a regular soldering iron (using a standard chisel tip), so it isn’t that difficult, but it definitely requires some skill and patience. IC1 has closely spaced leads (0.5mm apart) while the other parts are not quite so tricky, but are still quite small, so you may need to work under magnification. The board was designed to be so small to leave as much room as possible to fit the battery in your light housing. Fig.4(a) shows where the parts go on the top of the board, and it’s best to start assembly with this side, specifically, by soldering IC1 in place. As well as having closely spaced leads, this part has a thermal pad on the underside. Ideally, it should be reflow soldered, eg, using a hot-air rework station. If you have such a station, spread a thin smear of solder paste on all the pads, place the IC in the correct position (ensuring its pin 1 goes towards the nearest corner of the board), then gently heat it with hot air until all the solder reflows. Don’t let the hot air dwell too long on one area or you risk burning the PCB or damaging the chip. The solder under the IC, on the large central pad, is likely to be the last to reflow. But you need to make sure it does, or else you could have hidden short circuits under the chip. If you don’t have a reflow oven or hot air rework station, the PCB pad has been extended slightly past the body of IC1, so that you can still heat the pad directly to solder that thermal pad. You will need a fine-tipped soldering iron to do it this way, though To hand-solder this chip, add a small amount of solder paste to the middle of the big pad in the middle of its footprint. If you don’t have solder paste, spread a thin smear of flux paste over the whole central pad instead. Then locate the pin 1 dot or divot on the IC (using a magnifier) and then rotate it so that it’s near the closest corner of the board. Rotate the whole lot so the that the chip leads are on the left and right sides, then add a tiny bit of solder onto one of the chip’s pads (eg, at the upper-right corner if you’re righthanded). Heat this solder and gently slide the chip into place. Scope4: we’ve now switched the driver into flashing mode and slowed the timebase down again, to 100ms/div, so that you can see the full effect. The flashing frequency is around 4Hz, and the duty cycle is 50%. Other flashing modes involve switching between lower LED brightness (PWMcontrolled) and full brightness. 19 15.8k 49.9k Having removed the heat, check Fig.3: because the PCB is so tiny to see whether its pins are properly Actual (same-size diagrams at left) we have size aligned with the pads on both sides. also shown the top and bottom at If not, heat that solder joint and very three times the actual size for clarity. carefully nudge the IC slightly in the 1 6 . 5 k right direction. TS1 D1 We got ours very close on our first CON3 IC1 attempt (probably close enough) but 100nF decided to nudge it a few more times IC2 Q1 to get the alignment perfect. When Si4447DY 0.22 you’re happy, add flux paste to both REG1 1 F Fig.4: 3x CON1 100nF sides, then add solder to the diagoTo battery diagrams of nally opposite pin before drag-solderthe top and 3x actual size ing the rest of the pins on that side of bottom of CON2 the chip. To LED(s) the PCB. Return to the other side and sol560pF Besides making der all the remaining pins, including sure all the CON3 the one you started with. Bridges are solder joints L1 33 H are good, the hard to avoid; if you get some, add DR74-330-R 10 F 10 F main thing to check more flux paste, then use solder wick 35V 35V TANT. is that the pin 1 dots of IC1, TANT. to suck the excess solder off the pins. IC2 and Q1 are in the right When you’re finished, check them CON1 orientations, along with carefully under magnification. You To battery the positive stripes on the should have nice looking fillets on all two 10µF tantalum capacitors. pins, down to the pads on the PCB. CON2 The wiring is shown on both sides To LED(s) Now add a little extra flux paste to as you can solder in the wires from the exposed part of the central pad either side. and feed some solder onto it. Hold the heat on there for a few seconds. If you have solder paste worry therefore if you bridge them; in fact, we suggest you under the chip, it should reflow now. Otherwise, the flux add enough solder on that side of the device to form one, paste under the chip should help suck some solder under- large solder joint, as we did on our prototype. There’s also no need to worry about bridges between neath it (fingers crossed). If you have a hot air rework station, you can still solder pins 1-3 because these all connect to the same point, but the chip by hand, then re-heat it to reflow solder paste un- you don’t want to bridge pins 3 and 4, as pin 4 is the gate. derneath the IC. That’s what we did, but again, be very care- You can use flux paste and solder wick to clean up a bridge ful to ensure that all the solder paste does melt or you will between these pins, should it occur. You can now fit diode D1, with its cathode stripe orihave trouble later. Also, try not to let the airstream blow ented as shown, followed by the three resistors and three the chip off its pads! It helps to keep the airflow rate low. capacitors. Make sure you use the correct values for the two smaller resistors. Remaining SMDs With the tricky part out of the way, solder IC2 next. Ideally, it should be pre-programmed (using 1610919A.HEX Components on the other side code available for downlod frmo thr September 2020 page Now flip the board over. There are just five components to of the PE website). Find its small pin 1 dot and rotate it mount on this side of the board, as shown in Fig.3(b). Unso that it is facing towards Q1’s mounting position. Then fortunately, the board will not sit flat at this stage, so you use a similar technique as for IC1 to solder it in place. It should find some small plastic shims to place strategically should be somewhat easier due to having fewer, larger, under it so that it won’t wobble around as you are soldering these final components. more widely spaced pins. Start with the two smaller components, making sure that Next, fit TS1 and REG1, both of which can only go in one orientation due to the differing number of pins on each side. you fit the capacitor in the position closer to the board edge. Follow with Q1, which has even more widely spaced You can then solder the two larger capacitors in place. It pins, which can possibly be soldered individually. Ensure helps to have fine tweezers when doing this, as they are its pin 1 dot/divot and chamfered edge go towards the bot- quite close together. As usual, make sure the striped ends are oriented correctly. tom of the board as shown in Fig.3(a). That just leaves the inductor. Spread some flux paste The PCB is designed to accept a MOSFET in the SOT-669 package, which has a single large tab in place of pins 5-8, on its pads, then use the usual technique to tack it into so there is one large pad for these pins. There is no need to place before soldering the opposite lead. Put some heat The two sides of the completed PCB are shown here rather significantly oversize, (about twice life size) just so you can see what goes where. The 560pF capacitor, 15.9kΩ resistor, 33µH inductor and the two tantalum capacitors mount on the underside (right) – note the stripes denoting the positive end of the capacitors. 20 Practical Electronics | September | 2020 and solder into the joints to make sure the fillets look good on both sides. Preparing the LED You may be able to buy a suitable LED pre-assembled and ready to wire up, but the recommended Cree XHP70 LED generally comes as a bare ‘chip on board’ type LED, which needs to be soldered to a suitable PCB both for electrical connections and to get heat out of it. This is then generally attached to a piece of metal which acts as a heatsink to keep the LED temperature under control. It’s a good idea to then mount the PCB on the back of this heatsink (with a suitable layer of electrical insulation in between!) so that the PCB can sense the heatsink temperature and reduce the LED brightness if it’s getting too hot. But we’re getting ahead of ourselves. First, you need to solder the LED to this PCB, which is often in a ‘star’ shape. Note that the XHP70 can be run at 6V or 12V, depending on the configuration of the PCB, so make sure you get a suitable PCB that’s designed to run it at 12V. Otherwise, the LED will require twice as much current for the same brightness. You can sometimes get the LEDs pre-soldered to the star boards, but we couldn’t find one locally, so we ordered the LED and board separately (from www.cutter.com.au, but there are plenty of other local/international suppliers). We then attached the LED to the board. First, we checked the T-shaped marking on the underneath to identify the anodes and cathodes; the bar across the ‘top’ of the T indicates the cathode. This goes towards the side of the star PCB with the negative (–) pads on it. We then covered all the LED pads (two small rectangles plug a larger Z-shaped pad) with a thin smear of solder paste mixed with some flux paste, placed the LED on top and gently applied heat from a hot air rework station from underneath the board. We did it this way to avoid overheating and damaging the LED lens. Make sure the small pads on the underside of the LED line up with the two small rectangles on the star board. We managed to heat the star PCB from underneath by clamping it with a hemostat (self-closing tweezers) and then clamping that in a vice, giving us access to the underside of the board without having to hold it. You definitely don’t want to hold an aluminium PCB while heating it to over 200°C! We had to gently nudge the LED using a metal object when the solder reflowed to get it properly centred on its pads. In theory, it should pull itself in due to solder surface tension, but ours got ‘hung up’ on something and needed some help. Wiring and testing The next step is to solder wires to the board for the control pushbutton (S1), battery power and the LED(s). As the board is so small, the wire holes are too, so you aren’t going to be able to solder heavy leads to it. You’ll be keeping the wires fairly short anyway, so medium-duty hookup wire is adequate. You will probably need to cut away some of the wire strands at the exposed end, so that you can twist the remaining strands together to fit through the holes in the PCB before soldering them. The current will quickly spread out through the other strands in the wire, so this should not cause any problems. But make sure you don’t leave any loose strands that can short to anything else. Now solder the two LED wires from the board to the ‘+’ and ‘–’ terminals on the LED star, then use screws and thermal paste to attach it to a heatsink. Solder the momentary pushbutton to the end of its wires; its polarity doesn’t matter. Before powering it up, carefully inspect both sides of the board, looking for short circuits between any of the wire Practical Electronics | September | 2020 Parts list – Ultrabrite LED Driver 1 double-sided PCB, code 16109191, 22 × 12mm 1 5S Li-ion/LiPo battery or similar, 1Ah+ 1 5S-capable Li-ion/LiPo battery charger 1 2-pin connector to suit battery 1 chassis-mount waterproof momentary pushbutton switch (S1) [eg, Altronics S0960/S0961 or Jaycar SP0756] 1 12V LED array, eg, Cree XHP70.2 P4 bin (2100 lumens at 1A, 4760 lumens at 2.2A) 1 heatsink to suit LED 1 lens to suit LED (optional) 1 DR74-330-R 33µH 1.4A SMD inductor, 7.2 × 7.2mm (L1) 1 waterproof enclosure, large enough for battery and LED(s) short lengths of medium-duty hookup wire or figure-8 Connector options for battery charging 1 waterproof 4-pin chassis-mount socket [Jaycar PS1009+ PS1005 (10A) or Altronics P9444+P9420 (5A)] or 1 waterproof 6-pin chassis-mount socket [Jaycar PS1003+PS1005 (10A) or Altronics P9446+P9420 (5A)] 1 4-pin line plug [Jaycar PP1006 (10A), Altronics P9474 (5A)] or 1 6-pin line plug [Jaycar PP1000 (10A), Altronics P9476 (5A)] Semiconductors 1 LM3409MY switchmode LED controller, MSOP-10 (IC1) 1 PIC10F202-E/OT 8-bit microcontroller programmed with 1610919A.HEX, SOT-23-6 (IC2) 1 TC6502P095VCT temperature switch, SOT-23-5 (TS1) 1 LM3480IM3-5.0 high-voltage 5V linear regulator, SOT-23 (REG1) 1 Si4447DY 40V 4.5A P-channel MOSFET, SOIC-8 (Q1) 1 15MQ040 40V 1.5A schottky diode, DO-214AC (D1) Capacitors 2 10µF 35V SMD tantalum capacitors, low-ESR, D case [eg, Kemet T495D106K035ATE120] 1 1µF 50V X7R SMD ceramic, size 3216/1206 2 100nF 50V X7R SMD ceramics, size 1608/0603 1 560pF 50V X7R SMD ceramic, size 1608/0603 Resistors (all 1% SMD 1/10W, size 1608/0603 unless otherwise stated) 1 49.9k 1 16.5k 1 15.8k 1 0.22 1% 0.75W, size 3216/1206 [eg, Susumu KRL1632EC-R220-F-T1] solder joints and nearby components, between components or component pins and also to ensure that all pins have good fillets, touching both the pin and the pad. Magnification and good lighting are critical to successfully inspecting a board populated with tiny SMD components. It’s also a good idea to clean it thoroughly beforehand, using a specialised flux solvent or alcohol (isopropyl, pure ethanol or methylated spirits). Otherwise, flux residue can get in the way of a proper inspection. Once you’re satisfied that it has been assembled correctly, its time to power it up. If you have a suitable DC voltage source such as a 1524V 1A DC plugpack or bench supply, you can now test the unit. Wire up the supply leads and use some electrical tape to make sure they can’t short together, then switch on power. At first, nothing should happen. If your supply has a current meter, you should get a reading of no more than a few milliamps. If the current reading is significantly more than that, switch off and carefully examine your board and wiring for faults. Now press the pushbutton, and the LED should come on. Depending on the supply voltage, you should see around 21 The Cree XHP70 is shown at left close to life size, with a larger scale front and back image at right. It must be used with a heatsink; otherwise it would destroy itself. The star-shaped Meodex at bottom right not only provides some heatsinking but is also a convenient means of connection. 500mA being drawn from the supply; slightly less if its output voltage is significantly above 15V. Brief presses of the button again should change the brightness — cycling between medium, low and off. Holding it down for a few seconds should switch the LED on at full brightness. If you continue to hold it, the LED should start flashing. Once it’s flashing, brief presses of the button will change the flashing mode; hold it down for several more seconds to switch the LED off. If it doesn’t work, most likely you have a soldering problem, or one of the components is in the wrong location or was fitted with the wrong orientation. Carefully inspect the board for problems. If you don’t find any, try adding flux paste to all the small IC leads and re-flow them all, either with a soldering iron that has a clean tip or (even better) a gentle application of hot air. Re-test to see if that fixed it. Once you’re sure it’s working, switch off the power, disconnect the test supply and solder the battery connector onto the end of the supply wires. Make sure you get the polarity right (very important!) and use heatshrink tubing to insulate the solder joints. There are several common types of lithium-ion battery connector, so you will need to obtain one that matches your battery (usually from the same source). We’ve seen connectors with red/black wire colour coding that’s actually the opposite of the supply polarity once it’s plugged into the battery. So check yours, and if this is the case, use red and black heatshrink tubing to change the wire colours to avoid mistakes. Placing inside your bike light At the outset, we designed this project ‘tiny’, so it could fit inside a bike light. However, because every bike light is different, we can’t offer much guidance here. It may be that you have an old dynamo-type bike light set gathering dust in a cupboard; these have been largely superseded by modern lamps which also save your legs somewhat when pedalling up a hill! But most of these older-style lights had a fair bit of room inside the light itself (because there was no battery). One of these could be worth experimenting with. The battery will need to be mounted in its own case external to the light – though this could be beneficial when it comes to charging. We should warn you though that many bike lights (especially plastic ones) may not like the heat of the ultrabright LED, so you may need to come up with some arrangement which ensures your bike light doesn’t melt. Putting it in a case However, if you need to mount the project in a new case, the following points might help you. The case should ideally be a waterproof one if you’re going to be using it on a bicycle, or anywhere external where it could be in the weather. You will probably have to install a waterproof transparent window so that the LED itself can be mounted inside the box. It can be made from clear plastic and sealed with silicone sealant. You should also seal around the pushbutton switch to ensure water cannot enter that way. The battery and board should be securely anchored inside the box so that they can’t put any strain on the wires. That just leaves the question of how you charge the battery. You could open the box up and remove the battery to charge it each time it runs low (or just swap it for a fresh one), but that’s hardly convenient. To charge the battery without removing it, you will need to fit a waterproof socket to the case and make up a cable with a matching plug to connect to a suitable lithium-ion battery charger. If you do this, it’s vital to choose a connector where you can’t accidentally short the pins. That could melt the connector or even damage the battery. Ideally, multi-cell (series) lithium-ion/LiPo battery packs should be balance charged. In the case of a 5S battery, that requires at least six contacts, two of which will carry the full charging current. But you can get away with the occasional balance charge, so you could compromise by taking the battery out from time to time, and simply fitting a two-pin connector for day-to-day recharges (although some connectors are not available with fewer than four pins). Another option is to build our April 2017 Battery Balancer and mount it inside the case, permanently attached to the battery’s balance connector. That way, it will automatically be balanced each time you charge it. It is a relatively small board, so you should not have trouble fitting it, and it draws little current when not active (around 25µA). We suggest that you use a four-pin chassis-mount socket for regular charging, with the pins wired in pairs for extra current handling, or a six-pin socket for balance charging. Suitable connectors are available from both Jaycar and Altronics; see the parts list for details. Don’t forget to insert the waterproof gasket (if supplied) when putting the lid on your box. Reproduced by arrangement with SILICON CHIP magazine 2020. www.siliconchip.com.au Having trouble holding the LED in place while you solder it? Here’s how we did it: a pair of tweezers held tight in a bench vice, with the LED held firmly at the opposite end! A wooden clothes peg (NOT plastic!) also works well! 22 Practical Electronics | September | 2020