disseration

49
Project Pelton A PELTON WHEEL TESTING RIG Prepared by: Hugo Tilmouth Supervisor: Justin Hinshelwood Word Count: 9926 Completed: Thursday, 21 April 2016 PROJECT PELTON

Upload: hugo-tilmouth

Post on 15-Apr-2017

45 views

Category:

Documents


1 download

TRANSCRIPT

Project Pelton A PELTON WHEEL TESTING RIG Prepared by: Hugo Tilmouth Supervisor: Justin Hinshelwood Word Count: 9926 Completed: Thursday, 21 April 2016

PROJECT PELTON

TABLE OF CONTENTS

A PELTON WHEEL TESTING RIG

Table of Contents i List of Figures ii Acknowledgments iii Executive Summary iv Table of Notations v

CHAPTER 1

Introduction 1 CHAPTER 2

Technical Review 2 CHAPTER 3

Laboratory Safety and testing 5 CHAPTER 4

Initial Rig Condition 7 CHAPTER 5

Deviation from Initial plan 12 CHAPTER 6

Learning Outcomes 14 CHAPTER 7

Experiments and Calculations 25 CHAPTER 8

Conclusion and further work 28 References 32 Appendices 1

!i

PROJECT PELTON

LIST OF FIGURES

!ii

PROJECT PELTON

ACKNOWLEDGMENTS

There are several Academics at Exeter University that should be thanked for their input to this project.

Firstly, Justin Hinshelwood, both for being my module supervisor and more importantly providing many hours of support throughout this 7 month long project. His knowledge of many different aspects of the projects design and requirements were incredibly helpful.

Additionally, thanks go to:

• Richard Cochrane for his help with many aspects of the project; from the tooling in the lab to ordering parts.

• David Parish was very helpful in regards to the safety and risk assessment of the project.

• Adam Feldman provided countless suggestions and useful insights towards the project.

• Mohammid Abusara provided great knowledge of the electric control systems used in the project.

Finally the team of students that constructed the in-complete rig must be thanked. The team consisted of: Paul Ashley, George Brooke, Kieran Meredith, William Michlethwaite, Samuel Naylor and William Yapp. Without them the project would not have succeeded and despite the difficulties faced due to lack of documentation, the rig itself was well constructed and ambitiously designed with a variety of sensors to interface.

!iii

PROJECT PELTON

EXECUTIVE SUMMARY

This project set out with the aim to develop a teaching resource to demonstrate and test the performance of a Pelton wheel turbine, and its ability to power a generator system. The key stages were to understand the operation of the rig as left by the pervious team, develop a control system to builds in safety and control logic, commission the equipment and develop a range of experiments for the user to perform. This report highlights the various learning outcomes gained throughout the project, as well as describing the best practise methods gained and implemented from literature around the learning outcomes. Problem: The rig was incomplete and required some elements of the mechanic structure to be fixed. It lacked a long term, safe and suitable control system. Objective: Design, construct, test and provide instructions for a control system that allowed the user safe and intuitive operation. Methodology: Produce a control system using an Arduino micro controller using the Arduino programming language. Design, construct and test in an interactive fashion to more efficiently manage time. Achievements: The objects for this project were fully achieved and the rig is up and running. There is a section of the report detailing further projects but the critical components are all complete.

!iv

PROJECT PELTON

TABLE OF NOTATIONS

Terms

All Nomenclature is explained within the report immediately following its use.

Term Meaning

The Rig, Pelton Rig These terms all refer to the Pelton Wheel testing rig on which this project is based.

The Control Panel This refers to the bank of switches and status LED’s on the front of the Pelton Wheel testing rig.

The Front of the rig The side of the rig which has the computer, control panel and rack door.

The Back of the rig The side of the rig which has open side of the rack, this should be orientated away from the user.

The rack, computer rack The metal casing containing the computer, all the connections and Arduino board

Arduino board The strip board containing components, connections and Arduino mounted inside the rack.

Load controller The Electronic load controller located on top of the rack

Power supply The variable bench power supply that is located on top of the rack

Glass screen The acrylic screen that lowers onto the front of the water testing chamber to prevent splashing but also allow access to the chamber.

Solder The coil of wire made of a low melting allow that allows fusing of two less fuse able metals

Arduino Uno, Uno The most common Arduino micro controller board on the market details can be found here: https://www.arduino.cc/en/Main/ArduinoBoardUno

Arduino Mega, Mega A larger version of the Uno with more pins, details can be found here: https://www.arduino.cc/en/Main/ArduinoBoardMega2560

Control Board The circuit board containing the Arduino that controls the rigs outputs and inputs with logic in between.

Camel Case A standard coding technique starting each new word with a capital for instance “switch one state” would read “switchOneState”

Head Height The height between the surface of the water at lower level and the surface of the water at a higher level.

!v

PROJECT PELTON

CHAPTER 1

INTRODUCTION Summary

This project was selected from the list of dissertations due to its highly practical nature. It developed understanding of the Arduino micro controller, control, monitoring, soldering, wiring, PCB design, PCB production and general electronics. Once completed the rig allowed for you to design and test a range of Pelton wheel runners and develop deeper insights into CAD, 3D printing, Pelton wheel design and performance optimisation for turbines.

This report aims to cover firstly the history and technical operation of Pelton wheels and hydroelectric power in general. The importance of safety and measures to ensure the building and operation of the rig is safe. Then the report details the methods employed while investing the rig at the start of the project and the control system design process to control the rig. The construction and testing process then makes up a large part of the report. The report then details the experiments that can be conducted on the rig and the calculations that these experiments entail.

Scope The scope of the project was largely dictated by the project brief. This outline serves as a guide for aims of the project.

• Understand the rig in its initial state, investigating each of the devices used in control and monitoring on the rig. This will inform the design of the Arduino system.

• Design an Arduino control and data acquisition system that communicates reliably with the rig devices. • Construct the Arduino system that is both simple but safe enough for students to use. • Thoroughly test the system for errors, resilience and safety. • Write an instructions manual for the rig to allow students to easily use the rig once completed. • Develop experiments for students to complete as part of the renewable energy degree. • Explore the possibility of 3D printed Pelton wheels. • Provide a troubleshooting guide to allow the rig to be repaired if a fault occurs.

!1

CHAPTER 2

TECHNICAL REVIEW

Summary

This section of the report aims to investigate the principles behind a Pelton wheel and hydroelectric power and the research already conducted in this area. It is important before starting any research project to take time to investigate what has already been written in peer reviewed journals and textbooks.

Hydroelectric power Hydroelectric power, electric power produced by the movement of water, has been used for centuries to power the the pre steam industries such as flour mills. Now hydroelectric power accounts for “16% of the worlds electric supply with 3,427 terawatt-hours of electricity production in 2010” (Institute, 2013).

The power of hydroelectric devices is calculated using the equation below:

"

Where P is the power in watts, D is the density of water in kgm-3, Q is the volumetric flow rate in m3s-1, g is acceleration due to gravity, H is head in m, 𝜂 is the efficiency of the turbine and the generator.

