e resp · 2007. 5. 11. · by estimate, we guess that the hall effect sensor will take little...
TRANSCRIPT
Cameron N. Hess – Jon Shambeda – Justin Kelly
Renewable
Energy
Sensor
Package
5.11.2007
RESP.14 Problem Detail
Design & Implementation
Full Results
Final Design Report
Page 1
ABSTRACT:
This project was to continue the 2004-2005 fourteen channel Renewable Energy Data-logger
(RED14) senior project, renewable energy sensors were designed according to objectives and
specifications required by the RED14 design. We designed these sensors with state-of-the-art
accuracy and quality, yet low-cost components. The project also required our development of a
communication method between the sensors and the RED14 data-logger. Project team members are
Jon Shambeda, Justin Kelly, and Cameron Hess; advisors include Dr. David Gray of Engineering and
consultant Stephen Frank.
Page 2
Table of Contents ABSTRACT: ..................................................................................................................................................................... 1 ACKNOWLEDGEMENTS: ............................................................................................................................................... 5
1. INTRODUCTION .................................................................................................................................................................. 6
1.1 DESCRIPTION........................................................................................................................................................................... 6 1.2 LITERATURE REVIEW .................................................................................................................................................................. 6 CURRENT SENSORS........................................................................................................................................................ 6 VOLTAGE DC SENSORS ................................................................................................................................................ 7 VOLTAGE AC SENSORS ................................................................................................................................................ 8 SOLAR INSOLATION SENSORS...................................................................................................................................... 9 WIND SPEED SENSORS ................................................................................................................................................ 10 TEMPERATURE SENSORS.............................................................................................................................................. 13
1.3 SOLUTION ............................................................................................................................................................................. 14 CURRENT SENSORS...................................................................................................................................................... 14 VOLTAGE DC SENSORS .............................................................................................................................................. 15 VOLTAGE AC SENSORS .............................................................................................................................................. 15 SOLAR INSOLATION SENSORS.................................................................................................................................... 15 WIND SPEED SENSOR .................................................................................................................................................. 15 TEMPERATURE SENSORS.............................................................................................................................................. 15 DIGITAL PROTOCOL ................................................................................................................................................... 16 POWER......................................................................................................................................................................... 16 INSTALLATION TIME ..................................................................................................................................................... 16
2. DESIGN PROCESS............................................................................................................................................................. 16
OVERVIEW ................................................................................................................................................................... 16 MICROCHIP AND COMMUNICATION PROTOCOL ................................................................................................. 16 CURRENT SENSORS...................................................................................................................................................... 17 VOLTAGE DC SENSORS .............................................................................................................................................. 18 VOLTAGE AC SENSORS .............................................................................................................................................. 19 SOLAR INSOLATION SENSORS.................................................................................................................................... 19 WIND SPEED SENSOR .................................................................................................................................................. 19 TEMPERATURE SENSORS.............................................................................................................................................. 20
3. IMPLEMENTATION............................................................................................................................................................. 21
3.1 CONSTRUCTION .................................................................................................................................................................... 21 SURFACE MOUNT SOLDERING................................................................................................................................... 21 PART SELECTION.......................................................................................................................................................... 21 MIKROELECKTRONIKA ................................................................................................................................................ 21 PROTOTYPE MACHINE ................................................................................................................................................ 22 ENCLOSURE ................................................................................................................................................................. 22 SOLAR CELL SEALING ................................................................................................................................................. 22
3.2 OPERATION........................................................................................................................................................................... 23 CURRENT SENSORS...................................................................................................................................................... 23 VOLTAGE DC SENSORS .............................................................................................................................................. 23 VOLTAGE AC SENSORS .............................................................................................................................................. 24 SOLAR INSOLATION SENSORS.................................................................................................................................... 24 WIND SPEED SENSOR .................................................................................................................................................. 24 TEMPERATURE SENSORS.............................................................................................................................................. 25 INTERFACE I2C ............................................................................................................................................................. 26 INSTALLATION .............................................................................................................................................................. 26 CALIBRATION............................................................................................................................................................... 26
4. SCHEDULE ......................................................................................................................................................................... 27
5. BUDGET ............................................................................................................................................................................. 28
Page 3
DIRECT CURRENT SENSOR: PV CURRENT, WIND TURBINE, CHARGE CONTROLLER............................................... 28 DIRECT CURRENT SENSOR: BATTERIES........................................................................................................................ 28 ALTERNATING CURRENT SENSOR............................................................................................................................... 28 TEMPERATURE SENSOR: PV ARRAY, ENVIRONMENT ................................................................................................ 29 TEMPERATURE SENSOR: BATTERY ............................................................................................................................... 29 WIND SPEED SENSOR .................................................................................................................................................. 29 SOLAR INSOLATION SENSOR...................................................................................................................................... 29 DC VOLTAGE SENSOR................................................................................................................................................ 30 AC VOLTAGE SENSOR................................................................................................................................................ 30 TOTALS FOR SENSOR COSTS: ..................................................................................................................................... 31 TOTAL BUDGET: ........................................................................................................................................................... 32
6. CONCLUSIONS................................................................................................................................................................. 33
LESSONS LEARNED ...................................................................................................................................................... 35
7. RECOMMENDATIONS FOR FUTURE WORK...................................................................................................................... 36
BIBLIOGRAPHY ..................................................................................................................................................................... 37
APPENDIX A – SPECIFICATIONS.......................................................................................................................................... 38
DC Voltage & Current Sensor (Solar Array and Wind) .......................................................................................... 39 GENERAL...................................................................................................................................................................... 39 ELECTRICAL ................................................................................................................................................................. 39 DC Voltage / DC Current Sensor (Battery) ............................................................................................................. 40 GENERAL...................................................................................................................................................................... 40 ELECTRICAL ................................................................................................................................................................. 40 AC Voltage / AC Current Sensor (Inverter Output) ............................................................................................... 41 GENERAL...................................................................................................................................................................... 41 ELECTRICAL ................................................................................................................................................................. 41 DC Current Sensor (Inverter Input Current)............................................................................................................. 42 GENERAL...................................................................................................................................................................... 42 ELECTRICAL ................................................................................................................................................................. 42 Temperature Sensor (Battery and Solar Array) ....................................................................................................... 43 GENERAL...................................................................................................................................................................... 43 ELECTRICAL ................................................................................................................................................................. 43 Temperature Sensor (Environment).......................................................................................................................... 44 GENERAL...................................................................................................................................................................... 44 ELECTRICAL ................................................................................................................................................................. 44 Solar Insolation Sensor (Environment) ...................................................................................................................... 45 GENERAL...................................................................................................................................................................... 45 ELECTRICAL ................................................................................................................................................................. 45 Wind Speed Sensor (Environment)........................................................................................................................... 46 GENERAL...................................................................................................................................................................... 46 ELECTRICAL ................................................................................................................................................................. 46
APPENDIX B – SCHEMATICS................................................................................................................................................ 47
GLOBAL RENEWABLE ENERGY SENSOR/DATALOGGER SYSTEM DIAGRAM: ........................................................ 47 WIND SPEED SENSOR: WIND SPEED RANGE 0-50MPH............................................................................................. 48 AC VOLTAGE SENSOR................................................................................................................................................ 50 DC VOLTAGE SENSOR: PV/WIND TURBINE ............................................................................................................... 52 LONG DISTANCE I2C COMMUNICATION ................................................................................................................. 55 SOLAR INSOLATION SENSOR...................................................................................................................................... 55 TEMPERATURE SENSOR ............................................................................................................................................... 57 INVERTER ALTERNATING CURRENT OUTPUT .............................................................................................................. 58 PV/WIND TURBINE CURRENT OUTPUT ........................................................................................................................ 58 BATTERY DIRECT CURRENT SENSOR ........................................................................................................................... 59
Page 4
APPENDIX C – MICROPROCESSOR CODE ......................................................................................................................... 60
I2C COMMUNICATION PROTOCOL FOR THE MASTER PIC18F2515 IN C:............................................................... 60
APPENDIX D – TEST DATA / GRAPHS................................................................................................................................... 72
APPENDIX E – SCHEDULE ..................................................................................................................................................... 83
Page 5
ACKNOWLEDGEMENTS:
We would like to thank all of our professors for their help especially Dr. David Gray, our
advisor.
Page 6
1. Introduction
1.1 Description
We designed fourteen sensors according to objectives and specifications required by the
Renewable Energy Data Logger with simplicity at the heart our design, installation, and use. For
communication between the sensors and the RED14 box, we adapted the I2C protocol, determined the
connection apparatus to connect the sensors to the data-logger on the physical level, and created
circuitry to allow for communication over long wires (up to 100 yards). We optimized the design for
cost and designed the sensors to consume less than one Watt of power in total from the data-logger.
Finally, we designed a method for calibrating each sensor to ensure its accuracy.
1.2 Literature Review
CURRENT SENSORS
Types or ways of measuring
• Galvanometer – consists of a coil of wire and some permanent magnets. Current running
through the coil causes it to twist to the side. It may need some type of circuit to transducer the
motion into an electrical signal.
• Hall Effect sensor – uses the Hall Effect to measure a very small voltage across a metal strip in
a magnetic field. This device requires amplification so digital interfaces are common. There are
two types of Hall Effect sensors: open-loop and closed-loop. Closed-loop devices have a
feedback current that cancels the magnetic field present on the ferrite core, while open-loop
devices merely measure the voltage induced by the magnetic field (From Source “Hall-Effect
Current…”)
• Current Shunt – places a known low resistance resistor in the circuit and measures the voltage
across that resistor. Pros and Cons
Device Galvanometer Current Shunt Hall Effect
Pro -cheap
-easy design
-simple
-high precision
-common
-state of the art technology
-no need to break the circuit
Con -must be transduced
-difficult construction
-have to break the circuit
-have to break the circuit
-higher power draw
-small voltage result
-will have to be amplified
-difficult to build
Page 7
Existing Accuracies
Current Shunt: .25%
Hall Effect: 1%
Estimated Cost of Buying
Galvanometer: $15
Current Shunt: $20
Hall Effect: $5-$30
Power Usage
Variable power usage, depending on the method, seems to range from 5-50mA.
VOLTAGE DC SENSORS
Types or Ways of Measuring
• A high resistance ammeter
• Simple voltage scaling by series resistors
• Voltage Scaling by op-amps
• Digital voltmeter (an integrator along with a known voltage causes a test voltage to go up for a
certain amount of time, then an unknown voltage is used to take the test voltage down to its
original state; the whole process is timed and the unknown voltage can be determined by time
ratios and the value of the known voltage).
Pros and Cons
Method High-resistance
Ammeter
Series-resister voltage
scaling
Op-amp voltage
scaling
Digital
voltmeter
Pros -Low wattage
-Simple design
-Combines with
ammeter design
-Low wattage
-Few components
-Low cost
-Simple design
-Few Components
-Low cost
-Simple design
-Very precise
Cons -Inaccuracies from
resistors.
-Precision depends on
components
-Precision depends on
components
-Complex
Design
-High
wattage Existing Accuracies
Page 8
The general resolution for this type of sensor was .1%. The best reasonable sensor found had a
resolution of .025%.
Estimated Cost of Buying
If we were to buy this piece, we would have to adapt it anyway, so building the piece to our
specifications would be most cost efficient and allow for our own designs.
Power Usage
Variable power usage. Depending on the method, tests will need to be performed. We have general
idea for high or low power, but the exact numbers will depend largely on our design
VOLTAGE AC SENSORS
Types or Ways of Measuring
• Using a Hall effect sensor by having a specific current relate to the voltage linearly
• Using a precision rectifier and measuring the DC voltage similar to the previous process
Pros and Cons
Method Hall Effect Sensor Precision Rectifier to DC Voltage
Pros -could be self-powered with low wattage
-could be quite precise if fine tuned
-simple Design, DC Voltage sensor above
-very little design work
Cons -requires a lot of design work
-complex design
-would definitely need calibration because
of the inaccuracies of components and the
precision required.
-large scale AC voltage scaling requires
inaccurate and possibly large chips
-probably more power than Hall effect
-inaccuracy with low voltages possible
-would probably need calibration because of
the inaccuracies of components and the
precision required.
Existing Accuracies
The resolution in the field averaged 500 and the max found was 1000.
Estimated Cost of Buying
Page 9
We found one sensor that exactly matches the specifications in the website below. This sensor sold for
over 100 Euros, which is more than $100, so building would definitely be the preferred method.
Other similar sensors were also over $100.
Power Usage
The power usage for the meters we found included digital processing and LED displays so we
neglected using this information as accurate. By estimate, we guess that the Hall Effect sensor will
take little energy and the Precision Rectifier will take more energy, but still no number can be placed
on this.
SOLAR INSOLATION SENSORS
Types or Ways of Measuring
For the sensor part
• Photodiodes – produces a voltage current when illuminated
• Photocells – an array of photodiodes
• Phototransistors – like a photodiode except slower, yet more sensitive
• Photo-resistors – change resistance when illuminated
• Thermopile sensors – IR directly related to a voltage output
For scaling
• Photomultipliers – multiplies the incoming light by some factor (currently high gain)
• Polarization – the sensor is placed behind a set of offset polarized lenses
• Screening – the sensor is placed behind an opaque lens
Other optical sensors
• CCD’s – capacitors sensitive to light (used in digital cameras, 70%)
• Active pixel sensors – cheap alternative to CCD’s
• Image sensors – an array of CCD’s or Active Pixel sensors
Pros and Cons
In the field today, the only practical used options for measuring solar insolation are either
photovoltaic cells or thermopiles.
Photovoltaic Cells Thermopiles
Pros -inexpensive -inputs all frequencies
-much higher resolution
Cons -age and become less accurate -more complicated
Page 10
-accepts only a limited set of frequencies -external power needed
Existing Accuracies
Most solar insolation sensors we found were sensitive to the nearest 1% to 0.1% for photovoltaic and
to the nearest 0.1% to 0.01% for thermopiles.
Estimated Cost of Buying
Solar insolation sensors tend to be expensive, costing between $250 and $600 each.
Power Usage
Power usage for the photovoltaic will be non-existent or low, while the power usage for the
thermopile will be low but present.
WIND SPEED SENSORS
Types or Ways of Measuring
Rotational (either "bridled" or freely rotating cups or vanes)
o about a horizontal axis
o about a vertical axis
o shown to be too sluggish for wind gusts
o only measures velocity
Pressure tube
o measures velocity and direction
Deflection
o of a hinged, swinging plate
o of a hanging sphere
o of a plate held normal to the wind (including a drag force anemometer that can be used
in supersonic flow)
Thermoelectric
• hot-wire
o measures a fluid velocity by noting the heat convected away by the fluid.
o heat lost to fluid convection is a function of the fluid velocity.
o (circuit 11 below) increases V-OUT until the power dissipated in the wire
sensing element, and hence its temperature and resistance, has risen to
the point where the bridge is at equilibrium. Air movement past the wire would cool
it, but V-OUT increases compensate for the increased dissipation restoring the wire
to its equilibrium temperature. The equilibrium behavior of the system is
Page 11
independent of the heat capacity of the wire. However, the dynamic response, and
noise figure, are both improved by minimizing the size of the wire.
• hot-film
� Sample
Circuit
• ultrasonic and LASER Doppler
� measure the phase shift of sound or coherent light reflected off of moving air
molecules
Some Schematics/Examples:
Source "An Anemometer Circuit…”
Source “Windmeter/Anemometer… “
Records wind speed from 0-38mph
Cost to make: < $300
Page 12
Pros and Cons
Method Hot-Wire
Pros -Excellent spatial resolution
-High frequency response
- >10 kHz (up to 400 kHz)
Cons -Fragile, can be used only in clean gas flows
-Needs to be recalibrated frequently due to dust accumulation (unless the flow is very
clean)
-High cost
Existing Accuracies
• Propeller type (i.e. – R. M. Young: Model 05103)
o Resolution: 0.2 m/s
o Range: 1-20 m/s (0.4-36 m/s)
o Accuracy: ±0.3 m/s or 3%
• “Traceable® Anemometer/Thermometer” (Source “Traceable Anemometer… ”)
o Anemometer accuracy is ±3% of full scale
o 0.9 to 67.0 miles per hour - .1 m/h resolution
• Model 014A Met One Wind Speed Sensor (Source “Model 014A Met One… “)
o Threshold: 0.45 m/s (1 mph)
o Calibrated Range: 0-45 m/s (0-100 mph)
o Gust Survival: 0-53 m/s (0-120 mph)
o Accuracy: 1.5% or .11 m/s (0.25 mph)
Page 13
o Temperature Range: -50 C to +70 C
o Distance Constant Standard: < 4.6 m (15 ft) (Aluminum cups)
o Optional Fast Response: < 1.5 m (5ft) (Lexan Cups)
o Weight: 680 grams (1.5 lbs)
• From Source “WindSonic - Ultrasonic Wind… “
o Wind speed range: 0.1m/s to 60m/s
o Wind speed accuracy: +/- 2%
o Wind direction range: 0 - 360° (no dead band)
o Wind direction accuracy: +/- 3°
Estimated Cost of Buying The price of anemometers varies significantly depending on the quality of the device. Prices range from roughly $90 to $475. Power Usage
• Low Power Example (Source “Anemometers from Vector… “)
6.5-28VDC & <2mA (.013W-.056W)
• From Source “Model 014A Met One… ”
9 - 30 VDC at 40mA typical
• From Source “A100L2 Low Power Anemometer… “
6.5..28V DC (max 2mA, average is typically less than 1mA
TEMPERATURE SENSORS
Types or Ways of Measuring
• Resistance Temperature Detectors (RTDs) (PRTs)
• Thermocouples
• Thermistors
Page 14
Pros and Cons
Method RTD’s Thermocouples Thermistors
Pros -excellent means of measuring
average temp with wire spread out
-recommended for accuracy,
linearity, stability
-have high readout
Cons -is bulky & therefore temp
measurement is not possible at a
point
-max signal for a required
measurement is limited
-are considered to not be
stable
-non-linear and require a
reference temperature
-are very non-linear
-even with calibration
drift is existent
Existing Accuracies
• -50 °C to +50 °C, ±0.1 °C for general purpose
• -50 °C to +50 °C, ±0.05 °C for high accuracy; for dual measurement for differential
temperature (ΔT)
• -30 °C to +50 °C, ±0.1-0.15 °C for some specialized configurations
Estimated Cost of Buying Prices range significantly, depending on specialization of hardware and added hardware from roughly $70 to even $800. Power Usage Power usages for these devices span a decent range, but we guess the power usage will be around 10 mW for our purposes.
1.3 Solution
CURRENT SENSORS
We used Hall Effect sensors because of their low cost and ease of installation. Hall Effect
sensors allowed us to have a current sensor that does not require breaking the existing cabling by
Page 15
going between. This decreased installation time. We also selected Hall Effect sensors because shunts
are bulky, temperature sensitive, and expensive for high ranges.
VOLTAGE DC SENSORS
The high resistance ammeter and the digital voltmeter are complicated circuits and more
expensive, so we did not use these methods. This left of decision to the choice between series-resistor
voltage scaling and op-amp voltage scaling. We used a mix of both of these methods because series
resistor methods were required in our design for large voltages and op-amps were required for low
output impedances.
VOLTAGE AC SENSORS
We used the same circuit that we used for the DC voltage sensors to scale the AC voltage
down to a measurable value. We then used a precision rectifier to convert the AC voltage to a DC
voltage because of its inexpensiveness and our testing that showed that we could reach the desired
accuracy. Commercially available parts were much more expensive and more difficult to integrate
into our system.
SOLAR INSOLATION SENSORS
The two alternatives that we chose between were photovoltaic cells and thermopiles. Since we
were only interested in the wavelengths that are received by photovoltaic cells (as this is what solar
power systems are made of), the photovoltaic cells were the logical choice for our application. We
overcame the natural decay of the photovoltaic cells by requiring a compensation method in
software.
WIND SPEED SENSOR
We did not use a hot wire approach because hot wire wind sensors require the wind to be
made of clean air to be accurate; dust and dirt can cause inaccuracies. We utilized a cup anemometer
design, as this design allowed for the most cost-efficient and accurate method of wind speed
measurement. We ordered the anemometer from inspeed.com because the mechanical requirements
for building an accurate wind sensor exceeded the scope of our project.
TEMPERATURE SENSORS
To measure temperature, we used the MAX6633 integrated circuit. This allowed for the most
cost efficient method of temperature sensing because this chip senses temperature and has an I2C
output. An analog sensor would have required additional circuitry to achieve the same result.
Page 16
DIGITAL PROTOCOL
We decided to interface all of the sensors to the data-logger with the I2C digital protocol. With
an all-digital system, we should have less noise issues and an easy time adapting the system to a
data-logger (since we know the RED14 box can communicate in I2C protocol).
POWER
For power, we built a board that would make 0, +5, +12, and -12 VDC inputs for other boards
easily available from our 0 and +5 VDC input from the RED14.
During the design process, we attempted to choose devices that used low power. The one
exception to this was the current sensors, where each of the 5 devices selected were rated to use
around 80mW of power. The shunt alternative would have been less power, but would have had
additional cost and much more complexity.
INSTALLATION TIME
To keep our installation time below two hours we attempted to make all wire connections
logical and straightforward. This was difficult because the large number of external connections
required by the fourteen discrete sensors. We decided to use a hardware connection board to
interface most of the external connections. We chose to house all of the sensors together in a single
box since most of the sensors were within 20 feet of a central location and the long distance sensors
could be encased individually with epoxy. This kept all of our large circuit boards in a single box to
keep the installation as simple as possible.
2. Design Process
OVERVIEW
All of our sensors are multiplexed into the I2C communication protocol, which we can be
interfaced with the RED14 data-logger. A block diagram of all of the types of sensors and how they
are transduced to I2C is in Appendix B.
MICROCHIP AND COMMUNICATION PROTOCOL
We chose I2C as the communication protocol for our project because it provides the properties
we needed. It provided simple serial communication between multiple masters (we only needed
Page 17
one) and multiple slaves over bi-directional lines. All it required was a serial data line (SDA) and a
serial clock line (SCL) and two pull-up resistors. Conveniently, it is widely used and documented.
We were not able to interface directly with the RED14 mainly because there was some
additional work to be completed on that project that prevented us interfacing with their
microprocessor; therefore, we implemented our own I2C master, which simulated communication
between our sensor package and the RED14.
The choice for our master microchip for I2C communication changed throughout the life of our
project, as we more thoroughly understood desirable features for the chip; these choices made the
writing, testing, and debugging of our code with the sensor(s) mush easier and time efficient; also,
the chip came in a DIP, which made the chip much easier to prototype. Initially, we chose the
Motorola 68HC11 and chose to write the I2C code in assembly because documentation was provided
for standard I2C communication assembly code, we were familiar with the instruction set of the
microchip itself, and it was conveniently available in the electronics lab (Frey 254).
After consideration of how we would flash the code to the microchip itself, we decided to
change our microprocessor and began programming the PIC16C717 using assembly language. This
decision was advantageous for several reasons. The PIC16C717 microcontroller had hardware
routines specifically for the I2C communication protocol, which simplified much of the code and had
a large set of documentation for programming I2C communication protocol in assembly language.
For example, the hardware support included an MSSP module, which allowed for I2C serial
communication between the master chip and the slave chip and had other hardware registers for
controlling the I2C communication and sending and receiving data via the MSSP module. In
addition, the PIC16C717 was directly compatible with the program MPLAB that included convenient
‘include’ files specifically for the PIC16C717 and debugging options for the I2C assembly code.
Additionally, the PIC16C717 was chosen because we thought it was completely compatible with the
PICFLASH2 code flashing device and software, the EasyPIC3 development board, and the associated
mikroBasic program.
We then realized the PIC16C717 did not have FLASH memory, as would be needed to burn
the code to the chip several times for debugging, it only had one-time programmable memory (OTP).
Thus, we decided on the PIC18F2515 microchip, which also provided the same standard I2C
hardware solutions as the PIC16C717, provided flash memory, and was in supply in the electronics
lab (Frey 254). This microchip was therefore directly compatible with the PICFLASH2 program
where as the PIC16C717 was not. Then for debugging purposes, we decided to convert the code to
the higher level Basic language, which gave us use of the mikroBasic program, its software and
hardware (ICD) debugging capabilities, and its integration with the PICFLASH2 flashing program.
CURRENT SENSORS
The current sensors required us to be capable of measuring within the ranges mentioned in
our specification chart (Appendix A). Although it was not specified, each sensor also needed to be
Page 18
able to fit around particular gauge wire. We initially considered building our own sensor, but the
amount of mechanical design required for production level Hall Effect sensors was too great.
Therefore, we began to search through catalogs to find Hall Effect sensors capable of our sensing
range and wire sizes.
We found a company, the Tamura Corporation that had an extensive line of sensors that fit
our application well. For the 500A specification, we obtained the L03S500D15 Tamura Hall effect
current sensor; for the 100A specification, we obtained the L08P100D15 Tamura Hall effect current
sensor; and for the 50A specification, we obtained the L08P050D15 Tamura Hall effect current sensor.
These sensors are based on Hall Effect technology and therefore are small and reasonably priced.
They are also a loop style that makes them better for retrofitting to systems; the sensor can be slid
over an existing wire and does not require a break in the line like a shunt. The Tamura transducers
have a +/-15V input and a 0-4V output. There was a different product line that only required 5V
input, which would have simplified the power circuitry, but the output was sensitive to the stability
of the input voltage.
Our specifications mentioned only the amperage for each current sensor, not the wire gauge,
so there was a potential problem with wire sizing that we came across. For example, the battery
direct current sensor must measure up to 500 Amps, but the sensor we selected only has an opening
big enough for round wire up to #3/0 (10.4 mm diameter). However, a #3/0 wire cannot safely
conduct 500ADC, so the sensor cannot practically measure 500ADC. The actual dimensions of the
opening are 10.5mm by 20.5mm, so it could measure an odd shaped wire or metal bar, but that is not
very practical.
The last consideration we had to make was how to interface the current sensors with our I2C
communication protocol. Since the transducers provide 0-4V output based on the input, we decided
that a simple A/D converter with integrated I2C output is the best solution. To balance the line and to
provide low output impedance for the analog to digital (A/D) converter, we ran the output of the
Tamura current sensor through a simple differential input operational amplifier circuit.
VOLTAGE DC SENSORS
For the voltage DC sensors, we began by making calculations for the voltage scaling circuit.
An error in our assumptions caused our circuit design to fail because the operational amplifiers that
we selected would not allow input voltages over 25V. Since our line voltages could be anywhere in
the range of (600V) to 600V, we decided to place a resistive scaling circuit in front of the operational
amplifier scaling circuit. This lowered the voltages from -600V to 600V down to -4V to 4V. We passed
this through a differential operational amplifier that gave us the voltage difference between the two
wires in reference to ground that we measured with an A/D converter. This gave us a digital
measurement that was proportional to the input voltage.
Schematics for this sensor are in Appendix B.
Page 19
VOLTAGE AC SENSORS
When designing the AC voltage sensor, we used the same circuit as the DC voltage sensor
with the scaling going from 500 Vac RMS down to 4 Vac Pk and put the output of that circuit through
an ideal rectifier. We used the ideal rectifier to determine the highest level of the wave, which we
could then put into the A/D converter.
Schematics for this sensor are listed in Appendix B.
SOLAR INSOLATION SENSORS
The solar insolation board required many more design considerations than most of the other
designs. For the solar insolation board, we short circuited the output of a photovoltaic cell and
measured the current produced. This current was supposed to be proportional to the power of the
light reaching the surface of the solar cell. We measured that current with the ACS712 Hall Effect
sensor. This is an IC from Allegro Microsystems Inc., which outputs a voltage that is linearly related
to the current. The solar cell had a natural offset that was linearly related to the temperature of the
cell, so we included a temperature sensor that measured the temperature of the solar cell. The
temperature sensor output a voltage that we scaled and combined with the output of the Hall Effect
sensor to negate the effect of temperature on our measurement. The output would be linearly related
to the solar insolation regardless of temperature and would be in the range of 0-4 VDC. That output
was fed into an A/D converter, which would talk with the I2C master.
To calculate our scaling multipliers, we planned to test the correlation between the
temperature and the current levels for short-circuiting the board to relate the two. These estimates
would determine how the temperature affects the short circuit current for a steady insolation.
Schematics for this sensor are in Appendix B
WIND SPEED SENSOR
For the wind-speed sensor, we used a cup anemometer (Inspeed Vortex Wind Sensor from
inspeed.com) that had a resistance across two wires that would change depending upon the position
in the rotational cycle. The resistance changed between a virtual short circuit and a virtual open
circuit. By attaching one end of this wire to +5V we created a square wave on the other end of the
wire. The frequency of the square wave was linearly related to the rotations per second of the sensor,
which was linearly related to the speed of the wind. Therefore, by inputting the square wave into a
microprocessor that counted the frequency of the square wave, we were able to calculate wind speed.
For the microprocessor, we used a PIC..., which was capable of communicating in the I2C protocol.
Schematics for the circuit board that attaches to the anemometer are in Appendix B. The code we
wrote for the microprocessor is in Appendix C.
Page 20
TEMPERATURE SENSORS
For the temperature sensors, we decided on the MAX6633, a temperature sensor that natively
outputs in the digital I2C protocol. The only considerations we needed to take with this sensor were
how to mount it, weatherproof it, and whether we would need to use an I2C buffer to enable the I2C
to work over a long wire.
To enable outdoor mounting and weatherproofing for this sensor, we found an electronics
enclosure epoxy to encase the temperature sensors in, and depending on which sensor was being
mounted, we determined either to mount the sensor freely (as for the ambient temperature sensor) or
to attach it directly to the object whose temperature was being measured.
Since the I2C output for these sensors may be up to 50 meters away from the I2C master and
the I2C protocol is only intended for short distance, we had to provide some long distance buffering.
We found an IC made by Phillips that provided extra power to decrease the capacitive damping of
the long wire runs when placed on both sides of the long wire.
Schematics for the long distance buffer are in Appendix B.
Page 21
3. Implementation
3.1 Construction
SURFACE MOUNT SOLDERING
During the design phase of this project, we made many decisions about which integrated
circuit to use. While we attempted to use the Dual Inline Packages that are easy to solder, we ran into
difficulty when we found some critical devices were only available in surface mount technology
(SMT) packages. Initially we thought it would be fairly easy to solder these devices, but construction
proved surface mount soldering to be a significant obstacle.
Secondary to the actual difficulty with soldering was our trouble with the precision of our
manufacturing techniques. We had planned to use the engineering department’s PCB milling
machine for all our work since small boards on that device only cost around $5 each. However, this
machine could not easily mill out the very small traces needed for our small SMT chips. We therefore
had to place a more expensive order with a company specializing in small PCB boards etched in a
more precise manner.
We bought some conductive epoxy to overcome some of our surface mount soldering issues
because it was suggested to us by another student who had previously worked with surface mount
chips. Even this proved to be a challenge, one that was not impossible, but it was still quite difficult.
PART SELECTION
We initially planned to use a particular A/D converter to convert all of our signals into a digital
value the data-logger could easily read. The chip we decided on had 4 input channels meaning we
needed 4 different chips. Each device on the I2C bus must have a unique hardwired address to avoid
data conflicts and corruption. The data-sheet for the chip suggested that each chip had a factory set
address and that different part numbers came with different addresses. We successfully ordered
samples and tested them, but when we went to order chips with alternate addresses, they were not
available. Apparently, they are only available for large production runs. Because of this, we had to
modify our design to use a different single package 12 channel A/D converter.
MIKROELECKTRONIKA
Because of the efficiency, compatibility, and relevant convenience of the PICFlash2 USB 2.0 In-
System programmer for PIC microchips, we were confined to the software development tools
produced by MikroElectronika. This was because MikroElectronika’s programs were integrated with
the PICFlash2 device and directly compatible with most PIC microchips, providing helpful software
routines and directives. The programs we utilized were initially the mikroBasic compiler and finally
the mikroC compiler. We initially made use of the mikroBasic compiler because Basic was the
Page 22
simplest of the unfamiliar programming languages for us to begin learning and implementing. The
mikroBasic compiler also had some very helpful standard I2C routines for implementation on our
PIC18F2515. These built-in routines, however, failed to function. The reason for this was not clear to
us; however, the mikroBasic compiler seemed to consistently perform erratically while we used it and
may have had some installation errors, or perhaps the I2C routines or the program itself were simply
poorly constructed. Regardless, this setback caused a notable delay in our I2C implementation’s
completion. Considering our limited remaining time, we were forced to seek another solution:
software-driven I2C. Thus, we discovered some open-source, standard I2C routines written in C for
software I2C implementation with PIC microprocessors. We were then able to successfully adapt this
code for our processor and its desired functionality within MikroElectronika’s mikroC program.
PROTOTYPE MACHINE
Most of our boards simply needed to be milled out, soldered together, and tested. We used
Ultiboard to create the board layouts for our final design and transferred them to the milling
machine. We milled several boards over many weeks for many of our sensors.
We had a few issued with the milling machine and the milling head moving up and down. The
lubricant that allowed the head to move up and down become thick twice, causing the milling
machine to be unusable for about a day each time.
We also had issues with soldering a few connections. When we had put together the voltage
boards the first time, none of them worked according to what we expected. We learned first that
soldering ICs directly onto a milled board can cause the IC to stop working because of electrostatic
discharge. We were able to fix this problem by soldering terminals onto the board and connecting the
ICs to the terminals. We also had some poor connections between the board that were causing some
of the connections to be unconnected. By re-soldering our connections, we were able to make every
voltage board work according to our specifications.
ENCLOSURE
We wanted to have a single unified enclosure that would be capable of handling all of our
inputs and outputs to make the installation as simple as possible, so we decided to buy an enclosure.
We determined that since our enclosure would be near a battery system that we would not need to be
concerned about meeting NEMA standards for boxes (standards that ensure waterproof, airtight, etc).
We bought an enclosure from Hammond Manufacturing (part no #1411Z) that was 17” x 5” x 4”. This
allowed us to mount our circuit boards (4” x 3” maximum) onto screws that created 5 stacks of
boards. A schematic of this can be seen in Appendix B.
SOLAR CELL SEALING
Sealing the solar cell that we needed to use to measure the solar insolation proved to be a
difficult challenge. With none of us knowing how to seal a solar cell and no professors knowing a
good method, we spent hours on the internet determining methods for sealing the solar cell.
Page 23
However, the method that we determined to be the best was not the same way that we ended up
being sealing our prototype because it would have cost over $100 for supplies only. Both designs
require the initial step to be the connection of tabbing to the solar cell. Tabbing creates the electrical
connection that is required to have a working solar cell. The three important design considerations
after this were selecting a material to back the solar cell with for strength, selecting a method of
adhering the solar cell to that backing material, and sealing the solar cell and backing material from
the elements.
The design we used for our prototype used a cardboard backing for strength. We used
masking tape to adhere the silicon and the plastic backing. For sealing the cell, we used a clear spray
on acrylic.
The design we suggest for our final design would use a fiberglass back panel. Fiberglass was
one of the most common types of back panel that we found. To connect the solar cells to the fiberglass
back panel, we found that 3M VHB Double Sided Tape Y9473 would suit our needs and be an
inexpensive alternative. For our sealing, we chose the clear spray on acrylic because it is inexpensive
and is used in the solar industry.
3.2 Operation
CURRENT SENSORS
We were able to test the lower levels of all of our current sensors in the lab very easily. We
connected the appropriate cable to the pin-out of the Tamura sensors according to the manufactures
specifications. We then connected a lab power supply through a precision ammeter and across a 10
Ohm power resistor. We next measured the output of the sensor as we varied the voltage on the
meter. Test data for this sensor is available in Appendix D.
Our data was very linear and confirmed the manufacture’s specifications (1% of max). We
could not test the high ranges safely or accurately, so we were unable to truly look at the full range
required by the current sensor specifications. However, given the very high precision and accuracy in
the tested range, and the manufacture’s specifications, we feel that the sensors can successfully
perform according to our specifications.
VOLTAGE DC SENSORS
The design process for the DC voltage sensors also required us to make a test board capable of
creating 600VDC. We created a board with 12 individual capacitors that could be charged up to 60V
each. Since the capacitors slowly drain over time, we made it capable of a higher voltage than we
actually needed. We successfully were capable of charging this board up to 630VDC, which
surpassed our 600VDC requirement.
The next step was to test our design before building boards and assuming that it would work.
We built the design on a breadboard to test. We charged the testing board up to 600V and let it drain
Page 24
connected to the sensor. We measured the input and output voltages of the sensor by recording a
video of the voltage draining. We then analyzed the video frame by frame to correlate the two
voltages. This did not allow the precision that we were originally looking for. We needed to find a
machine capable of one more digit of precision than the multi-meter that we were using. We used a
precision meter and did the experiment again. This time we were able to assess the method and
determine that it was a feasible alternative to get the precision we desired. Test data for this sensor is
available in Appendix D.
VOLTAGE AC SENSORS
We tested this using a smaller voltage sinusoidal wave generator and determined what the
error of the ideal rectifier would be. We again used the four digit precision multi-meter and found
that with a large capacitor (>5mF) we were capable of the precision we desired for the voltage range
of 0-4Vpk.
We tested our AC Voltage Sensor by using a smaller range of 0-140Vac. When we originally
tested the sensor, we were having errors because of an offset DC voltage component going to our
ideal rectifier. Since we had tested our ideal rectifier with a pure AC Voltage, we did not think about
compensating for DC voltages by filtering the input. When we placed a filter on the input of the ideal
rectifier, our AC Voltage sensor worked well within its range of error. We only tested in the range 0-
140Vac, but each component worked properly when tested individually with higher voltages. Future
work would involve testing the higher ranges that we could not easily simulate. Test data for this
sensor is available in Appendix D.
SOLAR INSOLATION SENSORS
We attempted to test our solar sensor by first comparing the short circuit current of our solar
cell against an analog solar insolation meter. Unfortunately, that sensor was not calibrated and very
unresponsive. We could visually detect differences in sunlight but the meter would not change, and
the current of our solar cell would change dramatically while the “control” moved only slightly. Our
data is recorded in Appendix D, but it means very little except that this sensor is untested. Future
work would definitely be to find a good control and actually finish testing this sensor.
Another aspect of this sensor that still needs to be tested is the temperature compensation
circuit we developed. Since the current that is linearly related to the solar insolation can change with
respect to temperature also, we created the combination circuit as mentioned in the design section.
We would like to test the relationship between the input and output voltages when the solar cell
temperature changes. Test data for this sensor is available in Appendix D.
WIND SPEED SENSOR
This sensor was actually very linear, so an analog frequency counter may have worked;
however, we decided to implement a microprocessor frequency counter. We wrote a software
Page 25
program that measured the interval between pulses, found the equivalent frequency, and then
converted that frequency to miles per hour. This microprocessor also implemented I2C, so there was
no need for an A/D converter.
We were able to test nearly the full range of the Wind Speed Sensor in the engineering fluids
lab. We set up the anemometer inside the wind tunnel and connected the output to the circuit board
designed for it. We then varied the speed of the wind tunnel in increments of 1 MPH from 2-45 MPH.
Our sensor was not responsive below 2MPH, and the wind tunnel was not capable of exceeding
45MPH. We used a hot wire sensor as a control since the wind tunnel control did not have units. Our
data is presented in Appendix D. Test data for this sensor is available in Appendix D.
TEMPERATURE SENSORS
We were able to test our temperature sensor against a digital temperature sensor (T type
thermocouple). We first attempted to walk around in different environments and compare the
MAX6633 to the thermocouple but the greater mass of the 6633 resulted in a significant delay; we
could not measure quickly or the MAX6633 would lag behind the thermocouple. We then decided to
immerse both sensors in heated or cooled water. That way we could maintain a constant temperature
in both sensors for an extended period of time and remove the mass factor. This helped considerably,
and the data from this is presented in Appendix D. While one or two data points are outside of our
specifications that may be due to the waterproofing method for the MAX6633. We had to seal it from
water because this testing was done before waterproofing the sensor, so we simply wrapped it in a
plastic bag. This may have added some air bubbles to the sensor when submerged and altered our
results. Test data for this sensor is available in Appendix D.
Page 26
INTERFACE I2C
We were able to test only the temperature sensor along with the I2C protocol. Most of the other
sensors were input to an A-D converter. We had problems placing the A-D converter we had selected
onto a board because it was surface mount. We tried soldering many ways for several days, but were
unable to have success with the surface mount soldering and this chip. From what we can see with
the temperature sensor, we successfully have interfaced with I2C, but we were unable to successfully
test our A-D converter that output I2C.
INSTALLATION
While we planned to keep the installation time below two hours, we were not able to actually
test the true time. While we did purchase an electronics enclosure and installed set screws to place
the circuit boards inside a single package, we were not able to interconnect the circuit boards. We
have no data to suggest the time for installation, but estimate that this is achievable considering that
there are 52 cables coming out of the box, and no cable should take more than two minutes.
CALIBRATION
For our calibration objective, it is hard to quantify our results. We can use the fact that the
sensors we tested were successfully calibrated by us to prove that our calibration method worked,
but the meters we used throughout the year might not have been calibrated themselves. We believe
that we have met this objective sufficiently on all of the sensors that we feel have a final design and
are well tested.
Page 27
4. Schedule
Our Project Gantt Chart can be found in Appendix E. The grey lines indicate original plan that
our team came up with at the beginning of the semester. The red lines are tasks that have been
pushed back and the blue lines are completed tasks as they actually happened.
We organized the project so that Justin and Jon would complete the design of each sensor type
and then build that sensor. They would then proceed to test the sensor. Cameron would work on the
software projects: develop an I2C master, test it, and then work on the wind sensor microprocessor.
The last week we would focus on the presentation and Final Design Report.
The reality of our project was severely impacted by our pace of work and some difficultly with
different parts. Shipping was not really an issue, just our own inability to judge the amount of time a
task would take. For instance, we originally expected programming the I2C master to be a fairly quick
task given the microprocessors hardware support for the protocol. It did, however, take about two
months to really complete the programming.
Page 28
5. Budget
DIRECT CURRENT SENSOR: PV CURRENT, WIND TURBINE, CHARGE CONTROLLER
Part Quantity Cost Per Total Cost Gift In Kind
Hall Effect Sensor 1 $15.62 $15.62 No
Cabling and Encasing 1 $6.40 $6.40 No
Total Cost $22.02 -$0.00
DIRECT CURRENT SENSOR: BATTERIES
Part Quantity Cost Per Total Cost G.I.K.
Hall Effect Sensor 1 $15.62 $15.62 No
Cabling and Encasing 1 $6.40 $6.40 No
Total Cost $22.02 -$0.00
ALTERNATING CURRENT SENSOR
Part Quantity Cost Per Total Cost G.I.K.
Hall Effect Sensor 1 $15.62 $15.62 No
Cabling and Encasing 1 $6.40 $6.40 No
Total Cost $22.02 -$0.00
Page 29
TEMPERATURE SENSOR: PV ARRAY, ENVIRONMENT
Part Quantity Cost Per Total Cost G.I.K.
MAX6633 1 $1.28 $1.28 Yes
Cabling 50 yds. $42.00 $42.00 No
Total Cost $43.28 -$1.28
TEMPERATURE SENSOR: BATTERY
Part Quantity Cost Per Total Cost G.I.K.
MAX6633 1 $1.28 $1.28 Yes
Cabling 20 ft. $5.60 $5.60 No
Total Cost $6.88 -$1.28
WIND SPEED SENSOR
Part Quantity Cost Per Total Cost G.I.K.
Cup Anemometer 1 $30.00 $30.00 Yes
Milled Circuit Board 1 $4.00 $4.00 No
Integrated Circuits 1 $4.61 $4.61 No
Cabling 4 ft. $0.32 $0.32 No
Various Components $0.20 $0.20 No
Total Cost $39.13 -$30.00
SOLAR INSOLATION SENSOR
Part Quantity Cost Per Total Cost G.I.K.
BP Solar PV Cell 1 $3.00 $3.00 Yes
Solar Cell Sealant 1 $1.00 $1.00 No
Page 30
Part Quantity Cost Per Total Cost G.I.K.
Plastic Backing and Tape 1 $1.40 $1.40 No
Milled Circuit Board 1 $4.00 $4.00 No
Integrated Circuits 1 $3.70 $3.70 No
Various Components $1.30 $1.30 No
Total Cost $14.40 -$3.00
DC VOLTAGE SENSOR
Part Quantity Cost Per Total Cost G.I.K.
LMV321 1 $4.00 $4.00 No
Integrated Circuit 1 $0.72 $0.72 No
Cabling 44 ft. $3.52 $3.52 No
Various Components $1.43 $1.43 No
Total Cost $9.67 -$0.00
AC VOLTAGE SENSOR
Part Quantity Cost Per Total Cost G.I.K.
Milled Circuit Board 1 $4.00 $4.00 No
Integrated Circuits 1 $0.80 $0.80 No
Large Capacitor 1 $1.40 $1.40 No
Various Components $2.00 $2.00 No
Cabling 44 ft. $3.52 $3.52 No
Total Cost $11.72 -$0.00
Page 31
TOTALS FOR SENSOR COSTS:
Sensor Quantity Cost Per Total Cost G.I.K.
Direct Current, PV, CC 3 $22.02 $66.06 -$0.00
Direct Current Battery 1 $22.02 $22.02 -$0.00
Alternating Current 1 $22.02 $22.02 -$5.50
Temperature Sensor, PV, Environment 2 $43.28 $86.56 -$2.56
Temperature Sensor Battery 1 $6.88 $6.88 -$1.28
Wind Speed Sensor 1 $39.13 $39.13 -$30.00
Solar Insolation Sensor 1 $14.40 $14.40 -$3.00
DC Voltage Sensor 3 $9.67 $29.01 -$0.00
AC Voltage Sensor 1 $11.72 $11.72 -$0.00
Enclosure, terminal board, and hardware 1 $45.00 $45.00 -$0.00
Subtotal $342.80 -$42.34
Page 32
During the design of our prototype, we had additional costs that were not accounted for by the cost
of the sensor package.
Additional Costs (VDC Testing Board and SMT specialized board):
Component Quantity Cost Per Total Cost G.I.K.
Milled Board 1 $17.92 $17.92 -$0.00
Resistors and Capacitors 1 $15.95 $15.95 -$0.00
SMT Boards 3 $20 $60 -$60.00
Subtotal $93.87 -$60.00
TOTAL BUDGET:
Component Cost G.I.K.
Sensor Costs $297.80 -$42.34
Additional Costs $93.87 -$60.00
Total: $391.67 -$102.34
Page 33
6. Conclusions
Below is a quantitative analysis of each objective and a statement detailing to what level we
completed it:
1. Design and build the fourteen sensors to the accuracies specified by the table in section 6.2:
We were able to successfully build and test 13 of the 14 sensors. Because the insolation
meter we intended to compare our sensor to was unusable, we were unable to verify our solar
insolation sensor. We were also unable to test the full range of each current sensor although
the ranges we could test met the manufactures specifications.
2. Design and build a circuit board that interfaces each sensor to RED14 data logger:
We changed this objective slightly based on our research and the unavailability of the
RED14 data-logger; we decided to build a comprehensive digital communications package to
connect all the sensors together. We were able to test this protocol successfully; however, we
had difficulty with our A/D converters. We were able to ensure that the I2C protocol could
work for long distance communication. While this objective is met, some future work on
integrating the last few sensors into the package should be done.
3. All sensors combined will draw less than one Watt from the RED14 data-logger.
We were able to test each sensor individually and ensure that the total power usage was
under 1W. The following chart shows the power usage of each type of sensor:
Sensor mW
Voltage 120
Solar Radiation 80
Wind Speed 40
Temperature 45
Current 410
DC/DC converter 87
A/D converter 20
Total 802
We attempted to minimize our power usage, but perhaps some work could be done to
try to reduce the power draw of the current transducers.
Page 34
4. Optimize the designs and keep the total cost for the sensors below $250.
We were unable to keep the cost for our design under $250, as shown in Section 5. The
main reason we missed this objective was the twisted pair wiring we intended to use for our
sensors. This cabling was $0.16/foot, and we had several very distant sensors in our
specifications (temperature, solar insolation). Because of this, we had over $120 in wiring costs
for the complete sensor package. A detailed study of various wire types and their effect on the
system could perhaps reveal a cheaper method of wiring. We feel that although we did not
meet this objective that we failed in any way. If our cost for wiring would be this much, then
our competition would have the same costs, maintaining our product as a viable alternative.
5. Develop calibration methods for each sensor that allows the accuracies required.
We developed three different methods for calibration that we allowed us to adjust any
sensor to calibrate to the proper value. Through these three methods, we successfully
developed calibration methods to ensure precision for each of our sensors.
The first method we used was to use transducer to change the measured values into
voltages. This was convenient both because voltages are easy to scale with operational
amplifiers and A/D converters that speak I2C are easy to find. These voltages can be scaled as
needed with potentiometers allowing for large ranges of calibration.
The second method of calibration we used was to buy pre-calibrated chips. We did this
for sensors that would have been unreasonable for us to test or calibrate, for example the
current sensors. These sensors are put through quality control as they were being
manufactured, so we were able to trust their manufacturer’s specifications.
The last method that we used was to calibrate the sensors within software. This was
used only for the wind sensor, but might also be used for other sensors as needed if further
testing requires. Since it is within software, the sensors can be individually calibrated.
6. Keep the time for installation and calibration of sensors below two hours for a well-informed
person.
We were unable to test this objective since our final product was not in a complete
package form. We attempted to fit all of the sensor boards into an enclosure but there are
problems with our design. We never tested a complete install of each board and never had a
chance to simulate installing each sensor. While we did not fail this objective, we certainly did
not achieve it.
Page 35
LESSONS LEARNED
This project was very informative and we learned a lot from it. Leaning the details of I2C
programming and the nature of real world microprocessor development was certainly educational.
We also gained a lot of experience with PCB design and prototyping.
The management aspect of this project was also interesting. We learned about the need for a
strong plan and the importance of sticking to that plan.
Page 36
7. Recommendations for Future Work
If we had it to do all over again, we would have started testing and construction much earlier
(October-December). We waited until the spring semester before we started building circuit boards,
which made our testing not as thorough as, we would have liked it to be. We really had most of the
designs finalized by November, but were too busy or unwilling to start work on them.
Another change we would have made was creating the communication system first in the
design process. The incompleteness of the communication microprocessors late in the semester made
us unable to test as much as we would have liked to. Placing the I2C protocol on a higher priority, i.e.
designing and testing the software in the fall semester would have accelerated our work considerably
In addition, the selection process for the microchip master for the communication protocol was
less than ideal. It would have been more convenient to have selected the ideal microchip,
programming language, and method for flashing the code from the beginning. This was attempted,
but, naturally, many obstacles and changes arose. Lack of experience is to blame for this failing.
The last change that we would have made would be to find through-hole chips instead of
surface mount chips to make board construction much easier. This made the construction process
more expensive and time-consuming than we expected. Alternatively, we could have invested
significant time earlier in the semester acquiring the skills and equipment necessary to perform
surface mount soldering easily.
For future work, we would like to have interfaced the sensors with the actual data-logger to
test the compatibilities of the two devices. Because we were not able to do this, we tested our sensors
individually for brief periods of time. Additional work on the connection to an actual data-logger
might reveal other problems that must be overcome.
We would also like to perfect the code for the communication protocol to maximize its
efficiency and handle any possible errors. We are currently using I2C in software mode, which has
some advantages and disadvantages. An analysis of the differences and a well-informed choice could
reduce the complexity of the programming and reduce the power consumption of the project.
Much future work for this project is in the mechanical placement of the sensor boards. They all
should fit into some type of enclosure, and they all should receive various power lines in addition to
sensor inputs and outputs. Some type of enclosure that provides a simple connection scheme would
make this project much easier to use and disassemble. Dr Gray has suggested a setup similar to that
in PCs where the boards slide into a slot with plated conductors, thereby eliminating much of the
wiring.
Further testing could easily fill another senior project – our testing was barely adequate for a
true description of the sensors’ behavior. Testing up to the full range specified for each sensor with
accurate, calibrated equipment might be expensive, but has to be possible somehow. Such testing
would really characterize each sensor and lend more authority to our claim that they are complete.
Page 37
Bibliography
1) “A100L2 Low Power Anemometer (Analog+Pulse Outputs)” Vector Instruments. Oct. 2006.
<http://www.windspeed.co.uk/ws/index.php?option=displaypage&Itemid=49&op=page>.
2) “An Anemometer Circuit” 2004. G. L. CHEMELEC Oct. 2006.
<http://www3.telus.net/chemelec/Projects/Anemometer/Anemometer.htm>
3) “Anemometers (Wind Speed Sensors) from Vector Instrument” Jan. 2003 Vector Instruments. Oct.
2006
<http://www.upgmbh.com/produkte/pdf/06114.pdf#search=%22types%20of%20wind%20spee
d%20sensors%22>.
4) “Hall-Effect Current Sensors.” Allegro Microsystems, Inc. Oct. 2006.
<http://www.allegromicro.com/hall/currentsensor.asp>.
5) “High-Slope, Low-Power, Analog Temperature Sensor in an SC70 Package” Aug. 2002. Maxim.
Oct. 2006. <http://datasheets.maxim-ic.com/en/ds/MAX6612-MAX6612MXK.pdf>. 6) “Model 014A Met One Wind Speed Sensor: Instruction Manual” Nov. 2006 Campbell Scientific,
Inc. Oct. 2006. <http://www.campbellsci.com/documents/manuals/014a.pdf>.
7) “One Mile long I2C communication using P82B715” Sherman, Don. Phillips Semiconductors
Application Notes AN444.” 1994.
8) Russel, Richard P. “WindSonic - Ultrasonic Wind Sensor Specification” Oct. 2006. <http://www.r-p-
r.co.uk/windsonic/windsonic_spec.htm>.
9) Theory and Design for Mechanical Measurements., Figliola, Richard, Beasley, Donald. John Wiley
& Sons, Inc. 2000.
10) “Traceable Anemometer/Thermometer” Extech Equipment PTY. LTD. Oct. 2006.
<http://www.extech.com.au/control3/assets/4331p.php>.
11) “Using the P82B715 I2C extender on long cables.” Sherman, Don. Phillips Semiconductors
Application Notes AN444.” 1993.
12) “Windmeter / Anemometer by Infidigm” Infidigm Technological Solutions Oct. 2006.
<http://www.infidigm.net/projects/windmeter/>.
Page 38
Appendix A – Specifications
This table shows the general specifications that we were hoping to obtain this semester. The
following pages show the more detailed specifications that we were hoping to obtain for our
products.
Designation Measurement Range Precision
Solar PV
PVV Solar Array Voltage 0-600Vdc +/- 0.5V PVI Solar Array Current 0-100Adc +/- 0.1A III Inverter Input Current 0-100Adc +/- 0.1A BAV Battery Voltage 0-60Vdc +/- 0.05V NBI Net Battery Current (500)-500Adc +/- 1A IOV Inverter Output Voltage 0-500Vac +/- 1V IOI Inverter Output Current 0-50Aac +/- 0.1A PVT Solar Array Temp 0-60degC +/- 0.1degC BAT Battery Temp 0-60degC +/- 0.1degC Wind Power
WTV Wind Turbine Voltage 0-600Vdc +/- 0.5V WTI Wind Turbine Current 0-100Adc +/- 0.1A Environment
AMT Ambient Temp 0-60degC +/- 0.1degC SII Solar Insolation 0-1200W/m2 +/- 10W/m2 WIS Wind Speed 0-50mph +/- 0.5mph
Page 39
DC Voltage & Current Sensor (Solar Array and Wind)
GENERAL
Operating environment: Protected from precipitation and wind
Temperature Range: 0-60 degrees Celsius
Humidity: 0-100% humidity
Cable Type: Twisted Pair / Weatherproof (Able to be translated to RJ-45)
Cable Length: at most 10 meters for solar array; 100 meters for wind
Dimensions: less than 6” – 6” – 6”
Weight: less than 10 lbs
Cost: less than $30 altogether
ELECTRICAL
Input Voltage: 0-200Vdc
Input Current: 0-100Adc
Output for Voltage to RED14: 0-4Vdc in proportion to Input Voltage
Output for Current to RED14: 0-4Vdc in proportion to Input Current
Output Resistance: less than 1000 Ohms
Output Resolution: 4096 Voltage Sensor Accuracy: +/- 0.5V Voltage Sensor Precision: +/- 0.1V
Current Sensor Accuracy: +/- 0.5A Current Sensor Precision: +/- 0.1A
Stability : Varies less than 1% yearly.
Power: less than 100 mW drawn from RED14 box
Page 40
DC Voltage / DC Current Sensor (Battery)
GENERAL
Operating environment: Protected from precipitation and wind Temperature Range: 0-60 degrees Celsius
Humidity: 0-100% humidity
Cable Type: Twisted Pair / Weatherproof (Able to be translated to RJ-45)
Cable Length: at most 10 meters
Dimensions: less than 6” – 6” – 6”
Weight: less than 5 lbs
Cost: less than $20 altogether
ELECTRICAL
Input Voltage: 0-60Vdc
Input Current: (500)-500Adc
Output for Voltage to RED14: 0-4Vdc in proportion to Input Voltage
Output for Current to RED14: 0-4Vdc in proportion to Input Current
Output Resistance: less than 1000 Ohms
Output Resolution: 4096 Voltage Sensor Accuracy: +/- 0.1V Voltage Sensor Precision: +/- 0.2V
Current Sensor Accuracy: +/- 2A Current Sensor Precision: +/- 1A
Stability : Varies less than 1% yearly
Power: less than 100 mW drawn from RED14 box
Page 41
AC Voltage / AC Current Sensor (Inverter Output)
GENERAL
Operating Environment: Protected from precipitation and wind Temperature Range: 0-60 degrees Celsius
Humidity: 0-100% humidity
Cable Type: Twisted Pair / Weatherproof (Able to be translated to RJ-45)
Cable Length: at most 10 meters
Dimensions: less than 6” – 12” – 6”
Weight: less than 10 lbs
Cost: less than $50 altogether
ELECTRICAL
Input Voltage: 0-500Vac
Input Current: 0-50Aac
Input Frequency: 90-400Hz
Output for Voltage to RED14: 0-4Vdc in proportion to Input Voltage
Output for Current to RED14: 0-4Vdc in proportion to Input Current
Output Resistance: less than 1000 Ohms
Output Resolution: 4096 Voltage Sensor Accuracy: +/- 2V Voltage Sensor Precision: +/- 1V
Current Sensor Accuracy: +/- 0.2A Current Sensor Precision: +/- 0.1A
Stability: Varies less than 1% yearly
Power: less than 200 mW drawn from RED14 box
Page 42
DC Current Sensor (Inverter Input Current)
GENERAL
Operating environment: Protected from precipitation and wind Temperature Range: 0-60 degrees Celsius
Humidity: 0-100% humidity
Cable Type: Twisted Pair / Weatherproof (Able to be translated to RJ-45)
Cable Length: at most 10 meters
Dimensions: less than 6” – 3” – 3”
Weight: less than 10 lbs
Cost: less than $20 altogether
ELECTRICAL
Input Voltage: 0-60Vdc (if we hook into the wires; non-Hall effect)
Input Current: 0-100Adc
Output to RED14: 0-4Vdc in proportion to Input Current
Output Resistance: less than 1000 Ohms
Output Resolution: 1000
Current Sensor Accuracy: +/- 0.2A Current Sensor Precision: +/- 0.1A
Stability : Varies less than 1% yearly
Power: less than 50 mW drawn from RED14 box
Page 43
Temperature Sensor (Battery and Solar Array)
GENERAL
Operating environment: Battery is protected from the weather, but solar array is not Temperature Range: 0-60 degrees Celsius
Humidity: 0-100% humidity
Cable Type: Twisted Pair / Weatherproof (Able to be translated to RJ-45)
Cable Length: 50 meters
Dimensions: less than 4” – 4” – 2”
Weight: less than 5 lbs
Cost: less than $20 altogether
ELECTRICAL
Temperature Range: 0-60 degrees Celsius
Output to RED14: I2C
Output Resistance: less than 1000 Ohms
Output Resolution: 600 Temperature Sensor Accuracy: +/- 1 degree Celsius Temperature Sensor Precision: +/- 0.1 degrees Celsius
Stability : Varies less than 1% yearly
Power: less than 50 mw drawn from RED14 box
*note that Ambient temperature sensor was neglected from this spec because this sensor requires contact
Page 44
Temperature Sensor (Environment)
GENERAL
Operating environment: Protected from precipitation and wind Temperature Range: 0-60 degrees Celsius
Humidity: 0-100% humidity
Cable Type: Twisted Pair / Weatherproof (Able to be translated to RJ-45)
Cable Length: 50 meters
Dimensions: less than 4” – 4” – 2”
Weight: less than 5 lbs
Cost: less than $20 altogether
ELECTRICAL
Temperature Range: 0-60 degrees Celsius Output to RED14: I2C
Output Resistance: less than 1000 Ohms
Output Resolution: 600 Temperature Sensor Accuracy: +/- 1 degree Celsius Temperature Sensor Precision: +/- 0.1 degrees Celsius
Stability : Varies less than 1% yearly
Power: less than 50 mW drawn from RED14 box
*note that Solar Array and Battery temperature sensors were neglected from this spec because this sensor requires no contact
Page 45
Solar Insolation Sensor (Environment)
GENERAL
Operating environment: in all weather, including precipitation and wind Temperature Range: 0-60 degrees Celsius
Humidity: 0-100% humidity
Cable Type: Twisted Pair / Weatherproof (Able to be translated to RJ-45)
Cable Length: 50 meters
Dimensions: less than 4” – 4” – 2”
Weight: less than 10 lbs
Cost: less than $50 altogether
Calibration: Software
ELECTRICAL
Solar Insolation Range: 0-1200 Watts per meter squared
Output to RED14: 0-4Vdc in proportion to Input Current
Output Resistance: less than 1000 Ohms
Output Resolution: 120 Solar Insolation Sensor Accuracy: +/- 10 Watts per meter squared Solar Insolation Sensor Precision: +/- 10 Watts per meter squared
Stability: Varies less than 5% yearly
Power: less than 50 mW drawn from RED14 box
Page 46
Wind Speed Sensor (Environment)
GENERAL
Operating environment: in all weather, including precipitation and wind Temperature Range: 0-60 degrees Celsius
Humidity: 0-100% humidity
Cable Type: Twisted Pair / Weatherproof (Able to be translated to RJ-45)
Cable Length: 50 meters
Dimensions: less than 12” – 12” – 24”
Weight: less than 20 lbs
Cost: less than $50 altogether
ELECTRICAL
Wind Speed Range: 0-50 Miles per hour
Output to RED14: 0-4Vdc in proportion to Input Current
Output: I2C
Output Resolution: 100 Wind Speed Sensor Accuracy: +/- 1.0 Miles per hour Wind Speed Sensor Precision: +/- 0.5 Miles per hour
Stability: Varies less than 1% yearly
Power: less than 50 mW drawn from RED14 box
Page 47
Appendix B – Schematics
GLOBAL RENEWABLE ENERGY SENSOR/DATALOGGER SYSTEM DIAGRAM:
Page 48
WIND SPEED SENSOR: WIND SPEED RANGE 0-50MPH
Page 49
Figure 1: Wind sensor circuit design in Ultiboard
Page 50
AC VOLTAGE SENSOR
Page 51
Figure 2: AC Voltage Circuit Design in Ultiboard
Page 52
DC VOLTAGE SENSOR: PV/WIND TURBINE
Page 53
Figure 3: 600VDC sensor in Ultiboard
Page 54
Figure 4: 60VDC Sensor in Ultiboard
Page 55
LONG DISTANCE I2C COMMUNICATION
SOLAR INSOLATION SENSOR
Page 56
Figure 5: Solar Insolation Sensor in Ultiboard
Page 57
TEMPERATURE SENSOR
Page 58
INVERTER ALTERNATING CURRENT OUTPUT
PV/WIND TURBINE CURRENT OUTPUT
Page 59
BATTERY DIRECT CURRENT SENSOR
Page 60
Appendix C – Microprocessor Code
I2C COMMUNICATION PROTOCOL FOR THE MASTER PIC18F2515 IN C:
//************************************************************************* // testi2c.c // Version 1.00 // // Modified by Cameron N. Hess and Jon Shambeda for Messiah College // Senior Project Team Renewable Energy Sensor Package // for implementation on the PIC18F2515 microprocessor master for I2C // Communication to simulate communication between our sensors and the RED14 // Datalogger // // Utilizes routines from m_i2c_1.c file. Implements I2C communication with // MAX6633 Temperature Sensor over I2C bus with standard protocol and outputs // the temperature in celsius onto LCD // // Author: Cameron N. Hess & Jon Shambeda // Renewable Energy Sensor Package Senior Project Team, // Messiah College // // Completed: April 2007 // // Processor: PIC18F2515 // //#define BITNUM(adr, bit) //((unsigned)(&adr)*8+(bit)) #define GIE INTCON.F7 //#define WDT CONFIG2.F0 //#define XTAL_FREQ 10MHZ //-- Define the crystal frequency //#define SLOWDOWN #include "m_i2c_1.c" int loop; int ack; int var; char high; char low; //char *text = ""; char pointer[6]; char pointer2[13]; unsigned int sum; float celsius;
Page 61
int h; void main(){ ADCON1 = 0x0E; OSCTUNE = 0x80; OSCCON = 0xFF; GIE=0; //Disable Global Interrupts // WDT=0; //Disable Watch Dog Timer var = 1; ack = 1; Lcd_Init(&PORTB); // Initialize LCD connected to PORTB Lcd_Cmd(LCD_CURSOR_OFF); // Turn cursor off //----------------------------------------------------------------------------- do{ //Begin I2C Send Sequence to configure CONFIGURATION register################## i2cstart(); //send address of slave i2csendbyte(0x80 & 0xFE); //-- Lowest bit = 0 => WRITE //wait for ack ack = i2cgetack(); //send command byte; "COMMAND" for MAX6633; selects reg for write i2csendbyte(0x01); //wait for ack ack = i2cgetack(); //send data byte; "DATA" for MAX6633; goes into reg set by COMMAND i2csendbyte(0x20); //wait for ack ack = i2cgetack(); i2cstop(); Delay_us(200); //Begin I2C Send Sequence to configure CONFIGURATION register################## i2cstart(); //send address of slave i2csendbyte(0x80 & 0xFE); //-- Lowest bit = 0 => WRITE //wait for ack ack = i2cgetack(); if(ack == 0) { var = 0; i2cstop(); }
Page 62
//send command byte; "COMMAND" for MAX6633; selects reg are reading from i2csendbyte(0x00); //wait for ack ack = i2cgetack(); if(ack == 0) { var = 0; i2cstop(); } i2cstart(); //send address of slave again because of change in Data Flow Direction i2csendbyte(0x80 | 0x01); //-- Lowest bit = 1 => READ //wait for ack ack = i2cgetack(); if(ack == 0) { var = 0; i2cstop(); } //read data WORD from register set by the COMMAND byte high = i2cgetbyte(); i2csendack(); low = i2cgetbyte(); i2cstop(); Delay_us(100); //unsigned short btnRes; h=(int)high; // Lcd_Cmd(LCD_CLEAR); // Clear display //Lcd_Chr(1,1, high); //Lcd_Chr(1,2, low); sum= (int)low.f3*1+ (int)low.f4*2+ (int)low.f5*4+ (int)low.f6*8+ (int)low.f7*16+ (int)high.f0*32+ (int)high.f1*64+ (int)high.f2*128+ (int)high.f3*256+ (int)high.f4*512+
Page 63
(int)high.f5*1024+ (int)high.f6*2048; celsius=.0625*sum; // sum=(int) high.f0; // IntToStr(sum ,pointer); FloatToStr(celsius,pointer2); // Lcd_Out(1,1,pointer); Lcd_Out(1,1,pointer2); Lcd_Out(2,1," Celsius"); //i think this will work: // look at the first help article after you search for "bit" // it seems to indicate that you can access bits in chars just like in //portb , portc etc. //therefore: /* //shorter because we discard last bits: //might be off by one here i=7 while (i>=0){ Lcd_Chr(1,i +8,i); i--; } */ }while(1); } //************************************************************************* // End testi2c.c //*************************************************************************
Page 64
//************************************************************************* // m_i2c_1.c // Version 1.00 // Modified by Cameron N. Hess and Jon Shambeda for Messiah College // Senior Project Team Renewable Energy Sensor Package // for implementation on the PIC18F2515 microprocessor master for I2C // Communication to simulate communication between our sensors and the RED14 // Datalogger // // Mike's simple software driven I2C routine - hopefully done for compactness. // Master Only mode - output only in this version // // Original Author: Michael Pearce // Chemistry Department, University of Canterbury // // Started: 2 June 1999 // Modified: April 2007 //************************************************************************* // Version 1.1.0 - 15 June 2000 // Added I2C_Read and i2cgetbyte routines - hope they work //************************************************************************* // Version 1.0.0 - 2 June 1999 // Single routine to write data to i2c //************************************************************************* //#include <p18F2515.inc> //******** REQUIRED DEFINES *********** //#define BITNUM(adr, bit) ((unsigned)(&adr)*8+(bit)) #include <built_in.h> //#define Delay_us #define SCL PORTA.F0 //-- The SCL output pin #define SCL_TRIS TRISA.F0 //-- The SCL Direction Register Bit #define SDA PORTA.F1 //-- The SDA output pin #define SDA_TRIS TRISA.F1 //-- The SDA Direction Register Bit // #define XTAL_FREQ 8MHZ //-- Define the crystal frequency #define I2CLOW 0 //-- Puts pin into output/low mode #define I2CHIGH 1 //-- Puts pin into Input/high mode #ifndef MHZ
Page 65
#define MHZ *1000 /* number of kHz in a MHz */ #endif #ifndef KHZ #define KHZ *1 /* number of kHz in a kHz */ #endif //********* I2C Bus Timing - uS ************ #define I2CSTARTDELAY 100 #define I2CSTOPDELAY 100 #define I2CDATASETTLE 40 #define I2CCLOCKHIGH 200 #define I2CHALFCLOCK 100 #define I2CCLOCKLOW 200 #define I2CACKWAITMIN 100 #define i 0 /* #define I2CSTARTDELAY 50 #define I2CSTOPDELAY 50 #define I2CDATASETTLE 20 #define I2CCLOCKHIGH 100 #define I2CHALFCLOCK 50 #define I2CCLOCKLOW 100 #define I2CACKWAITMIN 50 #define i 0 */ //********************* FUNCTIONS ************************ char I2C_Send(char Address,char *Data,char Num); char I2C_Read(char Address,char *Data,char Num); char i2csendbyte(char byte); char i2cgetbyte(void); char i2cgetack(void); void i2csendack(void); //void Delay_us(char delay); void i2cstart(void); void i2cstop(void); void i2cclock(void); char i2creadbit(void); char I2C_Idle(void); void I2C_Idle(void) { SDA_TRIS = I2CHIGH; SDA = I2CHIGH; SCL_TRIS = I2CHIGH; SCL = I2CHIGH;
Page 66
Delay_us(100); } //************************************************************************* // I2C_Send // // Inputs: // char Address - Address to write data to // char *Data - Pointer to buffer // char Num - Number of bytes to send //************************************************************************* /*char I2C_Send(char Address,char *Data,char Num) { i2cstart(); //-- Send Address i2csendbyte(Address & 0xFE); //-- Lowest bit = 0 => WRITE if(!i2cgetack()) { i2cstop(); return(0); } while(Num--) { i2csendbyte(*Data); if(!i2cgetack()) { i2cstop(); return(0); } Data++; } i2cstop(); return(1); } */ //************** END OF I2C_Send //************************************************************************* // char I2C_Read(char Address,char *data, char Num) //************************************************************************* /* char I2C_Read(char Address,char *Data, char Num) {
Page 67
i2cstart(); //-- Send Address i2csendbyte(Address | 0x01); //-- Lowest bit = 1 => READ if(!i2cgetack()) { i2cstop(); return(0); } while(Num--) { *Data=i2cgetbyte(); Data++; if(Num > 0) { i2csendack(); } } i2cstop(); return(1); } */ //************************************************************************* // i2csendbyte //************************************************************************* char i2csendbyte(char Byte) { char count; SDA=I2CLOW; SCL=I2CLOW; Delay_us(I2CCLOCKLOW); //-- Minimum Clock Low Time for(count=8;count>0;count--) //-- Send 8 bits of data { if( (Byte & 0x80)== 0) //-- Get the Bit { SDA=I2CLOW; //-- Ensure Port pin is low SDA_TRIS=I2CLOW; //-- Lower pin if bit = 0 } else { SDA_TRIS=I2CHIGH; //-- Release pin if bit = 1 }
Page 68
Byte=Byte<<1; //-- Shift next bit into position i2cclock(); //-- Pulse the clock } SDA_TRIS=I2CHIGH; //-- Release data pin for ACK return(1); } //************** END OF i2csendbyte //************************************************************************* // char i2cgetbyte(void) // // Reads in a byte from the I2C Port //************************************************************************* char i2cgetbyte(void) { char count,Byte=0; SDA=I2CLOW; SCL=I2CLOW; Delay_us(I2CCLOCKLOW); //-- Minimum Clock Low Time for(count=8;count>0;count--) //-- Read 8 bits of data { Byte=Byte <<1; SDA_TRIS=I2CHIGH; //-- Release pin so data can be recieved if(i2creadbit()) { Byte +=1; } } return(Byte); } //************************************************************************* // i2cstart //************************************************************************* void i2cstart(void) { //-- Ensure pins are in high impedance mode -- SDA_TRIS=I2CHIGH; SCL_TRIS=I2CHIGH; SCL=I2CLOW; SDA=I2CLOW; Delay_us(I2CSTARTDELAY); //-- Generate the start condition SDA_TRIS=I2CLOW; SDA=I2CLOW;
Page 69
Delay_us(I2CSTARTDELAY); SCL_TRIS=I2CLOW; Delay_us(I2CCLOCKLOW); //-- Minimum Clock Low Time } //************** END OF i2cstart //************************************************************************* // i2cstop //************************************************************************* void i2cstop(void) { //-- Generate Stop Condition -- SDA_TRIS=I2CLOW; SCL_TRIS=I2CHIGH; Delay_us(I2CSTOPDELAY); SDA_TRIS=I2CHIGH; } //************** END OF i2cstop //************************************************************************* // i2cclock //************************************************************************* void i2cclock(void) { Delay_us(I2CDATASETTLE); //-- Minimum Clock Low Time SCL_TRIS=I2CHIGH; //-- Release clock Delay_us(I2CCLOCKHIGH); //-- Minimum Clock High Time SCL_TRIS=I2CLOW; //-- Lower the clock Delay_us(I2CCLOCKLOW); //-- Minimum Clock Low Time } //************** END OF i2cclock //************************************************************************* // i2creadbit //************************************************************************* char i2creadbit(void) { char Data=0; Delay_us(I2CDATASETTLE); //-- Minimum Clock Low Time SCL_TRIS=I2CHIGH; //-- Release clock Delay_us(I2CHALFCLOCK); //-- 1/2 Minimum Clock High Time if(SDA !=0 ) Data=1; //-- READ in the data bit Delay_us(I2CHALFCLOCK); //-- 1/2 Minimum Clock High Time SCL_TRIS=I2CLOW; //-- Lower the clock Delay_us(I2CCLOCKLOW); //-- Minimum Clock Low Time return(Data);
Page 70
} //************** END OF i2cclock //************************************************************************* // i2cgetack //************************************************************************* char i2cgetack(void) { SDA=I2CLOW; SCL=I2CLOW; SCL_TRIS=I2CLOW; //-- Ensure clock is low SDA_TRIS=I2CHIGH; //-- Release the Data pin so slave can ACK SCL_TRIS=I2CHIGH; //-- raise the clock pin Delay_us(I2CHALFCLOCK); //-- wait for 1/2 the clock pulse if(SDA) //-- sample the ACK signal { return(0); //-- No ACK so return BAD } Delay_us(I2CHALFCLOCK); //-- Else wait for rest of clock SCL_TRIS=I2CLOW; //-- Finish the clock pulse Delay_us(I2CCLOCKLOW); //-- Minimum Clock Low Time Delay_us(I2CCLOCKLOW); //-- Minimum Clock Low Time return(1); } //************** END OF i2cgetack //************************************************************************* // void i2csendack(void) //************************************************************************* void i2csendack(void) { //--- Send Ack to slave except for last time --- SDA=0; SDA_TRIS=I2CLOW; //-- Send ACK Delay_us(I2CDATASETTLE); //-- Give it time to settle i2cclock(); //-- Pulse the clock SDA_TRIS=I2CHIGH; //-- Release ACK Delay_us(I2CDATASETTLE); //-- Gap between next byte } //************** END OF i2csendack //************************************************************************* // Delay_us // // This delay is approx us plus the function call delays // Should be close enough for I2C
Page 71
//************************************************************************* //void Delay_us(const char delay) //{ // int delay2; // delay2 = 10; // Delay_us(delay2); // DelayMs(delay); //-- For Debug //} //************** END OF Delay_us //************************************************************************* // End m_i2c_1.c //*************************************************************************
Page 72
Appendix D – Test Data / Graphs
Graph
Test Data
Vin (V) Vout (mV)
0.001 -102
8.68 465.75
14.74 862.4
18.515 1109.5
25.21 1548
30.23 1876.7
33.52 2092.2
38.67 2429.8
43.01 2714
47.87 3032.1
52.73 3350.8
57.44 3659.5
59.86 3817.7
Page 73
Graph
Page 74
Sample Test Data Vin Vout Vin Vout Vin Vout Vin Vout Vin Vout
600 4.791 468 3.738 302.9 2.418 150 1.197 32 0.253
599 4.784 467 3.733 301.9 2.409 149.1 1.189 31 0.245
598 4.77 466 3.724 301.1 2.403 148 1.18 30 0.236
597 4.765 465 3.713 300 2.397 147.1 1.172 29 0.229
596 4.758 464 3.704 299 2.388 145.9 1.164 28 0.22
595 4.744 463 3.699 297.9 2.379 145 1.156 27 0.213
594 4.739 462 3.69 297.2 2.372 143.9 1.147 26 0.205
593 4.732 461 3.68 296.1 2.363 143.1 1.141 25 0.197
592 4.725 460 3.674 295 2.357 142 1.132 24 0.189
591 4.718 459 3.671 294 2.348 141.1 1.125 23 0.181
590 4.714 458 3.66 292.9 2.339 140.1 1.117 22 0.173
589 4.7 457 3.651 291.9 2.33 139.1 1.108 21 0.165
588 4.693 456 3.641 291.2 2.324 138 1.101 20 0.157
587 4.689 455 3.636 290.1 2.318 137 1.092 19 0.149
586 4.675 454 3.627 289.1 2.308 136 1.084 18 0.141
585 4.668 453 3.616 288.1 2.3 135 1.078 17 0.133
584 4.663 452 3.613 287 2.291 134.1 1.069 16 0.125
583 4.657 451 3.603 286 2.283 133 1.061 15 0.116
582 4.65 450 3.594 285 2.276 132.1 1.054 14 0.109
581 4.639 449 3.589 284 2.268 131 1.045 13 0.101
580 4.632 448 3.578 282.9 2.259 130.1 1.037 12 0.093
579 4.625 447 3.57 281.9 2.25 129 1.029 11 0.085
578 4.614 446 3.56 280.9 2.241 128.1 1.021 10 0.077
577 4.607 445 3.551 279.9 2.236 127 1.012 9 0.069
576 4.6 444 3.551 278.9 2.227 126 1.005 8 0.061
575 4.589 443 3.541 277.9 2.218 125.1 0.997 7 0.053
574 4.582 442 3.532 276.9 2.21 124.1 0.99 6 0.045
573 4.58 441 3.522 275.9 2.204 123 0.981 5 0.037
572 4.569 440 3.514 275 2.196 122 0.974 4 0.029
571 4.558 439 3.504 274 2.188 121.1 0.965 3 0.021
570 4.551 438 3.496 273 2.179 120.1 0.957 2 0.013
569 4.545 437 3.49 272 2.17 119 0.949 1 0.005
568 4.54 436 3.485 271.1 2.164 118 0.94 0 -0.001
Page 75
Graph
Test Data Vin Vout Vin Vout
3.204 6.8 68.1 249.7
4.7 12.7 70.05 256.8
6.82 21.2 73.8 270.3
8.66 28.5 75.9 278
9.9 33.2 78.3 286.8
12.4 43.1 80.55 295.3
16.75 60 83.1 304.2
20.2 73 86.2 315.4
23 84 89.6 327.8
24.86 91.1 92.1 336.8
26.13 96 96.6 353
27.63 101.5 98.65 360.3
29.6 108.9 102.55 374.6
31.1 114.6 104.95 383.4
34.25 126.2 107.25 391.7
38.25 141 110.25 402.3
41.1 151.6 114.3 417.2
43.9 161.8 117.8 429.5
46.7 172.3 121 441.4
49.36 182.1 123.9 451.7
53.68 197.7 128.3 467.9
55.83 205.6 131.1 478
58.12 213.8 135.4 493
59.98 220.7 138.7 504.2
Page 76
63.03 231.7 143.7 523.4
66.9 245.4
Page 77
Graph
Test Data
Amps W/m2
160 0.657
185 0.678
130 0.62
80 0.443
190 0.707
20 0.2
10 0.122
100 0.125
150 0.21
200 0.697
150 0.583
200 0.463
210 0.583
150 0.424
200 0.553
170 0.51
135 0.422
100 0.295
150 0.435
Page 78
180 0.634
Page 79
Graph
Test Data
Tmeasured Tcontrol
4.8 3.7
4.9 4.8
4.8 4.6
7.5 8.1
10.3 11.3
15.8 15.9
25.3 25.7
26.2 26.3
27.2 27.2
31 31.1
31.4 31.3
33.8 34
36.3 37.4
41.8 43.6
44 44.2
52.1 52.2
59.7 59.4
Page 80
Graph
Test Data
Iin Vout
0 0.022
0.07 0.026
0.335 0.0355
0.497 0.042
0.77 0.053
1.03 0.063
1.25 0.072
1.53 0.083
1.749 0.092
2.06 0.104
Page 81
Graph
Test Data
Hz mph
0.545455 1.988636
1.176471 3
1.428571 3.761364
1.73913 4.818182
2.162162 5.863636
2.5 6.988636
2.857143 8.522727
3.5 9.534091
4.21 11.375
5.03 13.40909
5.28 14.09091
5.7 15.11364
6.175 16.30682
6.57 17.38636
6.98 18.46591
7.61 20.22727
7.9 21.47727
8.55 23.06818
9 24.54545
Page 82
9.8 25.79545
9.9 26.93182
10.35 28.18182
10.85 29.65909
11.5 31.25
12.23 33.06818
13.1 34.77273
13.85 36.81818
14.55 38.29545
15.2 40.45455
15.77 42.27273
16.2 44.54545
16.75 45.45455
Page 83
Appendix E – Schedule
Page 84
Page 85
Page 86
Page 87