document updated 18 years ago, on Apr 5, 2006
Requirements
There's a 12v supply available from the alternator and car battery. It must power a PIC microcontroller which flashes a small array (2-6) LEDs at an arbitrary rate (or rates) at some fixed voltage in the PIC's range (one which maximizes the array's brightness). Current draw isn't a big deal, as long as it's similar to current draw of other bulbs in the car, and as long as it's not overheating within the confines of the dome-light shell. Input buttons to change the LED array duty-cycle are optional.
The 12v supply is toggled outside this circuit (either by the dome-light switch, or by the ignition)
Optimize for: small size, low cost, and high brightness that's well directed
Specs
LEDs should be either amber or green to preserve dark-adaptation.
LEDs should be of the new super-bright flashlight replacement variety. Further product-searching is under this dropdown: ![]()
LED's from radioshack:
- 276-0307, 3000 millicandela, 12° 5mm red LED
- 276-0086, 5000 millicandela, 30° 10mm red LED
Digikey (all red)
- 404-1090, 3600 millicandela, 10° ($0.77 ea)
- MV8114, 2400 millicandela, 12° ($0.42 ea)
- SSL-LX5093SRC/E, 2800 millicandela, 30° (is it degrees? what the heck is "2x theta"?) ($0.54 ea)
- LTL-2R3VEKNT, 1200 millicandela, 30° ($0.43 ea)
It's probably better to get a 30° one, because 1) it'd be a PITA to have to add a difusser there somewhere, 2) 30° isn't too wide at all, 3) heavy overlap will help get coverage everywhere
Circuit Sections
Voltage "Regulator": The 12v goes through an emitter-follower voltage divider to produce fixed 5 volts. This is a cheap but inefficient PSU, so the resistors should be as high a value as possible to minimize current draw, but be slightly higher than the PIC's current usage (2mA). The LED will driven directly from the 12v so we don't have to drive that here. The transistor (as explained in the link) is used to keep the divided voltage relatively constant regardless of load (eg. current draw will go up quite a bit when an LED is strobed, and current draw is constantly changing due to the PIC's digital switching).
Okay, this is really just silly. For the cost of a TO-92 package transistor and 3 resistors, I can get one low-power low-dropout 5v linear regulator in a TO-92 package that does the same thing (okay, actually quite a bit more) and presumably gives off very little heat. Plus it'll take a lot less space and require less soldering. So just buy a bunch of those and keep them in the cabinet. ![]()
- AN8005 — 50mA 5V, 0.3v dropout, .5mA quiescent (I think?), $1.00
- LM2936Z-5.0 — 50mA 5V, LDO, 15µA quiescent, $2.50
- LM2936Z-5.0 — 50mA 5V, 1.7 dropout, 5.5mA quiescent, $0.45
- TL750L05CLP — 150mA 5V, 0.6v dropout, "ultra low" quiescent (no idea how low), $0.70
The fixed low voltage is buffered and stored in a large (~22µF electrolytic) capacitor as well as a small fast (~0.1µF ceramic?) capacitor to handle sudden changes in current. It's not a big deal if the LED's don't turn off instantaneously when power is removed, but they shouldn't stay on for more than a second or two.
Control: Power goes directly to the 16F628, which runs on its internal 4mhz oscillator to minimize parts/cost/size. Pins 4 (MCLR/RA5), 10 (LVP/RB4), 12 (RB6), and 13 (RB7) are reserved for in-circuit programming via Wisp628. Pin 11 (RB5) is used for the double-click detector. The following pins are used for LED outputs:
+------------+
RA2 | 1 18 | RA1
RA3 | 2 17 | RA0
| 3 16 | RA7
| 4 15 | RA6
| 5 14 |
| 6 13 |
| 7 12 |
RB2 | 8 11 |
RB3 | 9 10 |
+------------+
Double-Click: The combination of the capacitor buffers and the max 2mA current draw
of the 16F628 doubles as a classic R/C timer, allowing the PIC to run for 1 second after power has been removed. In the meantime, pin RB5 will detect exactly when power is removed. If the user turns the dome-light switch off and then back on within 1 second, then RB5 will drop low, then high again over the course of that second, while the PIC remains constantly powered and executing. Thus, a quick double-click can be detected, and the PIC will cause the LED to brighten one step (until it's at its brightest, when it will loop back to being its darkest). With switch debouncing, the states are:
According to the R/C Time Constant rule, time (seconds) = resistance (ohms) * capacitance (farad). T = R * C. Substituting V=IR in since we have a certain current draw and not a fixed resistance, we get T = V/I * C. Fortunately, google makes this terribly easy for us.
(dotted lines indicate when the PIC is/becomes powered off and unable to compute (eg. VSS drops below 3.0 volts). Yet "switch on" and such refer to the direct switch status coming in through RB5, not the time-delayed VSS input)
Output: Each LED should be flashed at least 40 times a second.
A MOSFET is used to drive the LEDs because it provides both voltage and current gain and thus is frequently used for microcontroller driving of power loads.
Shopping List
Power supply (get 3 of these)
LED Driver
12v wall-wart PSU for testing
- 7812
(eg. UA7812CKC)
- (all the other crap...)
- 1.5 amp rectifier
(eg. 1KAB05E)
- 0.33µF capacitor
(eg. this)
- 0.1µF capacitor (from above)
- 1k resistor
(eg. this)
- an LED power-on indicator
(eg. blue LED)
- heat sink
(eg. 507302C00000)
- (use part of the LED arrays's predrilled board or the LED driver board's plain copper-clad board)
- a male three-pin Molex connector from below for the board
- a three-pin female and 2-pin non-friction male Molex connector for insertion into a breadboard
- a three-pin female to three-pin Molex cable for testing of the board
Other
18-pin DIP socket
(eg. this)
single-sided copper-clad board for the control board
(eg. this)
Parts for the ICSP connector
2 male and 2 female min 2amp Molex connectors
(eg. male
and female
and terminals)
(actually, that fits the specs for the Wisp628 power input, and with 2.5amps supported, will work for any of my powersupplies. So get a bunch!)
Todo before ordering:
- Determine how many 5mm LEDs will fit in the cavity (tons... I could fit 30 in there I bet if I really tried) (actually, at 1" x 2" opening, and .1" holes drilled, I could fit around 50 in there, .2" is 5.08mm, so it's actually slightly over 50. And if my calculations are correct, that's about 20 watts of LEDs up in there (burst mode... 6 watts continuous... which is funny because the incandescent bulb that was in there was an 8 watt bulb (what's even more funny is thinking that replacing a $0.50 builb with $18 in LEDs is a good idea...))
- Figure out exactly what combination of male/female headers I'll want (or any other connectors...)
(2pin male & female, 3pin male & female)
(there's a .5" by .5" opening for the 3-pin header to go through. Hopefully it fits)
- Figure out exactly what's needed for the DIL clip connector.
- Power is directly connected on the Wisp628 side. The other part of power can come either directly from the chip, from an auxilary breadboard connection, or from an outside source. Basically, I want a male 2-pin header in the middle of this thing that's breadboardable, or can plug into a PSU, but with a dummy 2-pin female header hanging off just so it can be sheathed.
Todo after receiving order:
- Build the 12V supply, get it working like my 5v one
- Buy some "waxless auto rubbing compound"
- Buy a little awl/spikey thing for helping to align and start holes through copper?
- Finalize and verify trace layout
- Clean
- Drill holes
- Apply etch-resist
- Etch
- ...
- Build the DIL clip thing.
- Prototype the LED driver circuit on the breadboard
- See what sort of voltage drop through the LEDs the MOSFET can support (using just one row of LEDs, thus the same voltage but lower current)
- Build the LED array board. Make sure it works with the prototyped circuit (how many amps can my breadboard handle?)
- Build the LED driver board. Make sure it works with the 12v supply and the LED array board
- Splice the molex connector into the switch. Attach both boards to the car.