torsdag 28. februar 2013


How to set up a WebFront in IP-Symcon to control a Xcomfort system


·         Open the “IP-Symcon Management Console
·         First you need to make sure the IPSymcon WebServer is running. This is done by clicking on the “Logical Treeview” link

·         Navigate to the “Core Instances” and check that there is a component called “WebInterface WebFront”. Double click on this to open the property page.

·         Verify that the server is running and that it is configured to listed to “All” addresses and that the Port is set to a TCP port that is not in use (default is 82). Make a note of the port value as we will configure the firewall later to allow incoming traffic to this port. If you made any changes then click [Apply]

·         Next you need to organize all the XComfort components into a logical structure.
·         Still in the “Logical Treeview” window. As shown in the example below I have created a set of Catagories and placed the XComfort components (and some PHP scripts) into a desired logical structure. You add a new Category by right click a node and select “Add Object – Add Category
·         
      Now, close the “Logical Treeview” window and return to the main windows in IPSymcon
·         Normally IPSymcon is installed with a default web front. I will now add an additional WebFront only for the XComfort components show above. Click on the “Configure WebFront” link

·         Click on the [New] button

·         A default WebFront is created with some basic items in it. In this example I will not make many adjustments to this, but there is a lot of configuration you can do to build quite advanced web pages to control various events and components.
·         Double click on the “Category” item to open the properties page



·         Click on the number 0 value in the “Root” property.

·         A location tree will now appear. Select the root level of the XComfort devices you want to add by double click on it (in my example it is the “Lys” with ObjectID 42817)

·         Back in the Category properties window, verify that the root value have changed to the ObjectID that you selected (in my example this is 42817). Click [OK]

·         Back in the WebFront config window, click [Apply]

·         Click on the “Appearance” TAB and e.g specify the name “XComfort” in the Title field . Click [Apply]

·         If you are using the Android or iOS app from IPSymcon then click on the “Mobile/Retro” TAB and configure as shown below. Click [OK] and [Apply] when done

·         You may also want to protect the access to this configuration with a password. You do this by clicking on the “Security” TAB and specify a password. This is especially important if you publish this configuration towards Internet in your internet router (e.g if you want to control the WebFront from the mobile app and/or a browser outside your home).
·         OK, almost there. You can now close the WebFront configurator and return to the main window in IP Symcon and then close the IP Symcon console
·         Finalize the setup by configure the Windows firewall. Open the windows Firewall management console (in Windows 7 and Windows Server 2008 R2 this is called “Windows Firewall with Advanced Security
·         Click on the “Inbound” node and click “New Rule” in the action pane:
o   Select “Port
o   Select “TCP” and then specify the port 82 (same as the IPSymcon WebServer is running on as shown previously in this procedure)
o   Select “Allow the connection
o   Select “Domain”, “Private” and “Public
o   Type a name for the rule
o   Click [Finish]
·         Now test the new WebFront by open an internet explorer e.g Chrome (do not use IE as this does not work properly with IPSymcon) and specify the URL:
 http://<ip address of your machine>:82
·         You should now see the IPSymcon welcome page and a link called “XComfort” (if you used that name on the WebFront previously) at the front page. The “Login” is another WebFront that I have in my system.

·         Click on the XComfort link and specify the password (if that was configured previously). The web page (WebFront) is now shown and you have a menu item corresponding to the logical structure of your XComfort devices as configured in the IPSymcon logical treeview.

·         If you need access from Internet, then publish this IP and port through your Internet router. I will not go into details how this is done as this varies quite a bit from router to router. See the internet router documentation for instructions how to do this.
·         If you are using the IPSymcon mobile app, then configure this to point to the same IP and port as shown above (or the NAT ip address of your internet router). You will then get the same logical structure on the mobile device as shown in the browser above. I know the app cost a bit, but I can strongly recommend it.
·         Enjoy!

onsdag 24. august 2011

How to configure IP-Symcon to support Eaton XComfort

In this blog post I will explain how to use the Home Automation software IP-Symcon to control light dimmers, switches, etc from Eaton XComfort. Since all documentation from IP-Symcon is on German, I had to do quite a lot try and failure before I got it all working. This post will explain in detail how you do this setup including all the details.

The first thing you need to do is of cause get a IP-Symcon license. This can be purchased directly from IP-Symcon and it takes just a couple of minutes to complete. Go to their web shop at http://www.ip-symcon.de/shop/software. I have purchased the Pro version as this give a whole lot of benefits.

Once you got the license, then you can download and install the software. The software is in English so the installation is straight forward with all default values.

Now, to control a Eaton XComfort system you will need to have some connection information from the XConfort system and you will need a device (CKOZ-00/03 see below) to send the RF signals from the machine running the IP-Symcon software that control the dimmers and switches +++. Now, this part might cost you or if you are lucky you may borrow some equipment from your local XComfort dealer. The equipment you need is:

1) Eaton XComfort USB Communication Interface - CKOZ-00/03
2) Eaton XComfort RS-232 Communication Interface - CRSZ-00/01

