Posts from a Philips Dynalite Programmer & Installer

Menu

Ok so we’ve completed a recent job… integrating Dynalite with a Ness M1 security system. We wanted the Dynalite system to alter lighting based on certain actions of alarm. The M1 installer placed a Dynalite interface on his system, allowing Dynalite preset messages to be sent on the bus. The Dynalite bus cable was wired directly to the interface. The M1 was capable of sending a set of low Area numbers with set of presets… or the option of an area 255 with set of presets. We had a lot of lighting already on lower areas so we went with area 255. I had the installer program and email me with a list of M1 actions, and a corresponding Area 255 and Preset that would be sent with the actions.

So we just had to build tasks that were looking for these messages. When they saw these messages the appropriate lighting actions were completed. Below is one that is waiting for Area 255, Preset 2 which performs a welcome home type lighting scene when the alarm is disarmed.

The M1 comes with it’s own iPhone app so the security contractor added a bunch of other items like “All Off”, “Welcome Home”, “Garden On/Off” etc… this integration allowed us to keep everything on the one app… simpler for the home owner.

Hello again. One thing I’ve mentioned before about DLight2 is that you may need to use it every now and again on older Dynalite jobs. It is compatible with some older gear that Envision Project isn’t. Another powerful thing about DLight2 is it has an inbuilt decompiler. This means we can extract tasks from Dynalite devices without having the original code in our project. Let’s look at how we do this.

I’ve opened a project we’ve worked with before and double clicked a keypad. You will see the buttons at the bottom “Edit”, “Compile”. When we click “Edit”, it opens the keypads EVT file located in our file folder which contains the tasks for the device. I don’t have an EVT file for the keypad yet as I haven’t made any tasks for it. Let’s decompile the tasks from the device.

Edit and Compile buttons at bottom.

Hold down “Shift” and while keeping it held, click the “Comp” button. You will be prompted for the EVT file name to save the code to. The default name is fine. Click “OK”. Now we have an EVT file in our project folder that contains the decompiled tasks from the device. Click “Edit” to view the contents of the file.

Now we’ll set some areas and logical channels on our load controllers and keypads so we can switch some lights. Bring DLight2 up to where we were last time.

I have 2 x 12 Channel LED controllers and 2 x DR2P keypads in my training kit. I have showing in my physical window.

DLight2 physical window

Let’s start setting up our first Dynalite load controller. Highlight the first load controller in the physical window and hit “C” to configure. All options and hotkeys are available under “Utils” and “Options” menus. You will see the settings of the load controller. These are the factory default values. Notice all areas are Area 1, and logical channels just count up.

Configure Load Controller

Start by entering a “Device Name” so we can identify the load controller. I’ll call mine “LED Dimmer 1″ Before we do anything else, let save this change. Tick the box next to “Dump”. If this is selected and we hit “OK”, this means the changes will be saved to the device. On the window that appears next choose the shown settings if they aren’t already.

Save to device

This will save any changed data to the device, and use the faster Dynet2 protocol to communicate with the device. If you are uncertain whether your changes are making it, you may select “Entire Data Map” to save all settings to the device, regardless of what you have edited.

Ok at this point the device will be updated. We should however get used to saving our project as much as possible. I usually go to “File” then “Save all”.

Ok let’s open the load controller again with “C.” The channels 1 – 12 across the top represent our 12 physical channels on our load controller. We can click into the boxes underneath each channel number and alter the logical area, and logical channel. As you go through each physical channel, you can change the “Channel Name” description below. This would be something like “Kitchen Down Lights” or “Living Pendant” for example. I’ve filled mine out to suit my Dynalite training case.

You can check which channel is connected to what circuit by opening the controller with “P” or double click. Changing the slider levels here will alter the load controller levels.

Load controller levels

So back in the device configuration I’ve configured all my physical channels to their appropriate logical area and channel numbers.

Load Controller Areas and Channels

So now we can configure buttons on our keypads to match these logical areas and channels to switch lights.

Double click on the keypad you want to configure or highlight the keypad and hit “P”. Click “Advanced Settings” at the bottom left if it is visible.

DLight2 Keypad Config

You may switch between the buttons by clicking the arrows near the bottom left. Change the function of each button in the left window. There are a number of options here but most commonly we use “Preset”, “Task”, and “One touch button.”

