TED Modification for real-time data output
The following describes a modification to the
TED energy monitor which will provide a real-time output of the data sent by the MTU every second. The change was required so that the unit could be used without the need for proprietary windows software. This modification can be done without affecting the display unit however it will void your warranty.
Note: You will need to know how to do basic soldering and have a basic understanding of circuit boards. Proceed with the changes at your own risk.
This first modification was done to a USB unit but also applies to the serial unit. This is the simplest since we are providing the data out a separate port. This was needed because the unit was to be connected to a LinkSys router, which has TTL level serial ports, so no USB or standard RS232 level interfaces could be used. In this scenario, all we need to do is tap the output of the Philips modem chip and direct it out of the TED to a connector. For our implementation, we installed a female stereo phone jack (Radio Shack 274-249) onto the TED and put two more on the WRT54GL. The end pin on the TED is data out and the outer rim is ground. On the WRT54GL we need to reverse the jack connections so the end pin is recv and center connector is transmit. We then just use a 1/8" jumper (Radio Shack 4202387) to connect the TED to the WRT54GL.

For the connection, the ground was tapped off of the third pin on the programmer jumper.

The data line is connected to the R20. This is all that is required if you need just TTL level serial data.

If you want to use the USB port as the output, you will instead run a jumper from the output of the Philips modem to the input of the FTDI USB chip (
datasheet). However, we will need to disconnect the current input connection to make it work. The red X on the circuit trace below should be cut with a razor. Then, connect the jumper from R20 to pin 5 on this chip. Depending on your soldering skills, you can connect it to a portion of the trace or directly to the pin. Just be careful not to keep the soldering iron on the chip too long.

Software
The data send from the modem is async, 1200 bps N81 format. Every second an eleven byte binary packet is sent from the MTU. This packet contains at least, packet count, current power measurement ,voltage and check sum.
| Byte | Name | Description |
| 0 | Sync | Always hex $55 |
| 1 | Address | Address of MTU unit. |
| 2 | Counter | Counter |
| 3 |
| 4,5 | Power | Power in killowatts = 1.19 + 0.84*(x - 288)/204 |
| 6 |
| 7,8 | Voltage | Line voltage = 123.6 + (x - 27620) / 34 |
| 9 | Checksum | Checksum |
The following is a perl script that is run on the LinkSys device loaded with OpenWRT. The script is configured to receive data on the first serial port (/dev/tts/0) and
simply prints the output for every packet that is received. Our scripts will collect 30 seconds of this data and then push it to a web server where it is then stored into a database.
#!/usr/bin/microperl
system("stty -F /dev/tts/0 1200 cs8 raw");
open INFILE, "/dev/tts/0"
or die "\nCannot open /dev/tts/0!\n";
@data = ();
$buf = "";
$cnt = 0;
$started = 0;
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); }
$a = 0;
}
}
}
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 = 123.6 + ($voltage - 27620) / 85 * 0.4;
$power = 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,$power,$voltage\n";
}
close INFILE;