360 likes | 543 Views
TEAM 8: FULL COLOR AND BRIGHTNESS ADJUSTABLE LED LAMP. Kwin Xie Praveen Pradeep Tianyu Qi. Introduction. Purpose: Build an LED lamp capable of being remotely controlled to output nearly any color combination over a full visible light spectrum Benefits: Energy Efficient
E N D
TEAM 8:FULL COLOR AND BRIGHTNESS ADJUSTABLE LED LAMP Kwin Xie Praveen Pradeep Tianyu Qi
Introduction • Purpose: Build an LED lamp capable of being remotely controlled to output nearly any color combination over a full visible light spectrum • Benefits: • Energy Efficient • Wide arrange of immediate status indicators • Sunlight replication has mood enhancing effects • Certain colors advantageous in different situations e.g. reading, volatile chemicals, etc.
Objective • Operate using IR Remote • Independently adjust brightness of each LED (R,G,B) • Replicate sunlight • Create a product that is scalable for greater brightness
Original Design • Extension of EOH Project • Modular Design to Facilitate Easy Division of Work • Three Distinct Parts: IR Receiver, PWM, LED Circuit
Project Build Final Design • Eliminated second PIC for room considerations • Chose Set Resistor Values Instead of Potentiometers • IR Input to Pin 7
Infrared Receiver Circuit & Code Components • Toshiba TV Remote Control • Panasonic Infrared Receiver Chip • MicroChip PIC 16F877A
Infrared Receiver Circuit & Code Toshiba CT-900037 • 38 kHz Carrier Frequency • Bit Scheme • Used digital oscilloscope to capture the signal • Control Scheme • Assigned functions to buttons based on design needs
Infrared Receiver Circuit & Code Control Scheme • Set LED Brightness Value • Red, Green, and Blue LED Select • Power • Sunlight Replication and Transition Mode • Increment/Decrement Brightness
Infrared Receiver Circuit & Code Start Signal 13.64 ms 0-bit 1.110 ms 1-bit 2.240 ms Total 32 bits 67.24 ms
Infrared Receiver Circuit & Code 64 191 7 248 | Start Signal | 00000010 | 11111101 | 1 1 1 00000|000 1 1 1 1 1| | Start Signal | 00000010 | 11111101 |000 1 0000|1 1 1 0 1 1 1 1| 64 191 8 247
Infrared Receiver Circuit & Code Panasonic PNA 4602M • Off the Shelf Chip vs Custom Circuit • Cheaper, better, more convenient • 3-pins – Vo, GND, and Vcc
Infrared Receiver Circuit & Code Tests • Power Consumption • 5V*0.001A = 0.005 W • Range and Operating Envelope Tests • Max: 81 ft • Angle: Up to 105 Degrees from Center
PIC 16F877A • Operating speed 20 Mhz external clock 200 ns instruction cycle • Operating temperature ~-55 to +125°C • Max current ~300 ma
Epson Crystal Oscillator • 20.0 Mhz • Same as the one used in PIC data sheet • Smaller than Fox 20.0 Mhz oscillator • Operating temperature~-20oC to 70oC
Infrared Receiver Circuit & Code PIC 16F877A • Code was incorporated into the main PWM code • Numerous Challenges Faced • How to handle start code • Trial and Error for correct Threshold • How to handle bad signals Initialize PWM, I/O Ports, and Variables Sample Input Pin, wait for Falling Edge Call “GetSignal” Function Update PWM
Infrared Receiver Circuit & Code GetSignal Function Array[Index] = 0 T < Threshold Check Timer Value Index++ Timer = 0 T > Threshold Falling Edge Array[Index] = 1 Convert Bits 16-23 to Decimal Value Check Time Since Last Falling Edge Return Value Loop Times Out Timer ++ No Falling Edge
Mode Selection Flowchart Select mode based on RGB value from GetSignal() SUNLIGHT Set duty to sunlight mode TRANSITION If duty[i]<255 increment once each cycle until 255. If 255 is reached, decrement once each cyclye until 0. Repeat CONSTANT DISPLAY Choose the color based on variable RGB. Set the color’s duty[i] = Value [updated by GetSignal()] Program PWM
Apparent Magnitude Scale • Apparent magnitude • M1-M2 = -2.5log(PWM1/PWM2) • M1-M2 = -1 indicates that source 1 is perceived to be twice as bright as source 2. • PWM = 13.7583*X^1.329
Sunlight Replication • Measured each LEDs total output (= Ir,Ig,Ib)
Sunlight Replication • Calculated wavelength at peak brightness of each LED (=wr,wg,wb) • Measured relative height of sunlight spectrum at wr,wg,wb(= Hr,Hg,Hb) • Calculated PWM for each LED using Ii*PWMi = constant*Hi(wi )
Light-emitting Diode Specifications • Kingbright 3W RGB LED • 350 mA max current each channel • Built-in zener protection • Aim for max output power for each color, match luminosities through PWM
Current amplification • Increase current output from PIC (25 mA max) • Common-emitter amplifier configuration of BJT • BC337 NPN capable of driving 350 mA+ • 680 ohm base resistors ensure operation in saturation region
Current-limiting Resistors • Increase current output from PIC • Affix current magnitude through each LED to be near 350 mA Set Ic around 330 mA. For red at worst-case: Magnitude always around this value at worst-case, duty cycle varies through PWM output
Testing Current through LEDs • Measure voltage across current-limiting resistors and divide by resistance • Make up for differences in ‘expected’ current and luminosity in scaling factor through PIC
Red LED channel voltage Red at 5 brightness setting on remote Ir,measured=1.06/8.7=122 mA
Green LED channel voltage Green at 2 brightness setting on remote Ig,measured=1.27/6.8=187 mA
Blue LED channel voltage Blue at 8 brightness setting on remote Ib,measured=1.14/6.2=184 mA
PCB Fabrication and Mounting • Switch from 2 to 1 PIC design enabled 4 x 3 in. PCB size and layout in EAGLE • PCB enclosed within lamp on stand • Sensor and DC power supply wires run out from bottom
Testing-Temperature • Left LEDs at max for 18 hours • Temperature increase in LED and PIC imperceptible • All functions tested successfully • Fuse still intact
Successes and Challenges • Decoding 1-bits and 0-bits • Troubleshooting problems with new IR Receiver Chip • Two PIC Modular Design vs Single PIC • LED Light Dispersal
Recommendations • USB Interfacing • Feedback Control (match sunlight at different times of day) • Programmable sequences • Scaling up – green, blue more important for reading