I’ve set button 1 with function “Preset” which sets Area 2 to Preset 1 (On). To switch between presets (like on and off), we could choose function “One Touch Button”, and below it “Fade Preset to Preset”. This works with area, channel number, on preset, and off preset. So we set our area, channel number, and in most cases to switch between on and off we choose preset 1 and preset 4. If you want this button to affect all channels in this area, change the “Channel” value to “All”. It is worth checking the “LED” value to make sure it matches the button we are pressing.

Dynalite keypad DLight2

With this config my button 2 turns all lights in area 2 on, then off which each button press. As I mentioned before we can also run a task from a keypad button. We’ll look at that in a different post.

Hi there. Most of us are programming Dynalite these days with Envision Project software. Before Envision, Dynalite programmers were using DLight2. DLight2 in comparison to Envision Project is more primitive and less intuitive. I really got to know DLight2 and resisted moving to Envision, but Envision has really proved the superior software. There are a couple reasons why you may need to revert back to DLight2 however.

- Envision Project does not have a decompiler. This means that you cannot extract task programming from a device with Envision Project software. We can however do this Dlight2. This can save a lot of time if you are doing a job where the original programming files are unavailable.
- DLight2 supports older hardware that Envision doesn’t. This can be required when you are working on a job that contains some old hardware not supported by Envision.

Dlight2 can be obtained from your Dynalite distributor. The latest version created was build 985. The installer I have is an older version, then I apply an update. It is installed with the default options selected. It also installs a program called Crimson Editor which is used for editing the tasks.

Once installed, you can run the software. It may whinge that it doesn’t have a config file, and wishes to create one… hit OK. It will also complain that a PC Node is not connected. You must have a Dynalite USB programming interface connected, and the driver for it installed. You may need to get this driver separately from your distributor. I extracted the driver, then went to Device Manager, right clicked on the troubled interface, and chose update driver. I then browsed to the location of the driver files that I extracted. The exclamation symbol went away then and I could see a COM3 next to the device in the Device Manager. Look at the beautiful DLight2 interface:

DLight2 Interface

The top window shows the devices in your network. The bottom is our network log. The top window can be changed to view our logical view (Areas) by pushing F8.

So that we can connect to our Dynalite network, we need to choose the correct COM port in our config. This part is not automatic like in Envision. We saw that our port was COM3 in the Device Manager. So go to Options then Initial Settings. Choose Comms. Change the port number to your port. (Mine is 3), and hit OK. Don’t forget to select “save to ini” so that it loads the correct port next time we open the software. To test this, close DLight2, then open it again. You should now have no PC Node error.

DLight2 Comms Config

We’ll load our devices from the network then we’ll call it a blog. We’ll follow this with more DLight2 tutorials. Much like with Envision, we need to search for a type of device, and within an address range. I know I have two D3 Dimmers in my training kit so first I’ll go to Options, then Config Search List. I click the tick box next to D3 Dimmer and put in a range of 0 to 10 as I know their addresses are under 10. After I hit OK it finds them and loads the information into the software.

DLight2 Search

You can see “Reset device to load now” in the above picture. If you have this window open and reset a device, the label will change to “Load XX device now” or similar, and this will load the device you just reset if you click it. This is useful if you have no idea of address or device type. OK so now I’ve got both my load controllers in my Physical View window.

Physical View DLight2

OK so I’ll do use a combination of these methods to add my keypads and my sensor. Now I see the following. I have my 2 load controllers, 2 keypads, and a sensor ready to program. I can see in the physical window the device given to the device, the device type, the firmware version, and the box number. We are ready to program these bad boys.

DLight2 Devices Loaded

We do need to save our project first. Unlike Envision, DLight2 does not have a single project file. It is made up of HEX files and EVT files. There is a single HEX file per device, and an EVT file containing our tasking for each device. Start by clicking the top device and hit “File” and “Save.” Choose a location to save this HEX file. Then you can select all the devices and hit “File” and “Save All.” This will save each devices HEX file to the same folder as the first. If you close DLight2 and need to open this project again, you will need to go to “File” and “Open.” Browse to the location of the HEX files in this project. Select all the HEX files and hit OK. All the devices will appear in the physical windows again.

I’ll post some information on basic and possibly advanced DLight2 programming in some following posts.