The USB interface is used for sending RF control signals to the XComfort actuators (dimmers, switches, etc), so this you will need to buy. The RS-232 interface cost about twice the USB intrerface and is only needed for a short period to program the actuators and create a connection between the actuators and the USB interface (you might be able to borrow or rent this interface from a local vendor). Tip: Both interfaces can be bought for a "low" cost from Poland (http://xcomfort-sklep.pl/content/1-delivery).

You should now connect the USB interface to you machine running IP-Symcon so it has power through the USB port and the green light is illuminated. You may want to upgrade the firmware, this is done using the "Eaton CI Update" software. Tip: You MUST update the firmware on a 32-bit Windows operating system as the device driver needed for the software does not work on a 64-bit system.

Download and install the "Eaton RF System" from their web site (do a Google search to find the latest version. I used 2.00 Norwegian version). Connect the RS-232 interface to your computer and start the Eaton RF System software. The user manual for this software is pretty good, so I will not explain in detail how you use it, but your goal is to scan for all your existing actuators, including remote controls and especially the USB interface CKOZ-00/03. You should now see all existing connection between the actuators, remote controls and switches. You should also see that the USB interface was discovered. Next, you need to draw a line between all the actuators and the USB interface. You should now have something that look like this:

Tip: Give all the actuators a descriptive name!

After all connections are finished, then right click and select "Create Data Point List". This is a text file which contains information about all the actuators and their connections and how they are controlled. We will use this file later to import the configuration into IP-Symcon.

Start the IP-Symcon Management Console and connect to your IP-Symcon server. The first step will be to import the XComfort configuration. You do this my selecting "Manage Configurations" and then press the "New" button. Select XComfort Configurator and click through the rest of the wizard. The configuration screen will now show. Click on the "Upload Data Point List" and browse to the file you saved earlier from the Eaton RF System program. Now all the configuration is imported into IP-Symcon.

I would recommend that you organize the actuators and this is done by selecting "Logical TreeView" from the IP-Symcon Welcome page. I created the following structure (see picture below).

Once the structure is on plave, you can now move on to configure the IP-Symcon WEB interface. This is done by clicking on the "Configure WebFront" from the Welcome screen. Click New and go through the wizard. Once the WebFront configuration page is shown you can various web elements/part. The web part used to display your XComfort devices are the "Category" item. This item can be linked into a TabPane. The Category item is configured by pointing the "root" property to the root of the structure that you created earlier. See picture below.



My WebFront config looks like this:

And the result by browsing to http://<ip-symcon server>:82/

Tip: Create scripts that configure different themes. E.g "Evening", "Night", "Dinner", etc. A script can look like this:
<?
 //Start writing your scripts between the brackets
MXC_DimSet(59940 /*[Stue\Lys forstue ]*/, 30);
MXC_DimSet(28496 /*[Kjøkken\Lys kjøkken ]*/, 50);
MXC_SwitchMode(28025 /*[Stue\Lys skap ved TV ]*/, true);
MXC_DimSet(51422 /*[Stue\Lys spisebord ]*/, 50);
MXC_DimSet(22250 /*[Stue\Lys stuebord ]*/, 60);
MXC_SwitchMode(20792 /*[Kjøkken\Lys kjøkkenbenk ]*/, false);
MXC_SwitchMode(39724 /*[Trapp og Loft\Lys trapp loft ]*/, false);
MXC_SwitchMode(43107 /*[Stue\Lys ved soffa ]*/, false);
MXC_SwitchMode(16480 /*[Stue\Lys ved TV ]*/, false);
MXC_SwitchMode(52496 /*[Kjøkken\Stikk tak kjøkken ]*/, false);
MXC_SwitchMode(19669 /*[Stue\Stikk utg terrasse ]*/, false);
?>

Place the script in the logical structure and link them to the webconfig in the same way that you linked the actuators. See example below:
You can now by a single click set all actuators to a pre-defined configuration. Nice! :-)




