Very Cheap TED 1001 House Power Monitors (and possible hacking)

i also see that ssterm works fine too ssterm -s -b 1200 -d 8 -t 1 -x -c /dev/ttyUSB0 maybe I can get it to work with this
 

 
 
okay i found a ssterm.py  and i started to modify it slightly, though I do not know much of python programing  perhaps i can get to to work form me.
 
 just have to figure out how to add the to invert the hex and math calculations
 so far this is my out puts for ssterm.py
 

linux-05e9:/home/sash # python ssterm.py -b 1200 -x /dev/ttyUSB0
aa 31 d0 0d 65 01 2d 5b 92 05 be
aa 31 cf f9 64 01 0f 67 92 04 e6
aa 31 ce 4a 65 01 59 62 92 05 50
aa 31 cd f0 65 01 bd 6f 92 04 3a
aa 31 cc fb 65 01 53 6d 92 04 9c
aa 31 cb eb 65 01 89 6a 92 04 7a
aa 31 ca 15 66 01 43 68 92 05 98
aa 31 c9 aa 2a 02 a9 7c 92 04 c5
aa 31 c8 70 d4 02 11 a4 92 04 c6
aa 31 c7 f2 c3 02 7b a6 92 03 ea
aa 31 c6 98 64 01 39 73 92 05 1a
aa 31 c5 d2 64 01 87 75 92 04 91
aa 31 c4 66 65 01 3f 63 92 05 57
aa 31 c3 4a 66 01 67 60 92 05 4e
aa 31 c2 56 66 01 41 5c 92 05 6d
aa 31 c1 33 66 01 31 60 92 05 9d
aa 31 c0 1d 66 01 d9 64 92 05 08
aa 31 bf 83 66 01 cb 54 92 04 c1
aa 31 be cd 9e 01 cb 6e 92 04 26
aa 31 bd 9f 82 02 a3 9c 92 04 6a
aa 31 bc d9 31 02 db 9d 92 04 49
aa 31 bb d2 3f 01 e5 80 92 04 57

 

 
 
okay figured it out  when I copy and pasted ended up with an extra space and it messed every thing up
 
okay,
trying to figure out this RRD graph stuff.  for some reason, instead of appending the data with new it overwrites the old data with the new..

#!/usr/bin/perl -W -s

system("stty -F /dev/ttyUSB0 1200 cs8 raw");

open INFILE, "/dev/ttyUSB0"
   or die "\nCannot open /dev/ttyUSB0!\n";


@data = ();
$buf = "";
# $cnt = 0;
$started = 0;
sub processPacket($);

while (read(INFILE, $buf, 1)) {
  $d = ord($buf) ^ 0xff;
  if ($d == 0x55 && $started == 0) {
    $started = 1;
    $a = 0;
  }
  if ($started == 1) {
    $data[$a] = $d;
    $sum += $data[$a];
    # printf("0x%02X ", $data[$a]);
    $a++;
    if ($a >= 11) {
      $sum -= $data[9];
      $sum &= 0xff;
      if ($sum == 0) { processPacket($data); }
      $started=1;
      $a = 0;
    }
  }
}

  # Working sub process packet stuff
  sub processPacket($) {
  local($data) = @_;
  #  If the power reading is way off, uncomment the other power line
  $power = (($data[5]^0xff)<<8) + ($data[4]^0xff);
  # $power = ($data[5]<<8) + $data[4];
  $voltage = ($data[8] << 8) | $data[7];
  $voltage = sprintf("%.3f",123.6 + ($voltage - 27620) / 85 * 0.2);
  $power = sprintf("%.3f",(1.19 + 0.84 * (($power - 288.0) / 204.0)));
  @tda = localtime(time);
  $td = ($tda[4]+1)."/$tda[3]/".(1900+$tda[5])." $tda[2]:$tda[1]:$tda[0]";
  system("rrdtool updatev ted.rrd N:$power:$voltage");
  print "$td,  KW $power, Voltage $voltage\n";
  }
i edited the 0.4 to 0.2  now it matches my house voltage exactly

 
this is what it outputs-- return_value is the verbose output of rrdtools update
 

