Bạn có muốn phản ứng với tin nhắn này? Vui lòng đăng ký diễn đàn trong một vài cú nhấp chuột hoặc đăng nhập để tiếp tục.



 
Trang ChínhLatest imagesTìm kiếmĐăng kýĐăng Nhập

Share | 
 

 RGB LED Mood Light

Xem chủ đề cũ hơn Xem chủ đề mới hơn Go down 
Tác giảThông điệp
A3pro
A3pro
A3pro
A3pro

Tổng số bài gửi : 176
Join date : 04/11/2010
Age : 35
Đến từ : Bạc Liêu

RGB LED Mood Light _
Bài gửiTiêu đề: RGB LED Mood Light   RGB LED Mood Light EmptySun Nov 14, 2010 9:01 pm

http://picprojects.org.uk/projects/rgb/index.htm



RGB LED Mood Light
Standalone PWM
controller for RGB LEDs
using 12F6xx PIC



RGB LED Mood Light Indextop




google_protectAndRun("ads_core.google_render_ad", google_handleError, google_render_ad);
RGB LED Mood Light Line.colorbar
This RGB LED Moodlight is new for Autumn 2010
Check back regularly for updates to this project page
RGB LED Mood Light Line.colorbar This project is an update to the original RGB LED PWM Driver. The new version allows the use of either 5mm LEDs or the square bodied Superflux / Piranah style LEDs. The circuit now uses bipolar transistors rather than MOSFETs which make it more suitable for novice constructors and for the first time this project is available as a kit with all parts required to assemble the PCB including the superflux LEDs. (power supply not included) Full schematic and construction details are shown on this page, as well as the firmware download for those who want to create their own effects or build their own version from the schematic. If you're not into programming the kit includes a PIC microcontroller pre-programmed with the firmware and a number of mood lighting effects.






Circuit Description The circuit itself is fairly straightforward. Diode D1 provides reverse polarity protection for the board in case the power supply is connected backwards. C1/C2 and IC2 take the incoming 12 volt supply and provide a regulated 5 volt supply required by the PIC microcontroller. Thered, green and blue LEDs are arranged in three parallel strings ofthree LEDs. Resistors R1, 2 and 3 limit the current through the LEDsto a safe value when using a 12 volt power supply. The low side of eachLED string connects to a BC547 NPN transistor which is used to switchthe LEDs on and off. These transistors are in turn controlled by thePIC microcontroller which drives each of the red, green and bluechannel transistors with a PWM signal to control the average brightnessof the LEDs. Switch S1 is used to select different effect sequences. The firmware program running on the PIC microcontroller is the smartpart of the circuit and determines what colours are generated and howthey fade from one colour to the next. The three colours of LEDs are positioned on the PCB in an irregular arrangement to improve the colour mixing effect when placed behind / inside a diffuser such as a frosted glass globe. The controller uses (RGB) Red, Green and Blue high brightness LEDs that are pulse width modulated (PWM) to vary the intensity of each colour LED. This allows effectively any colour to be generated with rapid changing strobe effects, fast and slow colour fades as well as static colours. The data used to set and change the colours is held in an easy to edit file so if you don't like the sequences provided with it, you can modify the sequence data include file yourself and reprogram with your own sequences. (you will need a PIC programmer and some practical knowledge of microcontrollers and programming if you want to do this.)





