Using Arduino to control Philips LivingColors

Hi,

Has someone some experience with controlling Philips LivingColors with Arduino and IPS? I have the Arduino with CC2500 shield working, but now the step to get this working with IPS.

  • What are the commands to send to the Arduino COM port?
  • How can I check if the command is send to the COM port, to check if the COM port is working and the commands are send to the Arduino?

By example this command should be send: w0-255-255-255

Maybe someone has a script which is already working?

I hope someone can help me.

Thanks,

Albert

I found out that the command should be:
COMPort_SendText(21575 /[Serial Port Arduino]/, „n0“);

Only, there is no result on the lamp. When sending n0 with Putty the lamp is going out, as it should be.

How can I check if the command is send, or should I do more to send commands to de Arduino via a serial port?

I hope someone can help me started with this.

Albert

Hello…

… use the debug function @ the instance of the com-port!

Regards,
Peter

Sent from my iPhone using Tapatalk

OK, a few hours later I got the “Farbauswahl” working, and it looks like I can send the right commands with the help of another topic.

http://www.ip-symcon.de/forum/f18/umrechnung-variable-profil-hexcolor-14811/index2.html#post175075

I managed to get the lamp working once, only when I switch it off via a terminal session. When switched off, only this way, I can send a command once. After that nothing happens anymore?

Peter: what do you mean by debug the instance, could this be the problem that the command is only send once? Do you have an example?

Albert

Here comes a screenshot!

click on debug !

Peter

Thanks for the help, this is what I needed to solve this problem.

There was no answer coming from the ComPort because the command I send didn’t end with a carriage return. So I added chr(13) at the end and now it is working.

For those who want to add a Arduino with a CC2500 to your IPS to control your Philips LivingColors (first generation):

  • First I added a color selection “Farbauswahl” to ISP (Add Variable, Type Integer and Custom profile ~HexColor).
  • To the color selection I added a script with the next code.

And now it is working ………………

Albert


<?

// ################################################################################################
// Valid commands LivingColors are:
//     q						: this help screen.
//     r						: reset.
//     wl-rrr-ggg-bbb	: r, g and b are numbers 000 to 255. Example w000-255-000 for bright green.
//     hl-hhh-sss-iii	: h, s and i are numbers 000 to 255. No example for now.
//     i						: print info.
//     annn					: select lamp n. Example a001 to select lamp 1.
//     nl-rrr-ggg-bbb	: turn lamp on.
//     fl					: turn lamp off.
//     ee					: e = 0 echo off, e = 1 echo on.
//     l						: listen for adresses. Use i to list adresses.
//     saabbccddeeffgghhii : store adress in a..i. 9 numbers as 2 digit hex.
//     ?						: dummy command.
//
//     A response of ? means invalid command.
//     A response of ! means command executed.
// ################################################################################################

$hexcolor = 39782  /*[Scripts\Test Scripts\LivingColors Woonkamer\Achterzijde\Kleurinstelling]*/ ;

if ($IPS_SENDER == "WebFront")
{SetValue($IPS_VARIABLE, $IPS_VALUE);

$color = GetValueInteger($hexcolor);

function HexColor2Dec($color)
{
    $rood  = $color >> 16;
    $groen = ($color & 0x00FF00) >> 8;
    $blauw = $color & 0x0000FF;
    return array(sprintf("%03d",$rood), sprintf("%03d",$groen), sprintf("%03d",$blauw));
}

$sendcolor = "w0-".HexColor2Dec($color)[0]."-".HexColor2Dec($color)[1]."-".HexColor2Dec($color)[2].chr(13);
$sendcolor1 = "w1-".HexColor2Dec($color)[0]."-".HexColor2Dec($color)[1]."-".HexColor2Dec($color)[2].chr(13);

COMPort_SendText(21575 /*[Serial Port Arduino]*/, $sendcolor);
COMPort_SendText(21575 /*[Serial Port Arduino]*/, $sendcolor1);

}

?>

Hi Albert,
thanks for the script. Where do you buy the stuff to control the lamps? I have 2 livingcolors 1.generation at home. it sounds nice to operate them via ips!!
regards,
Peter

Hi Peter,

You need a few things.

A Arduino board
I have bought the USB version at a Web Shop in The Netherlands, but you can buy them every ware. There is also a Ethernet version but I’m not sure it will work with the CC2500 shield. I don’t see any response about that. The USB version is working (In IPS since today :slight_smile: ). They cost around € 25.

FLORIS.CC - Arduino Uno Rev3

The LivingColors Arduino shield
I’m not sure if this is a special board or just the standard CC2500, but I have bought the shield from a Dutch guy who has them on stock right now.

LivingColors Arduino shields in stock « Electronics projects and kits

On his website you will find a complete explanation on how it works and about the software you need. First you have to find out how the Arduino is working with the software, but after a few hours I had it working. It took some longer to get this working with IPS, but this is also running now. The shield cost € 22 without shipping.

Using the CC2500 Arduino Shield « Electronics projects and kits

A case
If you want the board in a case, there is a special case for it. I only had to remove some inner parts. It cost € 11,25.

Behuizing voor Arduino

It works great and you can connect multiple LC to it. Only the distance is a problem. I ordered some connectors, hopefully I can connect the Arduino via a RJ45 connection to my living room.

I took me some Google hours, but I found the way …………

Albert