Small PV solar panels are ideal for outdoor embedded hardware applications. The panels are inexpensive and using them prevents the need for extension cords. You can monitor the panel and battery pack to make sure you are producing adequate electricity. This project explains how to use two Xbee modules, a laptop, and Pachube to view online the status of the remote PV solar panel and battery pack. A modified setup could be used to monitor a much larger system or the output of almost any sensor.
Step 1: Parts

Voltaic 10V / .13A Panel ($30)
Xbee Explorer USB ($24.95)
USB Mini-B Cable 6′ ($3.95)
qty: (2) Xbee 1mW Chip Antenna ($22.95)
Voltage Regulator 3.3V ($1.95)
Coax Power Jack 1.3mm I.D ($0.35)

Your local Radio Shack is will carry the rest.

Breadboard ($8.99)
Solderless Breadboard Jumper Wire Kit ($5.99)
10 ohm 1/2W resistor ($0.99)
qty: (2) 4.7k ohm 1/4W resistor ($0.99)
qty: (2) 10k ohm 1/4W resistor ($0.99)
qty: (2)100k ohm 1/4W resistor ($0.99)
qty: (4) AA Batteries($12.99)
4 x AA Battery Holder ($1.79)
9V Snap Connector ($2.69)
qty: (2) Blue 5mm LED ($3.49)
Wireless PV Monitor Parts

Step 2: Schematic
Our goal is to monitor the performance of the Solar Panel in terms of volts and millamps. A simple way to do this is to drop a 10 ohm resistor between in the positive connector on the battery and the positive PV panel. Then to monitor both sides of that 10 ohm resistor using two ADC pins on the Xbee adapter. These ADC pins will do the necessary analog to voltage conversion so that we can see the voltage drop going across a resistor of known value. If we know the voltage and resistance than we can calculate the current using ohms law. Special thanks to the batwatch project for the 10ohm resistor trick.
PV Battery Monitor Xbee
Step 3: Getting the data onto a computer
We have a end point Xbee unit which is harvesting the PV panel. We will need to get that data onto a computer. This is where the Xbee explorer node comes in. It is connected to a laptop (in my case a Macbook Pro running OS 10.5). The Xbee end point wakes up once a minute sends the PV panel / battery ADC values to the Xbee explorer unit which is tethered to a laptop. The laptop runs a python script called ‘xbee-solar-power.py’. This requires that python 2.5 be installed along with a some other python packages (serial, xbee, eeml). The Xbee modules can be configured using Ladyada’s excellent tweet-a-watt configuration.The same project also provides some handy python scripts for collecting Xbee data on a computer.
#!/usr/bin/env python2.5
from xbee import xbee
import serial
import eeml

# pachube
API_KEY = 'YOUR API KEY'
API_URL = 'YOUR API URL'

# xbee config
SERIALPORT = "/dev/cu.usbserial-A6005uPn"	# the com/serial port the XBee is connected to
BAUDRATE = 9600					# the baud rate we talk to the xbee
VOLT_SENSE_1 = 0				# XBee ADC has LDS sensor
VOLT_SENSE_2 = 4				# XBee ADC has LDS sensor

DEBUG = 0

# open up the FTDI serial port to get data transmitted to xbee
ser = serial.Serial(SERIALPORT, BAUDRATE)
ser.open()

print "Volts / mAmps"
print "------------"

while True:
	# grab one packet from the xbee, or timeout
    packet = xbee.find_packet(ser)
    if packet:
	xb = xbee(packet)
        adcdata1 = [-1] * (len(xb.analog_samples) - 1)
        adcdata2 = [-1] * (len(xb.analog_samples) -1)

	# grab 1 thru n of the ADC readings, referencing the ADC constants
	# and store them in nice little arrays

	for i in range(len(adcdata1)):
		adcdata1[i] = xb.analog_samples[i+1][VOLT_SENSE_1]
		adcdata2[i] = xb.analog_samples[i+1][VOLT_SENSE_2]

	# Average all ADC values into one number for each array
	adcsum1 = 0
	adcsum2 = 0
	adcavg1 = 0
	adcavg2 = 0

	for i in range(len(adcdata1)):
		adcsum1 += adcdata1[i]
		adcsum2 += adcdata2[i]

	adcavg1 = adcsum1 / len(adcdata1)
	adcavg2 = adcsum2 / len(adcdata2)

	# voltage estimate based on ADC numbers
	magicadcvolt = 38.42			# Every 40 ADC points equals +1V
	correctadc = 1.00			# resistor tolerance - add 5% to voltages for accuracy

	# convert adc averages to actually battery/pv voltages with magic number and correction
	voltageadc1 = (adcavg1 / magicadcvolt) * correctadc
	voltageadc2 = (adcavg2 / magicadcvolt) * correctadc

	# current estimate based on voltage drop
	resistor = 10				# ohms value for voltage drop resistor between ADCs in circuit
	baseadccurrent = 0			# standard difference between two ADC values is 30 (no current)
	adccurrentstep = 2.62			# current increment for each adc difference over 30
	voltdropadc = (adcavg1 - adcavg2)	# subtract first ADC from second ADC (eg. 209 - 178)
	amps = adccurrentstep * (voltdropadc - baseadccurrent)	# 19mA * (209-178) - 30 = 10mA
	voltage_fmt = '%2.2f' % (voltageadc1)
	mamps_fmt = '%4.0f' % (amps)

	if DEBUG:
		print '%d %d %2.1f %2.1f %4.1f' % (adcavg1, adcavg2, voltageadc1, voltageadc2, amps)
	else:
		print voltage_fmt, mamps_fmt

	# Send Data to Pachube
	pac = eeml.Pachube(API_URL, API_KEY)
	pac.update([eeml.Data(0,voltage_fmt), eeml.Data(1,mamps_fmt)])
	try:
		pac.put()
	except:
		print "pachube update failed"
Step 4: Graphing the Data A very simple way to graph the data is to use a service called Pachube. This script has less than five lines of code in it dedicated to the Pachube data logging and graphing portion. This makes for a easy way to track the PV panels status via a cell phone or remote computer. Pachube Website for Wireless Monitoring of a PV panel
Example Graphs:
graph1graph2
Step 5: Waterproofing the System

Since this is a outdoor project you might consider a case to keep the electronics dry. I found this plastic case which I’m pretty sure had some overpriced LEDs in it years ago. It seems to do a fine job of holding everything together.
solar case xbee

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.