Schematic <blockquote> [url=http://picprojects.org.uk/projects/rgb/schematic RGB101D.jpg] RGB LED Mood Light Schematic%20RGB101D_small[/url] [url=http://picprojects.org.uk/projects/rgb/RGB LED Driver 101D sch.pdf]Download schematic as PDF RGB LED Mood Light Pdf[/url]
RGB LED Mood Light Pcbbot Artwork bottomRGB LED Mood Light Pdf RGB LED Mood Light Pcbtop Artwork topRGB LED Mood Light Pdf RGB LED Mood Light Overlay OverlayRGB LED Mood Light Pdf

The dimensions of the PCB are 50mm x 50mm.
The PCB supplied with the kit is professionally manufactured thru-plated with solder mask top and bottom and screen print overlay on FR4 laminate with RoHS finish.
If you want to etch your own PCB you can use the artwork above. Unless you are able to thru-plate your own PCB you will need to solder component leads top and bottom where required. Also look for the single via on the board that will need to be wired through.
The ready made PCB supplied in the kit has through plated holes so this does not apply.
</blockquote> Kit Contents <blockquote>
RGB LED Mood Light P6100019_small1 The kit available from the Picprojects On-line store contains all the parts required to build the RGB LED Moodlight. This includes all the components, quality FR4 double sided PCB, Superflux LEDs and a PIC12F629 microcontroller pre-programmed with the firmware. RGB LED Mood Light Infodot12 volt power supply is not included in the kit
RGB LED Mood Light Dcpower_small A 2.1mm chassis mount DC power jack and 100mm of red/black wire are available as an option
RGB LED Mood Light Line.colorbar
<table id="table12" width="80%" border="0" cellpadding="9" cellspacing="0"> <tr> <td bgcolor="#00ff00">
Available now from the on-line store - self-assembly kit for the RGB LED Mood Light project only £9.99</td> </tr> </table>
RGB LED Mood Light Line.colorbar

</blockquote> Construction & PCB <blockquote> RGB LED Mood Light Infodot The information in this section is relevant whether you are assembling from the kit or sourcing everything yourself so please take the time to read through this section and refer back during assembly. This section is written so that even someone with little knowledge of electronics can successfully assemble the board; for those with more experience there is still useful and relevant information so please stick with it.
RGB LED Mood Light P6100021_small1 RGB LED Mood Light P6100024_small1 RGB LED Mood Light P6100028_small1 RGB LED Mood Light Ledship_small
Photo.1 Photo.2 Photo.3 RGB LED Mood Light Exclamation3Photo.4
Photo. 1 The bare PCB. The component side has a white component overlay silk screened onto the board which should be used as a reference when installing the components. Note: Components JP1, R8 and C3 are not used with this project and are not supplied in the kit #101F. Do not install any components in these locations. Photo. 2 Start by installing the 1N4148 diode D1 in the position shown. Note the black band around one end of the diode. This must be installed in the direction shown Photo. 3 Install all the resistors. The coloured bands denote the resistor value. It doesn't matter which way round you fit them but you must make sure the right value resistors are installed at the correct locations. RGB LED Mood Light R68R blue, grey, black, gold - value 68R ( R1, R2 ) RGB LED Mood Light R150R brown, green, brown, gold - value 150R ( R3 ) RGB LED Mood Light R1K brown, black, red, gold -value 1K0 (R4, R5, R6, R7) Photo. 4 <table width="100%" border="0" cellpadding="5" cellspacing="0"> <tr> <td valign="top"> RGB LED Mood Light Exclamation2</td> <td> The LEDs are shipped in anti-static foam along with the PIC16F629 microcontroller and IC socket. The red, green and blue LEDs appear physically identical when not operating. In order to identify them for assembly they are placed in the anti-static foam in three rows as shown in photo. 4 </td> </tr> </table> <blockquote> Please DO NOT REMOVE the LEDs until you are ready to fit them and then do so one LED at a time. If you get the LEDs mixed up and solder one into the wrong position it is difficult to unsolder them without damaging the PCB and/or LED. </blockquote>
RGB LED Mood Light P6100037_small1 RGB LED Mood Light P6100041_small1 RGB LED Mood Light P6100047_small1 RGB LED Mood Light P6100053_small1
Photo.5 Photo.6 Photo.7 Photo.8
Photo. 5 Now install the three RED LEDs in the locations marked 'R' on the PCB overlay. One corner of the LEDs plastic body is cut-away. You must install the LED so that this corner corresponds to the marking on the PCB overlay. Also make sure to keep the LED firmly pressed against the PCB while soldering in place so it doesn't finish at some odd angle. Photo. 6 Now install the three GREEN LEDs in the locations marked 'G' on the PCB overlay. One corner of the LEDs plastic body is cut-away. You must install the LED so that this corner corresponds to the marking on the PCB overlay. Photo. 7 Now install the three BLUE LEDs in the locations marked 'B' on the PCB overlay. One corner of the LEDs plastic body is cut-away. You must install the LED so that this corner corresponds to the marking on the PCB overlay. <table id="table13" width="100%" bgcolor="#c0c0c0" border="0"> <tr> <td bordercolor="#C0C0C0"> Option to install LEDs on the back side of the PCB Depending on your application for the mood light you may want to mount the LEDs on the back side of the PCB so you don't see the other components. If you do this you need to be careful to fit them in the correct location and orientation since there is no overlay on the back side. The photo (right) shows where to fit them and the correct orientation. Since the holes in the PCB are plated through you will solder the leads on the top side of the board.</td> <td> RGB LED Mood Light Flipleds_small</td> </tr> </table> Photo. 8/9 Install the 22µF capacitor C2. One lead is shorter than the other. You must install the short lead into the hole nearest the edge of the PCB as shown.
RGB LED Mood Light P6100054_small1 RGB LED Mood Light P6100059_small RGB LED Mood Light P6100061_small1 RGB LED Mood Light P6100068_small1
Photo.9 Photo.10 Photo.11 Photo.12
Photo. 10 Install the 100nF capacitor C1. This can be fitted either way round. Photo. 11/12 Next install the three BC547 transistors Q1,2,3. These look physically similar to IC2 so make sure you check the laser-etched marking on the body of the part (photo. 11). The transistors must be installed the correct way round. Align the body to match the PCB overlay. RGB LED Mood Light Infodot BC548 transistors may also be used for Q1,2,3 and are interchangeable with the BC547 part.
RGB LED Mood Light P6100069_small1 RGB LED Mood Light P6100072_small1 RGB LED Mood Light P6100075_small1 RGB LED Mood Light P6100080_small1
Photo.13 Photo.14 Photo.15 Photo.16
Photo. 13/14/15 Now install the 78L05 voltage regulator, IC2. The wire leads on this part may need to be realigned to go through the holes on the PCB, carefully bend them using flat nose pliers. Again, this part needs to be fitted the correct way round. Ensure the body is aligned to match the PCB overlay. Photo. 16/17 Install the 8 pin socket for IC1. Note the small notch at one end of the socket. This should be aligned with the marking on the PCB overlay. Also install switch S1 into its position on the PCB. You may need to push down firmly and evenly to get the switch to seat into the holes in the PCB. <table id="table14" width="100%" bgcolor="#c0c0c0" border="0"> <tr> <td>Option to locate S1 on back side of the PCB Depending on your application you may want to fit switch S1 on the reverse side of the PCB. If so, simply fit it on the back of the PCB as shown and solder in place. You may also use a pair of short wires (up to 200mm / 7 inches) if you want the switch located off the PCB, for example on the outside of a case.</td> <td> RGB LED Mood Light Flips1_small</td> </tr> </table>
RGB LED Mood Light P6100083_small1 RGB LED Mood Light P6100084_small1 RGB LED Mood Light P6100091_small1 RGB LED Mood Light P6100089_small1
Photo.17 Photo.18 Photo.19 Photo.20

Photo.18
RGB LED Mood Light Exclamation2Before applying power to the board for the first time, check the underside of the PCB for solder bridges, bad joints and bits of component lead off-cuts that may have stuck to the board. Connect the red and black wires for the power connection to the board. The board requires a 12 volt regulated power supply input of at least 200mA. See the section here for more information on the Power Supply Requirements RGB LED Mood Light InfodotThe board has reverse polarity protection so it shouldn't be damaged if the power supply is connected the wrong way round, however it won't operate unless the power is connected correctly. Photo. 19/20 You don't have to check the voltages to the board however, if you have a multimeter to hand it is advisable to have a quick check before installing the PIC microcontroller into the IC1 socket. Check the 12 volt supply to the board. This should be between 11.8 and 12.8 volts Check the 5 volt supply at pins 1 and 8 of the IC1 socket (photo 20). The voltage should be between 4.75 and 5.25 volts. If either of the measured voltages are outside the ranges above you need to investigate the cause before continuing.

RGB LED Mood Light P6100095_small

RGB LED Mood Light P9140038_small

RGB LED Mood Light Operating_small
RGB LED Mood Light Globe_small
Photo.21 Photo.22 Photo.23 Photo.24
Photo. 21 RGB LED Mood Light InfodotIMPORTANT. Before continuing make sure you have disconnected the power supply to the PCB. With the power disconnected you should now install the PIC microcontroller into the IC1 socket. The PIC has a small notch or indent at one end. This should be located towards Capacitor C1 as shown. Photo. 22 Take the two wires connecting power to the board and pass them through the hole in the PCB as shown. This acts as a strain relief for the wires. Photo. 23 Once the PIC microcontroller has been correctly installed into the IC1 socket apply power to the board. The LEDs should now light and start fading through various colours. RGB LED Mood Light Exclamation2The light from these LEDs is very intense when viewed on-axis so you should avoid looking directly into them when the board is operating. Photo. 24 Example of how the board can be used. A small round frosted glass table lamp bought from a DIY store. Remove the original bulb holder fitting and sit the RGB LED Mood light board inside for a stunning effect. More info' here (this particular lamp was bought from B&Q in the UK, type Athens Small Glass Table Lamp White, price £8.98 - Summer 2010) <table id="table15" width="100%" bgcolor="#c0c0c0" border="0"> <tr> <td> LED options The PCB101D was designed so it could be used with both 5mm LEDs using a 0.1" lead spacing as well as the 4 lead square Superflux type LEDs. The kit is supplied with the Superflux LEDs but if you're building your own version you have the choice of LED type to use.</td> <td> RGB LED Mood Light 5mmleds_small</td> </tr> </table> Wiring the DC Power Jack If you bought the DC Power Jack option from the on-line store you should wire the terminals as shown below. The centre pin will then connect to the red 12V wire and the outer barrel to the black Gnd wire. This is suitable for use with the majority of plug top style power supplies wired with a centre positive terminal
RGB LED Mood Light Dcwired_small
DC Power Jack (DCPWR21)
RGB LED Mood Light Infodot Please note this applies only to the DC Power Jack supplied as a kit option; if you source your own connector its terminals may be wired differently and you will need to establish this yourself.
RGB LED Mood Light PSUjack_small
</blockquote> Power Supply Requirements <blockquote> The RGB LED Moodlight requires a 12 volt regulated DC power supply rated for 200mA or higher. This is important, a non-regulated 12 volt supply may actually output 14 or 15 volts and this will damage the LEDs over time unless you alter the current limiting resistors. The power supply must also output DC not AC. Avoid halogen down light transformers unless they are specifically designed for operation with LED lighting since many supply unfiltered DC or even AC which is unsuitable. Also don't use Constant Current power supplies designed for LED lighting with this board. Many downlight transformers will not work correctly without a high power load connected to them. (Halogen type down lights use 20-50watts, the LED mood light uses about 1 watt) You can get plug top style power supplies from many places including eBay where there are good deals to be had. In the UK you can also get them from the high street retailer Maplin Electronics and online from Rapid Electronics If you're buying a power supply to use with the DC power jack option available from the on-line store, the barrel connector on the power supply needs to be 2.1mm (this refers to the diameter of the hole in the middle) Any of the following power supplies from Rapid Electronics are suitable and if you look at these it will give you an idea of what you need if you're sourcing from elsewhere.

  • 5W Switch mode plugtop PSU Euro Plug 12V 420MA Rapid Part # 85-3732
  • Plug & Go 12vdc 6 watt (EUP) Rapid Part # 85-3703
  • 12vdc 1amp CCTV Smpsu (EUP) Rapid Part # 85-3770
  • 12vdc 15watt UK Smpsu 2.1 C ve (EUP) Rapid Part # 85-3737
<blockquote> Part numbers correct as at September 2010 </blockquote> To summarise then, you need a 12 volt DC regulated power supply capable of delivering at least 200mA of output current (a higher current rating is fine, but it must be 12 volts DC) </blockquote> Mood Light Example <blockquote> This is something I put together in the workshop in 30 minutes, I'm sure you can do better but this gives you an idea of what you can do. This was made using a lamp bought from B&Q in the UK, type Athens Small Glass Table Lamp White. The base plate is made from 1mm aluminium sheet cut and shaped as shown. Holes are drilled for the PCB mounting spacers and the DC jack socket. The aluminium is bent and then 4No 10mm nylon hex spacers are fitted with 4mm M3 counter sunk machine screws. The DC socket is fitted to the angled bracket (note the use of insulating sleeving on the terminals). The assembled LED Mood Light PCB is then fitted to the base using 6mm M3 machine screws. The lamp bowl already had a slot in the side so when it is placed over the Mood Light assembly the power cable has room to pass through.
RGB LED Mood Light Mlb1_small RGB LED Mood Light Mlb2_small RGB LED Mood Light Mlb3_small RGB LED Mood Light Mlb4_small
RGB LED Mood Light Mlb5_small RGB LED Mood Light Mlb6_small RGB LED Mood Light Mlb7_small RGB LED Mood Light Mlb9_small
</blockquote>
google_protectAndRun("ads_core.google_render_ad", google_handleError, google_render_ad);





google_protectAndRun("ads_core.google_render_ad", google_handleError, google_render_ad); Operation <blockquote>

  • When the PIC is first powered on after programming, it should start running the first RGB sequence found. If you're using the original sequences supplied with the code here it will run a sequence of fading red thru blue thru green repeating.

  • [url=http://picprojects.org.uk/projects/rgb/RGB101 effects.pdf]List of sequences / effects with the pre-programmed PIC RGB LED Mood Light Pdf[/url]

  • User control of the RGB Driver is done using the S1 switch which performs multiple functions as described in the following section.

    Single press to Hold / Run current sequence

    You can press S1 at any time to stop the sequence running and hold the colour being displayed at that moment in time. Pressing S1 again will start the sequence running.

    If the controller is powered off while in the hold state when it is next powered on it will remain in the hold state displaying the same colour.

    Double press to Select Next Sequence

    (press S1 twice less than 0.5 second apart; think 'double-click' computer mouse button)

    Step through all available sequences. When the last sequence has been reached it will go back to the first available sequence. Each time the S1 switch is 'double clicked' the RGB LED PWM values are set back to 0 (LEDs off) and the new sequence will start running.

    When stepping through the sequences it always starts each new sequence in the Run state, even if it was previously in a Hold state

    ( the last sequences is indicated by 3 short blinks of the blue and green LEDs repeating)

    Press and hold to enter / exit sleep state
    Press and hold S1 switch for about 1.2 seconds to put the PIC into sleep mode. Once in sleep mode, press the S1 switch for about 2 seconds then release it to wake the PIC from sleep. If the S1 button isn't held for two seconds the PIC returns to sleep

  • About 10 seconds after the S1 switch is last pressed the currently selected sequence number, RGB colour values and Hold state are saved to non-volatile EEPROM memory. When the RGB LED driver is next powered on, the saved sequence number is read back and will automatically start running the sequence. If it was in a Hold state at power off it will power on and remain in the 'Hold' state until S1 is pressed again.

  • Anytime the PIC is put into sleep mode by holding S1 switch down, the currently selected sequence, displayed colour and Hold state will be saved to EEPROM.
</blockquote> Firmware <blockquote> The HEX file is ready to program directly into a PIC 12F629. The zip file contains the source code which you can modify or just view to see how it works. If you are going to modify the code I recommend you download and install the Microchip MPLAB IDE which will allow you to edit, modify and program the PIC seamlessly.
Description Filename Download link
Source code rgb101g3.zip, v3.0.3, 14/09/2010 RGB LED Mood Light Dl download
HEX file ready to program into the PIC rgb101g3_main.HEX, v3.0.3, 14/10/2010 RGB LED Mood Light Dl download
checksum 0xDC5F
RGB LED Mood Light Pixel If you need a PIC Programmer I strongly recommend the Microchip PICKit 2, this is available from suppliers world wide or direct from Microchip. It's reasonably cheap to buy and reliable. </blockquote>

Format of the Sequence Data <blockquote>
The data used by the application for the RGB sequences is held in the file 'sequenceData.inc' You can edit this file to add, remove or change the data provided. You must ensure that it follows the format described. In particular pay attention to the 'end of sequence' and 'end of all data' markers and also ensure that each line of sequence data contains five comma separated entries. (see screen dump below)

A really useful on-line utility for simulating the sequences can be found here:
RGB LED Mood Light RgbballRGB LED Simulator
(thanks to Marek 'Marki' Podmaka for creating and sharing this simulator)

RGB LED Mood Light Seqdat
In the screen dump above note the 'end_of_sequence' markers circled in red and the 'end_of_all_data' marker circled in purple.
You must have at least one sequence present up to a maximum of 256 individual sequences, although you're likely to run out of available memory on the PIC before you reach this limit.


  • Each line of data starts with a 'dt' (data table) assembler directive.

  • All data is specified using decimal values.

  • Each data value must be separated by a comma

  • The sequence data on each line has five fields:


    1. Fade Rate: speed the colours fade from the current values to the new values. Each step occurs at an interval of 5ms x Fade Rate.


      • Fade Rate value of 0 indicates the RGB values will be updated immediately without fading.

      • Fade Rate value must not be set to 255 except to indicate end of sequence. (see e. below)

    </li>
</li>
<li>
Hold Time: after fade completes, delay before moving to next line of data. Interval is 50mS x Hold Time


  • Hold Time value of 255 following a Fade Rate of 255 indicates end_of_all_sequence data.

</li><li>
Red PWM value. 0 = 0% (LED off) through to 255 = 100% (LED fully on)
</li><li>
Green PWM value. 0 = 0% (LED off) through to 255 = 100% (LED fully on)
</li><li>
Blue PWM value. 0 = 0% (LED off) through to 255 = 100% (LED fully on)


  • Typically changes in LED brightness are more noticeable between 0 and 128 than from 128 to 255.
</li>
<li>
End of the current sequence data is indicated by the Fade Rate field being set to '255'. When the application encounters this it restarts the sequence from the beginning.
</li><li>
At the end of all available sequence data both the Fade Rate and Hold Time fields must be set to '255'
</li>
After editing sequenceData.inc the file should be saved and the rgb101g3_main.asm reassembled. The resulting rgb101g3_main.hex file can them be programmed into the PIC </blockquote> Contact us:
RGB LED Mood Light Contact
PCB artwork available on this site is free for educational or individual use but not commercial use. It is not permissible to use PCB artwork available on this site in any profit making venture, whether private, educational or commercial. Use of the free application program code or hardware presented on this website is not permitted in commercial products, or in any profit making activities. Disclaimer All firmware supplied either in a pre-programmed device or as a download, and any other information, hardware or software is provided on an "as-is" basis without warranty of any kind and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall Picprojects be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this firmware, hardware, software or information, even if Picprojects has been advised by user of the possibility of such potential loss or damage. The user agrees to hold Picprojects harmless from and against any and all claims, losses, liabilities and expenses.
Copyright © 2009-2010, Picprojects
Về Đầu Trang Go down
https://sucsongmoi.forum-viet.net
 

RGB LED Mood Light

Xem chủ đề cũ hơn Xem chủ đề mới hơn Về Đầu Trang 
Trang 1 trong tổng số 1 trang

Permissions in this forum:Bạn không có quyền trả lời bài viết
 :: .:: TIN TỨC, THẢO LUẬN :: TIN TỨC, THẢO LUẬN-
Chuyển đến 
|
Bookmarks

RGB LED Mood Light

Xem chủ đề cũ hơn Xem chủ đề mới hơn Go down
Sun Nov 14, 2010 9:01 pm
A3pro
A3pro
A3pro

Cấp bậc thành viên
Danh vọng:
176%/1000%

Tài năng:35%/100%

Liên lạc
https://sucsongmoi.forum-viet.net

Thông tin thành viên
» Tổng số bài gửi : 176
» Join date : 04/11/2010
» Age : 35
» Đến từ : Bạc Liêu
» Hiện giờ đang:

Bài gửiTiêu đề: RGB LED Mood Light


http://picprojects.org.uk/projects/rgb/index.htm



RGB LED Mood Light
Standalone PWM
controller for RGB LEDs
using 12F6xx PIC



RGB LED Mood Light Indextop




google_protectAndRun("ads_core.google_render_ad", google_handleError, google_render_ad);
RGB LED Mood Light Line.colorbar
This RGB LED Moodlight is new for Autumn 2010
Check back regularly for updates to this project page
RGB LED Mood Light Line.colorbar This project is an update to the original RGB LED PWM Driver. The new version allows the use of either 5mm LEDs or the square bodied Superflux / Piranah style LEDs. The circuit now uses bipolar transistors rather than MOSFETs which make it more suitable for novice constructors and for the first time this project is available as a kit with all parts required to assemble the PCB including the superflux LEDs. (power supply not included) Full schematic and construction details are shown on this page, as well as the firmware download for those who want to create their own effects or build their own version from the schematic. If you're not into programming the kit includes a PIC microcontroller pre-programmed with the firmware and a number of mood lighting effects.






Circuit Description The circuit itself is fairly straightforward. Diode D1 provides reverse polarity protection for the board in case the power supply is connected backwards. C1/C2 and IC2 take the incoming 12 volt supply and provide a regulated 5 volt supply required by the PIC microcontroller. Thered, green and blue LEDs are arranged in three parallel strings ofthree LEDs. Resistors R1, 2 and 3 limit the current through the LEDsto a safe value when using a 12 volt power supply. The low side of eachLED string connects to a BC547 NPN transistor which is used to switchthe LEDs on and off. These transistors are in turn controlled by thePIC microcontroller which drives each of the red, green and bluechannel transistors with a PWM signal to control the average brightnessof the LEDs. Switch S1 is used to select different effect sequences. The firmware program running on the PIC microcontroller is the smartpart of the circuit and determines what colours are generated and howthey fade from one colour to the next. The three colours of LEDs are positioned on the PCB in an irregular arrangement to improve the colour mixing effect when placed behind / inside a diffuser such as a frosted glass globe. The controller uses (RGB) Red, Green and Blue high brightness LEDs that are pulse width modulated (PWM) to vary the intensity of each colour LED. This allows effectively any colour to be generated with rapid changing strobe effects, fast and slow colour fades as well as static colours. The data used to set and change the colours is held in an easy to edit file so if you don't like the sequences provided with it, you can modify the sequence data include file yourself and reprogram with your own sequences. (you will need a PIC programmer and some practical knowledge of microcontrollers and programming if you want to do this.)





Schematic <blockquote> [url=http://picprojects.org.uk/projects/rgb/schematic RGB101D.jpg] RGB LED Mood Light Schematic%20RGB101D_small[/url] [url=http://picprojects.org.uk/projects/rgb/RGB LED Driver 101D sch.pdf]Download schematic as PDF RGB LED Mood Light Pdf[/url]
RGB LED Mood Light Pcbbot Artwork bottomRGB LED Mood Light Pdf RGB LED Mood Light Pcbtop Artwork topRGB LED Mood Light Pdf RGB LED Mood Light Overlay OverlayRGB LED Mood Light Pdf

The dimensions of the PCB are 50mm x 50mm.
The PCB supplied with the kit is professionally manufactured thru-plated with solder mask top and bottom and screen print overlay on FR4 laminate with RoHS finish.
If you want to etch your own PCB you can use the artwork above. Unless you are able to thru-plate your own PCB you will need to solder component leads top and bottom where required. Also look for the single via on the board that will need to be wired through.
The ready made PCB supplied in the kit has through plated holes so this does not apply.
</blockquote> Kit Contents <blockquote>
RGB LED Mood Light P6100019_small1 The kit available from the Picprojects On-line store contains all the parts required to build the RGB LED Moodlight. This includes all the components, quality FR4 double sided PCB, Superflux LEDs and a PIC12F629 microcontroller pre-programmed with the firmware. RGB LED Mood Light Infodot12 volt power supply is not included in the kit
RGB LED Mood Light Dcpower_small A 2.1mm chassis mount DC power jack and 100mm of red/black wire are available as an option
RGB LED Mood Light Line.colorbar
<table id="table12" width="80%" border="0" cellpadding="9" cellspacing="0"> <tr> <td bgcolor="#00ff00">
Available now from the on-line store - self-assembly kit for the RGB LED Mood Light project only £9.99</td> </tr> </table>
RGB LED Mood Light Line.colorbar

</blockquote> Construction & PCB <blockquote> RGB LED Mood Light Infodot The information in this section is relevant whether you are assembling from the kit or sourcing everything yourself so please take the time to read through this section and refer back during assembly. This section is written so that even someone with little knowledge of electronics can successfully assemble the board; for those with more experience there is still useful and relevant information so please stick with it.
RGB LED Mood Light P6100021_small1 RGB LED Mood Light P6100024_small1 RGB LED Mood Light P6100028_small1 RGB LED Mood Light Ledship_small
Photo.1 Photo.2 Photo.3 RGB LED Mood Light Exclamation3Photo.4
Photo. 1 The bare PCB. The component side has a white component overlay silk screened onto the board which should be used as a reference when installing the components. Note: Components JP1, R8 and C3 are not used with this project and are not supplied in the kit #101F. Do not install any components in these locations. Photo. 2 Start by installing the 1N4148 diode D1 in the position shown. Note the black band around one end of the diode. This must be installed in the direction shown Photo. 3 Install all the resistors. The coloured bands denote the resistor value. It doesn't matter which way round you fit them but you must make sure the right value resistors are installed at the correct locations. RGB LED Mood Light R68R blue, grey, black, gold - value 68R ( R1, R2 ) RGB LED Mood Light R150R brown, green, brown, gold - value 150R ( R3 ) RGB LED Mood Light R1K brown, black, red, gold -value 1K0 (R4, R5, R6, R7) Photo. 4 <table width="100%" border="0" cellpadding="5" cellspacing="0"> <tr> <td valign="top"> RGB LED Mood Light Exclamation2</td> <td> The LEDs are shipped in anti-static foam along with the PIC16F629 microcontroller and IC socket. The red, green and blue LEDs appear physically identical when not operating. In order to identify them for assembly they are placed in the anti-static foam in three rows as shown in photo. 4 </td> </tr> </table> <blockquote> Please DO NOT REMOVE the LEDs until you are ready to fit them and then do so one LED at a time. If you get the LEDs mixed up and solder one into the wrong position it is difficult to unsolder them without damaging the PCB and/or LED. </blockquote>
RGB LED Mood Light P6100037_small1 RGB LED Mood Light P6100041_small1 RGB LED Mood Light P6100047_small1 RGB LED Mood Light P6100053_small1
Photo.5 Photo.6 Photo.7 Photo.8
Photo. 5 Now install the three RED LEDs in the locations marked 'R' on the PCB overlay. One corner of the LEDs plastic body is cut-away. You must install the LED so that this corner corresponds to the marking on the PCB overlay. Also make sure to keep the LED firmly pressed against the PCB while soldering in place so it doesn't finish at some odd angle. Photo. 6 Now install the three GREEN LEDs in the locations marked 'G' on the PCB overlay. One corner of the LEDs plastic body is cut-away. You must install the LED so that this corner corresponds to the marking on the PCB overlay. Photo. 7 Now install the three BLUE LEDs in the locations marked 'B' on the PCB overlay. One corner of the LEDs plastic body is cut-away. You must install the LED so that this corner corresponds to the marking on the PCB overlay. <table id="table13" width="100%" bgcolor="#c0c0c0" border="0"> <tr> <td bordercolor="#C0C0C0"> Option to install LEDs on the back side of the PCB Depending on your application for the mood light you may want to mount the LEDs on the back side of the PCB so you don't see the other components. If you do this you need to be careful to fit them in the correct location and orientation since there is no overlay on the back side. The photo (right) shows where to fit them and the correct orientation. Since the holes in the PCB are plated through you will solder the leads on the top side of the board.</td> <td> RGB LED Mood Light Flipleds_small</td> </tr> </table> Photo. 8/9 Install the 22µF capacitor C2. One lead is shorter than the other. You must install the short lead into the hole nearest the edge of the PCB as shown.
RGB LED Mood Light P6100054_small1 RGB LED Mood Light P6100059_small RGB LED Mood Light P6100061_small1 RGB LED Mood Light P6100068_small1
Photo.9 Photo.10 Photo.11 Photo.12
Photo. 10 Install the 100nF capacitor C1. This can be fitted either way round. Photo. 11/12 Next install the three BC547 transistors Q1,2,3. These look physically similar to IC2 so make sure you check the laser-etched marking on the body of the part (photo. 11). The transistors must be installed the correct way round. Align the body to match the PCB overlay. RGB LED Mood Light Infodot BC548 transistors may also be used for Q1,2,3 and are interchangeable with the BC547 part.
RGB LED Mood Light P6100069_small1 RGB LED Mood Light P6100072_small1 RGB LED Mood Light P6100075_small1 RGB LED Mood Light P6100080_small1
Photo.13 Photo.14 Photo.15 Photo.16
Photo. 13/14/15 Now install the 78L05 voltage regulator, IC2. The wire leads on this part may need to be realigned to go through the holes on the PCB, carefully bend them using flat nose pliers. Again, this part needs to be fitted the correct way round. Ensure the body is aligned to match the PCB overlay. Photo. 16/17 Install the 8 pin socket for IC1. Note the small notch at one end of the socket. This should be aligned with the marking on the PCB overlay. Also install switch S1 into its position on the PCB. You may need to push down firmly and evenly to get the switch to seat into the holes in the PCB. <table id="table14" width="100%" bgcolor="#c0c0c0" border="0"> <tr> <td>Option to locate S1 on back side of the PCB Depending on your application you may want to fit switch S1 on the reverse side of the PCB. If so, simply fit it on the back of the PCB as shown and solder in place. You may also use a pair of short wires (up to 200mm / 7 inches) if you want the switch located off the PCB, for example on the outside of a case.</td> <td> RGB LED Mood Light Flips1_small</td> </tr> </table>
RGB LED Mood Light P6100083_small1 RGB LED Mood Light P6100084_small1 RGB LED Mood Light P6100091_small1 RGB LED Mood Light P6100089_small1
Photo.17 Photo.18 Photo.19 Photo.20

Photo.18
RGB LED Mood Light Exclamation2Before applying power to the board for the first time, check the underside of the PCB for solder bridges, bad joints and bits of component lead off-cuts that may have stuck to the board. Connect the red and black wires for the power connection to the board. The board requires a 12 volt regulated power supply input of at least 200mA. See the section here for more information on the Power Supply Requirements RGB LED Mood Light InfodotThe board has reverse polarity protection so it shouldn't be damaged if the power supply is connected the wrong way round, however it won't operate unless the power is connected correctly. Photo. 19/20 You don't have to check the voltages to the board however, if you have a multimeter to hand it is advisable to have a quick check before installing the PIC microcontroller into the IC1 socket. Check the 12 volt supply to the board. This should be between 11.8 and 12.8 volts Check the 5 volt supply at pins 1 and 8 of the IC1 socket (photo 20). The voltage should be between 4.75 and 5.25 volts. If either of the measured voltages are outside the ranges above you need to investigate the cause before continuing.

RGB LED Mood Light P6100095_small

RGB LED Mood Light P9140038_small

RGB LED Mood Light Operating_small
RGB LED Mood Light Globe_small
Photo.21 Photo.22 Photo.23 Photo.24
Photo. 21 RGB LED Mood Light InfodotIMPORTANT. Before continuing make sure you have disconnected the power supply to the PCB. With the power disconnected you should now install the PIC microcontroller into the IC1 socket. The PIC has a small notch or indent at one end. This should be located towards Capacitor C1 as shown. Photo. 22 Take the two wires connecting power to the board and pass them through the hole in the PCB as shown. This acts as a strain relief for the wires. Photo. 23 Once the PIC microcontroller has been correctly installed into the IC1 socket apply power to the board. The LEDs should now light and start fading through various colours. RGB LED Mood Light Exclamation2The light from these LEDs is very intense when viewed on-axis so you should avoid looking directly into them when the board is operating. Photo. 24 Example of how the board can be used. A small round frosted glass table lamp bought from a DIY store. Remove the original bulb holder fitting and sit the RGB LED Mood light board inside for a stunning effect. More info' here (this particular lamp was bought from B&Q in the UK, type Athens Small Glass Table Lamp White, price £8.98 - Summer 2010) <table id="table15" width="100%" bgcolor="#c0c0c0" border="0"> <tr> <td> LED options The PCB101D was designed so it could be used with both 5mm LEDs using a 0.1" lead spacing as well as the 4 lead square Superflux type LEDs. The kit is supplied with the Superflux LEDs but if you're building your own version you have the choice of LED type to use.</td> <td> RGB LED Mood Light 5mmleds_small</td> </tr> </table> Wiring the DC Power Jack If you bought the DC Power Jack option from the on-line store you should wire the terminals as shown below. The centre pin will then connect to the red 12V wire and the outer barrel to the black Gnd wire. This is suitable for use with the majority of plug top style power supplies wired with a centre positive terminal
RGB LED Mood Light Dcwired_small
DC Power Jack (DCPWR21)
RGB LED Mood Light Infodot Please note this applies only to the DC Power Jack supplied as a kit option; if you source your own connector its terminals may be wired differently and you will need to establish this yourself.
RGB LED Mood Light PSUjack_small
</blockquote> Power Supply Requirements <blockquote> The RGB LED Moodlight requires a 12 volt regulated DC power supply rated for 200mA or higher. This is important, a non-regulated 12 volt supply may actually output 14 or 15 volts and this will damage the LEDs over time unless you alter the current limiting resistors. The power supply must also output DC not AC. Avoid halogen down light transformers unless they are specifically designed for operation with LED lighting since many supply unfiltered DC or even AC which is unsuitable. Also don't use Constant Current power supplies designed for LED lighting with this board. Many downlight transformers will not work correctly without a high power load connected to them. (Halogen type down lights use 20-50watts, the LED mood light uses about 1 watt) You can get plug top style power supplies from many places including eBay where there are good deals to be had. In the UK you can also get them from the high street retailer Maplin Electronics and online from Rapid Electronics If you're buying a power supply to use with the DC power jack option available from the on-line store, the barrel connector on the power supply needs to be 2.1mm (this refers to the diameter of the hole in the middle) Any of the following power supplies from Rapid Electronics are suitable and if you look at these it will give you an idea of what you need if you're sourcing from elsewhere.

  • 5W Switch mode plugtop PSU Euro Plug 12V 420MA Rapid Part # 85-3732
  • Plug & Go 12vdc 6 watt (EUP) Rapid Part # 85-3703
  • 12vdc 1amp CCTV Smpsu (EUP) Rapid Part # 85-3770
  • 12vdc 15watt UK Smpsu 2.1 C ve (EUP) Rapid Part # 85-3737
<blockquote> Part numbers correct as at September 2010 </blockquote> To summarise then, you need a 12 volt DC regulated power supply capable of delivering at least 200mA of output current (a higher current rating is fine, but it must be 12 volts DC) </blockquote> Mood Light Example <blockquote> This is something I put together in the workshop in 30 minutes, I'm sure you can do better but this gives you an idea of what you can do. This was made using a lamp bought from B&Q in the UK, type Athens Small Glass Table Lamp White. The base plate is made from 1mm aluminium sheet cut and shaped as shown. Holes are drilled for the PCB mounting spacers and the DC jack socket. The aluminium is bent and then 4No 10mm nylon hex spacers are fitted with 4mm M3 counter sunk machine screws. The DC socket is fitted to the angled bracket (note the use of insulating sleeving on the terminals). The assembled LED Mood Light PCB is then fitted to the base using 6mm M3 machine screws. The lamp bowl already had a slot in the side so when it is placed over the Mood Light assembly the power cable has room to pass through.
RGB LED Mood Light Mlb1_small RGB LED Mood Light Mlb2_small RGB LED Mood Light Mlb3_small RGB LED Mood Light Mlb4_small
RGB LED Mood Light Mlb5_small RGB LED Mood Light Mlb6_small RGB LED Mood Light Mlb7_small RGB LED Mood Light Mlb9_small
</blockquote>
google_protectAndRun("ads_core.google_render_ad", google_handleError, google_render_ad);





google_protectAndRun("ads_core.google_render_ad", google_handleError, google_render_ad); Operation <blockquote>

  • When the PIC is first powered on after programming, it should start running the first RGB sequence found. If you're using the original sequences supplied with the code here it will run a sequence of fading red thru blue thru green repeating.

  • [url=http://picprojects.org.uk/projects/rgb/RGB101 effects.pdf]List of sequences / effects with the pre-programmed PIC RGB LED Mood Light Pdf[/url]

  • User control of the RGB Driver is done using the S1 switch which performs multiple functions as described in the following section.

    Single press to Hold / Run current sequence

    You can press S1 at any time to stop the sequence running and hold the colour being displayed at that moment in time. Pressing S1 again will start the sequence running.

    If the controller is powered off while in the hold state when it is next powered on it will remain in the hold state displaying the same colour.

    Double press to Select Next Sequence

    (press S1 twice less than 0.5 second apart; think 'double-click' computer mouse button)

    Step through all available sequences. When the last sequence has been reached it will go back to the first available sequence. Each time the S1 switch is 'double clicked' the RGB LED PWM values are set back to 0 (LEDs off) and the new sequence will start running.

    When stepping through the sequences it always starts each new sequence in the Run state, even if it was previously in a Hold state

    ( the last sequences is indicated by 3 short blinks of the blue and green LEDs repeating)

    Press and hold to enter / exit sleep state
    Press and hold S1 switch for about 1.2 seconds to put the PIC into sleep mode. Once in sleep mode, press the S1 switch for about 2 seconds then release it to wake the PIC from sleep. If the S1 button isn't held for two seconds the PIC returns to sleep

  • About 10 seconds after the S1 switch is last pressed the currently selected sequence number, RGB colour values and Hold state are saved to non-volatile EEPROM memory. When the RGB LED driver is next powered on, the saved sequence number is read back and will automatically start running the sequence. If it was in a Hold state at power off it will power on and remain in the 'Hold' state until S1 is pressed again.

  • Anytime the PIC is put into sleep mode by holding S1 switch down, the currently selected sequence, displayed colour and Hold state will be saved to EEPROM.
</blockquote> Firmware <blockquote> The HEX file is ready to program directly into a PIC 12F629. The zip file contains the source code which you can modify or just view to see how it works. If you are going to modify the code I recommend you download and install the Microchip MPLAB IDE which will allow you to edit, modify and program the PIC seamlessly.
Description Filename Download link
Source code rgb101g3.zip, v3.0.3, 14/09/2010 RGB LED Mood Light Dl download
HEX file ready to program into the PIC rgb101g3_main.HEX, v3.0.3, 14/10/2010 RGB LED Mood Light Dl download
checksum 0xDC5F
RGB LED Mood Light Pixel If you need a PIC Programmer I strongly recommend the Microchip PICKit 2, this is available from suppliers world wide or direct from Microchip. It's reasonably cheap to buy and reliable. </blockquote>

Format of the Sequence Data <blockquote>
The data used by the application for the RGB sequences is held in the file 'sequenceData.inc' You can edit this file to add, remove or change the data provided. You must ensure that it follows the format described. In particular pay attention to the 'end of sequence' and 'end of all data' markers and also ensure that each line of sequence data contains five comma separated entries. (see screen dump below)

A really useful on-line utility for simulating the sequences can be found here:
RGB LED Mood Light RgbballRGB LED Simulator
(thanks to Marek 'Marki' Podmaka for creating and sharing this simulator)

RGB LED Mood Light Seqdat
In the screen dump above note the 'end_of_sequence' markers circled in red and the 'end_of_all_data' marker circled in purple.
You must have at least one sequence present up to a maximum of 256 individual sequences, although you're likely to run out of available memory on the PIC before you reach this limit.


  • Each line of data starts with a 'dt' (data table) assembler directive.

  • All data is specified using decimal values.

  • Each data value must be separated by a comma

  • The sequence data on each line has five fields:


    1. Fade Rate: speed the colours fade from the current values to the new values. Each step occurs at an interval of 5ms x Fade Rate.


      • Fade Rate value of 0 indicates the RGB values will be updated immediately without fading.

      • Fade Rate value must not be set to 255 except to indicate end of sequence. (see e. below)

    </li>
</li>
<li>
Hold Time: after fade completes, delay before moving to next line of data. Interval is 50mS x Hold Time


  • Hold Time value of 255 following a Fade Rate of 255 indicates end_of_all_sequence data.

</li><li>
Red PWM value. 0 = 0% (LED off) through to 255 = 100% (LED fully on)
</li><li>
Green PWM value. 0 = 0% (LED off) through to 255 = 100% (LED fully on)
</li><li>
Blue PWM value. 0 = 0% (LED off) through to 255 = 100% (LED fully on)


  • Typically changes in LED brightness are more noticeable between 0 and 128 than from 128 to 255.
</li>
<li>
End of the current sequence data is indicated by the Fade Rate field being set to '255'. When the application encounters this it restarts the sequence from the beginning.
</li><li>
At the end of all available sequence data both the Fade Rate and Hold Time fields must be set to '255'
</li>
After editing sequenceData.inc the file should be saved and the rgb101g3_main.asm reassembled. The resulting rgb101g3_main.hex file can them be programmed into the PIC </blockquote> Contact us:
RGB LED Mood Light Contact
PCB artwork available on this site is free for educational or individual use but not commercial use. It is not permissible to use PCB artwork available on this site in any profit making venture, whether private, educational or commercial. Use of the free application program code or hardware presented on this website is not permitted in commercial products, or in any profit making activities. Disclaimer All firmware supplied either in a pre-programmed device or as a download, and any other information, hardware or software is provided on an "as-is" basis without warranty of any kind and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall Picprojects be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this firmware, hardware, software or information, even if Picprojects has been advised by user of the possibility of such potential loss or damage. The user agrees to hold Picprojects harmless from and against any and all claims, losses, liabilities and expenses.
Copyright © 2009-2010, Picprojects

Chữ ký của thành viên



RGB LED Mood Light Collap11Trả lời nhanh
Trang 1 trong tổng số 1 trang