Power Monitoring



Overview:

This describes a electricity monitoring system that uses wireless modules to transmit data from a Watts Up Pro monitor to a Mysql web database.
This project is also hosted at NYU's ITP

This describes a electricity monitoring system that uses wireless modules to transmit data from a Watts Up Pro monitor to a Mysql web database.



List of supplies needed to build the system:

Base Station Component Supplies:
Reciever XBee
XBee Dongle
Spare old laptop that will be on all the time.

Components for 1 monitor:
Description category Mfg Mfg # Supplier Supplier # Number Ind. Cost Cost
5.0V Regulator Power TI UA7805CKTTR Digikey 296-20796-1-ND 1 $0.88 $0.88
3.3V Regulator Power TI UA78M33CDCYR Digikey 296-13424-1-ND 1 $0.56 $0.56
DC barrel connector Power Switchcraft RAPC722X Digikey SC1313-ND 1 $1.44 $1.44
XBEE PRO Series 1 Radio Digi XBP24-AWI-001 Digikey XBP24-AWI-001-ND 1 $32.00 $32.00
VDIP1 module USB FTDI VDIP1 Digikey 768-1001-ND 1 $24.50 $24.50
24 DIP socket USB 3M 4824-6000-CP Digikey 3M5467-ND 1 $0.27 $0.27
ATMEGA168-20PU Microchip Atmel ATMEGA168-20PU Digikey ATMEGA168-20PU-ND 1 $4.11 $4.11
28-DIP socket Microchip 3M 4828-3004-CP Digikey 3M5480-ND 1 $0.33 $0.33
16.000mhz Crystal Microchip CAC HC49US16.000MABJ-UB Digikey 300-8499-ND 1 $0.63 $0.63
22pF capacitor 0805 SMD Microchip Panasonic ECJ-2VC1H220J Digikey PCC220CNCT-ND 2 $0.36 $0.72
10K resistor 0805 SMD Microchip Rohm ESR10EZPJ103 Digikey RHM10KKCT-ND 1 $0.14 $0.14
1K resistor 0805 SMD Signal Rohm ESR10EZPJ102 Digikey RHM1.0KKCT-ND 1 $0.14 $0.14
200 resistor 0805 SMD Signal Rhom ESR10EZPJ204 Digikey RHM200KKCT-ND 2 $0.14 $0.28
Red LED 0805 SMD Signal Lumex SML-LXT0805IW-TR Digikey 67-1552-1-ND 3 $0.14 $0.42
Clear Project Box Enclosure Hammond 1591BTCL Digikey HM958-ND 1 $7.84 $7.84
2mm 10pin XBee Socket Radio Sparkfun PRT-08272 2 $1.25 $2.50
9V 650mA wall power supply Power Sparkfun TOL-00298 1 $5.95 $5.95
Circuit Board Circuit 4pcb.com 1 $33.00 $33.00
Watts Up Pro Meter 99333 Watts Up 1 $130.95 $130.95
Total               $246.67


Watts Up Pro:

The Watts Up Pro has a USB interface which the module will communicate over.

VDIP1:


The Watts Up Pro is a USB slave device, meaning that it needs a USB host device to communicate with and the Watts Up Pro must also get power from the host device.

A low cost easy to use USB host device is the VDIP1 USB host module by Viniculum (FTDI). Luckily, the Watts Up Pro uses a FTDI USB chip, which means that the VDIP1 is able to communicate with the Watts Up Pro.

Out of the box, the VDIP1 has a fairly simple firmware version installed. To get the VDIP1 ready to communicate with the Watts Up do the following:
1. Update the Firmware:
Go here and download the latest VDAP firmware
Put it in the root directory of a Flash Drive and rename the file:
FTRFB.FTD
Stick the flash drive in the VDIP1 and power it up. It is helpful to be monitoring the TX pin of the VDIP1 as this will provide information about the firmware upgrade progress. It took about 5 seconds for me.
After the update is done just pull the stick out. It may be a good idea to erase the .ftd file if you are planning on using the thumbdrive with VDIP1 since if the file is on there, the module will try to update it's firmware everytime you stick the thumbdrive in.