There are a variety of designs of turbines in use. Some are designed for high head (fast flowing water) and some for high volumetric flow of water. As can be seen in figure 2.1 the Pelton wheel is designed for high head and low flow applications.

P = D × E × g × H ×η

!2

Figure 2.1 - Shows a comparison of the different conditions different turbines operate under. (Power, 2011)

Pelton Wheels

The Pelton wheel is a water turbine of the impulse type. Invented in the 1870’s by Lester Allan Pelton, the wheel extracts energy from the water's impulse rather than just the weight of the water in the buckets. The original patent application can be seen in figure 2.2. This change in thinking and design lead to much more efficient and high speed turbines. Now Pelton wheels are generally used for hydroelectric applications with a high flow speed and low flow rate gained from a high head height. A modern design can be seen in figure 2.3.

Other rig designs

To understand the merits and downfalls of the rig this project was working on it was important to investigate other designs of Pelton wheel testing rigs. This section of the report aims to compare some of these designs.

Figure 2.4 shows the 1kW design by Creative lab Engineers.

!3

Figure 2.2 - From Pelton’s original patent application document. (Pelton, 1880)

Figure 2.3 - Shows a modern Pelton wheel design with two jet nozzles. (Pelton wheel for stock water supply, 2012b)

Figure 2.4 - Shows Creative Lab Engineers Pelton wheel testing rig. (Creative Labs, 2012)

This allows a turbine to be observed through an acrylic screen on the side of the test chamber. It includes a pressure sensor to measure the total supply head. A brake dynamometer allows the load to be increased to measure the power in the turbine. This allows the efficiency of the turbine to be calculated. This rig only allows the testing of turbines of a fixed size. It also has a much higher price than the rig build for this report. (Pelton Wheel Turbine Test Rig 1Kw, manufacturers suppliers in India, 2014).

The original Pelton wheel experimental rig in the lab (seen in figure 2.5), for which the this rig would replace, was relatively basic in its operation and was designed solely to determine the efficiency of a Pelton wheel hydro turbine using the readouts from the momentum change of the incoming flow to the rotational velocity of the shaft.

!4

Figure 2.5 - Shows the original rig in the renewable laboratory. (Authors own)

CHAPTER 3

LABORATORY SAFETY AND TESTING Initial Safety Device installation

To ensure that the project was conducted as safely as possible, David Parish, Head of Safety, Dept of Renewable Energy, was consulted. His recommendations will be implemented as part of the project and before connecting the rig to power.

The first recommendation was to replace the original plug connecting the rig to mains electricity with a 13amp RCD plug that would almost instantly cut off the power if a fault was detected; therefore preventing the rig user from receiving an electric shock.

The second recommendation was that any power connected devices on the rig should be earth bonded, including all metal parts of the computer rack, pump, valves, generator and control panel. This was completed and checked by David Parish to ensure the quality of each connection. He approved the work and gave approval for the next stage of the project to commence.

Best Practise for Electronic Safety Referring to the guidelines in 'The Electricity at Work Regulations' 1989, it states that “it is preferable that the conductors are made dead before work starts” (Health and Safety Exective (HSE), 2015). This can be achieved in the rig by pressing in the kill switch. By pressing the switch the rigs power is shut off totally, as if it were disconnected from the mains. For more dangerous activities such as altering the relay, which uses 230V mains electricity to power the pump, it would be best to completely isolate the rig from the mains power by disconnecting the wall plug from the socket. Before connecting, disconnecting or handling any wires the voltage must be checked using a regularly tested electronic meter.

Continuity and Isolation Testing All old and new connections were tested for continuity using a regularly tested electronic meter. The connections were also be tested to check that there is no connection between other components. This is especially important when producing a breadboard, strip board or PCB as the connections are much closer together on these components.

Safety Testing

The device is designed in such a way that without the user knowingly attempting to cause harm to the rig, they cannot injure themselves, both by electric shock or burn, or mechanical injury by the rotating Pelton wheel. This was thoroughly tested using several different users ranging from competent engineers to un-trained students. The back side of the rack is open and placing ones hand inside when the rig is live may result in an electric

!5

shock. This danger is mitigated against by orientating the rig with the back facing a wall to prevent students/others from accessing the back of the rig when it is live.

Each surface on the rig was tested to insure continuity to the ground. This means that if a fault ever occurred the students would not be electrocuted regardless of the surface they were touching.

Resilience Testing The device has been thoroughly tested to ensure that all the components, their connections and the logic controller are all time and stress resilience. First to test time resilience, each device was left in both on and off states for extended periods. After each test the functions were checked and every component passed. Secondly, to test the stress resilience, the switches were repeatedly switched on and off rapidly to test the rigs ability to cope with fast changes in signals. Again after each test the functions were tested and the rig passed.

This level of resilience can be guaranteed by over specifying the components to withstand higher power, current and voltage than they will ever encounter, even if a fault occurs. For instance, on a bread board the components are specified for the highest power source connected to the board rather than just the one to which they are connected.

Workshop Protection Equipment

When working on hardware components that required alterations such as using a pillar drill, the necessary safety precautions were followed. This includes wearing a dust coat, safety googles and ear protection. A suitable induction was also undertaken to ensure that safe use practises were followed.

When undertaking soldering for the project, protective eyewear was always worn. The lab was also suitably ventilated to prevent inhalation of the fumes from the solder.

When working in both the lab and the workshop, precautions were taken such that solitary work was never completed on the project. This will allow a second person to seek help if required.

!6

CHAPTER 4

INITIAL RIG CONDITION

Introduction

Once the decision to undertake the rig control project was taken the first stage was to investigate and understand how the rig worked in its current form. This understanding came from many sources and through a long process of testing and research. The details of this process are explained below.

Product manuals Provided with the project was a set of documents completed by the 4th year MEng Renewable Energy students. These included an operations manual, material specification, planning document and coding document. Unfortunately, the plans for how the device worked in final state were not very detailed and lacked any documentation of part numbers, wiring diagrams, wiring colours, voltages of devices and more. The documentation as it stood was not sufficient to generate an accurate plan for the project. Figure 4.1 shows a diagram of the rigs mechanic and sensory components.

!7

Scanned by CamScanner

R a c k M

Figure 4.1 - Shows the diagram of the rigs components from the planning documents of the rig completed by the last group. (4th Years rig document)

Documenting and Researching

The decision was made early on in the project that the only way to understand the components would be do document the product codes and serial numbers and use the internet to identify their functions and wiring. Figure 4.14.2 shows an example of the product information sticker that was documented from the flow meter. This allowed the identification of the exact model and it's associated information.

For instance, in the case of this component there was no information in the documentation, and there were 4 un-labelled wires exiting the sensor. The product information revealed that the device required a +5v (red), GND (white) and signal cable (yellow). Although the previous students extended the 3 core using a 4 core green, red,

!8

Figure 4.2 - Shows the product information and numbers for the flow meter. (Authors own)

