11th
Software
#4 of 5 part series
The client application runs on the iMx21 meter reader. It contains 2 endless threads SocketThread and LCD Thread.
LCDThread – each iteration of the loop it performs a frame grab using the EZFB API. It converts the image to grayscale then calculates the average pixel intensity for the square we care about. The pixel intensity is low when the box on the Elster LCD is “on” and goes up when the box is cleared. This thread also draws a square onto the LCD screen so the person installing the meter reader can easily align the video camera.
Images of the meter reader output LCD.
The Kh box is visible, note the O/F text output. 1 means the box has been detected.

The Hr box is not visible, note the O/F text output. 0 means the box has not been detected.

The second thread is the SocketThread. This thread waits for a new measurement from the LCDThread. When a new value is ready it just sends the power value over Socket to the web server.
Testing
I tested the accuracy of the box blink rate algorithm with a test LCD display. Using a Microchip Explorer16 Dev board and a PIC24H processor, I rigged up a simple blinking box on the explorer16 LCD. With this test setup I set the blink rate to .1Hz, 1Hz, and 10Hz to verify my Emeter application.
Calculations
This application converts Blink Time to power in kilo-watts. The formula for this calculation is:
Power (kW) = (.9kWh * 3600s * 200) / BlinkTime
The .9kW and 200 are values taken from the meter.
Data & Web Server
The web server is running Ubuntu Hardy Heron, ProFTPD and Apache 2.0
EMeterServer Application
The EMeterServer has only one simple socket thread. This thread just sits and waits for a new Power value from the client. If there is a new value, it writes it to a MySQL database table.
Web Server
The data server hosts the data via simple RSS feed, and Perl scripts. Any internet ready device or web page could access the scripts or RSS feeds to get real time power use.
PowerRss.php – Returns an XML RSS feed that contains the latest power use value.
graphUpdateLong.pl- Returns a link to an image of a graph of the power use over time.
meterUpdate.pl – Returns a link to an image indicating the power use as a simple needle meter.
GoogleJSON2.pl -Returns a JSON object table containing historical power use. (used for Google Visualizations API)
Insert a link to these files in your web browser and you will see the results
http://209.48.56.105/power/PowerRss.php
http://209.48.56.105/power/graphUpdateLong.pl

