Brultech ECM-1240 Software Development

3tones

Member
I decided to create a new thread for the discussion of interfacing with the ECM-1240. I'm thinking we should index what people have so far and what the features of each are.

To start the thread off, you can use the following commands to enable/disable the real time polling in your software:

Values in () are expected return values from the ECM

Enable Polling:
0xFC (0xFC) TOG (0xFC) XTD (0xFC)

Disable Polling:
0xFC (0xFC) TOG (0xFC) OFF (0xFC)

Disclaimer: This information has not been stated from Brultech, I just watched the serial port to figure it out. Please consider this as a risk when using this information.
 
For those of you who need to offload the serial data to another computer and don't have the ethernet adapter or wireless, I have found the following solutions for windows:

http://sourceforge.net/projects/com0com/

Run
Code:
com2tcp --ignore-dsr \\.\COM1 servername 8083
Where COM1 is the com port the ECM is connected to.
Where servername is where you want to send the data to.
You can then run the ECM Setup and use network connectivity.

You can also use a combination of com2tcp and com0com to replicate the data to a virtual serial port on another computer.
 
So my ultimate goal is to use a Linux machine to store the ECM-1240 data, and that machine will not have a built-in serial port. After testing a few USB-serial adapters it looks like some work and some don't.

[codebox]brian@media-ub:~/ecm$ lsusb
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 002: ID 0471:0815 Philips eHome Infrared Receiver
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 004: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
Bus 004 Device 003: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

[/codebox]

The FTDI FT232BM seems to work fine, but unfortunately I can not get the Prolific PL2303X to work. Not sure why, it should simply be just reading the data, but it's not. Both adapters work with other serial devices, so I am a little stumped. But at least one of them works! :P

So beware of the chipset of any adapter you plan on using. I've read on other forums that the FTDI is more reliable than the Prolific ones, by [acronym="ymmv"]Your Mileage May Vary[/acronym].
 
I've updated the python script to write to a MySQL database. This code is still ugly, but functional.

I have a cron job running to insert data into the db every 5 minutes, then use Open Flash Charts to display the data on a webpage.

Louis, another forum member has a BSD app I may try compiling on the SheevaPlug when it arrives.
 
As mentioned in this thread, kelvin has taken some basic python code i put together, and expanded to do more and support more hardware (along with making it more formal). He's done a great job, so check it out.

The plan is to have the usual read and mysql support, but down the road perhaps RRDTool support and more.

The code page is here: http://bitbucket.org/kelvin/pyecm/overview/

I've added WattzOn support. For an example, look here:
https://www.wattzon.com/wattizen/kelvin/powermeters/graph

Their interface is well-done and accounts are free, so it's an interesting option.
 
Hi Kelvin, I really like what you're doing with the Brultech/Wattzon integration. Well done. By the way, I just "fought" you at Wattzon and beat you. 5,756 to 5,823. Yee haw! I won my first fight!
 
Hi Kelvin, I really like what you're doing with the Brultech/Wattzon integration. Well done. By the way, I just "fought" you at Wattzon and beat you. 5,756 to 5,823. Yee haw! I won my first fight!

Ha ha, nice. :-) I've got to work on that. What's your WattzOn username?
 
Hi Kelvin, I really like what you're doing with the Brultech/Wattzon integration. Well done. By the way, I just "fought" you at Wattzon and beat you. 5,756 to 5,823. Yee haw! I won my first fight!

Ha ha, nice. :-) I've got to work on that. What's your WattzOn username?
It's AnthonyZ. I actually just signed up the other day and haven't actually finished everything on the profile so mine will most likely go up a bit more. It won't be much, though as it's just household "stuff" that I have left. I am really impressed with the Wattzon. It's eyeopening to see the "big picture".
 
Oh, wow, I was off. I just finished my profile at Wattzon and you now beat me handily, Kelvin. I'm now at 6,264 to your 5,823. I concede defeat. You are the man.
 
Adding to the list of 1240 software available:

tenEcmServer supports ECM-1220 and ECM-1240 and runs on Windows. Provides data to:

tenHsEcm12xx HomeSeer plugin

tenEcmDbLogger Archives hourly ECM data to SQL database

tenEcmCharts Charts real-time and archived data.

All available free at: tenholder.net site

All courtesy of tenholder. Thanks!
 
Hey all...

I created a graph for pyecm using phpgraphlib.

Put this code into a php file, that has phpgraphlib.php in the same folder. Set your DB connection parameters and run with it. I've also made some modifications to phpgraphlib.php to display more data if anyone is interested.

Code:
?php
include("phpgraphlib.php");
$graph=new PHPGraphLib(1200,500);
$link = mysql_connect('localhost', 'db_user', 'db_pass')
		 or die('Could not connect: ' . mysql_error());

mysql_select_db('ecm') or die('Could not select database');

$dataArray=array();

//set how far back to show data
$time2 = time() - (60*60*4);
$sql="SELECT * from ecm where time_created > ".$time2;
$result = mysql_query($sql) or die('Query failed: ' . mysql_error());
if($result)
{
		while($row = mysql_fetch_assoc($result))
		{
						$ch1=$row["ch1_ws"];
						$ch2=$row["ch2_ws"];
						$time=date('g:i a',$row["time_created"]);
						//ADD TO ARRAY
						$dataArray[$time]=$ch1;
						$dataArray2[$time]=$ch2;
						$dataArray3[$time]=$ch1+$ch2;
		}
}
$graph->addData($dataArray);
$graph->addData($dataArray2);
$graph->addData($dataArray3);
$graph->setLegendTitle("ch1","ch2","total");
$graph->setLegend(true);
$graph->setTitle(date('d M Y g:i a',time()));
$graph->setLineColor("navy", "red","blue");
$graph->setLine(true);
$graph->setBars(false);
$graph->createGraph();
?>
 
I want to start work on some charts that are a little more advanced than what I had before. I like this and I can certainly accomplish this without a lot of work:
http://www.bobshome.net/graph/energychart.php

But I really like the dynamic charts that wattzon has. I just want the same thing using my server with the data on my computer.
Has anyone started something like this so I don't reinvent the wheel?
Any idea on what technologies to use to duplicate the wattzon graphs?
 
I want to start work on some charts that are a little more advanced than what I had before. I like this and I can certainly accomplish this without a lot of work:
http://www.bobshome.net/graph/energychart.php

But I really like the dynamic charts that wattzon has. I just want the same thing using my server with the data on my computer.
Has anyone started something like this so I don't reinvent the wheel?
Any idea on what technologies to use to duplicate the wattzon graphs?

I don't quite understand what you mean by "dynamic" when referencing wattzon. I suspect that they are pulling data from a database to generate the graph. You use their API to insert data into the database. Do you mean that as soon as you upload new data, the chart is updated? Or the way you can zoom in/out on the data? I'm pretty sure that's just javascript making queries to the database.

My scripts are using php to pull the data from files that are updated every minute. They are not static charts. If you leave the page open, the charts are updated with new data every minute. The main page is using javascript to re-run the php scripts to re-generate the charts. You could use the same javascript to with your php that pulls data from the database.

Are you looking for the javascript to make the page update? If so, just look at the source for my page above, it's really simple.

I also had to modify phpgraphlib.php to handle all the data on the line chart.

Another option I looked at was gplot.pl, it's a perl wrapper around gplot. It also reads a datafile and generates an image and has the capability to handle a lot more data than phpgraphlib. But I really liked the bar charts from phpgraphlib.
 
Back
Top