fredag 19. august 2011

The beginning of the Arduino range sensor

In this blogg post I will update with the status of my first Arduino project from the beginning to the final installation.

Goal:
In the garage, meassure the distance from the car from the wall and display the distance in m/cm on a LED Matrix RG display

Hardware:
1 * Ultrasonic Range Finder - Maxbotix LV-EZ0
4 * LED Matrix - Serial Interface - Red/Green
1 * Arduino Uno

The hardware has arrived from sparkfun.com and the first part goal was to get the Matrix display anything. I really struggeled with the start as there was a lot of code examples for the LED Matrix RGB display, but hardly any examples at all for the R/G version of it. After hours of try and failure I finally ended up with a code that could display something. Actually, my problem was not in the code but in the wiring from the Arduiono board to the LED Matrix. I will show later exactly how this shall be connected as there is not much detailed info available for this specific LED Matrix.

Wiring:
Arduino pin 10 => R/G matrix pin CS (chip select)
Arduino pin 11 => R/G matrix pin MOSI (data)
Arduino pin 13 => R/G matrix pin SCLK (serial clock)
Arduino pin 5v => R/G matrix pin VCC (power)
Arduino pin GND => R/G matrix pin GND (ground)

(I did a mistake and connected the matrix on MISO instead of MOSI).

OK, that was the wiring. Next I did a lot of testing with the code to be able to display a solid character on each of the 4 displays. When daisychain multiple LED matrix display with a backpack and you write to them through the serial port, they will automatically shift the letters as a rolling text over the 4 displays. The code I used to stop them is shown below. In this code I tend to replace the counter that stop the text with the actual code for reading the sonar sensor. That will now be my next test:

For now the code looks like this which display the name "LENA" on the 4 displays:
The counter "count" will later be replaced with reading from the Ultrasonic range finder to check if the distance has changed since last reading.

The code will be updated as the project moves forward.....

// Simple program to test using the Arduino with the RGB Matrix
// & Backpack from Sparkfun. Code is a combination of Heather Dewey-Hagborg,
// Arduino Forum user: Little-Scale, and // Daniel Hirschmann. Enjoy!
//
// The Backpack requires 125Khz SPI, which is the slowest rate
// at which the Arduino's hardware SPI bus can communicate at.
//
// We need to send SPI to the backpack in the following steps:
// 1) Activate ChipSelect;
// 2) Wait 500microseconds;
// 3) Transfer 64bytes @ 125KHz (1 byte for each RGB LED in the matrix);
// 4) De-activate ChipSelect;
// 5) Wait 500microseconds
// Repeat however often you like!


#define CHIPSELECT1 10//ss
#define CHIPSELECT2 10//ss
#define CHIPSELECT3 10//ss
#define CHIPSELECT4 10//ss
#define SPICLOCK  13//sck
#define DATAOUT 11//MOSI / DI
#define DATAIN 12//MISO / DO

int dataL[] =
{1,1,0,0,0,0,0,0,
1,1,0,0,0,0,0,0,
1,1,0,0,0,0,0,0,
1,1,0,0,0,0,0,0,
1,1,0,0,0,0,0,0,
1,1,0,0,0,0,0,0,
1,1,1,1,1,1,1,0,
1,1,1,1,1,1,1,0
};

int dataE[] =
{1,1,1,1,1,1,1,0,
1,1,1,1,1,1,1,0,
1,1,0,0,0,0,0,0,
1,1,1,1,0,0,0,0,
1,1,1,1,0,0,0,0,
1,1,0,0,0,0,0,0,
1,1,1,1,1,1,1,0,
1,1,1,1,1,1,1,0
};

int dataN[] =
{1,1,0,0,0,1,1,0,
1,1,1,0,0,1,1,0,
1,1,0,1,0,1,1,0,
1,1,0,1,0,1,1,0,
1,1,0,1,0,1,1,0,
1,1,0,0,1,1,1,0,
1,1,0,0,1,1,1,0,
1,1,0,0,0,1,1,0
};


