Sei sulla pagina 1di 27

1

Team Foxtrot

Solar Collection Project


ABE3042C Design 1
Flora Vinson, Jason Ressler, Kathryn Chinn, Sandra Nakasone, Dimple Patel

04 November 2010

Table of Contents
Abstract...3 Introduction3 Problem Statement..3 A. Process Scheme...4 Figure 1.4 B. Preliminary Device. 5 Figure 2..6 C. Prototype Device.7 Figure 3......8 D. Photovoltaic Cells.. 8 E. Stepper Motors........ 9 F. Circuit Board... 9 G. 1208LS USB computer control... 9 H. Computer Programming.... 10 I. Materials and Costs....... 10 Table 1.....10 J. Simulation..... 10 Figure 4...... 11 Figure 5.......................... 12 K. Limitations.... 12 L. Appendix... 14 Figure 6...14 Programming...15 M. References. 27

Abstract This project's primary objective was to construct a solar collection device using materials such as photovoltaic cells, a 1208LS USB computer control interface, two stepper motors, and a circuit board. After the mechanical failure of a preliminary device that attempted to rotate a plurality of solar cells atop pylons, a prototype device was developed with lighter materials that experienced less friction. This prototype device rotated a single Teflon pylon holding photovoltaic cells. The Teflon pylon was anchored to an angled plexiglass support, which was then secured to a plexiglass base. A stepper motor was attached to the plexiglass support and the plexiglass base in order to aid in biaxial rotation. A code in the C sharp program guided the 180 degree rotation of the upper stepper motor from sunrise until noon, upon which the stepper motor was deactivated. Then for one hour, the lower stepper motor aided in the 180 degree azimuth rotation of the pylon in order to allow the photovoltaic cells follow the solar elevation angle until sunset. A brief simulation confirmed the efficiency of the prototype device against a supine, stationary photovoltaic cell. However, the collection of sunlight could have been maximized if seasons, weather, automated programming, and simultaneous rotations could have been incorporated. Introduction The vast majority of the energy generated in the United States is dependent on nonrenewable resources like fossil fuels and nuclear power1. The use of these increasingly costly resources has resulted in environmental repercussions such as release of atmospheric pollutants, accidental oil spills, deleterious emissions, and release of greenhouse gases. Therefore, alternative energy resources like wind or geothermal energy should be utilized; however, the efficiency of such energy sources should also be considered. This project will focus on solar power. The amount of energy provided by the sun is boundless and essentially limitless1. Currently, the application of solar energy includes standard calculators and off-grid homes1. Moreover, there is no pollution associated with the production and consumption of solar energy1. However, in the collection of solar energy, the mechanism of solar power collection should consider effectiveness in order not to increase the costs and materials needed for solar energy production1. In this case, the project will explore the optimization of the collection of solar energy with tools such as solar panels. Problem Statement This project aimed at collecting solar radiation. Nonetheless, as with most practical applications, there were constraints on the materials available for this project. Specifically, a 1208LS USB Computer control interface, small photovoltaic cells, two stepper motors, and a circuit board were used. Also, a time frame of one day was imposed for the window allowed for solar collection.

A.

Process Scheme

The engineering design group followed a plan of action that is illustrated in Figure 1. Unfortunately, the preliminary design consumed most of the time allowance. Problems encountered with its materials and computer programming forced abandoning the preliminary design. Therefore, after a brainstorming session, the group formulated a new device that would both employ new materials and programming. However, because of some initial concern with the new devices potential mechanical failure, the engineering design group was prepared to report a device that did not meet its design goals. Fortunately, the engineering design group procured an efficient prototype that can be easily replicated. Figure 1: Process Scheme of Solar Collection Project
Purpose: To design a device that will collect the most amount of sun radiation using stepper motors, solar cells and 1208LS USB controller.

Brainstorming Session

Original idea: to use wood pylons to hold 3 solar panels that will simultaneously rotate to maximize solar collection.

Final idea: Teflon pylon supported 1 array of solar panels. Biaxial rotation with 2 stepper motors and 2 two-step gears. Base and support made in plexiglass.

Testing Process Testing Process SUCCESS: Test Simulation succeeded with Microsoft Visual. FAIL: wooden pylons and platform were too heavy to move, excess friction against stepper motors. Problems occurred with the programming.

Completed programming. Real simulation with artificial light. Brainstorming Session

SUCCESS: plexiglass material was the lightweight for the stepper motors to move them. Programming in C# worked efficiently.

FAIL: Explain mechanical or computer deficiencies in presentation and report. No time for third device.

Final Presentation and a report.

B.

