XBee and AVR32 DC Electric Meter

NOTE: Replicating this project requires an intermediate skill level.  To do so, you must already know how to use the Eagle PCB layout program, solder a surface-mount component, etc.

This device is capable of measuring DC current up to 5A and DC voltage up to 13V or so.  It uses an Atmel ATNGW100 reference design board equipped with an AVR32 processor to communicate with a 16-bit sigma-delta ADC and a Digi XBee radio, which are both located on a custom board.  The ADC is connected to an ACS712 hall effect current sensor as well as the input voltage, both through resistive voltage dividers to accomodate the ADC's input specifications.  Most of the XBee radios are pin-compatible with each other, so you can choose from among those.  To build your own meter, first order all of the following parts:

Once they all arrive, use the Eagle board layout and schematic in this archive to construct the custom PC board.  Also solder two of the 14-pin headers into J5 and J6 on the ATNGW100, as shown below.

Arrange the boards in the enclosure as shown here:

Assemble the two IDC cables, and attach them as shown here:

Now attach connectors to the wires, connecting the red power wire for the ATNGW100 to the 14AWG meter wire going off the right side of the image above, so that the power consumption of the ATNGW100 is included in the meter's measurements.  Then, connect the 14AWG meter wire going off the bottom of the image above to the positive side of a power supply providing between 9V and 13V.  Then, connect the meter wire going off the right side of the image to whatever device is being metered.  Finally, connect the black wire supplying the ATNGW100 to ground on the power supply, and make sure the device being metered is also grounded properly.

Connect a patch cable between the LAN port on the ATNGW100 to an ethernet port on a computer, preferably one running Linux so that the following instructions apply directly.  Run DHCP on the computer to auto-connect to the ATNGW100.  Also connect a serial cable between the computer and the serial port on the ATNGW100 and install minicom on the computer.  Now, you must upgrade the system software on the ATNGW100 using the following custom instructions derived from HOWTOs on AVR32 wikis and forums across the web:

TO UPGRADE UBOOT AND ROOT FS: (usually not necessary)

 - Connect JTAG ICE mkII
 - avr32program erase -fcfi@0
 - avr32program program -F bin -vfcfi@0 binaries/atngw100/u-boot.bin
   - If error occurs, turn JTAG off and then on again
 - avr32program program -F bin -vfcfi@0 -O 0x20000 binaries/atngw100/rootfs.avr32.jffs2-root
 - Disconnect JTAG
 - Connect serial cable between desktop and ATNGW100
 - Start cutecom or minicom, configure to 115200 baud, and connect
 - Press reset button on ATNGW100
 - setenv bootcmd 'fsload /boot/uImage; bootm'
 - saveenv
 - Press reset button on ATNGW100

TO UPGRADE /USR FS:

 - Install TFTP server on desktop computer connected to LAN port of
   ATNGW100
 - cp binaries/atngw100/rootfs.avr32.jffs2-usr /var/lib/tftpboot/usr
 - Start TFTP server and make sure firewall is disabled on net
   interface to which ATNGW100 is connected
 - Connect serial cable between desktop and ATNGW100
 - Start cutecom or minicom, configure to 115200 baud, and connect
   - cd /tmp
   - tftp -g -r usr 10.0.0.35
   - ps
   - kill (all pids that look like they could be associated with /usr)
   - umount /usr
   - flash_eraseall /dev/mtd3
   - dd if=usr of=/dev/mtd3 bs=1056
   - reboot
 

Now you need to build the meter transmitting software to run on the ATNGW100.  First, install AVR32 Studio on your computer.  Then, import this project.  After it has built, use SCP to copy Debug/MeterTx.elf to the /tmp directory on the ATNGW100.  SSH into the ATNGW100 and copy /tmp/MeterTx.elf to /usr/bin.

Next, you need to build the meter receiving software on the PC.  Unpack this tarball and run "make" in the resultant directory.

Configure the XBee radios so that they transmit data to each other.

Plug one of the XBee development boards with a radio in it into the computer and note which serial port it is connected to.

Start the meter receiving software on the computer: ./pc-dumper /dev/tty<USBx|Sx>

Start the meter transmitting software on the ATNGW100: /usr/bin/MeterTx.elf &

You should start seeing data on the PC side shortly!

Contact mdlemay2 at illinois dot edu with questions and comments.

Last Updated on Wednesday, 18 March 2009 14:04  

JoomlaGATor!