./ted1.pl
return_value = 0
1/8/2014 17:9:4,  KW 1.363, Voltage 124.172
return_value = 0
1/8/2014 17:9:5,  KW 1.359, Voltage 124.148
return_value = 0
1/8/2014 17:9:6,  KW 1.359, Voltage 124.136
return_value = 0
1/8/2014 17:9:7,  KW 1.355, Voltage 124.144
return_value = 0
1/8/2014 17:9:8,  KW 1.342, Voltage 124.136
return_value = 0
1/8/2014 17:9:9,  KW 1.342, Voltage 124.129
return_value = 0


this is how i created the ted rrd data file - based on this
http://michael.bouvy.net/blog/en/2013/04/28/graph-data-rrdtool-sensors-arduino/
 

rrdtool create ted.rrd \
--step 300 \
DS:kw:GAUGE:600:0:100 \
DS:volt:GAUGE:600:0:300 \
RRA:MAX:0.5:1:2016


perhaps someone who is more familiar with rrd can see where my error is ???
 
okay think I figured it out, my rrd data base is filling up.  and it seams to be working..  the problem was with how I created the data base.
I had the resolution set too high  based on this

http://apfelboymchen.net/gnu/rrd/create/

--step 300 \  > --step 1 \  from  new entry every 5 minutes to new entry every second  but i think I will probably change it to  every 3 second or so have to experiment  until I get the  quantity and quality i like. I also see, i probably  have to set the program to exit after a data entry then  restart it using cron as the  program tends to stop  between 2 - 20 minutes


Code:
rrdtool create ted.rrd \
--step 1 \
DS:kw:GAUGE:600:0:U \
DS:volt:GAUGE:600:0:U \
RRA:MAX:0.5:1:2016

now it outputs  this

Code:
[1389227239]RRA[MAX][1]DS[kw] = 3.2961160800e+00
[1389227239]RRA[MAX][1]DS[volt] = 1.2502335490e+02
1/8/2014 18:27:19,  KW 3.298, Voltage 125.021
return_value = 0
[1389227240]RRA[MAX][1]DS[kw] = 3.3001158360e+00
[1389227240]RRA[MAX][1]DS[volt] = 1.2501359457e+02
1/8/2014 18:27:20,  KW 3.302, Voltage 125.007
return_value = 0
[1389227241]RRA[MAX][1]DS[kw] = 3.3153133500e+00
[1389227241]RRA[MAX][1]DS[volt] = 1.2501072774e+02
1/8/2014 18:27:21,  KW 3.327, Voltage 125.014
return_value = 0
[1389227242]RRA[MAX][1]DS[kw] = 3.3270000000e+00
[1389227242]RRA[MAX][1]DS[volt] = 1.2503423641e+02
1/8/2014 18:27:22,  KW 3.327, Voltage 125.052
return_value = 0
[1389227243]RRA[MAX][1]DS[kw] = 3.3248697600e+00
[1389227243]RRA[MAX][1]DS[volt] = 1.2506797680e+02
1/8/2014 18:27:23,  KW 3.323, Voltage 125.082
return_value = 0
[1389227244]RRA[MAX][1]DS[kw] = 3.3251334400e+00
[1389227244]RRA[MAX][1]DS[volt] = 1.2507826648e+02
1/8/2014 18:27:24,  KW 3.327, Voltage 125.075
return_value = 0
[1389227245]RRA[MAX][1]DS[kw] = 3.3334023240e+00
[1389227245]RRA[MAX][1]DS[volt] = 1.2506753062e+02
1/8/2014 18:27:25,  KW 3.339, Voltage 125.061
return_value = 0
[1389227246]RRA[MAX][1]DS[kw] = 3.3390000000e+00
[1389227246]RRA[MAX][1]DS[volt] = 1.2507489885e+02

 i think I have  my energy monitor webserver  up in a day or so depending on my time available..
  well hopefully  someone find the information useful as  there alot of ted 1001  hack talk on the internet just not much in very much details.
 
well here something interesting  you can use one hacked ted to monitor multiple MTU at the same time.
here a an adapted script to monitor the teds i have placed on multiple power source point
main hydro
grid tied solar panels
and a grid tied  wind generator.
 
it works well building separate graphs for and display them nicely.. 
 

#!/usr/bin/perl -w -s

