Bluetooth Connection of the Sunny Boy Inverter on Ubuntu

My photovoltaic panels are connected to the power grid through a Sunny Boy SB5000TL inverter. Although, this inverter comes out-of-the-box with bluetooth connectivity, this feature is only supported on Windows. Luckily, there exists a free tool that reads out the generation data on Linux: sma-bluetooth. This involves a few manual commands detailed in http://code.google.com/p/sma-bluetooth/wiki/ubuntu_compile_guide. The guide didn't work a 100% for me, so the next section details the steps I followed.

The code can be downloaded from http://code.google.com/p/sma-bluetooth.

In the terminal ( Ctl + Alt + T):
  • sudo apt-get install mysql-server mysql-client mysql-query-browser libmysqlclient-dev (the libmysqlclient-dev package is needed for compilation)
  • sudo apt-get install bluez libbluetooth-dev curl libcurl3 libcurl4-nss-dev
  • create a new Makefile in the sma-bluetooth-0.17 directory:
    gedit Makefile 
    Contents (make sure you use a tab, not spaces, in front of the gcc commands):
    smatool: smatool.o 
            gcc smatool.o -L/usr/lib -lmysqlclient -lbluetooth -lcurl -lm -o smatool  
    smatool.o: smatool.c 
            gcc -c smatool.c 
  • make
Now prepare the Bluetooth connection:
  • my bluetooth USB dongle is automatically up & read on ubuntu 11.10:
    $ lsusb | grep -i bluetooth 
    Bus 002 Device 002: ID 0a5c:4500 Broadcom Corp. BCM2046B1 USB 2.0 Hub (part of BCM2046 Bluetooth) 
  • hcitool scan
  • workaround if hcitool scan gives no result: (seehttps://help.ubuntu.com/community/BluetoothSetup#Setup_Devices for details)
    sudo hciconfig hci0 inqmode 0 
  • cp smatool.conf.new smatool.conf
  • gedit smatool.conf
    • modify the lines as explained in the comments
    • you can optionally upload your data to the excellent pvoutput.org service - see http://pvoutput.org/account.jsp for details:
      • get the API key
      • configure your unique SID
    • use the bluetooth password for 'normal' usage (by default 0000 in some devices). I had trouble with the different password reserved for maintenance.
If you use mysql:
  • install the database / create the tables (this requires a user with admin rights):
    ./smatool --INSTALL 
  • an empty password is not supported
  • ./smatool
  • debug & verbose can help identifying errors:
    ./smatool -d -v 
  • ./smatool -? lists out all options available
My pv-output: http://pvoutput.org/list.jsp?userid=9300

Next steps:
  • schedule the smatool in cron
  • replace mysql with sqlite for easier is
  • deploy the config on a plug computer


Wannes said...

What Bluetooth version did you use?
Bluetooth 2.0?

SBF said...

Yet another tool to read power production of SMA solar inverters