Showing posts with label white LED. Show all posts
Showing posts with label white LED. Show all posts

Thursday, January 02, 2014

Trailer Lights Version 3.1 Schematic

I am revisiting the trailer lights explained in several previous posts. I am implementing a few improvements. 
  • Twice as many LEDs. 
  • Real Lead-Acid battery charger built in. 
  • Lower "burden" current. 
The appropriate data sheets are linked to throughout this post. Figure 1 shows the version 3.1 schematic.

Figure 1. Trailer lights complete schematic.

Let's start with the input circuit as zoomed in on in figure 2. A 5A fuse protects the trailer battery from any short circuits. The boost switch-mode power supply at the input will convert the truck battery that may be between 10V and 16V to a steady 18V. If the truck battery is higher than expected, it will effectively pass through the boost circuit. A LM2587-ADJ is used in its default configuration for the boost. The Schottky diode (D1) in the boost regulator also forms a nice protection from too much voltage somehow getting produced on the circuit side feeding back into the truck battery. The parallel 3kΩ resistors (R18 and R19) were just to create a 1.5kΩ resistor and avoid getting yet another value of resistor.

Figure 2. Input boost regulator schematic.

A UC3906 forms the base of the charger section highlighted in figure 3. The two parallel resistors R20 and R21 set the maximum charging current. I couldn't find a reasonably priced ⅛Ω 2W surface mount current sense resistor, so I am using two ¼Ω 1W resistors instead. Note that 2A through a ⅛Ω resistor is ½W of continuous power dissipation; I think quadruple that is a reasonable safety margin since I want to avoid self-heating effects. The MJE15035G Bipolar (Q1) may drop up to 8V in the 2A charge state. Since that's 16W, a pretty hefty bipolar was chosen. The resistors are sized per the UC3906 data sheet with modifications from the application note. The Schottky diode D5 and connecting the bottom of the resistor string to the PWRIND (pin 7) pin instead of ground are hints from the application note to save power when the truck battery is not present.

The sense and power leads to the trailer battery are separate in the plug. The connection to the battery positive lead can be a single or double wire depending on how much trouble I feel like taking when constructing wiring harnesses. Given the effort needed to connect three wires to a four wire socket, I'll probably not run a separate sense lead all the way to the trailer battery, but the option is there. The fuse is in the power lead, of course, but this means the sense input to the charger controller is on the sense side of the fuse. If somehow the fuse blows but the trailer battery voltage is low enough for the charger controller to try to charge the battery but not so low that it senses an error (between about 10V and 13.8V), then the pass transistor Q1 could be turned on pretty solidly. If the truck battery is attached, this would drive the BATTRL power rail to about 17V (18V from the boost regulator minus a bipolar drop and a Schottky drop). This condition is not ideal, but all of the components connected directly to that rail are rated for continuous operation at that voltage.

Figure 3. Charger schematic.

The digital control section is zoomed in on in figure 4. I am using a TPS70950 linear voltage regulator because it has a 2μA bias current and is stable even when supplying less than 100μA. The good old LM7805 has a 6mA bias current and is not happy supplying less than 10mA current. The Microchip PIC12F609 run with a 32kHz crystal may consume only 60μA (2μA when asleep); since this is in the neighborhood of the battery's self-discharge current, it won't effect the working time between charges much. R1 and R2 are really just pads and holes to allow for any tuning needed to get the crystal oscillating. The resistor divider formed by R7 and R4 will force POWFB to 0.6V when BATTRL is 10V. A ±1% variation in R7 and R4 will mean 10.27V to 9.87V will cause the sense voltage of 0.6V. There is an additional ±50mV in the PIC reference voltage and ±10mV in the PIC comparator. This inaccuracy (call it ±10%) is acceptable since I'm just concerned with warning the user when the trailer battery is getting low. The bipolars Q3 and Q4 are a standard low current power switch. I'll discuss the program in the microcontoller in the next post.
The sharp eyed among you will notice the PIC12F609 cannot be configured with GP3 (pin 4) as a general purpose digital input and have the internal weak pull-up enabled. This is only true for GP3 (pin 4). So 1MΩ or so pull-up resistor will be "blue-wired" between BUTT and DIG (5V power). This was an oversight on my part that I didn't catch until after the PCBs were layed out and ordered. 