Preliminary Device

A solar collection device was constructed in order to test the efficiency of the solar panels and the stepper motors. As indicated by Figure 2, four panels of solar cells, or photovoltaic cells, were implemented. One of the four solar cells acted as a reference cell. The other three photovoltaic cells were situated on top of three wooden pylons, which were propped, in turn, by 2-inch long PVC pipes. The three wooden pylons had slanted faces at an angle of sixty degrees to the horizontal. These wooden pylons were then anchored into an 18-inch long wooden board at a slight angle. This wooden board was, in turn, attached to a slightly smaller wooden board, which served as the base. During a trial of the preliminary device, the stepper motors, which were intended to rotate the pylons and base board, failed to procure any movement. The ambitious preliminary device was speculated to be too heavy for the relatively weak stepper motors to move. In addition, loads of the heavy materials were directly situated on top of the stepper motors. Also, the stepper motors may have experienced excess friction as they were directly attached to the wooden pieces. Therefore, the entire design was rebuilt to ease movement provided by the stepper motors. First, the device was reduced in scale to decrease its weight; only one solar panel and pylon were used. Also, the wooden base and the wooden board were replaced by plexiglass, a lightweight, sturdy material with a density of 1.17 g/cm3 2. Although plexiglass is denser than wood (spruce has a density of 0.7 g/cm3), the platforms and base were scaled down enough to offset the possible increase in weight3. Likewise, the PVC pylons were replaced by a slightly denser Teflon material (density of 2.2 g/cm3)4. This material change was done to reduce the friction; Teflon has an extremely low coefficient of 0.054. Also, in order to ease the loads on the stepper motors, the pylons stepper motor was positioned at a 59 degree elevation angle, and the other stepper motor was placed adjacent to the platform. Moreover, in order to solve the problem of creating enough torque to rotate the pylon and its base, two-step gears were utilized with each stepper motor. The gears created enough mechanical advantage to smoothly rotate the pylon and its platform without overstraining the stepper motors.

Figure 2: Sketch of the preliminary solar collection device

Key: Brown-wooden board; light blue-solar panels; green-wooden pylons; grey-stepper motor.

C.

Prototype Device

In the project, two panels of solar cells, or photovoltaic cells, were implemented in the prototype device. One of the two solar cells acted as a reference cell. As indicated by Figure 3, the experimental photovoltaic cell was situated on top of one Teflon pylon at an elevation angle of 59 degrees (with the bottom plexiglass platform serving as the reference frame). The Teflon pylon itself was buttressed by a plexiglass platform. The Teflon pylon was also connected to a stepper motor (which is attached to another plexiglass support) with a two-step gear.

In regards to the plexiglass platform, a second Teflon pylon was connected to the aforementioned platform to the much larger plexiglass base. The second, upright Teflon pylon was connected to the second stepper motor with another two-step gear.

In terms of the mechanism of the device, the experimental solar panel was positioned at an elevation angle of 59 degrees in order to mimic the solar elevation angle at sunrise5. The solar panel pylon itself was set at an azimuth angle of 90 degrees (the angle is based on a north-based azimuth system). With the initial position set, the angled stepper motor rotated the pylon attached to the solar panel. From 8:00 A.M to noon, this angled stepper motor moved every 5.22 minutes; each of the successive 46 steps resulted in a slight rotation of 3.915 degrees. As a result, once noon struck, the solar panel was parallel to the plexiglass base (rather, the solar panel was orthogonal to the Zenith direction in the spherical coordinate system). Also, at that time, the angled stepper motor stopped moving.

From noon until 1:00 P.M., the upright stepper motor rotated the upright pylon attached to the base. This upright motor moved every 1.305 minutes; each successive step resulted in a slight rotation of 3.915 degrees. This stepper motor served to move the solar panel to an azimuth angle of 270 degrees. After 1:00 P.M., the upright motor stopped moving; the angled stepper motor resumed its motion by moving every 5.22 minutes until five oclock in the afternoon. However, in contrast to its morning run, the angled stepper motor moved downwards so that the solar panel was again at an elevation angle of 59 degrees. Also, the input of the experimental photovoltaic cells was compared to the energy input of the reference cell.

Figure 3: Sketch of the solar collection prototype

Key: Brown-plexiglass base; light blue-plexiglass platform/support; light grey-Teflon pylons; dark grey-stepper motor; black-solar panel; dark blue-gear.

D.

Photovoltaic cells

Small squares of photovoltaic cells were used to capture solar energy. Typically, photovoltaic cells are made up of semi-conducting materials6. Within the solar cells, an electric field is created such that incident light on the solar cells can form an electric circuit6. This direct current electricity can then be harnessed into input energy for other appliances6.

