How to Control White Light in RGBW Lamp

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to Control White Light in RGBW Lamp

2,100 Views
yuboli
Contributor II

hello everyone,

   I have a RGBW lamp. I want to control R, G, B and W with four PWMs respectively. I use JN-AN-1218 project. But your DeMeo algorithm only provides R, G, B, not W. When I adjust the color on the palette, how do I control the W value? Do you have an algorithm for W value? This algorithm has been bothering me for a long time.

Looking forward to your reply. Thank you very much

0 Kudos
Reply
9 Replies

1,930 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hi Daniel, I hope you're doing well!

 

There are some macros in the DriverBulb_OM15053.c source file. If you define INCLUDE_WHITE_CHANNEL, you can use the DriverBulb_vSetRGBWColour function to also set the white value for your light bulb, if you want to implement it for another board or device, you could create a function based on the DriverBulb_vSetRGBWColour one, and adapt it to your desired device.

 

Please let me know if you need more information.

 

Best regards,

Sebastian

0 Kudos
Reply

1,930 Views
yuboli
Contributor II

Thanks  , In the DriverBulb_OM15053.c source file:

#ifdef INCLUDE_WHITE_CHANNEL
PUBLIC void DriverBulb_vSetRGBWColour(uint32 u32Red, uint32 u32Green, uint32 u32Blue, uint32 u32White)
{
 sDriver.au32Colour[E_RED_PWM]   = u32Red;
 sDriver.au32Colour[E_GREEN_PWM] = u32Green;
 sDriver.au32Colour[E_BLUE_PWM]  = u32Blue;
 sDriver.au32Colour[E_WHITE_PWM]  = u32White;

 vJitterPwmWaveform((tsTimer *)REG_TMR2_BASE,E_RED_PWM);
 vJitterPwmWaveform((tsTimer *)REG_TMR3_BASE,E_GREEN_PWM);
 vJitterPwmWaveform((tsTimer *)REG_TMR4_BASE,E_BLUE_PWM);
 //vJitterPwmWaveform((tsTimer *)REG_TMR7_BASE,E_WHITE_PWM);
 vJitterPwmWaveform((tsTimer *)REG_TMR0_BASE,E_WHITE_PWM);
}
#endif

In the zpp_zcl_light_task.c source file:

#if (defined CLD_COLOUR_CONTROL) && !(defined DR1221) && !(defined DR1221_Dimic) && !(defined OM15045)
    vApp_eCLD_ColourControl_GetRGB(&u8Red, &u8Green, &u8Blue);

But the white is not, There is no vApp_eCLD_ColourControl_GetRGBW(&u8Red, &u8Green, &u8Blue, &u8white) function, how to get u8white?

0 Kudos
Reply

1,930 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hi Daniel,

 

I'm really sorry for the inconveniences this may cause, but you will need to create a custom implementation for an RGBW light.

You can base your implementation on the function in the DriverBulb_OM15053.c source file, or implement the W value in a similar way to how RGB are changed in the zpp_zcl_light_task.c source file.

 

Best regards,

Sebastian

0 Kudos
Reply

1,930 Views
yuboli
Contributor II

Thanks,

   But I still  don't know what is the relationship between RGB and W, how to calculate w based on RGB.  Can you give the detailed algorithm?

0 Kudos
Reply

1,930 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hi Daniel,

 

The control for W will depend on the lamp you're using.

 

Some lamps allow it to be controlled by another PWM, just like the RGB channels of a regular color light. The algorithm that's included in the DriverBulb_OM15053.c source file uses a timer to create a fourth PWM for the W color.

 

Some lamps use a Color Temperature value to control the W, so that could also be one way to control the device. If this is the case for your lamp, you could check the ColorTemperatureLight example in the JN-AN-1218 Application Note, as it shows how to set the color temperature with a function.

 

Best regards,

Sebastian

0 Kudos
Reply

1,930 Views
LChll
Contributor III
  • Could you please tell me what routine should use this DriverBulb om15053.c?

ad
0 Kudos
Reply

1,930 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hi Linklai,

 

DriverBulb_om15053.c should be used if you're using Demoboard OM15053, however, as it is no longer being manufactured, its only left in code for reference purposes. The functions implemented would go in your application and would be used in place of the new set RGB functions implemented.

 

Still, as previously stated, this implementation is custom and is not supported.

 

Best regards,

Sebastian

0 Kudos
Reply

1,930 Views
yuboli
Contributor II

Thanks ,

         Do you use the following function?

B4Z[XN}E(DP[_}_7$IXO(JW.png

but  u32White is not know. so I Cannot call  DriverBulb_vSetRGBWColour()?

0 Kudos
Reply

1,930 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hi Daniel,

 

Unfortunately, since support for RGBW lights is not included for all of the devices, the implementation for the device you're using is custom, and the function provided is only for reference purposes.

 

To use an RGBW light, you will have to implement another channel for the W value, based on the way the DriverBulb function did it.

 

I'm sorry for the inconveniences this may cause.

 

Best regards,

Sebastian

0 Kudos
Reply