Figure 4. Digital section schematic.

Finally, figure 5 zooms in on the LED power supply. Another LM2587-ADJ boost controller is configured as a current regulator. The lower current (and slightly cheaper LM2585-ADJ could be used, I just wanted to keep my parts list a little simpler and use the same boost controller that was used on the input. When R15 is 40Ω, about 30mA will be directed through an eight LED string. This current is also mirrored to the other eight LED string because of the mirror formed by Q4 and Q5. This current mirror is a cheap mirror, not a nice single package matched pair. In this application a few percent variation in current just isn't that big of a deal. The zener diodes D2 and D3 have a 36V breakdown. They keep the boost circuit from running away if the LEDs are not plugged in when the circuit is on or if either LED string has an open circuit because of a broken wire or smashed LED or any other reason. The resistors R12 and R13 with a value of "unpop" are not meant to be populated on the board but they do allow lowering the resistor value (and thus increasing the LED current) after the board has been populated. 
Figure 5. LED driver schematic.

The PCB for building this circuit is shown in figure 6. The bottom layer ground plane isn't shown for clarity. I am sticking with 1206 packages for resistors and small capacitors because they are easy for me to solder by hand. I ended up using through hole inductors because they are physically large devices and the through hole versions can be oriented vertically, taking up significantly less board space. The Q1 bipolar is a TO-220 package for power dissipation reasons so it is also through hole. The huge 1500μF capacitor C12 is meant to be leaned over the board, covering the microcontroller as shown in the 3d model in figure 7. The boards are on order and not expected until the end of the week, so I won't have a picture of an assembled board for a couple of posts.

Figure 6. PCB layout.
Figure 7. 3d model of PCB.

There's $88.72 worth of components in this project. The largest cost is
  • $22.89 GP1272F2 Sealed Lead Acid Battery 12V 7.2Ah .250" Faston tabs 
  • $17.78 (2@$8.89) LM2587S-ADJ/NOPB Switching Regulators 5A FLYBACK REG
  • $7.43 UC3906DW Battery Management Lead-Acid Linear Charge Mngt IC
  • $5.02 (16@$0.314) CP41B-WGS-CK0P0154 LEDs Through Hole 90DG C-WT STNDOF P4 LED 9000K 3.6V
  • $4.02 (2@$2.01) 0154005.DR  Surface Mount Fuses Fuseblock w/ fuse 5A OMNI BLOK 154
  • $3.35 RP-SPNS  Pushbutton Switches PUSHBUTTON SWITCH SPST 1A 120VAC 28VDC
  • $3.01 2210-V-RC  Fixed Inductors 56uH 15% Vertical
  • $2.64 (3@$0.88)  STPS5L60S  Schottky Diodes & Rectifiers PWR Schottky rectifier
  • $2.50 2200HT-102-V-RC  Fixed Inductors 1.0mH 15% Vertical
Six prototype boards from Silver Circuits run $105 including shipping ($17.50 each).

Now that I am writing this review I see one thing I should have done differently. I should have provided a 1MΩ in parallel with output capacitor C8 to bleed it off when power is removed.

I also wish I had found some way to move the big bipolar Q1 away from the electrolitic capacitor C12. That bipolar is going to run hot and I would prefer to keep hot components away from electrolitic capacitors.

My next post will cover the PIC program.
The post after that will discuss the case design and printing.
I may do a final post to wrap everything up and show the installation.
I will try to do a post every week so this project is complete by the end of January.

Bruce McLaren

Wednesday, January 02, 2013

Fancy On/Off Switch

The on/off switch for these lights became the most complex part. Remember the goals. The lights will be placed in a boy scout equipment trailer. They need to work for two nights every month. The battery may only get charged for two hours each month (an hour of travel time each direction). The users of the finished product vary between eleven year old boys and forty year old boys.
  • A single button to turn the lights on and off. You can't push the wrong button if there is only one. 
  • No power consumed when the lights are off. None. 
  • Lights turn off automatically after 30 minutes to conserve power. 
  • Before the lights turn off automatically, they blink to warn and give time to turn them back on. 
  • Pressing the button before the automatic off turns the lights off with the same warning blink. 
  • Pressing the button during the blinking turns the lights on for another 30 minutes.
Figure 1. Schematic for the whole she-bang.
An 600dpi version can be downloaded.
Figure 1 is the schematic for the whole operation. The boost regulator on the right was covered in the previous blog. The "Trailer Battery" is a "12V" lead-acid battery that is charged when the trailer is hooked up to the truck. The 7.5Ω 15W resistor (physically huge) will keep the charging current to about 1.3A even if the trailer battery falls to 10V and the truck electrical system is running at 20V. A 3A fuse is placed in the electrical path if that isn't sufficient. The diode keeps the trailer battery from feeding the truck if the trailer battery gets over charged somehow. 

A mechanical relay has the advantage of low resistance when on and effectively infinite resistance when off. Pushing the button will turn on the relay. The relay will then stay on as long as power is provided. It takes a 5V SHUTDOWN signal to the base of Q1 to pull down the coil voltage and depower the entire circuit. Note the two resistors (R1 of 430Ω and R2 of 150Ω) are 1W while the rest of the resistors are 1/4W; enough current could flow through those two resistors if the battery were to float high that I thought heftier components would be a good idea. 

I need to know when the button is pressed so I know when to turn off. The coil voltage is higher when the button is pressed than when the relay is operating self-latched. I can't directly use this voltage because all reasonably priced comparators that can operate from a 10-20V power supply have a common mode input range that only extends up to the power supply minus 2V. One side or the other of the comparator needs to be 2V below its power supply to get reliable operation. Thus the funky resistor network. Figure 2 shows just the resistor network with the resistor values as I decided them. 
Figure 2. Funky resistor network.
The basic idea of this funky network is that when the switch is open VPOS>VNEG and both are more than 2V below VPOW, and when the switch is closed, VNEG=VPOW, VPOS<VNEG, and VPOS<VPOW-2.
The relevant circuit equations are (hey, we had to have some equations in here somewhere!)

When the switch is open:
I2 = VPOW/(R2+(R2+RC)||(R3+R4))
VA = VPOW-I2R2
VNEG = VA*(RC/(RC+R1)
VPOS = VA*(R3/(R3+R4)
Check that even with VPOW=10V VPOS>VNEG and VPOS and VNEG < VPOW-2

When the switch is closed:
VNEG = VPOW
I3 = VPOW/(R2||R1+R4+R3)
VPOS = I3R3
Check that even with VPOW=10V VPOS<VNEG and VPOS < VPOW-2

I played with these in a spread sheet to find likely values then wrote a PERL script that varied all of the resistors by +/-1% or +/-5% to make sure it worked across corners.


The 7805 powers the microcontroller. It has a significant reservoir capacitor so the microcontroller will remain powered a bit longer than the rest of the circuit. This allows the microcontroller to turn off the main power supply. The 7805 can handle a back-power condition like this of up to 7V, so 5V is safe. 

I have not yet programmed the microcontroller; that will be next month's post. In the mean time, I am using a 74HCT74 dual D-Flip-Flop to control the SHUTDOWN signal as shown in figure 3. The button presses toggle the power on and off. This accomplishes nothing more than a push-on/push-off switch could accomplish. The microcontroller is needed for the 30 second time delay and blinking the lights in warning. 

Figure 3. Flip-flop used to verify hardware set-up until PIC software written.

The LIGHT signal is level-shifted up to the battery voltage and used to control a pnp high-side switch. The current flowing to the boost regulator is less than 250mA, so a small bipolar can be used. Another mechanical relay might have made sense here, I decided to go with the cheaper solution. 


Figure 4 is everything put together, though it using the flip-flop instead of the microcontroller. The boost regulator is soldered onto a protoboard to keep the parasitics down, but the rest of the circuit can be operated on a bread board. I am laying out a custom PCB, it will be the post after next. Since the circuit works when done somewhat sloppily on a bread board, I feel confident I can make it work on a two layer PCB. 


Figure 4. Prototype implementation, Boost supply on proto-board, everything else on breadboard.
Instead of listing the parts here, I am referencing my Mouser project. If you can't see that, let me know. That $33.93 includes all of the electrical components and sockets and plugs. It does not include the trailer battery, wire, case, or PCB. 

There you go.
 These things always seem simple once they are working. Next month a simple assembly language program to control this circuit. 

Bruce







Wednesday, December 05, 2012

Boost Regulator Powering Small White LEDs

My short contract turned out to last from March until November. Great for the paying the bills, lousy for getting anything else done. It was a decent gig, I got to do lots of things. Everything from writing and synthesizing Verilog, to block level analog verification, to top level mixed-signal verification, to Perl/Tk for a simulation environment, and creating a PSpice model to round the contract out. I had never done high level modeling in PSpice before, so I got to do a variety of things I've done before and something new. Not too bad. 

I have decided to publish this blog on a monthly basis; I intend to publish on the first Wednesday of each month. I should be able to keep up that pace even if I am in neck deep in a contract. Since I am briefly between contracts, I will write several blog entries ahead. I might even proofread them if I write them ahead of time like that. 

Enough administravia, on to some design!

I am revisiting and finishing the LED lighting system for a boy scout trailer. As you might recall, the challenge is to place a robust, low power lighting system inside a boy scout troop equipment trailer. The lighting system will be powered by a 12V lead acid battery that may only get charged for a couple of hours each month. the lights need to usable for two nights of camping in between those charges. Low power (30-40mA) white LEDs seem like a good way to handle this. 

To simplify the wiring to the LEDs, the LEDs are connected in series. Only two wires need to be connected to the LEDs from the control box this way. I want to keep the highest potential present in the system below about 40V. The white LEDs I chose have a maximum forward voltage drop of up to 4.4V. So eight in series. 

I am using the National Semiconductor (now Texas Instruments) LM2585 boost regulator controller. It's a nice chip for this application. It is simple to use, has a low pin count, and has more than enough power capability. The LM2585 datasheet recommends using TI's WEBENCH Power Designer. This is a nice tool, I like it's power, it's simplicity, and it's wealth of produced information (even a suggested parts list). However, it requires a more recent version of Adobe Flash than I have bothered to install on my Linux computer, so I had to shift over to my Windows laptop to use it, and I didn't really get the feel of the circuit. Since I am using the regulator in a current feedback mode, the simulations can't be made to do what I'm going to do. So it's a great system but I had to fiddle a bit with it's results before I was comfortable. Of course, I checked the results with hand calculation to make sure they made sense. 


Figure 1. LM2585 30mA LED driver.
There isn't much to say about this. It is close to the standard application schematic except that the feedback point is taken at the top of a 41Ω current setting resistor. The LM2585 will try to control the out voltage to maintain 1.23V at the FB node (1.23V/41Ω=0.03A). The 36V zener diode across the output keeps the voltage from increasing wildly if the chain of LEDs is broken. I have tested this by intentionally opening one of the LED connections. By the slight smell, I can tell this is straining the capacitor and the circuit is none too happy about that operating mode, but it is keeping the circuit from actually blowing up. Bursting into flames is almost always a bad thing.

I put this circuit together on a generic PC board as poorly shown in figure 1. The close up in figure 2 shows that my way of making a surface mount inductor into a through hole inductor. Just solder a couple of wires to it.

Figure 1. The physical implementation. The 1mH inductor is almost as large as the rest of the circuit. 


Figure 2. Now it is a through hole inductor.



Figure 3 shows a scope shot of the circuit in operation.

Figure 3. Scope shot. Channel 1 (yellow) is SWITCH. Channel 2 (blue) is FB. Channel 3 (purple) is OUT. Channel 4 (green) is IN. The too large capacitor (22uF) keeps the output level. 



When I started this project, I assumed getting the LED regulator going would be most of the work. I was wrong. Next time I will show what I came up with for the on/off switch. That turned out to be more complex. In fact, the installment after next will be the program for the micro-controller that is becoming part of the switch. 

Figure 4. The whole circuit on my dining room white board.


Next month, the on/off switch circuit and a complete parts list. Until then, I hope I'm doing someone besides myself some good. Good luck on your own projects!

By the way, does anyone out there know how to submit Design Ideas to EDN? I couldn't quickly find the submission guidelines online or in the print magazine. 

Bruce


Wednesday, February 29, 2012

Boost for LEDs

I need to light the inside of a trailer used to haul camping equipment for my son's Boy Scout troop. I've discussed this with the adult quartermaster at some length. We have agreed small white LEDs placed about every 30cm around the top inside perimeter should provided sufficient illumination without being so bright as to completely ruin night vision. 
My original idea was to to use an LM317 regulator configured as a current source to drive two groups of two LEDs (four LEDs per regulator). My previous blog entry discussed one way to achieve this.  That design had several problems.
  • Needs 11.1V to operate at worst case corner.
  • Lots of wiring needed to connect LEDs to regulator.
  • Several regulators needed around the trailer.
I decided a better design would include a DC-DC boost regulator to boost the battery voltage to 40V. Two LM317 configured as current regulators would then each drive a string of eight LEDs with 20mA current as shown in the schematic. I chose 20mA because the LEDs are sufficiently bright at that current and it is significantly below the maximum specification of 35mA. Eight LEDs at the maximum forward voltage of 4.4V still allow 4.8V of dropout in the current regulator.

The 40V supply could be provided from a capacitor charge pump or a switch mode chip. Since I want to actually design and implement the circuit myself, I chose to ignore these simpler, cheaper, and more rational alternatives. Basically, I want to solve this problem using a switched-mode boost converter because I've never designed or worked with a switched-mode boost converter. I expect to learn some things along the way. So let's dive into a switch mode DC-DC boost voltage regulator from components.

First, the most important stage of any design, the specification. You can't design something if you don't know what you're designing.

Parameter Minimum Typical Maximum
Input Voltage 10 V 13.8 V 20 V
Output Voltage 40 V 44 V 48 V
Output current 36 mA 40 mA 44 mA

That's all that really matters. The input voltage minimum and maximum are somewhat arbitrary. The output voltage needs to be at least 40V to allow for the worst case corner, +/-10% seemed reasonable, so I set the maximum 20% higher. The frequency should be higher than 200Hz so any brightness variation isn't visible.

The schematic you find plastered all around the internet is shown here. It is wonderful if what you want to do is discuss operation principles or interview someone. It is woefully incomplete if you want to design a regulator.

Oversimplified boost schematic

The next schematic is what I've put together to actually design from. It is largely gathered from a special topics course Dr. Abhiman Hande taught at UTD during the fall of 2008, I am especially leaning on Ian Lopez's excellent final report. I know using a MOSFET instead of the schoktty diode would improve the efficiency, but I am sticking with that simplification for now. 
Simulation schematic


Let's do some calculating.

The duty cycle is D ≈ (Vout−Vin)/Vout = 50-79%, 69% typical.

The minimum inductor size needed stay in continuous conduction mode
L ≥ (Vout D (1−D)2)/(2 Iout f) = 4.8mH I choose 6.8mH.

The minimum capacitor to keep the output ripple to less than, say, 1V
C ≥ (Iout D)/(ΔV f) = 0.035μF choose 1μF because I have several of that size laying around.

fc = 1/(2 π √(LC)) = 1.9kHz

Let's zoom in on the compensator. The textbooks refer to this as a "Type III" compensator. I'm used to it being a "PID" controller. Whatever you like to call it, I certainly need the feedback circuit.
Compensator schematic

Compensator values
Parameter Formula Numbers Result Std Value
R1+R2 Vout/Iref 44V/1mA 44kΩ
R1 Vfb/Iref 1.2V/1mA 1.2kΩ 1.2kΩ
R2 R1+R2 - R1 44kΩ-1.2kΩ 42.8kΩ 43kΩ
fp1 fc*7.5 1.93kHz*7.5 14.5MHz
C2 1/(2 π R22 0.04) 1/(2*3.1416*43kΩ2*0.04) 2.17nF 2nF
fp2 1/(2 π CL CESR) 1/(2*3.1416*1μF*0.5Ω) 318kHz
fz1 fc 1.93kHz 1.93kHz
R3 (fz1*R2)/(fp2-fz1) (1.93kHz*43kΩ)/(318kHz-1.93kHz) 261Ω 270Ω
C1 1/(2 π fp2 R3) 1/(2*3.1416*318kHz*270Ω) 1.92nF 1.8nF
fz2 fc 1.93kHz 1.93kHz
R4 1/(2 π fc C2) 1/(2*3.1416*1.93kHz*2nF) 41.2kΩ 43kΩ
fp3 0.75 fsw 0.75*100kHz 75kHz
C3 1/(2 π fp3 R4) 1/(2*3.1416*75kHz*43kΩ) 49pF 51pF

Two useful pages that list standard resistor and capacitor values.
fp2 is set the cancel the ESR zero. At least that's what the textbooks say. The capacitor ESR isn't a specified parameter, so it could be much higher or lower than this. But the pole needs to be set somewhere, so here it is.
fz1 and fz2 are set to cancel to cancel the poles at fc (1.6MHz).
Set fp3 to about 3/4 the switching frequency.
C2 should be much larger than C3

Some AC simulations are needed to verify this. But I'm impatient so I throw together a quick transient simulation just to do a quick check. And all you out there who know boost regulators already know the results. Vpwr=Vbatt-Vdiode. The problem is that if no switching is going on, it doesn't matter how the comparator is hooked up, the power transistor is either on or off and the feedback never crosses the reference. If switching isn't happening, it never starts. 

I didn't find any good references discussing this start up issue, so I'll have to figure a good solution myself. One quick solution is to simply ramp the reference voltage slowly. The current compensator and transient simulation is shown below.

compensator with ramped Vref

slow start-up, but at least it goes
There is much more switching noise than I expected, so I really need to verify those AC parameters. 

Looking at this start-up scheme, I also need to have a way to re-awaken the oscillations if they stop for some reason. Oh, well, more design work yet to be done! 

My son's Boy Scout Eagle project is this weekend and I have a short contract starting Monday so the next few entries here will be a bit brief. 

Until next week,
Bruce McLaren

Tuesday, February 21, 2012

LEDs Inside a Trailer

White LEDs are a good choice to light the inside of a boy scout trailer. They are low power. They do not produce too much light. They are inexpensive. They can be operated from a 12V battery. They are physically resilient.

The schematic shows four units of four LEDs and the associated circuitry. The unit can be repeated as many times as needed (four in this schematic). The LEDs are arranged in two parallel stacks of two series LEDs (2S2P). A stack of two LEDs will always operate with a battery voltage as low as 11.1V (4.4V for each LED, 1.3V across the resistor, 1V dropout). Two stacks will match close enough for this application while keeping the total current through the regulator below half it's rated capability. The LM317 is a nice adjustable regulator that I am using as a linear current regulator. Using a 33Ω resistor across the 1.2V reference results in 36mA of current. 

Schematic of four four LED units.


To implement this design, I obtained the following from Mouser. I bought 1000 resistors, so they are essentially free per piece. Each four LED unit costs $1.41, 16 LEDs costs $5.64.

Manufacturer Description Part Number Price
Cree White LED CP41B-WGS-CK0P0154 $0.30
Fairchild Adj. Regulator LM317LZ $0.17
Xicon 33Ohm 1/4W, 5% 291-33-RC $0.009

Construction

I breadboarded this circuit to get an idea of the brightness and so I would have a reference to drop LEDs into during construction to verify which direction they are pointing. I find these square LEDs difficult to orient.

One four LED unit on a breadboard.


The troop's adult quartermaster and I decided one light placed approximately every 30cm would be enough illumination for unloading the trailer at night. When I started to wire up the 16 or so LEDs that would be needed, I discovered this approach is a headache. Lots of branching and back and forth wiring is needed. Not a bad solution, but I can do better.

Next week I do better. Anyone for a boost switch mode DC-DC converter?

I've been listening to the Digikey/DesignNews "180 days of Education" For the last several weeks. The microcontroller lectures (the first two weeks) were worth the time. They are basic to intermediate level lectures well presented. The sensors lectures of the third week just didn't seem as useful to me. Probably worth listening to, but not necessarily. I will find the time to hear the next lectures.

Bruce McLaren