Friday 06 July 2012
Projects | Raspberry Pi | Solar Power |
The plan to use an Android phone and IOIO board to log the solar data has been abandoned after repeated failures of the IOIO boards to run for more than 24 hours without crashing or resetting. It maybe that I have purchased 2 faulty boards, phone issues (on 4 android devices) or some other bug in the code or firmware.
The new plan for the home solar PV and hot water logging system is to use a Raspberry Pi Linux based system and use this with the current sensors to log data both locally onto a mysql database on the Raspberry Pi memory card and also to upload to the online reporting website every minute.
import quick2wire.i2c as i2c
address = 0x49
with i2c.I2CBus() as bus:
bus.transaction(i2c.write_bytes(address, 0x01, 0x60))
sensora, sensorb = bus.transaction(i2c.write_bytes(address, 0x00),
temp = (sensora << 8 | sensorb) / 256.
print ("%02.02f" % temp)
The Raspberry Pi system image doesnt have I2C support as standard and I needed to install an updated kernel from http://www.bootc.net/projects/raspberry-pi-kernel/ and also GPIO Admin from http://github.com/quick2wire/quick2wire-gpio-admin. I then installed the Quick2wire api libraries from https://github.com/quick2wire/quick2wire-python-api and with help from the developers (http://quick2wire.com/2012/06/i2c-python/) I was able to get one of the MCP98003 temperature sensors to read via a Python script as shown below.
Screenshot of the code running reading a spare sensor.
The next stage will be to design and build a buffer circuit with a SPI based A/D converter to monitor the analogue inputs from the battery voltage, current sensors and an updated mains current logging system. We are also planning to add additional temperature and humidity sensors outside once we find suitable sensors.