( 2 Votes )

After

LED Boards

I recently brought a few components from Sure Electronics which included aluminium based LED boards. They caught my eye given the cheap price, US$2.04 (at the time of writing this article) and come completely assembled ready to be connected to 12-13.8V. Here's what they look like;

LED_Board 12103409331219459471

 

They throw a soft, wide angle light pattern which suits general purpose lighting effects, and that's exactly what I ended up using them for in one of my "Sunday afternoon" projects. The first piece of furniture that could benefit with a little lighting that came to mind was the entertainment unit. It has several storage compartments which would serve great places to mount the LED's and throw some light around. You could use any LED's to do a job like this, though the above modules flood light very well and are extremely easy to secure in place. Here's what the entertainment unit looked like before and after the modification;

Before After

The result is a soft (or harsh if desired) "radio-active" type glow, though the above photos really struggle to give it the justice - especially with low ambient light. So they are mounted in the above pictures, though I couldn't settle with just that - next on the plan was dimmable light control (with a PIC of course!).

 

Control Box

An early revision of the light dimmer included a Logic Level N-Channel FET being driven exclusively by the 5V PIC. It worked OK, though the FET was not saturating enough for my liking (without the FET "turning on" completely, the LED's were not driving at full brightness). Sure I could have ordered a better model LL FET with a lower Vgs, or I could cater for any type of FET and include a proper driving circuit (transistor driven Vcc instead of direct Vdd).

In hindsight a P-Channel Fet could have been used as the N-Channel inverts the operation. I originally compensated with software, though in the final revision I simply reversed the polarity of the potentiometer. All that said, you could use any method you like to drive the LED's, I chose the FET approach as it scales to larger projects quite well (can drive ++Amps compared to heavy duty transistors/darlington arrays). Not shown above is the external circuit to attach the LED modules. I made it separate as I didn't want a whole loom of wiring hanging out of the control box - a lead terminated with 2.5mm DC Sockets on either end connects to the two boxes and keeps things looking clean. Here's the main control box with potentiometer fitted to the top:

Complete

Top view of the control box. This is what sits on-top
of the entertainment unit.

Inside_View_copy

The completed PCB board with components fitted.

 

Schematic

Light_Dimmer_Circuit

 

Mounting the LED Boards

Mounting the LED boards were pretty easy. Pilot dril holes and some short 4AG screws did the job fine. I also used phone-line cable holders to route the cables neatly around the entertainment unit. Here's a shot of an installed LED strip;

mounted

One of the earlier photo's showed the entertainment unit with the LED's turned on - its in that shot that its noticeable that all the compartments have upper over-hanging bits of timber. Hiding the light source "adds" to this feature lighting approach, and can be used in similar methods on over-hanging bars or other features around the house.

 

PIC Program

And of course the program itself. Briefly put, the PIC grabs the 10-bit ADC value of channel 0 (the brightness control potentiometer), and places it into the 10-bit duty cycle buffer. Simple eh. Works beautifully to ;)

Lighting Program (Swordfish PICBasic)
    Device = 18f2520
Clock = 32
Config OSC = INTIO67
 
Include "InternalOscillator.bas"
Include "ADC.bas"
Include "PWM2.bas"
 
 
Const gamma(64) As Byte = ( 0, 1, 2, 2, 2, 2, 3, 3, 3,
4, 4, 5, 5, 6, 6, 7, 8, 8,
9, 10, 11, 12, 13, 14, 15,
17, 18, 20, 21, 23, 25, 27,
29, 31, 34, 36, 39, 42, 45,
49, 53, 57, 61, 65, 70, 75,
81, 87, 93, 100, 107, 114,
123, 131, 140, 150, 161,
172, 183, 196, 209, 224,
239, 255 )
 
 
Function GetBrightness(Channel As Byte) As Byte
Result = ADC.Read(Channel) / 16 ' Result 0..63
  End Function

 
// Start Of Program...
OSCTUNE.6 = 1 // enable PLL
ADCON1 = %00000000 // configure 18F2520 ADC module
ADCON2.7 = 1
SetConvTime(FRC)
 
pwm.SetFreq(31250)
pwm.Start1
pwm.SetDuty1Percent(0)
 
While True
// sample ADC channel 0, and fill duty cycle buffer with the result
CCPR1L = gamma((GetBrightness(0)))
Wend

(A BIG thanks to Mike for the code snippet for gamma correction)

With the above program there's 1024 bits of resolution for brightness control; allowing the LED's to go from completely off to hard-on.

Feel free to post comments below =)

Comments 

 
0 #1 hop 2010-02-20 17:04

I really like this project! Especially since it directed me to some wonderful lighting solutions at Sure Electronics. Their prices are amazingly reasonable and there are a lot of options as far as size, color, configuration.

And now that I have found that source thanks to you, I'll need a way to drive those fixtures. This project makes that happen.

Thanks again Graham for your awesome contribution!
Hop

Quote
 
 
0 #2 Graham 2010-07-16 09:27

Thanks to Mike for messaging me with the appropriate code for gamma correction. I have updated the article to include the changes

Quote
 

Forum Feed

New Articles



Simulating Analog Sensor Inputs +

Simulating Analog Sensor Inputs
When developing an embedded application using analog sensor inputs, testing at specific sensor levels can be difficult.  For example, in my icemaker controller project, actions need to occur at certain water levels.  Using the actual sensor...
Author: Jon Chandler

Simple Signal Generator - Revised +

Simple Signal Generator - Revised
I recently had use for the simple signal generatorI described before for testing out some piezo buzzers I got for next to nothing.  I reloaded the code onto a TAP-28 board...
Author: Jon Chandler

Reliable Header Connectors +

Reliable Header Connectors
Header pins are ubiquitous on dev boards.  Jumpers can be used to make connections during tests and code development but real-world applications need reliable connections.  Connectors for single row headers have always been a problem for me,...
Author: Jon Chandler

Swordfish Module - NMEA2 +

Swordfish Module - NMEA2
I had a couple of issues when using David Barkers module NMEA.bas on my Big GPS Clock project. In particular, variables were being corrupted making the program very unstable. I'm not familiar...
Author: Graham

10 Keys on One Port Pin? +

10 Keys on One Port Pin?
I'm working on a control system that will have several relays, a bunch of LEDs and a number of switches.  I was rapidly running out of port pins on a TAP-28 board to handle all the desired I/O.  Possible solutions included adding an I2C port...
Author: Jon Chandler

Port Pin Output Tricks +

Port Pin Output Tricks
Most micro-controller projects use port pins for outputs, often to turn on an LED or motor.  When using a port pin as an output, we usually think of two states.  A low state means the pin is connected to ground, while a high state means the...
Author: Jon Chandler
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

Member Access



Whos Online

 We have 15 guests and 1 member online


showcase

Make your own Tetris game. 64 LEDs and four buttons all controlled by one PIC..

More

C18 Tutorials


feature_a_small

Have a browse of the C18 category. Feel free to share your own guides with the community

More


showcase

Mitchy builds a clock with 4 inch displays and a GPS module at the core

More

DS1307 RTC


feature_a_small

This project makes use of Jon Chandlers TAP-28 development board. The DS1307...

More

Member Access