int dataA[] =
{1,1,1,1,1,1,1,0,
1,1,1,1,1,1,1,0,
1,1,0,0,0,1,1,0,
1,1,1,1,1,1,1,0,
1,1,0,0,0,1,1,0,
1,1,0,0,0,1,1,0,
1,1,0,0,0,1,1,0,
1,1,0,0,0,1,1,0
};

char spi_transfer(volatile char data)
{
SPDR = data;                    // Start the transmission
while (!(SPSR & (1<<SPIF)))     // Wait the end of the transmission
{
};
}

void setup()
{
byte clr;
pinMode(DATAOUT,OUTPUT);
pinMode(SPICLOCK,OUTPUT);
pinMode(CHIPSELECT1,OUTPUT);

digitalWrite(CHIPSELECT1,HIGH); //disable device 1

SPCR = B01010011;             //SPI Registers
SPSR = SPSR & B11111110;      //make sure the speed is 125KHz

/*
SPCR bits:
 7: SPIEE - enables SPI interrupt when high
 6: SPE - enable SPI bus when high
 5: DORD - LSB first when high, MSB first when low
 4: MSTR - arduino is in master mode when high, slave when low
 3: CPOL - data clock idle when high if 1, idle when low if 0
 2: CPHA - data on falling edge of clock when high, rising edge when low
 1: SPR1 - set speed of SPI bus
 0: SPR0 - set speed of SPI bus (00 is fastest @ 4MHz, 11 is slowest @ 250KHz)
 */

clr=SPSR;
clr=SPDR;
delay(10);


digitalWrite(CHIPSELECT1,LOW); // enable the ChipSelect on the backpack 1
delayMicroseconds(500);
spi_transfer('%');
spi_transfer(4);              //configure SPI for 4 displays
delayMicroseconds(100);
digitalWrite(CHIPSELECT2,HIGH); //disable device 2
delayMicroseconds(500);
digitalWrite(CHIPSELECT3,HIGH); //disable device 3
delayMicroseconds(500);
digitalWrite(CHIPSELECT4,HIGH); //disable device 4
delayMicroseconds(500);
}


int count = 0; //counter used to make sure we clock in text only once
void loop()           
{

  if (count < 1) //check if we have run the loop once
  {
  // Display 1
  delay(1000);
  int index = 0;                 
  digitalWrite(CHIPSELECT1,LOW); // enable the ChipSelect on the backpack
  delayMicroseconds(500);
  for (int i=0;i<8;i++) for (int j=0;j<8;j++)
  {
    spi_transfer(dataL[index]);
      index++;                 
  }
  digitalWrite(CHIPSELECT1,HIGH); // disable the ChipSelect on the backpack
  delayMicroseconds(500);

// Display 2
  index = 0;                 
  digitalWrite(CHIPSELECT2,LOW); // enable the ChipSelect on the backpack
  delayMicroseconds(500);
  for (int i=0;i<8;i++) for (int j=0;j<8;j++)
  {
    spi_transfer(dataE[index]);
      index++;                 
  }
  digitalWrite(CHIPSELECT2,HIGH); // disable the ChipSelect on the backpack
  delayMicroseconds(500);


// Display 3
  index = 0;                 
  digitalWrite(CHIPSELECT3,LOW); // enable the ChipSelect on the backpack
  delayMicroseconds(500);
  for (int i=0;i<8;i++) for (int j=0;j<8;j++)
  {
    spi_transfer(dataN[index]);
      index++;                 
  }
  digitalWrite(CHIPSELECT3,HIGH); // disable the ChipSelect on the backpack
  delayMicroseconds(500);
 
 
  // Display 4
  index = 0;                 
  digitalWrite(CHIPSELECT4,LOW); // enable the ChipSelect on the backpack
  delayMicroseconds(500);
  for (int i=0;i<8;i++) for (int j=0;j<8;j++)
  {
    spi_transfer(dataA[index]);
      index++;                 
  }
  digitalWrite(CHIPSELECT4,HIGH); // disable the ChipSelect on the backpack
  delayMicroseconds(500);
 
  count = count + 1; //update counter
  }
}