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 may be 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.
#!/usr/bin/env python3 import quick2wire.i2c as i2c import time address = 0x49 with i2c.I2CBus() as bus: bus.transaction(i2c.write_bytes(address, 0x01, 0x60)) bus.transaction(i2c.write_bytes(address, 0x01)) while True: sensora, sensorb = bus.transaction(i2c.write_bytes(address, 0x00), i2c.read(address, 2))[0] temp = (sensora << 8 | sensorb) / 256. print ("%02.02f" % temp) time.sleep(1)
The Raspberry Pi system image doesn't 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 an 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.
Comments