Hi again. A common request with Dynalite (well these days we just go ahead and do it) is to place a light and extractor fan for a bathroom on one button. When the button is pressed, both come on. When it is pressed again, the extractor fan stays on for a delay period (say 2 minutes or so) then turns off automatically. You can hit the button again at this time if you wish and turn the fan off immediately. Once it is off you are back at square one, the light and fan turn on again with a button press.

Our button is going to have to run a task as this gets a little complex. If this task is within a delay period we cannot get it out of it’s delay unless we cancel the task, so we are going to need a separate task to control the main task. This task will just be the following:

Task3(){ Name=”Task 3″ CancelTask(4) //needed to cancel the task if it is stuck in a delay StartTask(4) //restart the task}

Ok, we are going to have to use a flag in our main task to check what the current state of the light and fan are in. We’ll use 3 different states. 0 will tell us that the fan and light are off. 1 means the light is on and the fan is on. 2 means that the light is off and the fan is running.

We’ll do a check on this flag at the start of the task. No matter what state the task is in when we push the button, the task is cancelled and starts from the top. The flag check portion of the code looks like this:

Task4(){Name=”Toilet Fan Task”LDA ~0 //check the flagCMP #0 //compare to the number 0BRZ LightOn //if it matches, branch to “LightOn” codeCMP #1 //compare to number 1BRZ LightOffCMP #2 //compare to number 2BRZ FanOff

If light is off and fan is off, we turn them both on. We also want to turn the LED for the button on. Then we want to place the value 1 into our flag so that this shows the current state is light on and fan on. A NULL is placed at the end of the “LightOn” branch to cancel the task before going onto the next branch. The LightOn branch looks like this:

When we push the button again it checks the flag which now has the value of 1. We check this and branch to a “LightOff” portion of code. This code will turn the light off (leaving the fan on), it will also store the value of 2 in our flag so when checked we know it is in the state of light off and fan on. We then start a separate task which flashes the LED on and off. This shows the user that the fan is on a timer. And then we place our delay time. For testing purposes I just have the value of 5 (5 seconds). When this expires it runs onto our “FanOff” branch.

If we don’t want to wait for the delay to expire we push the button again, which checks the flag (which has value 2 now) and will start the “FanOff” branch as a result. The “FanOff” branch will cancel the LED flash task, turn the fan off, and store a 0 in our flag to signify we are back to the start of our sequence again.

Check out all the code:

Task3(){ Name=”Toilet Fan Task Control” CancelTask(4) //cancel the main task in case it is stuck in a delay StartTask(4) //start the main task again.}

LightOn: Preset(A=7,P=1) //turn on fan Preset(A=9,P=1) //turn on light LedOnOff(0×00,0×40,0×00,0×00) //Turn On [ 6 ] And Turn Off [ ] LDA #1 STA ~0 //store the new state as a value of 1 in our flag NULL

Preset Offset’s in Dynalite are useful for temporarily altering the state of lighting very quickly and easily. One idea for using preset offset is that we can set a button or task to go to preset 1 (for on) and preset 4 (for off) for a particular area. The preset offset can then be activated for this area to alter the result of preset 1 and preset 4. Just say we set a preset offset to this area of 4. Like this in code with area 10 for example:

PresetOffset(A=10, O=4)

What will happen now is if we tell area 10 to go to preset 1, it will offset by 4 and it will actually be set to preset 5. When we go to set the area to preset 4, it offsets by 4 and the result is preset 8.

A good use of this would be for a toilet. When the “Goodnight” button is pressed we include PresetOffset(A=10, O=4) in the “Goodnight task” for example. We then set a nice low level for Preset 5 for that area, and we set 0% for preset 8. So when someone goes to the toilet after bed time, with the preset offset active it will actually go to preset 5 (low), then preset 8 (off). We must remember to return the preset offset back to normal in the morning… this could probably be done with a task in our time clock at sunrise,

But what if our home owner wants full lights? Maybe they are up very early to catch a flight or something. We’ll need an override. Let’s just say this button only turns the bathroom on… so we make a task:

Task 1(){
Name=”Bathroom On”
Preset(A=10,P=1)
}

Ok, so we’ll now do 2 things. First we’ll add a delay to the task followed by a ramp of the lighting channels to full. Secondly we’ll Cancel this task when the button is released. So when the button is pushed the lights go to low (after bed time) and if it is kept held down for longer than the delay the lights will start ramping to full. This will allow the user to override the low light level if they need and ramp it as much as they want until they release the button.

So in the GUI we set the button press to start Task 1, and the same button release to start Task2. Then these are your tasks:

If you need to get a couple of simple actions to happen on a single Dynalite keypad button, here’s a nice little trick. It might seem stupidly simple and you might think “yeah great Greg… real good programming advice…. stop wasting my time….” but when I first did it, it was like one of those light bulb moments.

When we push a button we make it have some effect… like a preset or run a task. We usually write a task if we want a button to do more than one thing. But we can also add an action to the release of a button and this has saved me the time of writing a task if I need a button that does 2 things.

When you program the button, choose Fuction: Custom(press and release actions). You can then add an action when pressed, and an action when released. In my example I set an area to On when it’s pressed, and a different channel to 100% when it’s released. No task required.

Hi again. I’ve already done this post but we were hacked again last week. If I ever walk into a website hacker I swear I’m going to…. I don’t know… something bad. Anyways… hopefully the security measures we have in place now will stop the hackings!!!

OK so the Away button on a Dynalite system. We might want this for a number of reasons… in this example however I want to create an Away button that the user pushes when they leave to go on holiday or somewhere for a period of time. The effect we want is to turn on some lights at night, and give a “lived in look” to give the impression someone is home.

In this example I have a time clock. At sunset it already turns on some garden lights…. then at 10PM it turns them off for us… nice… so what we want to do is alter this. So when the user is away it turns on some house lights too… then turns them off.

Time clockevents

When the time clock runs the on and off lighting tasks it needs to know if it is in Away mode or not. So what we’ll use is a flag. When we run these tasks we’ll check the flag and then do the appropriate on and off lighting action. How do we set this flag? We’ll need some sort of indication from our home owner that they are away then store this in the time clock memory.

They’ll have an “Away” button at the front door that they hit when they leave. We’ll use a dummy preset (which is a preset that is not used for any other lighting or other purpose) This will be preset 200 in our example. When the “Away” button is activated it sends an Area 200, Preset 1. When deactivated, it’ll send an Area 200, Preset 4.

The time clock will have a task in it that listens for this Area 200 message. When it sees this message, it will run the code within the task. That code will store the preset message into the memory as a flag for us.

Task1(){ Name=”Set the Away flag” Start(0x1c,200,x,x,x,x,0xff) //listen for area 200 message LDA @3 //load the preset that was sent with the A200 msg STA ~0 //store this value in memory position 0 of this device}

The @3 means the value that is in position 3 of the dynet message… this is the preset value. We then store it in memory position 0. This value will be either 0 (preset 1) or 3 (preset 4).

So these are our tasks just ahead. Depending on the value in the time clock memory, it will either do a sequence of lighting to give a lived in look, or it will just turn on then off our garden lights.

So that’s it… so in summary… home owner hits “Away” button on their Dynalite keypad when they go away. It sends a dummy preset message (Area 200, Preset 1). Our time clock has a task within it that listens for this and runs when it hears Area 200 messages. The preset value is stored in the time clock’s memory at position 0. When the sunset task runs it checks the value in this memory position. If it is Preset 1 (0) it turns on our away lights arrangement. If it is Preset 4 (3), it just switches on the garden lights. Same circuits again for turning lights off.

I haven’t tested this Dynalite code as I don’t have a time clock at the moment but it looks pretty good to me.

Dynalite communications between devices are over the Dynet network… that CAT5 like cable that’s run between every single device in our project. Communications between devices on the Dynet bus is done by 8 byte messages. The last byte we don’t worry about when we program our own Dynet messages. This is a checksum type value and created automatically for us. (unless we are sending the Dynet messages from 3rd party devices.

Since Dynet messages are used for all communications, we can create our own messages to perform any action we want, even actions that aren’t possible with our GUI.

Before Envision Project was born, creating manual Dynet messages was a difficult and slow process. Thankfully EP includes a Dynet message sender tool which can help us. If you open the Dynet packet sender you will see a list of predefined actions on the left, and if you select one, you’ll see the associated Dynet message on the right. The best part is the description of the Dynet message’s action displayed underneath. This means you can tell exactly what it’s going to do.

dynet sender

From here we can build our own Dynet message starting with a predefined action, and change it to our needs. For example I’ve built a message which will set Area 11 to Preset 1. The message looks like: 1C 0B 64 00 00 00 FF. 1C: The sync byte. 0B: The area number in hex. 64: A data byte and in this case sets the fade time to 2 seconds. 00: The preset, which is preset 1. The next couple of 00′s are not used by can be to extend fade time, or use a high preset number. FF: is the join byte.

We can hit “Send” to test our Dynet message. Mine works! The lights in the dining room of my training kit came on.

Another way to get a Dynet message you need is to copy it out of the network log. All Dynalite messages show up in the network log and we can easily copy the data by right clicking on it and selecting “Copy Packet” We can then paste this directly into our code.

Network Log

Building our own Dynet messages is a very powerful thing. It means we can communicate to our Dynalite devices in ways that may not be possible with the programming language. We can also use these Dynet messages to communicate from 3rd party systems. The Dynet packet tool is also helpful to work out what decompiled code shown as a Dynet message means.

We all know motion sensors are useful… they turn a light on if motion is detected. After a period of no motion they turn off. This can save us from using switches, is good for security purposes, and can help us save power.

We’re going to setup a Dynalite sensor in Envision Project. We’ll pretend it’s in our garage. We want the garage light to turn on when someone enters, and turn off a period after that person is gone. We want to make sure it doesn’t turn off while they are still in there.

We have a Dynalite training kit to test it on, with a Dynalite DUS704W sensor attached. You can see in the photo the 4 LEDs that are on are the lights in the garage.

Dynalite with Sensor

OK the first thing we need to set in the “Motion Detector” tab is the area the motion detector is controlling. My garage is area 15 so I have 15 in there. There are a few more options here we won’t look at for this example.

The important stuff is in the options table below:

Motion Detector Options

OK so the way a sensor works is we define what action the sensor should take after a period of time of sensing no motion, and also the action to take if it senses motion within this time. We need to set these actions for every state the sensor is in. So actions to take with and without motion when active (lights on) and steps to take with and without motion when not active (lights off).

We’ll start with lights off. The sensor has not detected any motion. The Preset for the lights in this area is currently Preset 4 (0%). The motion detector is also in a state of Preset 4 as we set it to Area 15. We enter an action in our table shown above. Next to Preset 4 and in the “On Motion” column add a “Preset” action and make it Preset 1. This means when the sensor is in Preset 4, and motion is detected, it goes into Preset 1, and our lights come on.

Ok so what do we do to turn these lights off when no motion is detected after some time? Enter a Preset 4 action in the “On No-Motion” column and set a timeout period? That seems like the logical thing, but this means that the sensor will just time out after the timeout period regardless of whether any more motion is detected. And the occupant has no warning before the lights are to turn off. So what we do here is jump to another Preset which serves as our grace period. This grace period will allow us to return to Preset 1 if motion is detected again, and may also serve as warning to the occupant. If there is no motion during the grace period we’ll go to Preset 4 (lights off).

The Preset we choose for our grace period should have a light level of 100% so lighting levels don’t change. I don’t like changing default light levels of presets if I can help it so I’ll use Preset 5 for the grace period which by default is 100%. So enter an action of Preset 5 in the “On No-Motion” column next to Preset 1. Enter a timeout period or set “use global” which will use the global timeout settings in the motion detector’s options. I used 30 seconds for testing purposes. So when the motion detector is in Preset 1 and it detects no motion for 30 seconds it should go to Preset 5 with lights still on.

Now that we are in our Preset 5 (grace period), we want to jump back to Preset 1 if more motion is detected. On the other hand we want to jump to Preset 4 (lights off) if no motion is detected. I want to also use this opportunity put some sort of visual warning in for our occupant who may be working in an area the detector can’t see him. Let’s flick the lights on and off when we get into the grace period. When the occupant sees this he can wave his hands in front of the detector if he wants.

So next to Preset 5 and “On Motion” set a Preset 1. Set the “On No-Motion” setting to Preset 4. I have my timeout here set to 10 seconds for testing. So when in the grace period and motion is detected, it jumps to Preset 1. When no motion is detected it jumps to Preset 4 and lights go off. We end up with this:

Motion Detector Options

Don’t forget our visual warning! Go back and edit our action under “On No-Motion” for Preset 1. Under the Preset 5 action in this window add a “Task” and choose task 1. I wrote a simple task that turns lights off and on with a 0.1 second delay, enough to warn the occupant but not interfere with his sight too much. As you will see I alter channel level, not Presets to flick the lights. This is so we don’t end up changing the Preset of the motion detector and putting our actions out of sequence.