Designing building & installing a homemade 12VDC LED lighting system

Joseph Julicher, Engineering Mgr, MCU8 Division, Microchip Technology Inc. -November 04, 2014

An upgrade for the family cabin

My family has a cabin in the woods of Northern California. We built the "new cabin" in the late 1950s when the one built in 1922 had too many maintenance issues. Before our recent overhaul, its lighting was supplied by a combination of the original propane lamps and AC driven fluorescent tubes. The AC power is provided either by inverters fed by a battery bank or 3 KVA generator that is feeling its age. The generator works just fine and the AC light is working, but there are still a few issues.

1) All fuel has to be hauled up to the cabin in 5 gallon cans. The nearest fuel is 1 hour away.
2) The generator is noisy.
3) The generator must be turned off every night to conserve fuel and restarted when power is needed.

The generator fuel conservation measures mean that breakfast is always cooked by propane.

The cabin’s present energy storage system consists of several large car batteries, and works quite well. However, the batteries cannot be left at the cabin, due to the weather, and it must be large enough to accommodate both the AC lighting requirements and the inefficiencies of the cabin's old-style inverters. Lastly, solar panels which do a good job of charging the large battery bank during the summer are less effective in the fall, when some family members use the cabin as a hunting lodge.

With the arrival of the LED lighting revolution and efficient DC-DC converters, we decided to revisit the cabin’s battery-powered lighting system. It was determined that our baseline requirements could be met with 11 LED lights, capable of producing a nominal 60W incandescent-equivalent output, plus a few low-power LED night-lights to help visitors find their way to the restroom at night.

Figure 1: Our family's cabin, located in Northern California.

Designing the system

I decided to base the system's design on the CREE® LMH-2, light fixture rated to produce a nominal 850lm output while drawing 10W (500 mA at 20V). After having used the LMH-2 as a test load for MCU-controlled, DC-DC converters in my professional life, I already knew that they are reliable, offer good light distribution and include a circuit which corrects the LEDs' color temperature for temperature and age effects.

With the fixture I'd be using selected, my next task would be to create an inexpensive power supply which was compact enough to attach to each LED fixture and drive it off the DC power stored cabin's battery bank. The third step would be to install the resulting system.

The power supply design I developed is based on Microchip’s PIC16F1788 8-bit MCU1. Its SEPIC topology works with inputs ranging between 9 and 24 VDC (Figure 2). This particular MCU was well-suited to this project because it integrates many of the analog and digital peripherals and other features necessary to implement a modern DC-DC LED driver/controller. This includes:
1) Dual op amps for current measurement.
2) 1 high speed op amp for the peak current mode control.
3) The ability to configure the PSMC for fixed OFF time.
4) SPI interface for high-speed communications with the radio.
5) Sufficient memory to accommodate the code for the MiWi2 wireless networking protocol stack2).
6) Sufficient performance to run the current regulator at 6 khz. (adequate for an LED light)

Figure 2: A block diagram of the cabin's lighting system

The firmware I used in the LMH-2's MiWi™ wirelessly-controlled ballast performed the following functions:
1) Configure the hardware for SEPIC power supply according to the block diagram.
2) Regulate the output current to the desired level by closing the loop between the average output current and the peak current setpoint.
3) Manage the MiWi network and respond to dimming commands by adjusting the output current setpoint.

We'd hoped to light the entire cabin with a design power budget of 100W but that would have required LEDs with an efficacy of nearly 60lm/W. Unfortunately, the efficacy of today's commercial LED products are typically in the range of 100 lm/W. Planning the cabin's power budget began with this real-world figure which was further adjusted by factoring in the additional losses introduced by power-supply inefficiencies and light-fixture design. Using the LMH-2's specified output Lumens, the measured input power of the SEPIC converter and the LED fixtures, the system's end-to-end efficacy was estimated to be 70 lm/W.

Figure 3: Microchip’s PIC16F1788 28-pin 8-bit Advanced Analog Flash MCU serving as a DC-DC converter for one of our off-grid LED lighting fixtures.

System deployment

My father, Mark, and I arrived on site at midnight, after driving from Maricopa, AZ for 17 hours with conduit parts, wire, lights and tools. The conduit had been pre-staged by a relative the previous week, so all was in a state of readiness. We slept for five hours and got ready to work.

Over breakfast, which we prepared by propane light, we discussed the plan. We had 10 LMH-2 lights, each equipped with Microchip’s SEPIC controllers, 120’ of conduit and plenty of wire. So we decided to partition the lights, as indicated in Table 1.

Table 1: Cabin Lighting Plan

This arrangement provides us with excellent light in the two most used locations (kitchen and dining room), and provide somewhere between good and great light everywhere else. The power distribution box I constructed has six available fuses. We decided to pull the wire into the attic for all six fuses, and to save some wire for future expansion. The wiring plan was to run no more than five primary lights on each branch, which we would accomplish by grouping the lights, as shown in Table 2.