system("stty -F /dev/ttyUSB0 1200 cs8 raw");

open INFILE, "/dev/ttyUSB0"
or die "\nCannot open /dev/ttyUSB0!\n";


@data = ();
$buf = "";
# $cnt = 0;
$started = 0;
sub processPacket($);

while (read(INFILE, $buf, 1)) {
$d = ord($buf) ^ 0xff;
if ($d == 0x55 && $started == 0) {
$started = 1;
$a = 0;

}
if ($started == 1) {
$data[$a] = $d;
$sum += $data[$a];
printf("0x%02X ", $data[$a]);
$a++;
if ($a >= 11) {
$sum -= $data[9];
$sum &= 0xff;
if ($sum == 0) { processPacket($data); }
$started=1;
$a = 0;
}

}
}

# Working sub process packet stuff
sub processPacket($) {
local($data) = @_;
$mtu = $data[1];
# the $mtu equals your mtu number put in a Decimal to Hexadecimal Converter )
if ($mtu == 0xCE ) {
# If the power reading is way off, uncomment the other power line
$power = (($data[5]^0xff)<<8) + ($data[4]^0xff);
# $power = ($data[5]<<8) + $data[4];
$voltage = ($data[8] << 8) | $data[7];
$voltage = sprintf("%.3f",123.6 + ($voltage - 27620) / 85 * 0.2);
$power = sprintf("%.3f",(1.19 + 0.84 * (($power - 288.0) / 204.0)));
@tda = localtime(time);
$td = ($tda[4]+1)."/$tda[3]/".(1900+$tda[5])." $tda[2]:$tda[1]:$tda[0]";
print "$td, Hydro $power, Voltage $voltage\n";
system("rrdtool updatev ted.rrd N:$power:$voltage");
}
if ($mtu == 0xB1 ) {
# If the power reading is way off, uncomment the other power line
#$solar = (($data[5]^0xff)<<8) + ($data[4]^0xff);
$solar = ($data[5]<<8) + $data[4];
$voltage1 = ($data[8] << 8) | $data[7];
$voltage1 = sprintf("%.3f",123.6 + ($voltage1 - 27620) / 85 * 0.4);
$solar = sprintf("%.3f",(1.19 + 0.84 * (($solar - 288.0) / 204.0)));
@tda = localtime(time);
$td = ($tda[4]+1)."/$tda[3]/".(1900+$tda[5])." $tda[2]:$tda[1]:$tda[0]";
print "$td, Solar $solar, Voltage $voltage1\n";
system("rrdtool updatev ted1.rrd N:$solar:$voltage1");

}
if ($mtu == 0xA0 ) {
# If the power reading is way off, uncomment the other power line
# $wind = (($data[5]^0xff)<<8) + ($data[4]^0xff);
$wind = ($data[5]<<8) + $data[4];
$voltage = ($data[8] << 8) | $data[7];
$voltage = 123.6 + ($voltage - 27620) / 85 * 0.4;
$wind = 1.19 + 0.84 * (($wind - 288.0) / 204.0);
@tda = localtime(time);
$td = ($tda[4]+1)."/$tda[3]/".(1900+$tda[5])." $tda[2]:$tda[1]:$tda[0]";
print "$td,Wind $wind,Voltage $voltage\n";
system("rrdtool updatev ted2.rrd $td:$wind:$voltage");
}
}

 
 
okay one last update to  the ted script  this corrects all the issue I had that I noticed  it  now  tells which direction the your power usage is  whether it is positive or negative - when setting up if your positive data is ending up showing as  negative  just reverse the  polarity of the clamps, they have red dot  just face them in the opposite direction.. you can comment out some of the screen print data as i left them on for data debugging purposes..  when using this do not forget to enter in your MTU #  just use a decimal to hex converter http://www.mathsisfun.com/binary-decimal-hexadecimal-converter.html   ie mtu#206 = CE
Code:
#!/usr/bin/perl -w -s

system("stty -F /dev/ttyUSB0 1200 cs8 raw");

open INFILE, "/dev/ttyUSB0"
   or die "\nCannot open /dev/ttyUSB0!\n";


@data = ();
$buf = "";
# $cnt = 0;
$started = 0;
sub processPacket($);