Top Table

Tank 1 Tank 2

Pump

Computer Rack

Generator

Test chamber

Figure 4.3 - Shows a 3D sketch of the initial rig setup. Not to scale. (Authors own)

blue and yellow wire. Once stripped back to the original cable the wires could be identified and labelled and a plan drawn up for their connection to the new control board. Without documentation this would have been impossible.

Control and Measurement devices Once the documentation was completed the function and wiring map could be completed for the rig.

The rig consists of a top table and bottom table as shown in figure 4.4. The water for the rig is stored in two 50L tanks located on the bottom table. These have an open/close solenoid valve between them. Tank 1 is fed by a pump connected to mains supply.

Figure 4.5 shows the supply and bypass valves. These are Electro Controls Limited E08-24M that require 24v operating voltage and a control signal of 10v. These allow precise control over the angle of opening from 0-100%. This allows the speed to be controlled even though the pump has no valuable speed. The bypass returns the water back to tank 1. With the bypass at 0% and supply at 100% flow is at maximum speed.

Figure 4.6 shows the 3 different valves leading to the testing chamber. These are controlled by on/off solenoid valves that work on a 24V signal. The valves are connected to the switches on the font panel. The initial configuration is not intuitive and uses a range of push buttons and switches.

!9

Figure 4.4 - Shows a 3D sketch of the initial rig setup. Not to scale. (Authors own)

Pump

Bypass Valve

Supply Valve

Following each of the valves is a pressure transducer. This runs on a 5V signal but in the initial state these are not functional. There is also a pressure transducer in the supply pipeline also not functional and 5V signal.

The flow meter can be seen in figure 4.6. It uses a 5V signal and uses a hall effect sensor to measure the mechanic rotation of the water wheel contained within the casing. This produces a value for a frequency that can be calculated into a volume of flow value.

The generator as seen in figure 4.3 is a heavy duty motor that is intended to be used at 24v. This has been connected to a 2 core cable to allow the power production to be measured. At the initial stage it was not connected to anything.

!10

Figure 4.5 - Shows the bypass and supply valves. (Authors own)

Bypass Valve

Supply Valve

Flow meter

Pressure 1

Control and Monitoring System

At the initial stage of the project the control system consisted of an array of switches and buttons on the control panel, these were not intuitive but did work. For a final product these would not be suitable.

The control system for the supply and bypass valves consists of two 10k potentiometers on a breadboard, with a switch to send a 5v signal to the relay to control the pump. This system will definitely need replacing as it is just on a temporary breadboard and could break at any time.

Conclusion In conclusion although well constructed and thought out the control system is not only unfit for students to use it is dangerous both to the users and to the rig. The project will therefore entail completely redesigning the control system for this rig to leave an easy to use, safe and long lasting design.

!11

Figure 4.6 - Shows the 3 nozzles entering the test chamber. (Authors own)

Valve 2

Valve 1Valve 3

Test chamber

Pressure 2

Pressure 3

Pressure 4

CHAPTER 5

DEVIATION FROM INITIAL PLAN

Introduction

This initial plan for this project was written in October 2015 and covered many aspects of the project including the briefs, goals, time plan, resources required and management strategy. Although the original plan was mainly adhered to parts of the project were changed and additional elements were included as the project evolved.

Water Sensors During project development it became apparent that although there were 3 float switches which sense the presence of water, it was only necessary to have one in use. It was therefore decided that only the top switch would be used in the final project. This was mainly due to the decision to use an Arduino uno rather than a Arduino Mega, which is explained in greater detail below, as the Uno has fewer pins than the Mega.

The original plan used the 3 LED’s water level status lights on the control panel to display the level of the water in the tank. Again these 3 LED’s would have made the use of the Uno impossible, and they were deemed to be unnecessary during the final design and operational testing of the rig.

The final design still had the same safety feature in which the pump will cut off when the water level gets too low, but without the level display system of the original design. The implementation of these sensors is listed in the further work section of this report.

Stepping down voltage

The original design for this project called for 8 x 5v regulators. These were installed in November 2015 and worked for a period of time. However, the heat generated by them proved too much without a heat sink which was impractical due to the high number of regulators needed for this project.

After consulting electronics academics and by thorough research, it was decided that a simple voltage divider would be the optimum solution. The resistors used were 1M and 5M ohms with a 0.5w power rating which is more than ample for the application. Using a 24V supply the power would not exceed 0.576mWh

In the safety section of this report, there are details of the additional resilience testing carried out on the rig, to prove the longevity of these resistors.

Arduino Uno rather than Mega

The original plan for this projected included the use of an Arduino Mega. This a micro controller with 54 digital pins and 16 analog pins out of the box. This makes the Mega a great solution for projects with larger inputs/

!12

outputs such as this rig. It became evident as the project progressed that the Arduino Mega was an expensive and difficult board to replace and during prototyping two boards failed. The university lab has a large store of Arduino Uno boards and offered these for use with the project. The Uno has 14 digital pins and 6 analog, which although is significantly less than the Mega, could be used with a redesign of the board and a restriction to the number of sensors connected the Uno. This meant that the same functionality could be achieved with a more readily available and inexpensive board. It was therefore concluded that the Uno was the best option for the rig.

Breadboard circuit

The original design for the project included a custom made PCB that would be used to house the components and the Arduino. With further investigation and discussion with peers and academics, this seemed more difficult than originally expected. All companies charge very large sums for single board production and took a long time to fabricate the boards. It was therefore decided that it would be more suitable to use a breadboard to allow for much faster and cheaper construction in the lab for this time and project critical component, rather than having to rely on external providers. The use of a breadboard proved just as reliable and permanent, but the further work section details the next stage of getting a PCB produced. The design has already been completed and the Eagle files are included in the project folder.

!13

CHAPTER 6

LEARNING OUTCOMES SOFTWARE:

Introduction Several software packages were used during the development of this project. Software was required to complete the design, coding, planning and video production.

CADSoft Eagle V7® The first software package required was Eagle: a powerful PCB design tool. Through extensive research it was found that this was the industry standard software and therefore would prove useful after the project. The first step was to complete the Eagle training files included with the software to develop a greater understanding of the software. Once completed, several iterations of the component design were drawn using Eagle. For example figure 6.1 shows the initial design for the voltage regulators. This design was changed later in the project due to its lack of resilience, which emerged after the resilience testing stage.

Before completing the final circuit board it is good practise to design the circuit board in a program such as CADSoft Eagle V7®. This allows the design to be tweaked and adjusted to ensure that all connections were included. The connection map can be seen in figure 6.2. This includes all the components and connection ports and their necessary wiring configuration.

The strip board design could not be completed in Eagle and there did not seem to be a good way of designing it on the computer. Therefore this was drawn by hand using graph paper and pencil.

!14

Figure 6.1 - Shows the initial design for the voltage regulators for the rig inputs. (Authors own)

The next stage was to produce a PCB to allow repeatability and long term use. Unfortunately, the projects time constraints did not allow for the production of a PCB but the design for a functioning PCB is included in the

