Category: Moodlight

Moodlight

I got some cheap RGB led bars from Ledsee. Therefore I decided to make a moodlight where on I was already working with those led bars. I’m going to make an housing of aluminium U profile’s with a plexi cover. And with on the ends XLC connectors to connect multiple moodlights with each other. In each profile there will be 1 led bar and 1 controller. The controller can be set as master or as slave. The communication is serial protocol but on 0-5V level.

Pictures of the led bars:

RGB Ledstrip

RGB Ledstrip

RGB Ledstrip

The led bar in working (dimmed):

RGB Ledstrip

(Picture from http://vdbeke.gnimsch.net/lichtorgel.htm)

A drawing of how I plan it to make:

tekening

The green is the controller and the raised grey part is the led bar.

For the controller I’m going to use an SMD PIC16F628 with an ULN2003 for driving the led’s.

 

Circuit drawing:

schema

(Clickable)

Circuit board: Printplaat

(Clickable)

Moodlight – Update

Today I etched the circuit board and soldered it:

Moodlight printje

Moodlight printje

Moodlight printje

Moodlight printje

Moodlight – Update

Yesterday I went to buy some aluminium and today I made the enclosure out of it. The lid will be made of plexi but I don’t have that yet.

A couple of pictures:

moodlight behuizing

moodlight behuizing

Moodlight – Update

At request the pcb layout:

Top with components

Top without components

Bottom without components

Bottom with components

Moodlight – Update

Today I have completed the code and build the pcb’s in the enclosure:

moodlight behuizing

moodlight behuizing

The code:

    Device          16F627A
    Config          WDT_OFF, PWRTE_ON, MCLRE_ON, HS_OSC, LVP_off
    XTAL            = 20
    ALL_DIGITAL     = true    

'****************************************************************
'Declaraties
    Symbol Rood     = PORTB.7
    Symbol Groen    = PORTB.5
    Symbol Blauw    = PORTB.6
    Symbol Master   = PORTB.4 
    Symbol Slave    = PORTB.3 
    TRISB.7         = 0
    TRISB.6         = 0
    TRISB.5         = 0
    TRISB.4         = 1
    TRISA.3         = 1
    PORTB_PULLUPS   = 1
    Dim MasterSlave As Bit
    Dim Geval       As Byte
    Dim index       As Word
    Dim vertraging  As Byte
    'PWM
    Dim WaardeRood  As Byte
    Dim WaardeGroen As Byte
    Dim WaardeBlauw As Byte
    Dim WaardePWM   As Byte
    Dim roodUpDown  As Bit
    Dim groenUpDown As Bit
    Dim blauwUpDown As Bit
    Symbol snelheid = 5 'Hoe hoger dit getal hoe trager het prog
    'Seriele interface
    Dim serdata     As Byte
    Dim sergeval    As Byte
    Dim dataOfGeval As Bit
    HSERIAL_CLEAR   = On            

    HSERIAL_RCSTA   = 144
    HSERIAL_TXSTA   = 36
    HSERIAL_BAUD    = 2400			
    Symbol RCIF	    = PIR1.5		
    Symbol OERR	    = RCSTA.1		

    Symbol CREN	    = RCSTA.4			
    ON_INTERRUPT GoTo SeriIn		

    Clear                                                                        
'****************************************************************
'Checken voor master/slave 
    While 1 = 1
        If Master = 0 Then
            GoTo Masterprog
        EndIf
        If Slave = 0 Then
            GoTo Slaveprog
        EndIf
        High Rood
    Wend

'****************************************************************    
Masterprog:
    PIE1.5 = 0
    WaardeRood  = 255
    WaardeGroen = 0
    WaardeBlauw = 0
    Geval       = 0   
    
    HRSOut 1
    DelayUS 10
    HRSOut WaardeRood
    DelayUS 10
    HRSOut 2
    DelayUS 10
    HRSOut WaardeGroen 
    DelayUS 10
    HRSOut 3     
    DelayUS 10
    HRSOut WaardeBlauw 
    
    While 1 = 1
        For index = 0 To 255
            'Rood
            If WaardeRood >= index Then
                High Rood
            Else
                Low Rood
            EndIf
            'Groen
            If WaardeGroen >= index Then
                High Groen
            Else
                Low Groen
            EndIf
            'Blauw           
            If WaardeBlauw >= index Then
                High Blauw
            Else
                Low Blauw
            EndIf
        Next 
        Inc vertraging
        If vertraging = snelheid Then
            Select Geval
                Case 0
                    Inc WaardeGroen
                    GoSub GroenUit
                    If WaardeGroen = 255 Then
                        Geval = 1
                    EndIf      
                Case 1
                    Dec WaardeRood
                    GoSub RoodUit
                    If WaardeRood = 0 Then
                        Geval = 2
                    EndIf 
                Case 2
                    Inc WaardeBlauw
                    GoSub BlauwUit
                    If WaardeBlauw = 255 Then
                        Geval = 3
                    EndIf
                Case 3
                    Dec WaardeGroen
                    GoSub GroenUit
                    If WaardeGroen =  0 Then
                        Geval = 4
                    EndIf
                Case 4 
                    Inc WaardeRood
                    GoSub RoodUit
                    If WaardeRood = 255 Then
                        Geval = 5
                    EndIf
                Case 5 
                    Dec WaardeBlauw
                    GoSub BlauwUit
                    If WaardeBlauw = 0 Then
                        Geval = 0
                    EndIf
                Case Else
                    'Bij fout reset
                    WaardeRood  = 255
                    WaardeGroen = 0
                    WaardeBlauw = 0
                    Geval       = 0
            EndSelect
            vertraging = 0
            'GoSub seruit  
        EndIf
        
        If Slave = 0 Then
            GoTo Slaveprog
        EndIf
    Wend

'**************************************************************** 
Slaveprog:
    INTCON = %11000000
    PIE1.5 = 1
    WaardeRood = 0
    WaardeGroen = 0
    WaardeBlauw = 0
    Low Groen
    Low Rood
    Low Blauw
    While 1 = 1
        For vertraging = 0 To snelheid     
            For index = 0 To 255
                'Rood
                If WaardeRood >= index Then
                    High Rood
                Else
                    Low Rood
                EndIf
                'Groen
                If WaardeGroen >= index Then
                    High Groen
                Else
                    Low Groen
                EndIf
                'Blauw           
                If WaardeBlauw >= index Then
                    High Blauw
                Else
                    Low Blauw
                EndIf
            Next 
            If Master = 0 Then
                GoTo Masterprog
            EndIf
        Next
    Wend

'**************************************************************** 
'Subroutines:    
RoodUit:
    HRSOut 1
    DelayUS 10
    HRSOut WaardeRood
Return

GroenUit:
    HRSOut 2
    DelayUS 10
    HRSOut WaardeGroen 
Return


BlauwUit:
   HRSOut 3
   DelayUS 10
   HRSOut WaardeBlauw 
   sergeval = 0
Return

SeriIn:
    If dataOfGeval = 0 Then
        HSerIn [sergeval]
        dataOfGeval = 1
    Else
        HSerIn [serdata]
        Select sergeval
            Case 1
                WaardeRood = serdata
            Case 2
                WaardeGroen = serdata
            Case 3
                WaardeBlauw = serdata
            Case Else
                GoTo SeriIn
        EndSelect  
        dataOfGeval = 0
    EndIf
Context Restore

'****************************************************************
End

The hex file of this code: link.

You-tube clip of the moodlight working:

(Sorry for the bad picture quality)

Moodlight – Update

The past 2 weeks I’ve been busy finishing the second pcb and the housing.

I made a  time-lapse from the soldering:

To make it look professional I made some stickers for on the side’s.

stickers

The sticker as pdf: Link.

Today I got my milk-glass from “Daemen kunststoffen” and mounted it.

melkglas moodlight

melkglas moodlight

melkglas moodlight

melkglas moodlight