Table 2: Cabin Wiring Plan

Day 1
After breakfast, we started work by hanging the power distribution box and the power entry box. The power entry box is a weather-resistant box with brass contacts for attaching a 12V power source. Its brass contacts are large enough for automotive jumper cables. The power box was mounted on the outside of the cabin, close enough to where the vehicles are parked to “jump” the cabin with jumper cables. The power distribution box is located inside the cabin, and contains a fuse block, Watt-meter and master power switch. The fuse block supports six fuses. The wattmeter was originally designed for RC modeling, which seemed perfect for monitoring this power system.

After mounting the power boxes, we greased six wires and shoved them down the short conduit from a junction box in the attic into the power box. We placed ring terminals on the ends and wired up the box. The attic was now ready for wire.

The next order of business was to drill holes in the ceiling for lights in the bunk room. We drilled the holes and ran the conduit. Some surface-mount PanduitTM was run down the wall for the light switch, and an always-hot line to the night-light dimmer. The night-light was built from a long strip of 12V white LED tape. These tapes are 24W per 5 meters and consist of three LEDs and a resistor every 3 inches or so. You can cut them to length in multiples of the three LED circuit.

From the bunk room, we headed east toward the kitchen. This was a detour for the light switches and a break for lunch. Shortly after lunch, we had all lights tested and operating for the bunk room, kitchen and dining room. With some functioning light, we powered the two lights in the dining room and verified 23Ws from the battery. The 23Ws for a well-lit dining room seemed wonderful, so we had a steak dinner and went to bed.

Day 2
On Wednesday morning, we decided that we needed some parts. We had previously made only a crude conduit plan, due to a lack of knowledge of attic conditions. We were using T fittings at a high rate, and needed a weatherproof switch for the porch light. We loaded the truck and headed for the nearest hardware store, 1 hour away. We saw the morning clouds below us and scared up enough turkeys for a thanksgiving feast. There are some benefits to vacationing up here, but convenient trips to the local hardware store are not part of mountain life.

After returning from the hardware store with the remaining parts and some after-work snacks, we got busy finishing the master bedroom, master bathroom and the utility room.

Figure 4 shows the dining room. We left the previous fluorescent lights in place, as they were wired for use with a generator. If you bring gasoline and want the noise of a generator in the woods, you can get a slightly more light with the 80W twin tube fixtures. The two LMH-2s, however, provide almost as much light with a nicer color at 20W.

Figure 4: Dining Room

Figure 5 shows the utility room, with a single 23W fluorescent and a 10W LMH-2. The LMH-2 produces a little less light and it is, unfortunately, focused downward because I did not have the optional dome diffusers. The light fixtures are a .032” aluminum bent, punched and painted to hold the LMH-2 fixture and provide a little heat- sink area. Thermal management of this system is very easy because there is only 5W of heat in the light source and about 2W in the power supply; plus, the evening temperatures are around 20°C in the summer and 10°C in the winter. (As I write this, it is 9:20 p.m. and 27°C.

Figure 5: Utility Room

Day 3
Day three started with breakfast and a discussion on sustainable cabin energy. A waste heat converter on the propane water tank was interesting, but hydropower from the spring is continuous energy while it is not frozen. We checked the Watt Meter and learned that night lights, full power for photos, breakfast and talk used 56 Whs of energy. That should be replenished in 3 to 4 hours with my 30W solar blanket even with winter sun. Work for day three consisted of adding the last light in the kitchen, closed up the conduit and writing the usage manual so our relatives could utilize the system.

After a year of planning and three days of intense work, we now have a DC lighting system running off-grid in a remote part of the United States. This system should provide the family with trouble-free, quiet light for the next few generations. This cabin has already seen lighting advance from propane gas mantles to AC incandescent, AC fluorescent and now to DC LED. Each generation of technology has reduced maintenance, improved performance and increased the enjoyment of family vacations.

For additional information on the electronics used in this LED lighting system please refer to the links in the References section below or visit


1 - Devices Used in This Design:

PIC16F1787, MCU-Based Power Supply Controller

MRF24J40MA, 2.4GHz RF Module

MCP16322, 3.3v Switching Buck Regulator

MCP1416, Low Side MOSFET driver

MCP87130, N-Channel MOSFET

2 - The Microchip MiWi™ Wireless Networking Protocol Stack is a simple protocol designed for low data rate, short distance, low-cost networks. Fundamentally based on IEEE 802.15.4™ for Wireless Personal Area Networks (WPANs), it was later expanded to support Microchip's proprietary RF transceiver. More information can be obtained by visiting Microchip Technologies MiWi home page  or downloading Microchip application note #AN1066

Note: The Microchip name and logo, and PIC are registered trademarks of Microchip Technology Inc. in the USA and other countries. Cree is a registered trademark of Cree, Inc. All other trademarks mentioned herein are the property of their respective companies.

Loading comments...

Write a Comment

To comment please Log In