!15

Figure 6.2 - Shows the final schematic for the control board, including the connections to the Arduino and the rig. (Authors own)

appendix. This was also completed in Eagle. There are several companies that would produce this board at large scale, if it was decided in the future to produce the Pelton Wheel testing rig for other institutions/schools.

Cope Repository Research into best practise, within peer reviewed textbooks, suggested that an iterative method to coding design was both sensible and proven to be effective especially in a long project. “Iterative development is an approach to building software (or anything else) in which the overall lifetime is composed of several iterations in sequence. Each iteration is a self-contained mini project” (Larmen, 2004).

A best practise method with code design is to use a service such as GitHub which allows you to store all the versions of a code through the development process. This allows working in an iterative fashion, building on each version of working code, then saving it before continuing to the next iteration. Though the process of this project the different versions of the code were carefully saved to ensure they could be resorted back to if the latest iteration failed.

!16

Figure 6.3 - Shows the folder structure of a part of the coding process. Each folder represents a day of code. (Authors own)

Adobe Photoshop®

To design the control panel for the rig it was decided that Adobe Photoshop Vxx would produce the best results. The learning curve was very steep for this software package, but the result was very professional, and could easily be designed to scale. After carefully planning the exact layout of the existing holes for lights and switches, new holes were planned for the LED error array. The final design can be seen in figure 6.4. This design was printed on an A4 self adhesive label before applying it onto the control panel.

Figure 6.5 shows the completed control panel on the rig.

!17

Figure 6.4 - Shows the final design for the control panel. (Authors own)

Figure 6.5 - Shows the control panel attached to the rig. (Authors own)

Final Cut Pro X®

Once the project was completed it was decided that the fastest and easiest way to instruct students and academics on the operation of the rig was to produce a short video instruction manual. After some research it was decided that the most powerful, yet easy to learn program, would be Final Cut Pro. After following some tutorials online and the example projects provided with the software it was found to be relatively simple to use.

To shoot the footage required for the instructional video, a Canon EOS M was used on a tripod. Also for additional footage inside the testing chamber a GoPro Hero 3 was used on a pole mount and articulated arm.

The filming process was very rigorous following the instruction manual written prior to the filming day. Multiple angles were used to explain what was necessary at each step of the operation.

In the editing program the different clips were edited together and informative text introduced into the video.

Once completed the video was uploaded to youtube.com allowing users to view the video far into the future.

Video link: https://www.youtube.com/watch?v=Yjza8H7w7DA.

!18

Figure 6.6 - Shows the instructional video uploaded to youtube.com. (Authors own)

CODING:

Introduction Making up a large section of the project was the logic that controlled the actions of the inputs and outputs on the rig. After much careful research it was decided that rather attempting to learn how to use the PLC controller already left in the rig, it would be simpler and faster to design a new system using an Arduino. Arduino provides its own coding environment that makes the language very readable for beginners although it is based on C/C++.

Labelling Code Following the best practise guide for coding, a clear and simple labelling system was adopted, using camel case to name any variables. Camel case is the practise of starting each new word in a string with a capital letter to allow for clearer reading, for instance “value with pump” would read “valveWithPump”. The use of clear, well documented code provides the opportunity for others to modify the code at a later date without the need to understand every element of the project. The full code labelling can be found in the Appendix.

Frequency

The hall effect sensor in the flow meter sends a pulsed signal that increases in frequency as the flow rate increases in a linear relationship. The Arduino code measures the frequency of the pulses from the hall effect sensor by measuring the time between high pulses converting this to frequency. This gives a frequency value which is then inserted into a formula to give a value for volumetric flow rate.

Averaging Values To increase the reliability of the values detected in the hall effect sensor, the Arduino code waits until 10 values have been recorded and then averages them all. This allows anomalies to be smoothed out from the final data.

Serial printing

When connected to a computer the Arduino allows the printing of values to the serial window within the Arduino application. This is incredibly useful, particularly for testing. Once a device such as a switch is connected, the code can be set to print out its state in the serial window, allowing the device to be tested and its correct working ordered to be insured. This function has been used hundreds of times throughout the project as it allows an iterative method of building to be adhered to.

When completed, the serial window allows the data read outs from the various sensors, switches and errors to be displayed while operating the rig. The final output can be seen in figure 6.7. This displays the 4 different pressure traducers voltage readouts that has been converted to kPa. Also the flow rate sensors readout

!19

converted to l/sec. Outside of the figures view is the readout for the states of the switches and the states of the errors, which allows for trouble shooting as explained in the troubleshooting guide.

If statements All of the errors in the code use 'if statements' to check if they should light and therefore stop the pump. Checking the states of each of their components they can then either halt or continue pump operation. The diagram in figure 6.8 below is a very simplified version of the error handling system used in the Arduino.

!20

Figure 6.7 - Shows the serial readout from the Arduino as it appears in the final rig. (Authors own)

Figure 6.8 - Shows the error handling logic in the Arduino. (Authors own)

Calibration

There were a variety of situations in which the use of calibration curves was essential to understanding the relationship between the value a sensor produced and an appropriate unit for its magnitude. Using the values gained from the product information sheets, the values for their ranges could be found and related to the values they produced. This allowed relationship curves to be produced and an equation extrapolated from them. This equation would allow the values to be converted in the Arduino code. An example of a calibration curve used in the project can be seen in figure 6.9. This is the curve relating the time between signals from the hall effect sensor in the flow rate sensor and the flow rate in litres per second.

!21

Time (ms) vs Flow rate (l/s)

Flow

rate

(l/s

)

0

1

2

3

4

Time (ms)0 17500 35000 52500 70000

Figure 6.9 - Shows the calibration curve of time vs flow rate in the flow rate sensor. (Authors own)

HARDWARE

Introduction An important part of this project was the use of hardware devices to achieve the goals. This included everything from the workshop tasks, to the soldering. The following section discusses the skills learned and used in the project.

Specification and Ordering Process

Once a design had been completed it was important to specify the correct components. This was achieved by calculations and using the Farnel product search feature; a powerful tool to which can specify each part required for a project. The vast majority of components needed were then purchased from this website due to its highly specifiable search ability.

Labelling When commencing the project it was evident that the labelling of cables had been lacking and this made fixing the rig more difficult. It was therefore evident how important it is to label all the wires, not only for reference while completing the project but also in the situation where the project hasn’t been finished or needs to be modified in the future. The labelling system used is designed to be very clear and ideally not require the user to look up a key for every component. For instance the first switch is labelled S1. The full wiring key can be found in the appendix.

Voltage Divider Originally the plan for the project stated that 5V voltage regulators would be used to step down the 24V signal to the 5V signal for the Arduino to read on the digital pins. This proved a poor solution in practise as if the switches were left on for long periods the voltage regulators heated up as they could not dissipate their heat when so tightly spaced on the breadboard, and eventually failed.