while (read(INFILE, $buf, 1)) {
  $d = ord($buf) ^ 0xff;
  if ($d == 0x55 && $started == 0) {
    $started = 1;
    $a = 0;
   
  }
  if ($started == 1) {
    $data[$a] = $d;
    $sum += $data[$a];
    printf("0x%02X ", $data[$a]);
    $a++;
    if ($a >= 11) {
      $sum -= $data[9];
      $sum &= 0xff;
      if ($sum == 0) { processPacket($data); }
      $started=1;
      $a = 0;     
    }
    
  }
}

  # Working sub process packet stuff
  sub processPacket($) {
  local($data) = @_;
  $mtu = $data[1];
  # the $mtu equals your mtu number put in a Decimal to Hexadecimal Converter )
  if ($mtu == 0xCE ) {
  #  If the power reading is way off, uncomment the other power line
   $p = (($data[5]^0xff)<<8) + ($data[4]^0xff);
   print "$p ";
   $pa = ($data[5]<<8) + $data[4];
   print "$pa ";
  if ($p <= 5000) {
  $voltage = ($data[8] << 8) | $data[7];
  $voltage = sprintf("%.3f",123.6 + ($voltage - 27620) / 85 * 0.2);
  $p = sprintf("%.3f",(1.19 + 0.84 * (($p - 288.0) / 204.0)));
  @tda = localtime(time);
  $td = ($tda[4]+1)."/$tda[3]/".(1900+$tda[5])." $tda[2]:$tda[1]:$tda[0]";
  print "$td, Hydro $p, Voltage $voltage\n";
  system("rrdtool updatev ted.rrd N:$p:$voltage");
  }
  if ($pa <= 5000) {
  $voltage = ($data[8] << 8) | $data[7];
  $voltage = sprintf("%.3f",123.6 + ($voltage - 27620) / 85 * 0.2);
  $pa = sprintf("%.3f",(0 - (1.19 + 0.84 * (($pa - 288.0) / 204.0))));
  @tda = localtime(time);
  $td = ($tda[4]+1)."/$tda[3]/".(1900+$tda[5])." $tda[2]:$tda[1]:$tda[0]";
  print "$td, Hydro $pa, Voltage $voltage\n";
  system("rrdtool updatev ted.rrd N:$pa:$voltage");
  }
  }
  
   if ($mtu == 0xA0 ) {
  #  If the power reading is way off, uncomment the other power line
   $w = (($data[5]^0xff)<<8) + ($data[4]^0xff);
   print "$w ";
   $wa = ($data[5]<<8) + $data[4];
   print "$wa ";
  if ($w <= 5000) {
  $voltage = ($data[8] << 8) | $data[7];
  $voltage = sprintf("%.3f",123.6 + ($voltage - 27620) / 85 * 0.2);
  $w = sprintf("%.3f",(1.19 + 0.84 * (($w - 288.0) / 204.0)));
  @tda = localtime(time);
  $td = ($tda[4]+1)."/$tda[3]/".(1900+$tda[5])." $tda[2]:$tda[1]:$tda[0]";
  print "$td, Wind $w, Voltage $voltage\n";
  system("rrdtool updatev ted2.rrd N:$w:$voltage");
  }
  if ($wa <= 5000) {
  $voltage = ($data[8] << 8) | $data[7];
  $voltage = sprintf("%.3f",123.6 + ($voltage - 27620) / 85 * 0.2);
  $wa = sprintf("%.3f",(0 - (1.19 + 0.84 * (($wa - 288.0) / 204.0))));
  @tda = localtime(time);
  $td = ($tda[4]+1)."/$tda[3]/".(1900+$tda[5])." $tda[2]:$tda[1]:$tda[0]";
  print "$td, Wind $wa, Voltage $voltage\n";
  system("rrdtool updatev ted2.rrd N:$wa:$voltage");
  }
  }
    if ($mtu == 0xB1 ) {
  #  If the power reading is way off, uncomment the other power line
   $s = (($data[5]^0xff)<<8) + ($data[4]^0xff);
   print "$s ";
   $sa = ($data[5]<<8) + $data[4];
   print "$sa ";
  if ($s <= 5000) {
  $voltage = ($data[8] << 8) | $data[7];
  $voltage = sprintf("%.3f",123.6 + ($voltage - 27620) / 85 * 0.2);
  $s = sprintf("%.3f",(1.19 + 0.84 * (($s - 288.0) / 204.0)));
  @tda = localtime(time);
  $td = ($tda[4]+1)."/$tda[3]/".(1900+$tda[5])." $tda[2]:$tda[1]:$tda[0]";
  print "$td, Solar $s, Voltage $voltage\n";
  system("rrdtool updatev ted1.rrd N:$s:$voltage");
  }
  if ($sa <= 5000) {
  $voltage = ($data[8] << 8) | $data[7];
  $voltage = sprintf("%.3f",123.6 + ($voltage - 27620) / 85 * 0.2);
  $sa = sprintf("%.3f",(0 - (1.19 + 0.84 * (($sa - 288.0) / 204.0))));
  @tda = localtime(time);
  $td = ($tda[4]+1)."/$tda[3]/".(1900+$tda[5])." $tda[2]:$tda[1]:$tda[0]";
  print "$td, Solar $sa, Voltage $voltage\n";
  system("rrdtool updatev ted1.rrd N:$sa:$voltage");
  }
  }
  }
