House Power and Solar Monitor

Updated 22 June 2023

I’ve had a Current Cost Power Monitor for a number of years which worked well until we put solar on the roof. The Current Cost can’t determine which direction the power is flowing and so power generation and consumption are added together on the Current Cost display rendering it unusable.

The solution I came up with is actually two projects that communicate via RF.

  1. Arduino Yun connects to the Current Cost via the USB port to capture power consumption.
  2. Arduino Uno/Xino Basic for Atmel connects to a Xantrex Grid Tie Solar Inverter to capture power generation

Power consumption is calculated by the difference between the CurrentCost and the Xantrex Inverter. Results are displayed via a LCD screen.

The code for the project can be found at https://github.com/triase/PowerMonitor_CC_Xantrex

Note that you could actually choose to only do one of these projects or take some of the concepts and solve a problem of your own.

Project 1: House Power Monitor

This project uses an Arduino Yun and a Python script to continually poll a Current Cost connected to the serial port. The Yun is a device that contains both an Arduino microprocessor and Linux operating system.

Yun-logicalview.jpg

How it works

  1. The Yun gets the Power value from the Current Cost.
  2. The Solar generation is received from the RF Receiver (Arduino UNO connected to Xantrex Invertor transmitting via RF)
  3. Power and solar values are written to a LCD, daily log file and sent to PVOutput.org website

Hardware/Parts List

  • Arduino Yun
  • 16x2 LCD (Black on green so that backlight can be turned off)
  • 433Mhz RF Receiver
  • Vero/Stripboard
  • Trimmer Potentiometer
  • Various hookup wire
  • Micro SD card (Any size)
  • Current Cost Envi Power Monitor with Serial-USB cable

Current Cost

The first challenge, is to read the power from the Current Cost. Fortunately, a few people have already poked around the data coming out of a Current Cost and they have made their findings available on the internet. I have based my code on Jack Kelly’s found here - https://github.com/JackKelly/currentCostCosmTX

  1. Get the Yun setup as per these instructions and update the firmware.
  2. Install the coreutils-stty package on the Yun
  3. Connect the Yun to your PC
  4. Connect the Current Cost to the Yun using the Current Cost supplied USB to Serial cable
  5. Test the connection using Putty

From Putty or some other ssh client run the following commands

cd /dev
stty -F ttyUSB0 speed 57600 raw cs8
cat ttyUSB0
You should see an XML line every 6 seconds. Press ctrl-c to exit

Construction

It’s probably easier to assemble everything onto a breadboard before transferring to a vero board or other type of prototyping board. Wire up the Yun to the LCD, breadboard and RF Receiver as per the Fritzing diagram below. Install a SD card into the Yun and ensure that it gets mounted every time the Yun restarts.

Get yourself a PVOutput account.
http://www.pvoutput.org/

Python scripts

A Python script is used to continuously poll the usb/serial port and another to send the results to PVOutput.org. The following files need to be copied to the SD card. (it is better to store everything on the SD card to minimise issues during any future Yun firmware updates as all data gets erased). Use Winscp to copy the files.

Location of python scripts: /mnt/sda1/currentcost
File Listing: config.xml, currentcost.py, currentcost.sh, pvoutput.sh, send_to_pvoutput.py

Edit config.xml to match your own settings.

The currentcost.py Python script will be called by the Bridge on the Yun, but you can manually run it for testing purposes with the following process

ssh to the Yun and do the following
cd to /mnt/sda1/currentcost
Type ./currentcost.py
Wait for 30secs or so before pressing ctrl-c.

You should see a csv file with a date as the filename.
Use cat to view the contents of the file

Arduino Sketch

Upload the PowerMonitor_CC_Xantrex.ino sketch to the Yun
The code for the project can be found at https://github.com/triase/PowerMonitor_CC_Xantrex

Completed Project 1: House Power Monitor

 

Project 2: Xantrex RF Transmitter

This project reads the output from a Xantrex Solar Inverter and sends the value via RF to the Arduino Yun in Project 1. It resides in the Xantrex weather proof box outside the house without any mains power. I attempted to reduce power consumption by using a Xino Basic board and using sleep mode, but 4 AA batteries would only last about 4 days. Last Christmas, we had some fairy lights fail and I’ve now created an off grid project by using a reprovisioned solar panel and Pololu Lipo charging circuit.

How it works

When there is enough light (according to the Light Dependent Resister LDR) the circuit turns on and turns off again when too dark. The solar panel supplies power to the circuit and charges the Lipo battery when excess power is available.

The Arduino reads power generation from the Xantrex Invertor and sends the data across RF to the Arduino Yun inside the house (Project 1)

Hardware/Parts list

  • Xino Basic for ATMEL (DIY Arduino UNO Clone without power hungry components)
  • 433 RF Transmitter
  • MiniIO RS232 to TTL converter
  • Xantrex GT 2.8 Invertor (should work with any Xantrex with serial port)
  • Serial Cable with male DB9 - pinouts are: pin 2 (Tx), pin 3 (Rx), pin 5 (ground).
  • Solar panel (I used a reprovisioned Christmas Lights panel which measured 15v, 330mA unloaded in full sun)
  • Freetronics 5v Voltage Regulator
  • 3.6v Lipo battery
  • Pololu Solar Lipo Charger
  • Pololu 5V Step-Up/Step-Down Voltage Regulator S10V4F5
  • 10k Resistor
  • NPN Transistor
  • Light Dependent Resistor (LDR)
  • Various hookup wire
  • USB – Serial connector to upload sketches

Construction

It’s probably easier to assemble everything onto a breadboard before transferring to a vero board or other type of prototyping board. Wire up the Xino and other components to the breadboard as per the Fritzing diagram below.

Arduino Sketch

Upload the Xantrex_RFTransmitter.ino sketch to the Xino
The code for the project can be found at https://github.com/triase/PowerMonitor_CC_Xantrex

Future Improvements

These two projects have had constant tweaks and have evolved over a 12 month period. The next things I’d like to work on are

  • Remove the Current Cost house monitor and use the Arduino Yun to capture the RF signal from the Current Cost transmitter in the switchboard. http://jack-kelly.com/taxonomy/term/121
  • Add an LED or 2 for a visual of power consumption/generation

References

Current Cost
http://currentcost.com/cc128/xml.htm
http://dalelane.co.uk/blog/?p=456
https://code.google.com/archive/p/pycurrentcost/
http://jack-kelly.com/hacking_the_current_cost
https://github.com/JackKelly
https://github.com/mapkyca/Current-Cost-EnviR

PVOutput References
http://pvoutput.org
https://code.google.com/archive/p/pvccupload/

Low Power
https://github.com/petervojtek/diy/wiki/Arduino-with-Very-Low-Power-Consumption
http://www.openhomeautomation.net/arduino-battery
http://www.ciseco.co.uk/content/?p=1987
http://www.build-electronic-circuits.com/ldr-circuit-diagram/

Solar Monitoring
https://github.com/izy/xantrexlogger

RF
http://labalec.fr/erwan/?p=261
http://forum.arduino.cc/index.php?topic=145648.0
http://forum.arduino.cc/index.php?topic=45187.0
http://stackoverflow.com/questions/25997262/virtualwire-separate-received-data

 

Have a question? Ask the Author of this guide today!

Please enter minimum 20 characters

Your comment will be posted (automatically) on our Support Forum which is publicly accessible. Don't enter private information, such as your phone number.

Expect a quick reply during business hours, many of us check-in over the weekend as well.

Comments


Loading...
Feedback

Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.