Monitoring PDF

The Xantrex GT-2.8 inverter has an RS-232 port on it that will provide statistics about current system performance.  You send it a command, and it responds back with the data.  While Xantrex used to provide some 3rd party software to do this, it's no longer supported.  Fortunately, I found some very nice documentation describing the available commands and the correct serial port settings.  I'll make it available here in case it gets pulled down.  The easiest thing then would be to hook a computer directly to it.

 

Remove the Board

 

Since the inverter isn't located anywhere near my server though, I decided to modify a Linksys WRT54GL to connect to it wirelessly instead.  This particular model router has an internal RS-232 port that can be easily accessed if you use the OpenWRT firmware.  There's an unpopulated header on the main board, and pinouts are available here. The blue face of the case just pops forward and then the board will slide out (after unscrewing the antennas).  Unscrew the board from the bottom as shown and solder a 2 x 5 header into the board.

 

Level Shifter


You'll need to build a levelshifter to convert the CMOS 3.3V levels to RS-232 levels (+-12V) using a MAX3232 chip.  There's a 3.3V pin brought out on the header, so you'll have something to power it with too.  I shrinkwrapped mine to keep it from shorting out anything inside the router since it'll just be flopping around in there.  The cable going off to the left of the picture is the serial cable we'll connect to the inverter.

 

Serial Cable

 

Wire a serial connector onto the end.  The inverter is expecting a straight-through cable, so don't cross the TX and RX lines :-).  Now reflash the router with the OpenWRT firmware and configure it to connect to the wireless network as a client and set it up with a static IP.  I run the following cgi script to query the inverter and make the data available as a simple HTTP file. 


#!/bin/ash

echo "Content-Type: Text/plain"
echo ""

# Kill any pre-existing versions of head
pidof head | xargs -r kill -9

# Call head and send it into the background
head -6 /dev/tts/1 > /www/xantrex/data.txt &
sleep 1

# Send each query
echo -e "MEASIN?\r" > /dev/tts/1
echo -e "MEASOUT?\r" > /dev/tts/1
echo -e "KWHTODAY?\r" > /dev/tts/1
echo -e "KWHLIFE?\r" > /dev/tts/1
echo -e "MEASTEMP?\r" > /dev/tts/1
echo -e "TIME?\r" > /dev/tts/1

sleep 1
 
# Write out the file
cat /www/xantrex/data.txt

# Delete the file, we don't need it
rm /www/xantrex/data.txt

 

It's probably not the most elegant solution, but was the best way I could come up with to do it, and it's worked fine.  Now you can use a php script to grab that file, parse it, and stick it in a database.