Activity Programming The Dueling Solar Cells

We will be building upon our previous program, since every experiment uses the Plot_It subroutine. These additions let us read and compare the voltages generated by the two solar arrays. You can either download DuelingSolarCells.bs2 from www.parallax.com, or you can update your current program by following the steps below.

V In the BASIC Stamp Editor, open BatteryCharger.bs2.

V Rename and save the program as DuelingSolarCells.bs2

V Update the title to read as follows:

Experiments with Renewable Energy v1.0 - DuelingSolarCells.bs2 Indicates whether left or right solar cell has higher voltage reading.

V Add the following code to the bottom of the Declarations section.

----- For Experiment 2: Dueling Solar Cells -----------------------------

LeftSpLed PIN 9 ' Left Solar Panel LED on P9

RightSpLed PIN 8 ' Right Solar Panel LED on P8

offSet VAR codePtr 'Nib ' Value proportional to A/D voltage offset = 0 ' resolution of 0.02 volts/bit.

' Example:offSet=10x0.02V = 0.20V

V Next, in the Main routine, add an apostrophe in front of the gosub Exp_i command as shown below. This will make the entire line a comment, and keep the program from performing the Programmable Battery Charger experiment, which would conflict with the Dueling Solar Cells experiment. In other words, we are visiting the second "floor" of our "building" without stopping on the first!

Main Routine

Main: DO

' GOSUB Exp_1 GOSUB Exp_2 GOSUB Exp_3 GOSUB Exp_4 GOSUB Exp_5 GOSUB Plot_It LOOP

' Programmable Battery Charger Dueling Solar Cells Solar Cell Sun Tracker Half&Full Wave Rectification Three-Phase AC Alternator Plot Data w/ StampPlot Pro

Now follow up with adding the code for Experiment 2 in the Subroutines section: V First add the commented lines to document the subroutine:

' Experiment 2: Dueling Solar Cells

Convert the left solar panel voltage to an 8-bit value Convert the right solar panel voltage to an 8-bit value Compare the two voltage values:

IF both are equal plus or minus offSet Then illuminate both LEDs

IF the left solar panel voltage > the right solar panel voltage Then illuminate the left LED and extinguish the right LED

IF the right solar panel voltage > the left solar panel voltage Then illuminate the right LED and extinguish the left LED Return

V Then fill out the Exp_2 subroutine as shown:

a2dMuxId = A2dMuxId1 ' convert A/D Channel 1

GOSUB A2D ' which is the left solar panel ch1 = a2dResult ' set CH1 = converted value a2dMuxId = A2dMuxId2

GOSUB A2D ch2 = a2dResult

GOTO Exp_2_CH1_Is_Greater ELSEIF (ch2 > ch1) THEN

GOTO Exp_2_CH2_Is_Greater ELSE

GOTO Exp_2_CH1_Equals_CH2 ENDIF

convert A/D Channel 2

which is the right solar panel set CH2 = converted value test for CH1 > CH2 test for CH2 > CH1

Exp_2_CH1_Equals_CH2: HIGH LeftSpLed HIGH RightSpLed GOTO Exp_2_End

Exp_2_CH1_Is_Greater: ch1 = ch1 - offSet IF (ch1 = ch2) THEN

GOTO Exp_2_CH1_Equals_CH2 ELSE

HIGH LeftSpLed LOW RightSpLed GOTO Exp_2_End ENDIF

both CH1 and CH2 are equal, so illuminate the left LED and illuminate the right LED and exit

CH1 is > CH2, so subtract the offSet from CH1

branch if CH1 = CH2, else illuminate the left LED and extinguish the right LED and exit

Exp_2_CH2_Is_Greater: ch2 = ch2 - offSet IF (ch2 = ch1) THEN

GOTO Exp_2_CH1_Equals_CH2 ELSE

LOW LeftSpLed HIGH RightSpLed GOTO Exp_2_End ENDIF

CH2 is > CH1, so branch if CH2 = CH1, else extinguish the left LED and illuminate the right LED and exit

Exp_2_End: RETURN

V Save your work! Your Turn: Plotting the Dueling Solar Cells

If possible, have the solar cells exposed to bright sunlight for the next part of this test. If you cannot work near a sunny window, use a bright light bulb close to your solar cells for illumination. We have provided StampPlot illustrations for different light sources.

V Run the program DuelingSolarCells.bs2. The Debug Terminal should be displayed with the RX LED flashing.

