Wednesday, February 1, 2017

Software

   I've been working with the software.  I use a combination of PHP, Python, Bash, and HTML-javascript.
The reason for so many languages is some things are done more easily in one language than another. Python is better with the hardware end of things and PHP is better with the web and HTML/Javascript.
The situation is:
   A bash script run as a systemd service/daemon calls a PHP script which collects data from the hardware, namely, the charge controller charging the batteries using energy from the solar array. The charge controller contains a UART that performs communications tasks with the external world. The PHP script calls a Python script to calculate astronomical data for determining the current location of the sun by calculation. The PHP script then modifies the data and stores the end product in a file along with data to be plaotted, from the charge controller. A HTML file runs Javascripts to open the data file and read the contents. A chart is then drawn on the web page and a line of the activity of several variables, is plotted. The chart is a real time data provider.
   The plot is updated each minute with additional data. Another Python script calculates the times for sunrise and sunset and uses that information to run the data collection process between sunrise and sunset, and suspend data collection and storage from the hardware.
   The charge controller hardware collects data 24/7 using a UART to communicate in RS-485 protocol with a RJ45 connector plugged into the Raspberry Pi's USB port using a RJ-45 to USB cable.
   A hardware clock module has been added to the Raspberry Pi (RPi) to maintain accurate and consistent, system time. The module uses a small lithium battery to maintain settings storage during times when the RPi is shutdown (off). The battery will run down, though, if left un-refreshed long enough. I need to add a larger lithium battery. I have one from an old iPhone that should last several weeks, if not months, offline.
   I'm going to add sensing resistors in the return loop ( in the case of the Chinese charge controller, the positive line). This will allow me to keep a separate record of the detailed activity of the solar array. A side benefit exists of allowing me to examine the efficiency of the charge controller. The controller uses the positive line for ground return. This is not the way most Western systems are configured. This will work since the inverter output is lfoting (unugrounded). Without grounding, both lines from the array float about 16vdc above ground. This is more than the Analog to Digital converters I will be using can stand. When I ground the positive line of the arry, The differentials, less than 1 vdc, will be close to ground (0vdc) and easy to measure with a voltage divider on the ADC inputs.
   The charge controller uses a mathematical algorithm to estimate the state of charge of the battery bank. I will be able to determine if I need to find a better device.
   Eventually, I will move all of the electronics outside and into a weatherproof container, including one or more small batteries for the RPi. I will use a buck converter to convert the 12 volts D.C. from the batteries to the 5 volts D.C. needed by the RPi.
   A linear actuator will rotate the array to a position optimum for collecting solar energy. Relays will be programmed by the RPi to engage the actuator motor. The actuator is capable of moving 10,000 Newtons, or about one ton. The array will weigh about 500 pounds and have 12 panels mounted on a steel pipe  using something similar to U-bolts. The 'tracking' will be in two dimensions at first, and later, in three.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home