Solar Power Charting Tool

Introduction

The world is an innovative place. Although we still rely heavily on fossil fuels, renewable energy sources are becoming a more and more viable solution with increasing efficiency breakthroughs in solar, wind, and fuel cell technologies. Hopefully, we will see a major transition to these cleaner and natural resources in our lifetimes.

Solar energy takes on two forms. One form uses the sun's radiation to generate heat that can heat hot water for your home. Someday perhaps, the sun's rays can even be used to heat water hot enough to produce steam to move generators to produce electricity. Also, solar energy can generate electricity directly through a principle Einstein discovered called the photoelectric effect. Basically, the way the photoelectric effect works is if light is shined on a semiconductor or metal, electrons will flow into the metal. If the frequency of the light shined on the substance is greater than what is called the threshold frequency of the substance, then electrons are emitted from the substance. After the threshold is reached, the rate of the emission of electrons (current flow) is proportional to the intensity of light shined on the substance. Certain metals make better electron emitters than other metals at certain frequencies of light. For example, silicon and selenium are substances used to make solar cells because of their energy efficiency in sunlight.

SolarPowerImage.jpg

Figure 1. Photovoltaic Solar Energy Farm in Australia

The cell we will use for our solar tracking experiment is made from crystalline silicon and has a maximum voltage rating of .55V and a maximum current rating of 300 ma. The cell can be picked up in your local Radio Shack for about $5. Although the cell doesn't produce much power, this experiment can certainly be scaled to handle higher wattages.

Measuring the Solar Power

Power is the measure of energy per unit of time. It can be calculated by multiplying voltage by current at the output of the solar cell. Because our GP-3 Board can only measure voltage, we'll need to create what is called a current-to-voltage converter circuit. This circuit takes current from the photovoltaic cell and runs it through a couple of operational amplifiers to produce a corresponding voltage (1V corresponds to about 10 milliamps).

Figure 2 shows the circuit constructed for measuring current from the solar cell. The operational amplifier (also known as a differential amplifier) is a great circuit for sensing or measuring just about anything because it keeps the voltage at one input at a reference point determined by the other input. The first opamp is the current-to-voltage converter. It takes the current from the photovoltaic cell and converts it to a voltage determined by the 100-ohm feedback resistor. Unfortunately, the voltage produced at the output of the first opamp is negative (which the A/D channel on our GP-3 board can't measure). We need to flip the polarity of this voltage using a second op-amp set up to invert the voltage sign. This positive voltage is then fed into pin 10 of our GP-3 board, which is actually channel #0 of our A/D (Analog to Digital) converter.

SolarMeasurementCircuit.jpg

Figure 2. Current-To-Voltage Converter to Measure Current from the Solar Cell

Charting the Sun with .NET

The charting program consists of a User Control that plots data points on an XY Plotter. (See my previous article, An XY Plotter User Control in GDI+) a timer control, and the ActiveX control that talks to the GP-3 board. The program also has buttons that allow you to start and stop charting and a calibration check box to allow you to speed up data collection to test the program. Normally sampling takes place once every minute. In calibration mode, sampling is once every second. Figure 3 shows the solar charting form in calibration mode. The output you see was caused by varying the position of the solar cell:

SolarPowerCharter.jpg

Figure 3 . Charting solar power in calibration mode.

To chart the sun's power, it is more practical to take data every 1 minute or every 5 minutes because the sun doesn't change intensity that drastically every second. So when you are through in calibration mode, switch back to normal mode by clicking the checkbox again and hit the Clear button. Place your solar cell outside (make sure your serial cable reaches far enough!) and hit the start button to check the power potential in your area.

The code for capturing data is shown in Listing 1. The program reads A/D Channel #0 on the GP-3 board every time it enters the timer's event handler. The handler also adjusts the A/D reading to a voltage and converts the voltage back to a current using ohms law (current = voltage/resistance). The current is then multiplied by the voltage of the solar cell (.5V) to get a power measurement.

Listing 1. Measuring Power with the GP-3 and Displaying it in the Windows Form.

private float SimulatedHour = 0.0f;
private long StartClock = DateTime.Now.Ticks;
private void timer1_Tick(object sender, System.EventArgs e)
{
    // Take a reading every minute
    long tmp1 = this.axGP3IO2.a2d(0);
    // Convert the A/D reading from voltage to current using Ohm's law
    float current1 = ((float)tmp1 * 5.0f / 1024.0f) / 110;
    // Voltage is about 1/2 a volt in the solar cell
    float voltage1 = 0.50f;
    // Compute power using current X voltage
    float power = current1 * voltage1 * 1000;
    // Get the current time of day for the X axis
    float time = (float)DateTime.Now.Hour + (float)DateTime.Now.Minute / 60.0f;
    // Check for calibration mode
    if (checkBox1.Checked)
    {
        // In calibration mode, simulate the time increase
        SimulatedHour += 0.20f;
        time = SimulatedHour;
        // Stop the timer after 24 simulated hours
        if (SimulatedHour > 24)
            timer1.Stop();
    }
    else
    {
        // Stop the charting after 24 hours.
        if (DateTime.Now.Ticks - StartClock > (24 * 3600 * 1000))
        {
            timer1.Stop();
        }
    }
    // Add a point to the xy plot user control
    xyGraphControl1.AddPoint(time, power);
}

Conclusion

One easy improvement that could also be added to this project is to sum the total power produced over the course of a day. This way, you would have a number that is represented in mW-hours which, in essence, is a total energy measurement for that day.

If you want to try this experiment yourself, you can get a hold of the GP-3 board at the AWC website. The cost of the kit is $39.95. The other parts for the experiment (the op-amps, resistors, and solar cells) can all be purchased at Radio Shack.

Solar power is definitely viable in the near future. If you want to see some cool stuff being done with solar power, check out the SERC website. They have developed a solar/fuel cell car and are experimenting with using solar energy to create storable, clean hydrogen fuel. Also, check out the National Renewable Energy Laboratory Website for more information on renewable energy.

Previous Articles using .NET and the GP-3 Board

A Virtual Storage Oscilloscope in .NET

A Virtual VoltMeter in .NET


Similar Articles