V Make a note of which COM port the Debug Terminal is using.

V Close the Debug Terminal in preparation for displaying the solar panel voltages on the StampPlot screen.

V Open StampPlot via Start ^ Parallax Inc ^ StampPlot ^ Experiments with Renewable Energy ^ sic_ewre_exp_2.spm. (If StampPlot is already open, you may select Macros from the toolbar, then Select Start-Up macro, and open sic_ewre_exp_2.spm from the SIC_Energy folder.)

V In StampPlot, set your COM port to the one that was being used by the Debug Terminal.

V Click on the Connect button, and make sure Enable Plotting is checked.

V Next, point the solar panels at a bright light source. DO NOT TO LOOK DIRECTLY INTO YOUR LIGHT SOURCE!

V Move the solar panel tray from left to right and vice versa. Try covering up parts of each panel in turn. As you do this, watch how your actions cause the LEDs illuminate, and how the StampPlot graph and voltage meter readings change.

Figure 3-5 was created by placing a solar panel tray underneath a 60 watt bulb on a common adjustable-arm desk lamp. The graph shows the bulb being brought down close to the panels, then the panels being tilted to each side. Then each solar array was covered up one at a time. Finally, both panels were slowly covered at the same time. Can you discern each motion from the graph?

Figure 3-5: Dueling Solar Cells Voltage Display

V Now place the solar cell tray on a flat surface so that both panels are about equally exposed to very bright light.

If both LEDs illuminate, then the program is indicating that the solar panel voltage outputs are nearly the same. If, however, either the left or right LED illuminates by itself the program is indicating that one or the other panel is generating the most voltage. If both LEDs always seem to be illuminated, cup your hands around the solar panel tray to block out any sidelight. Figure 3-6, generated using the 60 watt incandescent bulb, shows that our solar cells are not exactly matched.

Figure 3-6: Voltage Display For Incandescent Light

Since each solar cell produces approximately 0.40 volts DC under no load, the combination of four cells can produce a maximum of 1.6 volts DC. If you are working indoors under a lamp, you most likely wouldn't get the full energy-producing effects of the sun on the solar cells, but you will still get a measurable voltage. Nevertheless, if the sun isn't shining and you want to do this experiment indoors, consider this option an advantage!

Now look at something else that's interesting in Figure 3-6 and ask yourself why the plotted voltages seem to ripple like sine waves. Once again, this plot was sampled indoors under incandescent light, not sunlight. The ripples, then, represent the 60 Hz AC that powers the incandescent light and modulates its intensity. Your eye probably can't detect this, but the solar cells certainly do.

If you choose to measure the period of the ripples on this plot, they do not match the period of a 60 Hz AC sine wave (1/60 = 16.67 milliseconds) simply because our sampling period for the A/D converter is timed by the pause 250 instruction in the Plot_It routine. Therefore, the plot shows selective voltage samples at different peaks and valleys of the 60 Hz AC over a longer period.

The next plot in Figure 3-7 created by placing the solar panels right underneath a 40 watt fluorescent tube. It also shows ripples. Fluorescent tubes also flicker (usually) faster than the human eye can perceive.

r-ip;"ii■ i""ii t'J"'j.l.i,hi i■- ,.tiii if f'*Jl +M ^ g^f H sH3l\|l r-ip;"ii■ i""ii t'J"'j.l.i,hi i■- ,.tiii if f'*Jl +M ^ g^f H sH3l\|l

Figure 3-7: Voltage Disp l ay For Fluorescent Light

Figure 3-7: Voltage Disp l ay For Fluorescent Light

Now turn your attention to Figure 3-8. Here we used a laptop computer to set up the experiment where we had access to direct sunlight. The solar panels are pressed against a window with the full afternoon sun shining on them, although at a high angle which is why the panels are still not generating the maximum 1.6 volts DC.

Figure 3-8: Voltage Display For Sunlight

Last, but not least, notice that both traces are holding steady but at slightly different voltages, given the fact that they are both stationary and pointing directly at the sun. This difference is expected since the individual cells that make up the left and right solar panels have slightly different voltage output characteristics due to the imperfections in their materials and manufacturing. But even so, what we want are the voltages from both panels to be equal when pointed at exactly the same light source. But how can we get there from here? Well, it's all in how our experiment is programmed.

Solar Power

Solar Power

Start Saving On Your Electricity Bills Using The Power of the Sun And Other Natural Resources!

Get My Free Ebook


Post a comment