It was therefore decided that a voltage divider would be a better solution as the Arduino can take a range of high values (2V - 5.5V) not just 5V. The lab has a great range of resistors and the high power capacity resistors were chosen to increase the longevity of the rig. A 5 MOhm and a 1 MOhm resistor were chosen as they produced an output voltage of 4V. This was thoroughly tested and deemed suitable for use.

Soldering During the project a large amount of soldering was required, both on the rigs connections and the circuit boards. The first stage to become competent at soldering was to complete some training exercises from a soldering academy online. Once many hours of practise were completed it was time to start soldering for the

!22

project. To ensure safe operation soldering was always completed on a grounded mat and the components were always disconnected and their current checked before handling.

Oscilloscope

The flow meter works using a hall effect sensor attached to the water blades. This means that when supplied with a power voltage the sensor will return a pulsed signal voltage back to the user, with a lower frequency meaning a slower rotation speed and therefore a shower water flow rate, and with a higher frequency the flow rate is higher.

The first stage was to connect the sensor to an oscilloscope and produce a waveform that shows the frequency increasing with flow rate. After studying many online videos and instruction documents, the use of the oscilloscope became clear and a square wave was plotted on the screen.

In the knowledge that the sensor was working, it was now time to investigate how to measure the frequency using the Arduino. This was relatively straightforward. Some calibration curves were used to produce equations relating the time between low values and the flow rate in litres per second, the calculated values could be read out of the Arduino. There is more information on the calibration techniques used in the software section of this report.

!23

Figure 6.10 - Shows the uncompleted breadboard. (Authors own)

Making connections robust

To ensure the safety and longevity of the rig the connections were checked and made robust. Firstly all connections were soldered carefully with ample solder used, then isolated using heat shrink tubing or electric tape. Then all connections were continuity tested and isolation tested to check these connections. The connections were made resistive to a medium force.

Troubleshooting guide A guide to fixing common errors has been written using all knowledge of past errors encountered with the rig. These errors have all been provided with steps that could be taken to fix the rig. This has been added to the appendix of the document.

Instructions manual

To make the rig easy to use a comprehensive instructions manual and video were produced. The manual was completed first by following all of the steps involved with each stage of the operation several times and carefully noting down every step in the most explicit way. The instruction manual also includes photographs to illustrate each step of the process.

!24

CHAPTER 7

EXPERIMENTS AND CALCULATIONS

Summary

The rig has been constructed for the main purpose of educating students about the principles of fluid mechanics, Pelton wheel design, 3D printing and experimentation good practise. Each of these learning outcomes can be achieved by conducting different experiments on the rig. This section of the report aims to explain the experiments and calculations that can be performed upon the rig to calculate a variety of different key values about its efficiency and operation.

Experiments There are many experiments that can be performed on the rig and this section of the report will detail one method that allows the students to cover many different learning outcomes in one session.

Firstly the students must learn what a Pelton wheel is and what makes for a good design. For instance the best Pelton wheel designs must have a rotational speed half of the water speed to catch the maximum amount of energy (Turbines, 1276).

With this knowledge the students must then design a 3D model using CAD software for the Pelton wheel. This will lead to many different variations in approach and varying levels of success. The size constraints of the

!25

testing rig can be seem in figure 7.1. The distance to centre of bucket must be 10-50mm, diameter of thread 11.85mm and height 10mm.

Once the design is completed the student will learn about 3D printing in the Falmouth design centre, using their Maker Bot 3D printer®.

The 3D printed wheels can then be tested on the rig to calculate the power output from their designs. This can be compared to the instantaneous power in the water to work out an efficiency of their turbine. The calculations that can be performed are found in the next section of this report. Figures 7.1 and 7.2 show the testing apparatus for the 3D printed Pelton wheels.

!26

Figure 7.2 - Shows the two adjustable nozzles that are used with the 3D printed Pelton wheel. (Authors own)

Figure 7.3 - Shows a already printed Pelton wheel design and the mounting screw used for all 3D printed wheels. (Authors own)

Calculations

The total power of the water can be found using the formula:

"

Where 𝜌 is the density of the water, g the acceleration due to gravity, h the head height and Q the volumetric flow rate. Q can be found from the data read out, h is about 2mm and the other values are well known constants.

The speed of the water exiting the jet can be found using the formula:

"

Where Q is the volumetric flow rate and d is the diameter of the nozzle. This can be measured using a vernier callipers.

At present, the apparatus does not support measuring the torque on the generator shaft which would allow the shaft power of the water to be calculated.

If there was a torque measuring device attached to the rig the shaft power could be calculated using this equation:

"

With 𝜔 being the angular speed and t being the torque in the shaft.

The generator is connected to an electronic load device which allows the power, current, voltage and resistance. This allows you to work out the electric power from the Pelton wheel.

Using the equation below you can work out the efficiency of the wheel comparing the mechanical power and the electric power. Pw is the power in the water, and Pe is the electrical power generated.

"

With these equations the students can learn more about the efficiency of their designs and how mechanic, shaft and electronic power are related.

Pw = ρghQ

vm = Q4πd 2

Ps =ωt

η = PwPe

!27

CHAPTER 8

CONCLUSION AND FURTHER WORK Summary:

This project covered a multitude of different skills and required a vast amount of additional learning and reading around each topic. This was done in tandem with a literary review. The aim of the project was to produce a function device that met the scope defined earlier in the report. In this regard the project can be deemed to be a success. The design process was challenging at times but each issue that was encountered was dealt with and provided a learning experience. It is recommended that the device be PAT tested and then placed in the hands of the students for their use throughout the degree course.

Evaluation: Now that the project has been completed it is a useful process to analyse what improvements could be made to a future project producing a similar rig. This section will discuss some of these improvements.

The project management aspect of this dissertation project worked very well. Initially creating a Gantt chart and constantly re-evaluating the duration of these tasks as their nature became clearer. This allowed the project to be realistically managed and the plan adhered to whether that meant later nights spent on the project to keep on track.

The control panel on the rig was installed when this project started and it was decided that modifying it rather than building a new control panel would be the easiest option. With hindsight the control panel designed by the construction team, was not very accessible from the back which made changing LED’s very difficult. In a future project it would be wise to design a control panel with a removable face to allow easy access to the back side and consequent easy replacement of components. This also includes the ability to replace the potentiometer. The potentiometer used is one from the Arduino starter kit and seems to be poorly made. It has failed after about 2 weeks of use. Therefore, easy replacement is necessary, although in a future project it would be suggested that different, more robust, potentiometer be used.

Along the same vein, it would be wise to use higher power rated LED’s and thicker gauge wire in a future build as two of the LED’s failed and due to the difficultly of replacement, were removed from the control panel. Although this does not hinder the function of the existing rig, if more control logic was added it would be useful to have additional error indicators to make it easier for the user to identify errors.

The project now uses an Arduino Uno, but for the majority of the project an Arduino Mega was used. These boards have many more digital and analogue pins on them but are harder to find and are more expensive. The Uno’s on the other hand are readily available in the lab and are very inexpensive to replace. If re-doing the

