Thursday, February 23, 2017

Remote RPi and power supply

   I received a buck converter in the post today. The unit has a 17vdc range input and a regulated 5vdc output. The unit will allow me to place the Raspberry Pi outdoors and use a sealed lead-acid battery as power source for day and overnight operation. The battery will have a Xantrex PWM 50W charge controller charging the battery from a single solar panel dedicated to powering the RPi, alone.
   The RPi has a micro-B USB connector that is used for power input connection. I will take a matching connector and attach the other end to the buck converter.
   A buck converter is a voltage converter that drops and input voltage to a lower level. A boost converter is a voltage converter that raises an input voltage level to a higher level.
   The RPi is mounted on a circuit board along with a couple of  other devices.

Monday, February 20, 2017

Sample graph chart produced by software

   Here is a sample chart created by my software in the form of a webpage in HTML and javascript.
   Click on the image for a full size view.
   This is of the current data for February 20 2017 up to about 2:00PM.
Note the PV power never reaches the 600W potential for the array, but hovers around 350W, maximum.



Just click for a view of a full size image.

Tracking and angles

One of the most unused options in residential solar power stations is the concept of tracking. A solar panel array can be mounted in such a way as to be adjustable. An adjustable array can have it's position adjusted periodically, to follow the sun, resulting the maximum exposure of the array to the sun's light/radiation. If an array is fixed in position, there will be one period in the day when the amount of power generated will be greatest. Before and after, the power will grow or decay with decreasing exposure. When sunlight shines on a panel at an angle, there is less energy than when illuminated from a position directly above the panel. Tracking positions the array so the sun is directly above the array and not at an angle off to one side.
   One of the major obstacles to tracking is mounting technology. There is no shortage or difficulty in acquiring the electronics or software use in tracking. Placing an array high in the air and on pivoting points is difficult since most hardware for the task is not in the hands of the consumer. Companies that specialize in medium to large installations can install such a system, but the cost is usually much more that the average consumer can afford. Retail, turn-key solar power stations are not cheap. My knowledge and experience in electronic engineering and advanced mathematics gives me an edge in such a pursuit. I can find out what I don't know and need to, then learn. Slow, maybe, but successful.
   My background in personal computing devices and programming has prepared me for the task of assembling or writing software and hardware for the task. Like anyone else, however, I'm stumped when it comes to mounting an array for tracking. I've considered many, many possibilities, both conventional, and not. For example, I considered finding the largest automotive universal  joint possible (think Hum-V or tractor trailor, possibly a tank) and using that as my primary pivot point.
   I also considered a popular option version used by installation companies based on worm gears or slew drives. Affordable and accessible by the consumer. The steel pipe/post which holds those devices is another matter. The closest I've come to locating that resource is one of the basketball posts found in many school yards or church yards. A steel pipe is mounted on another piece of pipe embedded in concrete and having a flange welded/molded to the top. The flange is circular and has several bolt holes to match with a similar flange on the bottom of the pipe with the basketball goal.
   The approach I finally decided on uses a device known as a linear actuator, effectively, a motorized arm. The unit resembles the pneumatic lift in the rear hatch of a hatchback automobile or the shock absorber in a car. The one I picked is designed for use in rugged conditions, including outdoors, and can push or pull 10,000 Newtons. That's approximately one ton. The array consists of 6-12 solar panels of about 20 lbs. each, two steel struts about 20 lbs each and a steel pipe about 20 lbs. Eventually, the array will weigh about three or four hundred pounds. Fortunately, the linear actuator will only have to push/pull the vertical vector from a 45 degree angled array. This means that only part of the weight of the array will need to be accommodated by the actuator. The linear actuator rod extends/retracts ten inches. The unit will have to be placed close enough to the center of the array that the ten inch push/pull will result in a change in angle of the array of at least 120 degrees. That will be close to the center. Given the closeness of the position, the force required to move the array will be greater than if the rod extended longer and could be placed further from the center of the array.
   The array can track the sun using one or both of two methods: sensor detection of the sun; and calculated sun position. The expected position of the sun at a given date and time can be calculated and used to position the array. Small solar cells, about an inch or more in size, can be used to detect the sun's position by the comparison of the power produced by each of the cells when they are mounted at relative positions corresponding to a cross. One high, one low, one left, and one right of center and mounted on the array to increase reliability and accuracy.
   One can serve as a check or verification of the other.
   The amount of energy acquired by tracking, compared to a fixed, unmoving array is worth the extra cost and work.
   Currently, I have 600W in six panels that produce only 350W at sun's highest point at my latitude (something else to consider when setting up an array). The time of year is the middle of winter, so the sun does not rise very high in the sky, and is never directly overhead, even in summer, due to the effect of latitude. By tracking the sun, I can point the array directly at the sun in the morning and keep the array pointed at the sun throughout the day. This will move my solar power production closer to the 600W@10hours per day I can achieve.

Friday, February 17, 2017

Software continued

   Among the difficulties encountered, are the coordination of tasks among several different languages. The timeline begins with data being read from hardware, a file is opened and the data written to the file. The file name is taken from the current date, the reasoning is, the current date constitutes a unique identifier that insures no two files will have the same name. The script reading the data is initiated by a service script used by the computer operating system to schedule tasks. The 'service' calls the data reader script. That script runs another script that gets the calculated solar azimuth and elevation for the current time. There is an option in that script to get previous and next sunrise and sunset times used in setting the schedule. A service timer script may eventually be used instead of rise and set times. The azimuth and elevation data are written to the opened data file along with the hardware derived data. The data reader also calls another script that creates a webpage that gives a brief overview of the station's current activity. Another webpage, pre-written, opens the day's data file and draws a line graph chart based on that data. Two data reader scrips/services run simultaneously. One collects all 22 variables every 30 seconds. The other collects four variables' data. The latter is the brief form and is the one from which the line graph is drawn.
   All of this is done with several scripts and 5 languages. An additional modification will create a permanent image of the line graph chart for long term storage, a snapshot of that day's activity.
   With all of this, there still remains the programming of the linear actuator(s) that will position the array for maximum exposure to the sun. Some improvements in the area of charting and data storage may be in the future. The computer uses a 16gb SD card for main storage. A packing program could reduce the amount of storage space used by the accumulating data files, by 80%. The amount of storage space used by, even a year's, data, is so small as to make the amount almost negligible.

   Changes made in the computer include downloading and installing many programs. The computer is programmed for wi-fi, both as a client, and as a server. This makes remote collection of accumulated data easier than going to the station and physically hooking a laptop or other device, to the computer to get the files. The languages have to be installed. Programs associated with several pieces of externally added hardware have to be installed and configured.  Periodic tests have to be run during the computer setup to insure each program is installed correctly, before moving on to the next stage. One mis-configured application can cause, seemingly, mysterious problems later on.
   Once the computer is setup, a system test is needed to make sure everything is running together smoothly. Hardware tests improve reliability. Among the additional hardware are the analog-to-digital converters that convert voltage and current readings to the binary language usable by computers. The current sensing resistors, bypass diodes, sun sensor cells, fuses/breakers, all have to be tested and calibrated.

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.