The perfect Remote, Programmable, Controller for interactive LED strips

Since when white light emitting high brightness LED are available, the handover from traditional lighting bulbs to the solid-state lighting has become irreversible: LEDs have an efficiency (expressed in lumens/watt) higher than that of almost all the traditional lamps (except, at the moment, the large sodium vapor lamps used for street lighting, unusable in closed environments for the high power required and the chromatic aberration they produce) at a cost that is today less prohibitive than it was a few year ago. They are indeed very sturdy and have a very acceptable ratio of luminous flux and size.

In common with the traditional lamps, at least with fluorescent and neon, white LEDs have the characteristic to be produced to emit, depending on the model, a shade of white that ranges from warm (3,000 K) to cold (over 6,000 K). For this reason, when you want to create a lighting solution with light emitting diodes, you must be careful about what you purchase, if you just take the first lamp you can end up having a lighting that is not exactly what you want.

Another problem arises if you want to achieve lighting that can change the shade of the white according to the taste or mood of the moment, or even just to suit the needs of the guests; in this case you need a system which allows to vary the shade of the light emitted. Each LED, however, is made to give a certain color temperature and cannot be changed. Anyway there is a solution: use diodes both in warm and cold white, mixing the light in varying proportions.

 

This is what the system described in this article does: basically a controller for two groups of white LEDs or for strips consisting of warm and cold white LEDs, driven separately (we tried with this solution) in PWM mode, so to vary the individual luminous flux of the two components and obtain a light that is a mixture of warm and cold white, with the chosen shade.

The system consists of a control circuit for LED strips with remote control receiver, remotely controlled by a radio signal in the UHF band at 433.92 MHz using a standard TX; the transmitter is amplitude-modulated with four channels; with the buttons on the transmitter  you can manage the channels individually: raise and lower the brightness of the different rows of LEDs with warm and cold light.

Since the transmitter is a standard commercial model based on the UMC UM3750 IC (an evolution of the classic MM53200 with 4.096 combinations with binary 12-bit encoding) we won’t describe it; we will focus, instead, on the receiver/controller of which we will publish and describe the circuit diagram in the next paragraphs.

The controller is a combination of a hybrid Aurel AC-RX2 receiver tuned on 433.92 MHz and a PIC16F876A microcontroller programmed to act as the decoder of the code of the button pressed on the remote control.  It generates two independent PWM signals and controls with them the gates of two enhancement-mode MOSFET with N-channel, which must drive the two LED strips or, more generally, groups of white LEDs. Since the transistors are configured in common-source, the circuit is suitable to drive common anode LED strips: we’ll in fact make available on the appropriate terminal the positive power supply and the MOSFET drain so that the circuit can drive the diodes bringing the cathodes to ground, with the times and manner prescribed by the PWM.

Let’s take a look at the circuit diagram: after the power-on, the Microchip microcontroller initializes its I/O and sets RC3 as input without pull-up dedicated to capture the data coming from the radio receiver U2, while. always as inputs, but with internal pull-up, sets RB2, RB3, RB4, RB5, RB6, RB7, which will be used to read the dip-switch DS1; instead RB0 is set as the output for the command of the signaling LED during procedures and RC1 and RC2 are set as the output of the PWM signal that drives the gate of the MOSFET T1 and T2.

Before proceeding, it is better specify that the output OUT1 (i.e. T1) controls the cold light LED (cold white) while OUT2 acts on the warm light ones (Warm white).The perfect Remote, Programmable, Controller for interactive LED strips

The wireless U2 receiver module is an AC-RX2 Aurel equipped with antenna signal amplifier (which gives a sensitivity of -106 dB),a superregenerative tuning stage tuned at 433.92 MHz using calibrated compensator at the factory and equipped with RF filter and amplitude demodulator; completes the module equipment, a squaring with a digital signal comparator (TTL level) coming from pin 14 and an LF amplifier of the output signal from the AM demodulator.