!28

project it would be suggested that the Uno be used from the beginning to prevent the expensive Mega boards being broken and the resultant lead time waiting for a replacement board.

For another project like this it would be suggested that a labelling kit be available from the outset, allowing all the wiring to be properly labeled and catalogued. Although the wiring was labelled for this project, it was done using masking tape and hand written labels. The lab now has a labelling kit and another student would be wise to use this kit from the start. Unfortunately, the kit does not allow the labels to be added to wires where both ends are soldered, as it must be threaded onto the wire in advance.

The control panel label was produced using an A4 sheet of self adhesive laser paper, unfortunately the printer used produces a glossy finish which is prone to smudging and is not waterproof. Any contact with water, which is likely in this rig, leads to dis-colouration. It would therefore be suggested that an inkjet printer be used as this printing is water proof. Failing that, a layer of clear film can be applied to the control panel to prevent water reaching the laser printed paper.

Further Work The scope for this project was large and required a large variety of different skills and aims. This meant that decisions of task priority had to be made to ensure the completion of the main project aims. This section of the report will describe the elements of the project that can be completed at a later date.

Firstly, the original project aimed to control the two motorised valves controlling supply and bypass using a pair of digital potentiometers varying the 10v supply from 0-10v. This would allow the Arduino to control the position of the two valves very accurately. Through extensive testing it was found that by leaving the supply valve open fully and just adjusting the angle of the bypass valve you could achieve full control of the flow rate. It was therefore decided to only implement control on one of the valves. This is currently controlled using an external power supply. This works very well as it allows the user to see exactly what voltage they are providing and therefore very accurately choose the angle of openness of the valve. A further project would be to implement the two digital potentiometers to control the two valves and link these through logic to the rotary potentiometer on the control panel. It would also be wise to provide a readout on the display for the 100% flow to allow fine tuning.

Secondly, the rig must be thoroughly tested by a professional electrician to ensure the safety of students and lecturers when carrying out experiments. This electrician will also have to complete a PAT test on the rig to allow it to be commissioned, and comply with the university health and safety protocols.

Thirdly, the pressure sensors were one of the hardest elements to interface with the Arduino and where consequentially left until nearer the end of the project. With hindsight, we know the problems of inactivity in the signal pin were due to the face that they were overtightened by the construction team when being assembled,

!29

leading to the pressure transducers to malfunction. Unfortunately, work on these devices was left to near the end of the project timescales so that once the malfunctioning components were identified there was insufficient time left to reorder and replace them. Therefore a further piece of work would replace the pressure sensors. The wires used with the original sensors should be re-installed as they are already connected to the Arduino control board. The code is already set up to allow the sensors to read-out to the serial port. The sensors that are malfunctioning are: 1,2 and 3.

While working on the project it was found that using three water level sensing float switches was unnecessary and the project would function fully and safely with just one sensor. Also not using all of these sensors allowed the whole design to fit on a single Arduino Uno rather than a mega or an Arduino with multiplexing. The highest sensor is currently the only sensor in use. A follow-on project would wire in the other two switches and add them into the code. This would require a larger Arduino/multiplexed pins as currently all the digital pins are in use.

As 3 sensors were not utilised it was considered unnecessary to use the water level LED indicators on the control panel. A further project would add these connections to the Arduino and add in the code to allow them to work.

Between tank 1 and 2 is a solenoid valve, exactly the same as the other valves, that allows the user to control when water can flow between the tanks. A further project would investigate why this would be useful and commission it.

The generator is currently connected to the electronic load box which allows the resistance, current, power and voltage to be monitored via a serial display on the computer. At this stage there is not way to read out the rotational speed of the generator. A further project would implement a system that allows the rotational speed to be monitored on the serial display and displayed either independently or within the Arduino code.

Through the testing process it was found that the motor used as a generator for the Pelton wheel was too large for the purpose. The startup resistance is so great that it is hard to turn by hand. This is unsuitable especially when testing the small 3D printed Pelton wheels. A further project would analyse the current motor and specify and order a new motor. This would lower the losses in the motor and allow more power to be produced leading to more accurate recording of production data.

The code is currently written to allow the addition of a temperature sensor to the pump to enable it to be monitored. A future project would install a sensor and calibrate it to cut out the pump before it overheats.

The current system to display the data for the user works well and clearly shows the real time read outs for each sensor. A future project would develop a UI that allows the data to be read from the Arduino serial output and

!30

turned into a clear GUI. It would also be useful for this interface to allow data logging and the production of graphs of the data.

The original plan for the project included the production of a PCB rather than a strip board. It would be interesting to have a PCB made up. The designs for a PCB are included in the appendix but the time and monetary constraints prevented this being actioned.

To allow the students to measure the torque in the shaft and therefore the mechanic power in the shaft, a torque measuring device would need to be installed on the shaft. This would be relatively easy as there is a clear space on the shaft to allow a device to be installed.

!31

REFERENCES Bibliography

AnthonyJ350 (2011) How to solder / soldering basics Tutorial. Available at: https://www.youtube.com/watch?v=BxASFu19bLU (Accessed: 13 April 2016).

Arduino (2016a) ArduinoBoardMega. Available at: https://www.arduino.cc/en/Main/arduinoBoardMega (Accessed: 15 April 2016).

Arduino (2016b) ArduinoBoardUno. Available at: https://www.arduino.cc/en/Main/ArduinoBoardUno (Accessed: 28 March 2016).

Arduino (2016c) Map. Available at: https://www.arduino.cc/en/Reference/Map (Accessed: 20 March 2016).

Arduino (2016d) PulseIn. Available at: https://www.arduino.cc/en/Reference/PulseIn (Accessed: 20 March 2016).

Blum, J. (2013) Exploring Arduino: Tools and techniques for engineering Wizardry. Indianapolis, IN: Wiley.

Contributors (2016) Logic levels. Available at: https://learn.sparkfun.com/tutorials/logic-levels (Accessed: 13 April 2016a).

Cross, N. (2008) Engineering design methods: Strategies for product design. 4th edn. Chichester, West Sussex, England: Wiley-Blackwell (an imprint of John Wiley & Sons Ltd).

Dion.Caswell (2014a) Low flow applications. Available at: http://www.gemssensors.com/~/media/GemsNA/InstructionBulletins/RFO-RFA-2500-may14.ashx (Accessed: 18 March 2016).

Document (2011) Ohm’s law calculator. Available at: http://www.rapidtables.com/calc/electric/ohms-law-calculator.htm (Accessed: 28 March 2016).

EricTheCarGuy (2014) How to solder ultimate guide -EricTheCarGuy. Available at: https://www.youtube.com/watch?v=9ErNVJytyNs&nohtml5=False (Accessed: 13 April 2016).

Fine, L.G. (2009) The Swot analysis: Using your strength to overcome weaknesses, using opportunities to overcome threats. United States: AUTHORHOUSE.