2. Produce a new version of the firmware Use Vinculum's firmware customization software ( Viniculum Firmware Customiser) to modify the v03.64VDAPF firmware. The firmware defaults to 9600 baud with hardware control on for serial. The Watt's Up runs at 115200 with no harware control, so I modified the firmware for this. Here is the firmware file: ftrfb_VDAP_115200noHD.FTD.

To install this, follow the same instructions as above in part 1.

Now the VDIP1 will be ready to work with the Watts Up Pro.

XBee:

The XBee provides our wireless communication. The XBee is a pretty sophisticated radio, with onboard microcontroller. Here are the settings used in this system:
Transmitters (in Modules):
ATIDBBDD --> PAN ID for system
ATMYAAxx --> radio address as AAxx
AP1 --> Set radio mode to AP1 ATWR --> write settings to xbee
Reciever:
ATIDBBDD --> PAN ID for system
ATMY0 --> radio address at 0
AP1 --> set radio to AP1 (check if neccisary) ATWR --> write settings to xbee
I use the API mode for the XBees, which embeds useful information into each radio transmission including Radio ID and signal strength. There is a useful explantion of the API here: Digi API tutorial

Atmel 168:

A microchip is neccisary to coordinate all the communication. In this case I used an Atmel 168 and program it with arduino.
Here is the final version of arduino code I used:VDIP_final
I also burn the program directly to the chip (as supposed to including the arduino bootloader as well, since this slows down start up).

Circuit Board + Circuit Board Assembly:

I use eagle to design boards.
I use 4pcb.com to get board made.
These are the files needed for the circuit board as a zip file: here.
A note if you are using default methods to create Gerber Files for 4pcb.com. You must rename the extensions on the files eagle creates as follows:
Top Copper(GTL) -> cmp
Top Soldermask (GTS) -> stc
Top Silkscreen (GTO) -> plc
Bottom Copper (GBL) -> sol
Bottom Soldermask (GBS) -> sts
Bottom Silkscreen (GBO) -> pls
Drill File (TXT) -> drd

You can first upload the zip file to freedfm.com which is a service of 4pcb.com. When you upload, here is the following information:
Nicely, 4pcb.com has an offer to make boards for $33 dollars each, in under a week. There are cheaper ways out there, but it can take a long time (slow boat to china).
Here are images of the board schematic and board image:

The following are the default options for the $33 per board:
MATERIAL TYPE: FR4
UNIT DIMENSIONS: 04.000 By 02.000
MATERIAL THICKNESS: 0.062"
ARRAY DIMENSIONS: 00.000
BOARD FINISH: LFSolder
ARRAY NUMBER UP: 0
COPPER WEIGHT: 1 oz
ARRAY QTY: 0
INNER COPPER WEIGHT: 0.5
TAB ROUTE: NO
SOLDER MASK SIDE: Both Sides
SCORING: NO
SOLDER MASK COLOR: Green
E.TEST OPTION: NO
LEGEND SILK SCRN: Both Sides
5% OVERAGE: no
LEG SILK SCRN COLOR: White

Here is an image of the circuit board assembled:


Python Script:

This python script (server) runs on a computer with the reciever XBee attached via an XBee dongle. The computer must also have internet access.
This script is written in python and requires that Python is installed on the laptop. Python installed on Macs but additional modules must be installed. Here is the list of needed software:
Mac:
pyserial (use pyserial-2.2.zip)
Windows:
python
pywin32 (neccisary for pyserial to run)
pyserial (use pyserial-2.2.win32.exe)


Remote Server Setup:

A Mysql database is used. It is written in php and uses a mysql database. The system also has a system using the google charts api to generate png charts