close INFILE;
 
You guys are having so much fun with this, its damn near making me wish I hadn't gone with a TED5000...
 
I think once I figure out that I could monitor  multiple mtu and  the direction of the current flow  of each  mtu from a single ted unit. the ted 1001 became  more functional then the ted 5000 to  me..  I can probably  put +10 mtu. ie one on each breaker. monitor them all from one  with one  hacked ted 1001.   up load the above script into openwrt  router or even some very small linux based tablet or  computer with usb support.  and generate better graphical information and web connectivity then the ted 5000. and not rely on some  google base 'spyware data mining " system to access the above info..   currently my graphing system for    the teds I have    gives live data  usage, the last 5 min, 60 minus, 8hrs, 24hrs, 1week,  3 months, 6 months and a year,  also  last week comparison to the current week.  all very cool if you ask me
 
 
What sort of spyware data mining system are you referring to?  I thought all TEDs were strictly local unless you choose to send MTU data to third party analysis providers such as Bidgley.
 
sash said:
I can probably  put +10 mtu. ie one on each breaker. monitor them all from one  with one  hacked ted 1001
 
I wonder at what point you might start getting a lot of errors due to collisions on the shared 120VAC wire network.  My guess is TED 1001s don't have any collision detection and avoidance built into them.
 
Great stuff here!
 
Personally I have left the sensors in the fuse panel but have the unit disconnected as it did cause me X10 grief making it worthless to utilize.
 
I am just recently playing a bit with RRD graphing relating to Linux automation stuff. 
 
Specifically recently with my PFSense firewall and new GPS time sync plugin. 
 
The logs/graphing modules are all RRD and this is teaching me a bit about RRD in general.
 
Great stuff here!
 
Apologies as I shut down the Ted device and quite playing with the DIY stuff that I wanted to do with it.
 
Personally I have left the sensors in the fuse panel but have the unit disconnected as it did cause me X10 grief making it worthless to utilize.
 
I am just recently playing a bit with RRD graphing relating to Linux automation stuff. 
 
Specifically recently with my PFSense firewall and new GPS time sync plugin.  The graphing modules are all RRD and this is teaching me a bit about it.
 
 
 
 
 
 

Attachments

  • Time.jpg
    Time.jpg
    219.2 KB · Views: 23
I have a circuit dedicated for TED components. It has a 20A X10 XPF noise filter right in the panel. A set of MTUs that monitor home utility usage connect to it there. From the panel the circuit runs to the computer room where the Footprints gateway resides. Then it goes into the attic where a second set of MTUs monitor our solar array.

I've not had an issue with X10, Insteon, or UPB with this isolation strategy.
 
here is example of my  ted  rrd graph. it the last 8 hours on my wind generator output - no sun today we are having a blizzard  today
 
pete_c --if you're running a pfsense firewall, just go to pfsense forum ( key word - howto webserver vhost) and you can check out how to build a fully functioning webserver on it.( curtsy of yours truly). and you could simply build   and generate every thing you want to  display about  your automation..
 
ted3.png
 
Back
Top