This application is different from my others as it is not available on the AppStore (yet!) because of its very particular usage.
In March 2012, my parents decided to install some solar panels on the roof on their house to reduce their electricity bill. They chose the brand Power-One and bought 24 panels linked to two inverters (model PVI-3.0), that means an array of 12 solar panels for each inverter.
Power-One has created a desktop software that can access the data stored inside the inverters via either a USB or an RS485 interface. As my parents have a WiFi network in their house, my father decided to buy a Serial to WiFi Adapter ATC-2000WF so the inverters can be accessed from any part of the house. A personal server (NAS) is also available on the house’s network and is accessible on the internet with a DynDNS account.
2. Workflow: Inverters – NAS – iPad
The next step was to create an iPad application that could get access to the data stored in the inverters from any part of the house (or the world). The first challenge was the inverters don’t store the real-time data. Only the total production and peak of the day are stored for each day in a memory card on the motherboard of the inverter. So, to not lose this information and generate nice graphs, I decided to create a little JAVA application that would be stored on the NAS that would continuously poll the inverters and store the data into a MySQL database.
There are different types of data stored:
- daily data: total production and peak of the day
- inverter data: lifetime production, hardware information (serial number, model number, manufacturer year, etc.)
- realtime data: current, power, voltage, resistance, leak of each array of solar panels linked to the inverter
- alarms: any event that occurs during the day (read timeout, grid failure, etc.)
The workflow of the JAVA application (running as a daemon on the NAS) is as follows:
- Based on the GPS coordinates of the house, it calculates the sunrise and sunset times (so it will not poll the inverters during the night as there is no sun).
- If we are between sunrise and sunset, it tries to connect to the inverters using the adapter described above at a specific IP and port.
- If it successfully connects to the adapters, it fetches the “inverter data” and “daily data” once.
- It fetches the “realtime data” and “alarms” for each inverter.
- It goes to sleep for a few seconds.
- While it is not sunset, it goes back to number 4.
With the JAVA daemon running, we know have the MySQL database that is continuously fed with the data coming from the inverters. The next step is to display them on the iPad. As I didn’t wanted to use directly the MySQL database from the iPad (good practice), I decided to create a REST API in PHP that would be on the NAS (it is a Linux with Apache, PHP and MySQL). So, the iPad would simply need to make some calls to that API to receive data from the database. We can specify the polling time directly inside the iPad application.
The last part consists in the management of the alarms. There, Apple has a nice tool that is called Apple Push Notification Service (APNS). For this, I created a daemon in PHP that looks at the alarms stored on the database then sends a message to the APNS each time there is a new alarm. The APNS then sends the message to the iPad which has been previously registered to accept messages for this application from the APNS.
3. The iPad Application: AuroraViewer
Now that we have a MySQL database full of data and an API to get access to it, it is time to create an iPad application to see the data: its name is AuroraViewer.
The first time you start it, you have to go to the Settings and enter the URL of the API. Once it is done, the application will check if the API exists. You can then specify the polling time, max power of your inverters (in W), cost of one kWh and average daily consumption. The last two parameters are not mandatory. Based on the information provided, the iPad will look for the inverters and you will have the possibility to see their Serial Number and associate a color to each of them.
After you have entered the parameters, you can go to the first tab of the application called Inverters. The screen shows a summary of the total production of your installation, its date of installation and the total money saved to date. To start the polling, simply tap on Start Polling on the top right of the screen. After a few moment, you will see the data coming on the screen. As soon as an alert is triggered by the system, it will appear on the summary page.Based on the number of inverters you have installed at your house (in my case, two), you will have extra pages on the screen. If you scroll on the right, you will see the realtime details of each inverter.
The next tab is called Daily Power. There, you can see your daily production for all your installation (split by inverter) as well as your average production. You can specify the period you want to see displayed on the graph. You can also choose a custom period. If you tap on Today, Last 7 Days or This Week, you will have the possibility to tap on a specific bar on the graph (one inverter at a time) and you will be redirected to a detailed graph of that day for the selected inverter. On this new screen, you will have the option to change the scale of the graph as well as display some flags for the alarms.
The third tab is called Alarms and is self-explanatory. All the alarms are grouped by day and there is a color-coding system based on the severity (green, orange, red). This list is updated in realtime with the data retrieved from the APNS and the API.
If you have any questions about this application, please don’t hesitate to ask :-).