FRANCIS TURBINE TEST RIG, KAPLAN WHEEL TURBINE TEST RIG., PELTON WHEEL TURBINE TEST RIG 1Kw, PRESSURE MEASUREMENT, LOSSES DUE TO PIPE FRICTION , manufacturers suppliers in India (no date) Available at: http://www.creativelabengineers.com/laboratory-instruments-equipments-suppliers-india.html?currentpage=8&number_of_pages=8&val=1&call=&cat_id= (Accessed: 21 April 2016).

Georgitzikis, V., Akribopoulos, O. and Chatzigiannakis, I. (2012) ‘Controlling physical objects via the Internet using the Arduino platform over 802.15.4 networks’, IEEE Latin America Transactions, 10(3), pp. 1686–1689. doi: 10.1109/tla.2012.6222571.

GreatScott! (2014) PWM VS potentiometer! When to use which technique? Available at: https://www.youtube.com/watch?v=90g6RpvXBYY (Accessed: 13 April 2016).

Health and Safety Exective (HSE) (2015) Guidance on regulations the electricity at work regulations 1989 HSE books health and safety executive. Available at: http://www.hse.gov.uk/pubns/priced/hsr25.pdf (Accessed: 28 March 2016).

!32

Incorporated, D. (2012) Recommended soldering techniques. Available at: http://www.diodes.com/pdfs/Ap02014_R1_Soldering.pdf (Accessed: 13 April 2016).

Institute, W. (2013) Use and capacity of global Hydropower increases. Available at: http://www.worldwatch.org/node/9527 (Accessed: 21 April 2016).

Javaid, M.A. (2012) ‘Coding the Arduino way’, SSRN Electronic Journal, . doi: 10.2139/ssrn.2389466.

Larman, C. (2004) Agile and Iterative development: A manager’s guide. Available at: https://books.google.co.uk/books?hl=en&lr=&id=76rnV5Exs50C&oi=fnd&pg=PA1&dq=iterative+development+model&ots=o9Z-UjHYO0&sig=nMmdJuZuNtevAnPRjNOj63TNHNI#v=onepage&q=iterative%20development%20model&f=false (Accessed: 21 April 2016).

Larman, C. and Basili, V.R. (2003) ‘Iterative and incremental developments. A brief history’, Computer, 36(6), pp. 47–56. doi: 10.1109/mc.2003.1204375.

Ltd, R.C. (2016) Absolute pressure sensor for various media, 150psi max pressure, 4.75 → 5.25 V, IP65. Available at: http://uk.rs-online.com/web/p/products/8315593/?grossPrice=Y&cm_mmc=UK-PLA-_-google-_-PLA_UK_EN_Automation_And_Control_Gear-_-Sensors_And_Transducers&mkwid=sfr9YCaWS_dc%7Cpcrid%7C88056616683%7Cpkw%7C%7Cpmt%7C%7Cprd%7C8315593&gclid=CjwKEAjwq6m3BRCP7IfMq6Oo9gESJACRc0bNpbYeErKJUszozgu1xWARAJertG9y8dcmkQO0mewBVxoCSKbw_wcB (Accessed: 17 March 2016a).

Ltd, R.C. (2014) RS components. Available at: http://uk.rs-online.com/web/c/tools/soldering-desoldering-tools/solders/ (Accessed: 28 March 2016b).

Margolis, M. (2011) Arduino cookbook. 1st edn. Sebastopol, CA: O’Reilly & Associates.

Mega Mechatronics (2014) Digital potentiometer Tutorial Arduino MCP4131 DAC raspberry pi. Available at: https://www.youtube.com/watch?v=_dUQOTemSJQ (Accessed: 13 April 2016).

Newton, R., plan, how to and manage a highly successful project (2007) Project management step by step: How to plan and manage a highly successful project. Harlow: Pearson Prentice Hall Business.

Patrick Hood-Daniel (2011) Microcontrollers - introduction to PWM (pulse width modulation). Available at: https://www.youtube.com/watch?v=mVx02s1fHIY (Accessed: 13 April 2016).

Pelton wheel for stock water supply (2012) Available at: http://www.crosstechengineering.co.nz/case-studies/Pelton-wheel-for-stock-water-supply/ (Accessed: 20 April 2016).

Power, H. 3 (2011) Types of turbines. Available at: http://www.3helixpower.com/hydropower/types-of-turbines/ (Accessed: 21 April 2016).

Salo, O. and Abrahamsson, P. (2007) ‘An iterative improvement process for agile software development’, Software Process: Improvement and Practice, 12(1), pp. 81–100. doi: 10.1002/spip.305.

Turbines (2000) Available at: http://mysite.du.edu/~jcalvert/tech/fluids/turbine.htm#Impu (Accessed: 20 April 2016).

Tushev, S. (2016) Measuring frequency with Arduino - Simon Tushev Website. Available at: https://tushev.org/articles/arduino/9 (Accessed: 20 March 2016).

Zhang, Z. (2016) Pelton turbines: 2016. Switzerland: Springer International Publishing AG.

!33

(No Date) Available at: http://www.hiil.org/bestpractices/How%20to%20determine%20acceptable%20levels%20of%20noise%20nuisance%20(UK (Accessed: 13 March 2016).

!34

APPENDICES

Contents:

A1: Video Manual

A2: Arduino Code Labelling

A3: Arduino Code

!1

DeviceID Device DescriptonControl/measurementDevice

ControlNeeded DisplayDataMethod

ArduinoInput Connec:on

ControlPanelInputsS1 On/Offswitchvalue PumpControl Switch On/off None D22 YesS3 On/Offswitchvalue Nozzle1 Switch On/off None D23 YesS4 On/Offswitchvalue Nozzle2 Switch On/off None D24 YesS5 On/Offswitchvalue Nozzle3 Switch On/off None D25 YesWL On/Offswitchvalue LowestWatersensor Switch On/off LED D26 YesWM On/Offswitchvalue MiddleWaterSensor Switch On/off LED D27 YesWH On/Offswitchvalue HighestWaterSensor Switch On/off LED D28 YesG1 On/Offswitchvalue GlassDownsensor Switch On/off LED D29 YesP1 PotenMometer SupplyControlDial PotenMometer 0-100 None A1 Yes

T1 Thermistor TemperaturesensoronPump Thermistor Temperature LED A No

MonitoringInputsP1 PressureSensor SupplyPressureSensor Pressuretransducer Analogueinput SerialDisplay A1 YesP2 PressureSensor Nozzle1PressureSensor Pressuretransducer Analogueinput SerialDisplay A2 YesP3 PressureSensor Nozzle2PressureSensor Pressuretransducer Analogueinput SerialDisplay A3 YesP4 PressureSensor Nozzle3PressureSensor Pressuretransducer Analogueinput SerialDisplay A4 YesF1 FlowMeter SupplyFlowMeter Halleffectsensor Analogueinput SerialDisplay A5 YesG1 Loadcontroler ConnectedtoGenerator NoRigOutputs

M1 ValveMotor SupplyValveMotor Supply Variablecontrol0-90 None No

