Tuesday, December 7, 2010

REST interface

So, what have I been doing in the meanwhile ?
I wasn't too happy with the granularity of the Pachube solution and the lack of data access made me look for a better solution.
So I started with setting up a couple of tables on my MySQL webserver. Added a REST interface to it and implemented the corresponding code to my datalogger on my Edimax OpenWRT machine.

Finally I implemented the pGraph library from SourceForge and provided some basic graphs for daily use :
  • Solar Production
  • Solar Efficiency
  • Solar Production Today vs Yesterday
  • Power Consumption (last 24h)
  • Power Consumption (Day/Night per day)
  • Solar Production vs Power Consumption

Thursday, June 24, 2010

Patching The World

I'm too lazy to setup my own MySQL database on my webserver, so I looked at my other options and I stumbled upon Pachube.The idea to be able to upload data to a central repository, view the data, connect to it and if needed download the data, looked very tempting.

After setting up an account on Pachube, I downloaded the Pachulib OpenWRT library and installed it on my machine. It's basically allowing a manual feed using CSV data to your Pachulib account.

I decided to aggregate information into my SolarPower feed every 60s and I upload :
  • Instantaneous Power : last Power measured in Wh
  • Average Power (60s) : average Power over last 60s in Wh
  • Total Power : Total Power production since dawn in kWh
  • Efficiency : W/Wp efficiency in %
I'm quite happy with the results. I can access my data remotely without setting up my own hosting and share data to everybody interested; The only downside is the archiving in 15 minutes granularity. I sometimes need a more precise tracking of production.

Tuesday, June 22, 2010

Solar Tweet

I was reading Jannich Brendle's article  about how to setup a Twitter client on a  OpenWRT machine, but it appears Twitter is going to disable basic authentication by the end of June, making the whole experience just a shortterm experiment.

No panic, a blogger called Lostman was so friendly to provide a script to perform the oAuth authorisation routine on OpenWRT.  In my particular setup I had to install curl, iconv and openssl-utils to get things working on the Kamikaze 08.09.02 r188801 machine. And oh, I had to activate the curl-http option instead of the wget. I first wanted to test it on my Ubuntu machine but the OpenWRT won't run on a different machine. I couldn't figure out where the commands or options differ between the two machine, so be warned : don't run this script on the host machine. Just run it on your target machine !

And tada! A few manual tweets from my machine and then I automated by calling the script through a 'system' call in my logger.

Monday, June 21, 2010

Kamikaze or Backfire ?

After a lot of reading I decided to give Kamikaze a go on the Infineon ADM5120P machine. With only 2MB NOR Flash, there's not enough room to run a decent set of tools without having to use swap-space, hurting performance quite a lot. So, after installing my Ubuntu virtual machine, and setting up the Kamikaze 8.09.02 SDK environment, I modified the kernel configuration in order to mount a USB-drive as rootfs. I know, I know, I'll lose one valuable USB port and I'll have to use an thumbdrive on the outside of my router, but I don't care. I'm happy to be able to remove the USB-drive from the router and to mount it on my Ubuntu-box !

Anyhow, after having run the 'make kernel_menuconfig" and the 'make menuconfig', I was able to flash the router with my own base-kernel image and after mounting the USB-rootfs, I was able to install more packages like the GPIO-modules. It took me a while to figure out which versions to download and to compile. So never mix old sources or packages with more recent ones. Also beware for the precompiled packages in the Openwrt repository, if you're using a non-standard router like the ADM5120P-based Edimax or Sweex or Omnima boards, you're out of luck cause none of the images will work on your board, an neither of the corresponding packages will load.

After verifying the correct loading of GPIO, GPIO_proxy and GPIO_Leds package we're all set !

Oh yes, the ntp-package was usefull to keep the machine correctly in sync with my ISP's timeserver. And adding the dns-servers in the resolv.conf file allowed correct resolution of internet addresses. :-)

Sunday, June 20, 2010

Edimax BR-6104-KP as Solar Logger

I finally decided to start monitoring my Solar installation. From a 'Green' perspective, it doesn't make sense to install PV-panels on the roof, trying to save some energy and then spend ridiculous amounts of money on 'gadgets' like a monitoring console. After looking into some professional hard & software, I finally bought myself a low-cost router.

At a clearance sale, I picked up an Edimax BR-6104-KP router at 29€. It's not a perfect machine, but with 2 USB ports, 5x 10/100 Mb Ethernet,1 serial port, 2MB Flash and 16MB RAM and lots of GPIO to interface to my projects, price/quality is unbeatable.

First thing I did after buying this router, was to strip it from its housing, prepare the serialport for flashing my own firmware and connect some input to the GPIO.