When pressing one of the buttons on the transmitter, the radiated RF signal reaches the receiving antenna of the module AC-RX2, which demodulates the data component and sends it to the pin 14; hence, the microcontroller takes the TTL pulse, places them in RAM and analyzes them with an appropriate firmware routine that, first of all, discerns among many signals picked up from the ether, the one that is compatible with the format of the UM3750 encoding. If so, checks if the code is one of those stored during the self-learning procedure and, if not, deletes the data from the RAM and gets ready for a new analysis.

We will later see how to match the transmitter to the circuit, by using self-learning procedure; for now it is enough to know that the firmware expects to learn all four command codes, which are increasing and decreasing the brightness of the cold light LED and increasing and decreasing  the brightness of the warm light LEDs. This choice allows you to adapt the system to both encodings UM3750 (or MM53200/UM86409) and Holtek HT-12, as well as to manage the circuit by means of two different transmitters, i.e. without the constraint of being linked to a single transmitter.

Now let’s see what happens if the received signal contains one of the codes learned and retained in the working EEPROM from the PIC16F876: in this case, a routine starts to managing the signal generated by the PWM module inside the microcontroller. The signal is, after the start of the main program, characterized by a 50% duty cycle (unless you have activated the recovery function, that will be explained a few paragraphs below). If the received code is recognized and matches the button learned as UP of the OUT1 (we recommend the one in the upper left corner of the remote control – channel 2), the PWM intended to control OUT1 has one increase in the duty cycle at once, which is proportional to the pressure time; if it matches the button learned as DOWN  of OUT1 (we suggest the lower left one) decreases the duty cycle of the PWM connected with channel 2. Again, if it matches the code learned as UP of OUT2 (button at the top right of the transmitter ) causes an increase of the duty cycle of the PWM that drives OUT2 and finally, if it is the code learned as DOWN  of OUT2, causes a reduction of the duty cycle of the PWM  of OUT2. It is understood that this is the operation in dimmer mode; if the received code lasts for less than a second (as will be explained later) you get the switching on or off of the corresponding light. The verification of the length of the code is done by the firmware.

Each output has a LED light which indicates its activity: for OUT1 is LD2 and for OUT2 is LD3; each diode has a current limiting resistor (R5 for LD2 and R6 for LD3).

 

BOM

R1: 1 kohm
R2: 1 kohm
R3: 4,7 kohm
R4: 470 ohm
R5: 4,7 kohm
R6: 4,7 kohm

C1: 100 nF
C2: 470 µF 35 VL
C3: 100 nF
C4: 220 µF 16 VL
C5: 100 nF
C6: 22 pF
C7: 22 pF

D1: 1N4148

LD1: Led 3 mm green
LD2: Led 3 mm green
LD3: Led 3 mm green

U1: PIC16F876A-I/P
U2: AC-RX2
U3: 7805

Q1: 4 MHz

DS1: Disp-Switch 6 vias

T1: P36N06
T2: P36N06

 

Specifications

 

  • Board Power: 12/24Vdc
  • Strip Power: 12/24Vdc
  • Current: 2A per channel
  • RF Encoding: MM53200/HT12 with self-learning
  • Resume state in the event of blackout
  • Functions: Dimmer, On/Off
  • Handling of two common anode strips (2 channels)

Firmware PBP

'****************************************************************
'*  Author  : Alessandro Sottocornola                           *
'*  Date    : 20/02/2014                                        *
'*  Version : 1.0         
'*          :                                                   *
'****************************************************************
INCLUDE "modedefs.bas"
'************************** D E F .    R E G I S T R O *************************
DEFINE OSC 4
DEFINE PULSIN_MAX 1350
DEFINE CCP1_REG PORTC 'Hpwm 1 pin port
DEFINE CCP1_BIT 2 'Hpwm 1 pin bit
DEFINE CCP2_REG PORTC 'Hpwm 2 pin port
DEFINE CCP2_BIT 1 'Hpwm 2 pin bit
OPTION_REG.7=0      'Abilita resistenze di pull-up su portb
adcon0=0
adcon1=7
            