M2 ValveMotor BypassValveMotor Bypass 10v:alwaysopen None NoPump On/OffDirectControl PumpControl S1 On/off None D30 NoN1 On/OffDirectControl Nozzle1 S3 On/off None D31 YesN2 On/OffDirectControl Nozzle2 S4 On/off None D32 YesN3 On/OffDirectControl Nozzle3 S5 On/off None D33 YesControlPanelOutputsWLLED LED LowestWatersensor WL=off On/off LED D34 YesWMLED LED MiddleWaterSensor WM=off On/off LED D35 YesWHLED LED HighestWaterSensor WH=off On/off LED D36 YesE1LED LED CloseTank G1=off On/off LED D37 YesE2LED LED SelectNozzle S3+S4+S5=off On/off LED D38 YesE3LED LED WaterLow WL=off On/off LED D39 YesE4LED LED PumpOverheat Temp=High On/off LED D40 YesE5LED LED PumpDisabled E1/E2/E3/E4=on On/off LED D41 YesE6LED LED Error6(Unassigned) On/off LED D42 Yes

A4: PCB Design

A5: Instruction Manual and Troubleshooting Guide

A1: Video Manual

The video manual can be found by following the link below:

https://www.youtube.com/watch?v=Yjza8H7w7DA

!2

A2: Arduino Code Labelling

!3

A3: Arduino Code

// // //----Code to interface all control devices----- // // //name all control panel inputs //digital const int S1 = 5; const int S3 = 6; const int S4 = 2; const int S5=3; //const int WL=30; //const int WM=; const int WH=7; const int G1=4; const int Speed=8; //analogue const int PressureSensorPin2=A3; const int VoltageReference = A0;

//name all rig outputs //digital const int Pump=9;

//name all control panel outputs //digital

const int E1LED=50; const int E2LED=10; const int E3LED=11; const int E4LED=12; const int E5LED=13; const int E6LED=14;

//name all states int S1State =0; int S3State =0; int S4State =0; int S5State =0; int WLState =0; int WMState =0; int WHState =0; int G1State =0; int P1State =0; int T1State =0;

// Is there an error? 0=no 1=yes int E1State =0; int E2State =0; int E3State =0; int E4State =0; int E5State =0; int E6State =0;

//Other Values float duration; float durationAbs; double LitresPerSecond;

///////////////////////////////////////// //the setup routine runs once when you press reset: //

void setup(){

//initialize serial communication at 9600 bits per second: Serial.begin(9600);

//make control panel inputs inputs //digital pinMode(S1,INPUT); pinMode(S3,INPUT);

!4

pinMode(S4,INPUT); pinMode(S5,INPUT); //pinMode(WL,INPUT); //pinMode(WM,INPUT); pinMode(WH,INPUT); pinMode(G1,INPUT); pinMode(Speed, INPUT); //analogue

//make rig ouputs outputs //digital pinMode(Pump,OUTPUT);

//analogue

//make control panel outputs outputs //digital //pinMode(WLLED,OUTPUT); //Water low //pinMode(WMLED,OUTPUT); //Water Medium //pinMode(WHLED,OUTPUT); //Water High pinMode(E1LED,OUTPUT); //Tank open pinMode(E2LED,OUTPUT); //select nozzle pinMode(E3LED,OUTPUT); //water low pinMode(E4LED,OUTPUT); //pump overheat pinMode(E5LED,OUTPUT); //pump Disabled pinMode(E6LED,OUTPUT); // unassigned }

///////////////////////////////////////// //the loop routine runs over and over again forever: //

void loop(){ //read the input pin: //digital int S1State = digitalRead(S1); int S3State=digitalRead(S3); int S4State=digitalRead(S4); int S5State=digitalRead(S5); //int WLState=digitalRead(WL); //int WMState=digitalRead(WM); int WHState=digitalRead(WH); int G1State=digitalRead(G1); duration = pulseIn(Speed, HIGH);

//analogue int PressureSensor2 = analogRead(PressureSensorPin2); float VoltageReferenceSensor = analogRead(VoltageReference); float Voltage = VoltageReferenceSensor * (5.0 / 1023.0);

///////////////////////////////////////// // Pressure Sensor Proccessing

float PressureVoltage2 = (PressureSensor2 * (Voltage / 1023.0))-0.74; float PressureSensorValue2 = 37.5*PressureVoltage2-18.75;

if (PressureSensorValue2 < 0) { PressureSensorValue2 = 0; }

// Pressure Sensor Proccessing float durationAbs = abs(duration);

float LitresPerSecond = 4.01973-0.0000527252*durationAbs;

if (LitresPerSecond >= 4.01973 || LitresPerSecond < 0) { LitresPerSecond = 0; } ///////////////////////////////////////// // ERRORS:

// Error 1: G1 and E1LED // if (G1State == LOW) {

!5

digitalWrite(E1LED, HIGH); } else { digitalWrite(E1LED, LOW); }

// Error 2: Select Nozzle //

if ( S3State == LOW && S4State == LOW && S5State == LOW ) { digitalWrite(E2LED, HIGH); digitalWrite(E2State, HIGH); } else { digitalWrite(E2LED, LOW); digitalWrite(E2State, LOW); }

// Error 3: Water Low //

if (WHState == LOW) { digitalWrite(E3LED, HIGH); digitalWrite(E3State, HIGH); } else { digitalWrite(E3LED, LOW); digitalWrite(E3State, LOW); }

// Error 5: Pump Disabled //

if (E1State == HIGH || E2State == HIGH || E3State == HIGH || E4State == HIGH ) { digitalWrite(E5LED, HIGH); } else { digitalWrite(E5LED, LOW); }

/////////////////////////////////////////

//Switch 1 and pump if (S1State == HIGH && E5State == LOW ) { digitalWrite(Pump, HIGH); } else { digitalWrite(Pump, LOW); }

//Error states are equal to the LED states E1State = !digitalRead(G1); E2State = digitalRead(E2LED); E3State = digitalRead(E3LED); E4State = digitalRead(E4LED); E5State = digitalRead(E5LED); E6State = digitalRead(E6LED);

// read the input on analog pin 0:

// print out the value you read:

!6

Serial.print("Pressure: ");

Serial.print(PressureSensorValue2); Serial.print(" psi");

Serial.print("\t");

Serial.print("Flow Rate: "); Serial.print(LitresPerSecond); Serial.print(" l/sec");

Serial.print("\t");

Serial.print("Errors: "); Serial.print(E1State); Serial.print(E2State); Serial.print(E3State); Serial.print(E4State); Serial.print(E5State);

Serial.print("\t");

Serial.print("Switches: "); Serial.print(S1State); Serial.print(S3State); Serial.print(S4State); Serial.print(S5State); Serial.print(WHState); Serial.println(G1State); delay(1); //delay in between reads for stability }

!7

A4: PCB Design

!8

A5: Instruction Manual and Troubleshooting Guide

This document commences on the next page.

!9