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