'************************** D E F .    P I N    P I C **************************
symbol LED = PORTB.0
SYMBOL SERIALE = PORTB.7
symbol DIP1 = PORTB.2
symbol DIP2 = PORTB.3
symbol DIP3 = PORTB.4
symbol DIP4 = PORTB.5
SYMBOL DIP5 = PORTB.6
SYMBOL DIP6 = PORTB.7
SYMBOL RF = PORTC.3
SYMBOL LUCE1 = PORTC.1
SYMBOL LUCE2 = PORTC.2

  

The perfect Remote, Programmable, Controller for interactive LED strips schematic

INPUT DIP1
INPUT DIP2
INPUT DIP3
INPUT DIP4
INPUT DIP5
INPUT DIP6
INPUT RF
OUTPUT LED
OUTPUT LUCE1
OUTPUT LUCE2
'************************* D E F .    V A R I A B I L I ************************
TX_MAX CON 4        'Numero di TX memorizzabili
TEMPO CON 30        'Aumentarlo se in monostabile il relè va ad intermittenza
TEMPO_ONOFF CON 10  'Valore che imposta il tempo massimo entro il quale non si
                    'gestisce il dimmer, ma solo On/Off del canale
CONTA VAR WORD      'Contiene la lunghezza dell'impulso
ERRORE VAR BYTE     '0:Nessun errore nel segnale - 1:Segnale non valido
I VAR BYTE          'Varibile di comodo per i conteggi e accessi all'array
TRENO VAR WORD[25]  'Contiene la lunghezza di tutti gli impulsi
COD_A VAR BYTE      'Parte alta codifica RF
COD_B VAR BYTE      'Parte bassa codifica RF
COD_1B var byte     'Parte alta codifica RF letta da memoria
COD_2B var byte     'Parte bassa codifica RF letta da memoria
TROVATO VAR BIT     '1:Dato in memoria corrispondete a quello ricevuto
LOC VAR BYTE        'Locazione memoria
RICEVUTO VAR BIT    '1: segnale RF ricevuto
CH VAR BYTE         'Identifica il pulsante (1,2,3,4) premuto
CH_ONOFF VAR BYTE   'Identifica il pulsante (1,2,3,4) premuto
PWM1 VAR BYTE       'Valore PWM strip WW (luce calda)
PWM2 VAR BYTE       'Valore PWM strip CW (luce fredda)
TEMPO_RX VAR BYTE   'Tempo trascorso dall'ultima ricezione codice RF
TEMPO_PASSATO VAR BYTE
TEMpO_RX=0
TEMPO_PASSATO=0
CONTA=0
ERRORE=0
TROVATO=0
RICEVUTO=0 
PWM1=0
PWM2=0
CH_ONOFF=0
'********************************* I N I Z I O *********************************
CLEAR
eeprom 0,[0,0,0,0,0,0,0,0]
eeprom 101,[0,0,255,255]
low led
low luce1
low luce2
SEROUT SERIALE,T9600,[13,10,"LED RF Dimmer v1.1 13/12/2013"
'Reset singolo canale desiderato
if dip1=0 or dip2=0 or dip3=0 or dip4=0 then
    if DIP1=0 then
        high led
        write 0,255
        write 1,255
    endif
    if DIP2=0 then
        high led
        write 2,255
        write 3,255
    endif     
    if DIP3=0 then
        high led
        write 4,255
        write 5,255
    endif     
    if DIP4=0 then
        high led
        write 6,255
        write 7,255
    endif
    pause 2000
endif
low led
'Inizializzo facendo lampeggiare il LED
for i=1 to 10
    TOGGLE LED
    PAUSE 200
NEXT I
'Lettura EEPROM PWM uscite
read 101,pwm1
read 102,pwm2
if dip5<>0 then   
    pwm1=0
endif    
if dip6<>0 then   
    pwm2=0
endif    
HPWM 1,pwm1,250
HPWM 2,pwm2,250
write 101,pwm1
write 102,pwm2
'*********************************** M A I N ***********************************
'Lettura lunghezza impulso "0" e successivamente lettura treno di bit ricevuti
MAIN:   
    RICEVUTO=0
    gosub CONTROLLO_RF
    if ricevuto=1 then
        high led
        pause 5
        GOSUB COMPRIMI_CODICE
        GOSUB CERCA_SENSORE
        IF TROVATO=1 THEN
            IF TEMPO_PASSATO>TEMPO_ONOFF THEN
                IF CH=1 THEN
                    IF PWM1<>255 THEN
                        PWM1=PWM1+1
                    ENDIF               
                    HPWM 1,pwm1,250
                ENDIF
                IF CH=2 THEN
                    IF PWM1<>0 THEN
                        PWM1=PWM1-1
                    ENDIF
                    HPWM 1,pwm1,250
                ENDIF 
                IF CH=3 THEN
                    IF PWM2<>255 THEN
                        PWM2=PWM2+1
                    ENDIF               
                    HPWM 2,pwm2,250
                ENDIF
                IF CH=4 THEN
                    IF PWM2<>0 THEN
                        PWM2=PWM2-1
                    ENDIF
                    HPWM 2,pwm2,250
                ENDIF
                write 101,pwm1
                write 102,pwm2
                write 103,pwm1
                write 104,pwm2
            ELSE
                TEMPO_PASSATO=TEMPO_PASSATO+1
                CH_ONOFF=CH
            ENDIF
            SEROUT SERIALE,T9600,[13,10,"PWM1:",#pwm1," - PWM2:",#pwm2]    
            tempo_rx=TEMPO
        ENDIF
    else        
        if tempo_rx>0 then
            tempo_rx=tempo_rx-1           
        endif
        if tempo_rx=0 then           
            'Funzione On/Off e non dimmer perchè è stato premuto brevemente il pulsante
            IF TEMPO_PASSATO>0 AND TEMPO_PASSATO<=TEMPO_ONOFF THEN                 
                high led
                pause 300
                low led
                IF CH_ONOFF=1 OR CH_ONOFF=2 THEN
                    IF PWM1=0 THEN
                        READ 103,PWM1
                        HPWM 1,PWM1,250
                    ELSE
                        PWM1=0
                        write 101,pwm1
                        HPWM 1,0,250
                    ENDIF                          
                    write 101,pwm1
                ENDIF
                IF CH_ONOFF=3 OR CH_ONOFF=4 THEN
                    IF PWM2=0 THEN
                        READ 104,PWM2
                        HPWM 2,PWM2,250
                    ELSE
                        PWM2=0
                        write 102,pwm2
                        HPWM 2,0,250
                    ENDIF                          
                    write 102,pwm2
                ENDIF
                CH_ONOFF=0
            ENDIF
            TEMPO_PASSATO=0   
        endif
        gosub controllo_dip               
    endif
    LOW LED
    CH=0
    
GOTO MAIN  
'************************** C O N T R O L L O _ D I P **************************
CONTROLLO_DIP:   
    IF DIP1=0 or dip2=0 or dip3=0 or dip4=0 THEN
        high led
        if dip1=0 then ch=1
        if dip2=0 then ch=2
        if dip3=0 then ch=3
        if dip4=0 then ch=4
        
        gosub CONTROLLO_RF
        if ricevuto=1 then
            GOSUB COMPRIMI_CODICE
            LOC=CH - 1
            loc=LOC * 2
            write loc,COD_A
            loc=loc+1
            write loc,COD_B           
            SEROUT SERIALE,T9600,[13,10,"Memorizzato canale ", #CH]
            low led
            while DIP1=0 or dip2=0 or dip3=0 or dip4=0
                TOGGLE LED
                PAUSE 100
            wend
            low led
        endif
    ENDIF
    IF DIP1=0 or dip2=0 or dip3=0 or dip4=0 THEN
        goto CONTROLLO_DIP   
    endif
    low led
    
    IF DIP5=0 THEN
        CH=0
    ENDIF
    IF DIP6=0 THEN
        CH=0
    ENDIF
    
RETURN

 

 

For more detail: The perfect Remote, Programmable, Controller for interactive LED strips

About The Author

Ibrar Ayyub

I am an experienced technical writer with a Master's degree in computer science from BZU Multan University. I have written for various industries, mainly home automation and engineering. My writing style is clear and simple, and I am skilled in using infographics and diagrams. I am a great researcher and am able to present information in a well-organized and logical manner.

Follow Us:
LinkedinTwitter