E.

Stepper Motors

Stepper motors are essentially electronic motors that can split a single rotation into incremented steps. The stepper motor consists of a stator, a rotor with a shaft, and coil windings7. The stator is the stationary part of the device that encases the motor7. The rotor rotates in response to the commands made by the microcontroller, or the 1208LS USB computer control7. Also, the shaft helps rotate the rotor. The stepper motors course of motion is dictated by two things: direction and step7. The controllers commands guides the direction to either be clockwise counter-clockwise. The step is associated with the degree of rotation. The entire stepper motor is powered by an H-bridge circuit. In this project, one stepper motor was connected to the angled Teflon pylon which holds the photovoltaic cells. This stepper motor is active from 8:00 A.M. until noon. Upon noon, the upright stepper motor, which is attached to the bottom Teflon pylon connected to the plexiglass base, is then activated for one hour, upon which the angled stepper motor returns the solar panel to its initial position. F. Circuit board

An H-bridge circuit board was used for the project in order to guide electrical current that will power the stepper motors rotating separate components of the photovoltaic-cell device. The H-bridge circuit has the unique ability of applying a voltage across a load in any of two directions. In this project, the H-bridge circuit had six components. Pins are connected to Toshiba TA8409S/SG Driver chips, which are sensitive to excess current. Also, there are two components that act as outputs to the individual stepper motors. Next, there are two sets of terminals for data acquisition (DAQ), or Digital I/O Input, which is dictated by the microcontroller. The circuit is powered by two power inputs of five volts. G. 1208LS USB computer control

The 1208LS USB computer control is a low-speed device supported by Microsoft Windows compatible with 1.1 USB ports and 2.0 USB ports. Essentially, the USB-1208LS computer control device provides commands for the stepper motors which dictate the movement of the device holding the photovoltaic cells. The USB-1208LS features eight analog inputs, two 10-bit analog outputs, 16 digital I/O connections, and one 32-bit external event counter8. The USB-1208LS does not need any external power since it is powered by the +5 volt USB supply from the computer8. Essentially, the USB-1208LS computer control device provides commands for the stepper motors which dictate the movement of the device holding the photovoltaic cells. After the USB 1208LS was calibrated, wires were used to connect the control interface to the circuit board and the solar cell panels. The first eight analog input connectors were used to obtain data from the solar cell panels. Pins 1 and 2 are connected to the experiment photovoltaic cell, and pins 7 and 8 are connected to the reference solar cell panel.

The I/O connections in the controller were used to send information to the circuit board. These connections are also called DAQ pins, for Data Acquisition. Pins 21 through 24 are connected to the circuit board via small wires to the left most I/O ports and pins 25 through 28 are connected to the right most ports. This connection feeds information to the circuit board which later sends the command to the stepper motor for the motor to move. H. Computer Programming The program that directed the USB computer control was C sharp (C#), a programming language by Microsoft. This program was used instead of the recommended Visual Basic due to the incapability of the latter with available computer equipment. The program was created to control the prototype device in a predetermined sun path and to capture the most sunlight in a solar cell. The program was created for an operator to control the different commands manually. First, the start button needs to be pressed to begin moving the angled stepper motor from 8:00 A.M to 12 P.M. At noon, the stepper motor is halted, and the upright stepper motor begins its azimuth rotation at noon, which finishes rotating 180 degrees at 1:00 P.M. To complete the simulation, the operator has to restart the angled stepper motor for the solar cell return to its initial position, at which point the program is terminated at 5:00 PM. I. Materials and Costs

The following budget provides an overall cost analysis of the project. The most expensive material was the Teflon pylons. Ancillary items like wires and screws added negligibly to the overall cost. The costlier materials, like the 1208LS USB control and the circuit board, were provided by the instructor and therefore not counted in the cost of this prototype. Table 1: Estimated costs of materials of the prototype device Cost of Materials Plexiglass platform Plexiglass base 2-step gears Screws Teflon pylons Drill rod Estimated Total Cost

$1.5 x 4 $3.50 $0.90 x 2 $0.08 x 8 $20.00 $4.99 $ 34.49

This prototype proved to be extremely economical. At this low cost and efficiency, the device is very practical for larger-scale applications such as houses and commercial buildings. J. Simulation A simulation was conducted on the device. Instead of natural sunlight, incandescent and fluorescent light bulbs were manually rotated to provide light. The entire testing window for the device was reduced from nine hours to 4.5 minutes. As a result, the angled stepper motor moved every 2.61 seconds; each of the successive 46 steps resulted in a slight rotation of 3.915 degrees. This aforementioned step was intended to mimic the movement of the solar panel in the morning.
10

Then, in order to simulate movement from noon until 1:00 P.M., the upright stepper motor rotated the upright pylon attached to the base. This upright motor moved every 0.6525 seconds; each successive step resulted in a slight rotation of 3.915 degrees. This stepper motor moved the solar panel to an azimuth angle of 270 degrees. After the pivot of the pylon was accomplished, the upright motor stopped moving; the angled stepper motor resumed its motion by moving every 2.61 seconds for two minutes in order to return the solar panel to its initial position. As indicated by Figure 4, the experimental solar cell was successful in harnessing more solar power than the reference cell. However, it was expected that the peak in solar output would occur at 169.25 seconds into the simulation, which corresponds to noon in a real trial. Also, as apparent in Figure 5, the abrupt changes in the difference in the voltage outputs between the experimental and solar cells were due to the mechanical errors by the operator of the artificial light. Also, the solar elevation angle may not have been precisely replicated. Another possible explanation for the uneven differences could be in the human error involved in parallax. Nonetheless, as expected, the difference in voltage output between the reference cell and the experimental cell increases from time 275 seconds until the end of the simulation. This trend is due to the position of the reference cell near the base of the device such that the afternoon sun was measurably closer to the experimental cell than the reference cell. Figure 4: Voltage outputs of experimental and reference solar panel during simulation
4 3.5 3 2.5 2 experimental cell 1.5 1 0.5 0 0 50 100 150 200 Time (Seconds) 250 300 350 400 reference cell

Voltage Output Vs. Time

Voltage (volts)

11

Figure 5: Difference in voltage outputs of experimental and reference solar panel during simulation

Difference Voltage between Reference & Experimental Solar Cells


2.5 2 Voltage (volts) 1.5 1 0.5 0 -0.5 0 25 50 75 100 125 150 175 200 225 250 275 300 325 350 375 Time (seconds)

K.

Limitations

Although this solar panel device was effective, the design did pose some limitations. The programming involved with controlling the stepper motors was not automated. Therefore, if the device were to become large-scale, an employee would have to manually direct the programming to rotate specific motors at the desired times. In addition, the reference solar cell used for the device was situated on the plexiglass base. The angled pylon may have cast a shadow during its rotations onto the reference solar cell, thereby affecting the readings. Also, the experiment assumed that sunrise occurred at eight oclock in the morning and sunset occurred at five oclock in the afternoon. However, the actual sunrise in Gainesville, Florida, is at 7:45 a.m.; the sunset, at 6:30 p.m9. Moreover, as the sun intensity is the highest at noon, perhaps the device should have been simultaneously elevated in the zenith direction as it was being rotated in the azimuth direction10. Also, the suns rotation is much more stratified than the small rotor motor was directed to be; perhaps an increase in the amount of steps for a smoother rotation would have yielded better results10.

In addition, the solar collection devices programming did not account for any seasonal changes, as the solar elevation angle is markedly different in each of the four seasons11. Similarly, the programming did not take obstructions like clouds, fog, and storms into consideration. Also, the use of a solar tracking device could have optimized the device12. A solar tracker would have reduced the angle of incidence between the light and the cells12.
12

Moreover, by using a combination of the two stepper motors operating in a synchronized fashion, the solar tracker would be able to properly account for the declination of the sun at any point in the year. The same multi-axis rotation is used to in telescope movement. The solar cell would then be allowed to move in its original 120 degree arc with a slight variation in each week to account for the change in declination. The variation would be weekly due to the limited number of positions the motors can take. The variations would need to be governed by a algorithm that takes into account the following parameters: position on the earth, time of day and time of year. With theses three variables represented, an equation could be written to account for the exact movement of the sun and concurrently counteract any obstructions such as clouds.

13

L.

Appendix Figure 6: Photograph of the Prototype Device

14

The following information includes the programming code for the software C sharp. The programming was utilized to provide instructions on the desired configuration and rotation of the solar panels pylon and the devices base. // ===================================================================== ========= // File: VIn01.CS Mccdaq.MccBoard.VIn()

// Library Call Demonstrated: // Purpose: // Demonstration: //

Reads an A/D Input Channel. Displays the voltage input on a user-specified channel. MccDaq.MccService.ErrHandling()

// Other Library Calls:

// Special Requirements: Board 0 must have an A/D converter. // Analog signal on an input channel. // ===================================================================== ========= using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Diagnostics; using MccDaq; namespace ULAI01 { public class frmDataDisplay : System.Windows.Forms.Form { // Required by the Windows Form Designer private System.ComponentModel.IContainer components; public ToolTip ToolTip1; public Button cmdStartConvert; public Button cmdStopConvert; public Timer tmrConvert; public Label lblValueRead; public Label voltage3; private MccDaq.MccBoard DaqBoard;
15

public Label voltage2; public Label voltage1; public Label voltage0; public Label MessageBox; private MccDaq.Range RangeSelected; private ErrorInfo ULStat; private DigitalPortType PortNumA = DigitalPortType.FirstPortA; private Timer timer1; private Timer timer2; private DigitalPortDirection Direction = DigitalPortDirection.DigitalOut; private Timer timer3; private CheckBox Reverse; public int currentpos = 0; public int countdownenabled = 0; private Timer timer4; private Timer timer5; private Button step2; private Button stop2; public int count; public int EngVolts; private TextBox textBox1; public int Chan; public frmDataDisplay() { // This call is required by the Windows Form Designer. InitializeComponent(); // Create a new MccBoard object for Board 0 DaqBoard = new MccDaq.MccBoard(0); RangeSelected = MccDaq.Range.Bip5Volts; ULStat = DaqBoard.DConfigPort(PortNumA, Direction); ULStat = DaqBoard.DBitOut(PortNumA, 0, DigitalLogicState.Low); }

// Form overrides dispose to clean up the component list. protected override void Dispose(bool Disposing) { if (Disposing) { if (components != null) { components.Dispose();
16

} } base.Dispose(Disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.ToolTip1 = new System.Windows.Forms.ToolTip(this.components); this.cmdStartConvert = new System.Windows.Forms.Button(); this.cmdStopConvert = new System.Windows.Forms.Button(); this.tmrConvert = new System.Windows.Forms.Timer(this.components); this.lblValueRead = new System.Windows.Forms.Label(); this.voltage3 = new System.Windows.Forms.Label(); this.voltage2 = new System.Windows.Forms.Label(); this.voltage1 = new System.Windows.Forms.Label(); this.voltage0 = new System.Windows.Forms.Label(); this.MessageBox = new System.Windows.Forms.Label(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer2 = new System.Windows.Forms.Timer(this.components); this.timer3 = new System.Windows.Forms.Timer(this.components); this.Reverse = new System.Windows.Forms.CheckBox(); this.timer4 = new System.Windows.Forms.Timer(this.components); this.timer5 = new System.Windows.Forms.Timer(this.components); this.step2 = new System.Windows.Forms.Button(); this.stop2 = new System.Windows.Forms.Button(); this.textBox1 = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // cmdStartConvert // this.cmdStartConvert.BackColor = System.Drawing.SystemColors.Control; this.cmdStartConvert.Cursor = System.Windows.Forms.Cursors.Default; this.cmdStartConvert.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.cmdStartConvert.ForeColor = System.Drawing.SystemColors.ControlText; this.cmdStartConvert.Location = new System.Drawing.Point(296, 224); this.cmdStartConvert.Name = "cmdStartConvert"; this.cmdStartConvert.RightToLeft = System.Windows.Forms.RightToLeft.No; this.cmdStartConvert.Size = new System.Drawing.Size(52, 26); this.cmdStartConvert.TabIndex = 5;
17

this.cmdStartConvert.Text = "Start"; this.cmdStartConvert.UseVisualStyleBackColor = false; this.cmdStartConvert.Click += new System.EventHandler(this.cmdStartConvert_Click); // // cmdStopConvert // this.cmdStopConvert.BackColor = System.Drawing.SystemColors.Control; this.cmdStopConvert.Cursor = System.Windows.Forms.Cursors.Default; this.cmdStopConvert.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.cmdStopConvert.ForeColor = System.Drawing.SystemColors.ControlText; this.cmdStopConvert.Location = new System.Drawing.Point(296, 224); this.cmdStopConvert.Name = "cmdStopConvert"; this.cmdStopConvert.RightToLeft = System.Windows.Forms.RightToLeft.No; this.cmdStopConvert.Size = new System.Drawing.Size(52, 26); this.cmdStopConvert.TabIndex = 6; this.cmdStopConvert.Text = "Quit"; this.cmdStopConvert.UseVisualStyleBackColor = false; this.cmdStopConvert.Visible = false; this.cmdStopConvert.Click += new System.EventHandler(this.cmdStopConvert_Click); // // tmrConvert // this.tmrConvert.Interval = 500; this.tmrConvert.Tick += new System.EventHandler(this.tmrConvert_Tick); // // lblValueRead // this.lblValueRead.BackColor = System.Drawing.SystemColors.Window; this.lblValueRead.Cursor = System.Windows.Forms.Cursors.Default; this.lblValueRead.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblValueRead.ForeColor = System.Drawing.SystemColors.WindowText; this.lblValueRead.Location = new System.Drawing.Point(12, 123); this.lblValueRead.Name = "lblValueRead"; this.lblValueRead.RightToLeft = System.Windows.Forms.RightToLeft.No; this.lblValueRead.Size = new System.Drawing.Size(184, 16); this.lblValueRead.TabIndex = 3; this.lblValueRead.Text = "reference voltage channel"; this.lblValueRead.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // voltage3 // this.voltage3.Font = new System.Drawing.Font("Arial", 8F); this.voltage3.ForeColor = System.Drawing.Color.Blue; this.voltage3.Location = new System.Drawing.Point(208, 192);
18

this.voltage3.Name = "voltage3"; this.voltage3.Size = new System.Drawing.Size(144, 16); this.voltage3.TabIndex = 9; this.voltage3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // voltage2 // this.voltage2.Font = new System.Drawing.Font("Arial", 8F); this.voltage2.ForeColor = System.Drawing.Color.Blue; this.voltage2.Location = new System.Drawing.Point(222, 156); this.voltage2.Name = "voltage2"; this.voltage2.Size = new System.Drawing.Size(144, 16); this.voltage2.TabIndex = 10; this.voltage2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // voltage1 // this.voltage1.Font = new System.Drawing.Font("Arial", 8F); this.voltage1.ForeColor = System.Drawing.Color.Blue; this.voltage1.Location = new System.Drawing.Point(222, 123); this.voltage1.Name = "voltage1"; this.voltage1.Size = new System.Drawing.Size(144, 16); this.voltage1.TabIndex = 11; this.voltage1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // voltage0 // this.voltage0.Font = new System.Drawing.Font("Arial", 8F); this.voltage0.ForeColor = System.Drawing.Color.Blue; this.voltage0.Location = new System.Drawing.Point(222, 92); this.voltage0.Name = "voltage0"; this.voltage0.Size = new System.Drawing.Size(144, 16); this.voltage0.TabIndex = 12; this.voltage0.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // MessageBox // this.MessageBox.BackColor = System.Drawing.SystemColors.Window; this.MessageBox.Cursor = System.Windows.Forms.Cursors.Default; this.MessageBox.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.MessageBox.ForeColor = System.Drawing.SystemColors.WindowText; this.MessageBox.Location = new System.Drawing.Point(12, 92); this.MessageBox.Name = "MessageBox"; this.MessageBox.RightToLeft = System.Windows.Forms.RightToLeft.No; this.MessageBox.Size = new System.Drawing.Size(184, 16);
19

this.MessageBox.TabIndex = 13; this.MessageBox.Text = "voltage channel 1"; this.MessageBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // timer1 // this.timer1.Enabled = true; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // // timer2 // this.timer2.Interval = 1305; this.timer2.Tick += new System.EventHandler(this.timer2_Tick); // // timer3 // this.timer3.Interval = 20; this.timer3.Tick += new System.EventHandler(this.timer3_Tick); // // Reverse // this.Reverse.AutoSize = true; this.Reverse.Location = new System.Drawing.Point(15, 224); this.Reverse.Name = "Reverse"; this.Reverse.Size = new System.Drawing.Size(72, 18); this.Reverse.TabIndex = 16; this.Reverse.Text = "Reverse"; this.Reverse.UseVisualStyleBackColor = true; // // timer4 // this.timer4.Interval = 326; this.timer4.Tick += new System.EventHandler(this.timer4_Tick); // // timer5 // this.timer5.Interval = 25; this.timer5.Tick += new System.EventHandler(this.timer5_Tick); // // step2 // this.step2.Location = new System.Drawing.Point(157, 224); this.step2.Name = "step2"; this.step2.Size = new System.Drawing.Size(75, 23); this.step2.TabIndex = 17; this.step2.Text = "step2";
20

this.step2.UseVisualStyleBackColor = true; this.step2.Click += new System.EventHandler(this.step2_Click); // // stop2 // this.stop2.Location = new System.Drawing.Point(157, 224); this.stop2.Name = "stop2"; this.stop2.Size = new System.Drawing.Size(75, 23); this.stop2.TabIndex = 18; this.stop2.Text = "stop2"; this.stop2.UseVisualStyleBackColor = true; this.stop2.Visible = false; this.stop2.Click += new System.EventHandler(this.stop2_Click); // // textBox1 // this.textBox1.Location = new System.Drawing.Point(13, 13); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(100, 20); this.textBox1.TabIndex = 19; this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged); // // frmDataDisplay // this.AcceptButton = this.cmdStartConvert; this.AutoScaleBaseSize = new System.Drawing.Size(6, 13); this.BackColor = System.Drawing.SystemColors.Window; this.ClientSize = new System.Drawing.Size(400, 277); this.Controls.Add(this.textBox1); this.Controls.Add(this.stop2); this.Controls.Add(this.step2); this.Controls.Add(this.Reverse); this.Controls.Add(this.MessageBox); this.Controls.Add(this.voltage0); this.Controls.Add(this.voltage1); this.Controls.Add(this.voltage2); this.Controls.Add(this.voltage3); this.Controls.Add(this.cmdStartConvert); this.Controls.Add(this.cmdStopConvert); this.Controls.Add(this.lblValueRead); this.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.ForeColor = System.Drawing.SystemColors.WindowText; this.Location = new System.Drawing.Point(182, 100); this.Name = "frmDataDisplay"; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
21

this.Text = "Universal Library Voltage Input"; this.Load += new System.EventHandler(this.frmDataDisplay_Load); this.ResumeLayout(false); this.PerformLayout(); } #endregion /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.Run(new frmDataDisplay()); } private void cmdStartConvert_Click(object eventSender, System.EventArgs eventArgs) /* Handles cmdStartConvert.Click */ { if (timer2.Enabled == false) timer2.Enabled = true; cmdStartConvert.Visible = false; cmdStopConvert.Visible = true; tmrConvert.Enabled = true; } private void cmdStopConvert_Click(object eventSender, System.EventArgs eventArgs) /* Handles cmdStopConvert.Click */ { if (timer2.Enabled == true) timer2.Enabled = false; tmrConvert.Enabled = false; Application.Exit(); } private void frmDataDisplay_Load(object eventSender, System.EventArgs eventArgs) /* Handles base.Load */ { MccDaq.ErrorInfo ULStat; // Initiate error handling // activating error handling will trap errors like // bad channel numbers and non-configured conditions. // Parameters: // MccDaq.ErrorReporting.PrintAll :all warnings and errors encountered will be printed // MccDaq.ErrorHandling.StopAll :if an error is encountered, the program will stop ULStat = MccDaq.MccService.ErrHandling(MccDaq.ErrorReporting.PrintAll, MccDaq.ErrorHandling.StopAll); }

22

private void tmrConvert_Tick(object eventSender, System.EventArgs eventArgs) /* Handles tmrConvert.Tick */ { MccDaq.ErrorInfo ULStat; float DataValue; MccDaq.VInOptions Options; //tmrConvert.Stop(); // Collect the data by calling VIn memeber function of MccBoard object // Parameters: // Chan :the input channel number // Range :the Range for the board. // DataValue :the name for the value collected Chan = 0; // set input channel Options = VInOptions.Default; ULStat = DaqBoard.VIn(Chan, RangeSelected, out DataValue, Options); if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.BadRange) { //MessasgeBox.Show( "Change the Range argument to one supported by this board.", "Unsupported Range", 0); } voltage0.Text = DataValue.ToString(); // print the counts Chan = 1; // set input channel Options = VInOptions.Default; ULStat = DaqBoard.VIn(Chan, RangeSelected, out DataValue, Options); if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.BadRange) { //MessasgeBox.Show("Change the Range argument to one supported by this board.", "Unsupported Range", 0); } voltage1.Text = DataValue.ToString(); // print the counts // Write the string to a file. System.IO.StreamWriter file = new System.IO.StreamWriter("C:\\Users\\flora\\Desktop\\example.txt",true); file.WriteLine(voltage0.Text + ", " + voltage1.Text + ", " + textBox1.Text); file.Close(); } private void cmbRange_SelectedIndexChanged(object sender, System.EventArgs e) { // RangeSelected = (MccDaq.Range)(cmbRange.SelectedItem); } private void timer1_Tick(object sender, EventArgs e) { textBox1.Text = DateTime.Now.ToLongTimeString(); }
23

private void lblClock_Click(object sender, EventArgs e) { } private void timer2_Tick(object sender, EventArgs e) { ULStat = DaqBoard.DBitOut(PortNumA, currentpos, DigitalLogicState.Low); if (Reverse.Checked == false) { switch (currentpos) { case 0: currentpos = 3; break; case 1: currentpos = 2; break; case 2: currentpos = 0; break; case 3: default: currentpos = 1; break; } } else { switch (currentpos) { case 0: currentpos = 2; break; case 1: currentpos = 3; break; case 2: currentpos = 1; break; case 3: default: currentpos = 0; break; } } ULStat = DaqBoard.DBitOut(PortNumA, currentpos, DigitalLogicState.High); timer3.Enabled = true;
24

if (countdownenabled == 1) { count = count - 1; if (count <= 0) { timer2.Enabled = false; countdownenabled = 0; } } } private void timer3_Tick(object sender, EventArgs e) { timer3.Enabled = false; ULStat = DaqBoard.DBitOut(PortNumA, currentpos, DigitalLogicState.Low); } private void timer4_Tick(object sender, EventArgs e) { ULStat = DaqBoard.DBitOut(PortNumA, currentpos, DigitalLogicState.Low); if (Reverse.Checked == false) { switch (currentpos) { case 4: currentpos = 6; break; case 5: currentpos = 7; break; case 6: currentpos = 5; break; case 7: default: currentpos = 4; break; } } else { switch (currentpos) { case 4: currentpos = 7; break; case 5:
25

currentpos = 6; break; case 6: currentpos = 4; break; case 7: default: currentpos = 5; break; } } ULStat = DaqBoard.DBitOut(PortNumA, currentpos, DigitalLogicState.High); timer5.Enabled = true; if (countdownenabled == 1) {count = count - 1; if (count <= 0) {timer4.Enabled = false; countdownenabled = 0;}}} private void timer5_Tick(object sender, EventArgs e) { timer5.Enabled = false; ULStat = DaqBoard.DBitOut(PortNumA, currentpos, DigitalLogicState.Low); } private void step2_Click(object sender, EventArgs e) { if (timer4.Enabled == false) timer4.Enabled = true; step2.Visible = false; stop2.Visible = true; if (timer2.Enabled == true) timer2.Enabled = false; } private void stop2_Click(object sender, EventArgs e) { if (timer4.Enabled == true) timer4.Enabled = false; step2.Visible = true; stop2.Visible = false; if (timer2.Enabled == false) timer2.Enabled = true; } private void textBox1_TextChanged(object sender, EventArgs e) { textBox1.Text = DateTime.Now.ToLongTimeString(); } }

26

M. References 1. Solar Power Organization. "Alternative Energy." Cooler Planet, n.d. Web. 4 Nov 2010. <http://www.solarpower.org/>. 2. MakeItForm. "Compare 2 Materials." N.p., n.d. Web. 4 Nov 2010. <http://www.makeitfrom.com/compare/?left=Acrylic&right=Soda_Lime_Glass>. 3. "Wood Densities." Engineering Tool Box. N.p., n.d. Web. 4 Nov 2010. <http://www.engineeringtoolbox.com/wood-density-d_40.html>. 4. "Fluoropolymer Comparisons: Typical Properties." DuPont Teflon fluoropolymer resins. DuPont Corporation, n.d. Web. 4 Nov 2010. <http://www2.dupont.com/Teflon_Industrial/en_US/tech_info/techinfo_compare.html>. 5. NOAA ESRL, . "Solar Position Calculator." National Oceanic & Atmospheric Association, n.d. Web. 4 Nov 2010. <http://www.srrb.noaa.gov/highlights/sunrise/azel.html>. 6. Lorenzo, Eduardo. "Solar electricity: engineering of photovoltaic systems." Progensa, 1994. Web. 4 Nov 2010. 7. Kuphaldt, Tony. "Stepper Motors." Motors. N.p., n.d. Web. 4 Nov 2010. <http://www.electojects.com/motors/stepper-motors-1.htm>. 8. "User's Guide." USB-1208LS. Measurement Computing, n.d. Web. 4 Nov 2010. <http://www.microdaq.com/measurement_computing/documents/usb-1208ls-usermanual.pdf>. 9. Edwards, Steve. "Custom Sunrise Sunset Calculator." N.p., 2002. Web. 4 Nov 2010. <http://www.sunrisesunset.com/usa/florida.asp>. 10. Pidwirny, Michael. "Earth-Sun Relationships and Insolation." Physical Geography.net. University of British Columbia Okanagan, n.d. Web. 4 Nov 2010. <http://www.physicalgeography.net/fundamentals/6i.html>. 11. "Seasonal Changes and Predictions." Environmental Literacy Council, n.d. Web. 4 Nov 2010. <http://www.enviroliteracy.org/article.php/691.html>. 12. Lundahl, Rob. "Solar Tracking Panel." ATR, n.d. Web. 4 Nov 2010. <http://www.atrcorp.com/solartrackingpanel.php>.

27

Potrebbero piacerti anche