Pressure Sensor Controlled Valve Based Microcontroller In General Engineering Essay A pressure sensor measures pressure, typically of gases or liquids. Pressure sensor can also be called as pressure transducers, pressure transmitters, pressure senders, pressure indicators and piezometers. Pressure sensors are used for control and monitoring in thousands of everyday applications. Pressure Sensor Controlled Valve based Microcontroller in General A pressure sensor controlled valve based microcontroller is a pressure sensing device that is capable of controlling a desired pressure up to the set point set by the user. Besides, the pressure sensing device also allows the user to monitor and control the entire process of the system by interfacing a Microcontroller with a PC Using RS232 and the PC Serial Port. Pressure sensor and valve are required to design pressure sensing device according to their task Nowadays pressure sensors can vary in design, performance, application suitability and cost. On the other hand, pressure sensors can be classified in term of pressure ranges they measure, temperature ranges of operation, and most importantly the type of pressure they measure. Valves are used to control conditions such as flow, pressure, temperature, and liquid level. The opening or closing of the valve is depend on the signals received from the controllers that compare a set point to a process variable where the value is obtain from the sensor that monitor the change of conditions. Besides, the opening and closing of the control valve is done by electrical, hydraulic or pneumatic system. A valve also can vary in design, pressure range and temperature range of the operation, application suitability and cost. Project Objective The main objective of this project is to design and construct a prototype of pressure sensor controlled valve based microcontroller. This prototype should have the following fundamental features: Able to control the pressure through the setpoint set by the user. Able to activate the alarm if the pressure is above a setpoint. Able to shutdown the whole process if the pressure is in critical pressure. Able to monitor the process of the control through PC. Upon successful implementation of these fundamental features, enhancements are added to improve the safety of this pressure sensor controlled valve based microcontroller. The first improvement is adding manual control function to make this control valve able to control by the user even the pressure sensor is fail to give a signal to the microcontroller. Besides, a backup battery is also added into the controller to provide power when there is absence of main power supply. The backup battery will power the circuit only in the event of failure. On the other hand, a temperature sensor will also be added into this pressure sensor controlled valve based microcontroller to maintain the optimum temperature of the gas. Project Overview The pressure sensor controlled valve based microcontroller is designed to control pressure either in gas or liquid medium in any suitable application. The pressure sensor will senses the pressure from the along the tube or pipe along the application. The bottom of the pressure sensor is connected with a T-Joint connector to the tube or pipe and the analog control signal from the pressure sensor will be connected to the analog port of microcontroller. The analog signal received by microcontroller will be analyzed by the microcontroller. The microcontroller will then control the control valve by with the signal received by the sensor. Besides, a temperature sensor (LM35) will also be added into the prototype to enhance the performance of the prototype. The temperature sensor will be mounted at the surface of the tube or pipe. The temperature sensor will sense the temperature of gas or liquids inside the tube or pipe and send a control signal to microcontroller. The analog control signal from the temperature sensor will be connected to the analog port of microcontroller. The microcontroller then will control the control valve according to the temperature received by sensor. Recently, serial port of computer slowly phase out from the market and to be replaced with USB. Nowadays, most developer will favor USB to serial converter to obtain virtual serial port. So, in order to for general and convenient use, a USB to UART converter (UC00A) which offers USB plug and play, direct interface with microcontroller will also be added to the prototype to create a monitoring system through PC. The Transmit Signal (TX) from UC00A will be connect to the microcontroller receiver pin (RX/RC7) . While the Receive Signal (RX) from UC00A will be connect to the microcontroller transmitter pin (TX/RC6) . Then, a GUI( Global User Interface) will be develop using Microsoft Visual Basic for user to monitor the process operation of the prototype. On the other hand, a backup battery of 24Vdc will also be connected parallel with the main power supply. This is to provide the prototype with a backup power supply when there is no power provided from main power supply .This is to prevent and protect the prototype from trip of circuit and critical shut down of the prototype that might cause damage to the hardware of the prototype. Besides, a LCD display (216 characters) is used to display the pressure and temperature measured from the sensors and indicates the condition or status of the control valve and the air compressor which useful for calibration, monitoring, debugging and testing. A buzzer is embedded in the prototype is used as an alarm when the pressure or temperature is above the setpoint set by the user. Project Scope and Methodology This project consisted both of the hardware and software implementation. According to the schedule, construction of the final prototype was ensured to achieve the projects objective. At the same time, software also designed to meet all the fundamental requirements. When the prototype that met the primary objectives was successfully constructed, the remaining projects duration was spent on enhancements of the prototype to make it more durable and reliable. In part one, projects objectives identification and planning had been done. After that, research on some the theoretical background of the project such as types of pressure sensor, temperature sensor, type and size of fittings and tube, types of control valve and the basic electric component for the controller that needed for this project. Electronic components were carefully selected to construct the prototype based of its functionality, reliability and cost. When hardware selection was finalized and decided, a layout for printed circuit board (PCB) was designed and fabricated. After that, a simple program was written to test, calibrate and debug the prototype to make it worked as described in the primary objective. In part two, further enhancements to the prototype were planned and implemented. The mechanical drawing of the prototype had been designed. The mechanical part of the hardware such as pressure sensor, tubing, fitting, control valve is joint up together and the wiring is connected to the into the main board(Controller) of the prototype. Besides, monitoring system of the operation is also embedded to the prototype to ease the user to monitor the operation using a PC in a control room. After all features, were completed, testing was undertaking to ensure the reliability of the whole system. Troubleshooting and debugging phase on software and hardware were necessary to make all the system become more reliable and safe. Structure of the Report This report is divided into six chapters. At the Chapter 1, Introduction to the project which includes Pressure Sensor Controlled Valve Based Microcontroller in general, Project objective, Project overview, Project scope and Methodology had been discussed. In Chapter 2, some theoretical background for this project will be explained and described in details. While in Chapter 3, how hardware designed of this project as well as their functions will be elaborated. Besides, Methodology used for design the hardware also will be discussed in this chapter. Chapter 4 described the Methodology for the software development of this project. Flow chart for the program will be showed and explained. Besides, equipment and tools used to design complete software also will be discussed in this chapter. In Chapter 5, results and discussion will be shown to explain how the pressure sensor control valves based microcontroller performs its operation. On the other hands, the problems encountered while designing the prototype either in hardware or software and how these problems solved will be also discussed in this chapter. Chapter 6 will be the summary and conclusion of the report whether all the fundamental requirements and objectives achieved for Final Year Project. Then, there will be a short recommendation or suggestion to further improve this project so that it can be used in various types of industry environment. Chapter 2: Theoretical Background 2.1 Introduction to Pressure Sensor A pressure sensor is one that will measure the pressure either gasses or liquids. Pressure is an expression of the force required to stop a fluid or gas from expanding, and it can be express as the equation below. [1] P=F/A Where: Pà is the pressure, Fà is theà normal force, Aà is the area. Pressure Units can be expressed as the table below: Table 1: Pressure Unit 2.1.1 Types of Pressure Measurement Basically, pressures sensor can be classified in term of pressure ranges, temperature ranges and most importantly the pressure type. Pressure sensor can be classified in 5 types of pressure measurement which are : Absolute pressure sensor -Whereby the sensor measure the pressure relative to perfect vacuum pressure (0 Psi or no pressure) 2) Gauge pressure sensor -Whereby the sensor measure the pressure relative to given atmospheric pressure. For example when a tire pressure gauge read 0 Psi meaning to say there is 14.7 Psi (atmospheric pressure) in the tire. 3) Vacuum pressure sensor -The sensor is used to measure pressure less than the atmospheric pressure. 4) Differential pressure sensor -The sensor measures the difference between two or more pressures introduced as inputs to the sensing unit. 5) Sealed pressure sensor Whereby the sensor is used to measure the pressure relative to sea level pressure. 2.1.2 Types of Control Signal from Pressure sensor There are two types of Control signal from pressures sensor which are current output and voltage output signal. Current output normally ranged from 4-20ma while the voltage output normally ranged from 1-5Vdc or 1-6Vdc (The voltage output range mostly is depend by the manufacturer or the type of application). The current output and voltage output always start from 4ma and 1Vdc is to check whether the wiring of the pressure sensor is done correctly and to check whether there is faulty at the pressure sensor. For example, if the pressure sensor output a current below 4ma or 1Vdc, we have to check at the pressure sensor because they might be faulty at the pressure sensor. The current output control signal is widely used in many kind of industry compared to voltage output control signal. This is because there is no voltage drop when current output control signal travel a very long distance compare to voltage output control signal. When travelling at a very long distance, voltage output control signal will have disadvantage due to the resistance of the long wire will cause a voltage drop and might give an inaccurate result to the controller. So, the current output control signal tends to give a more accurate result compare to voltage output control signal. Due to limitation at PIC microcontroller which only has Analog-to-Digital Converter, so a voltage output control signal will be more suitable for the project. Types of Application of Pressure sensor A pressure sensor can be widely used in many types of application.For example: [2] 1) Pressure Sensing -The pressure is measure directly using pressure sensors. This is very useful in oil and gas industry, cars, aircraft, and other machinery that has a pressure functionality implemented. 2) Leak Testing -A pressure sensor can be used to sense the decay of pressure due to a system leak. This is done by either comparison to a known leak using differential pressure, or by means of utilizing the pressure sensor to measure pressure change over time. 3) Level Sensing A pressure sensor can also be used to calculate the level of a fluid. This technique is commonly employed to measure the level of contents in a tank (such as in a water tower). For most practical purposes, fluid level is directly proportional to pressure. In the case of fresh water where the contents are under atmospheric pressure, 1psi = 27.7 inH20 / 1Pa = 9.81 mmH20. The basic equation for such a measurement is Pà =à pà *à gà *à h Where P = Pressure, p = Density of the Fluid, g = Standard Gravity, h = Height of fluid column above pressure sensor Introduction to Valve A valve is device that is used to regulate the flow of a fluid or gasses by opening and closing or partially obstructing various passageways. A valve can be operating either in manual operation or automatic operation driven by change in pressure, temperature or flow. For manual operation, the opening and closing of the valve is control by using hand wheel, lever or pedal using human force. Meanwhile for the automatic operation, the opening and closing of the valve is control using an actuator .An actuator will stroke the valve depending on its input and set-up, allowing the valve to be positioned accurately, and allowing control over a variety of requirements. Nowadays, Actuators are widely used for the purposes of automatic control such as in washing machine cycles, remote control such as the use of a centralisedà control room, or because manual control is too difficult such as when the valve is very large. [3] 2.2.1 Types of Actuator in the Valve Valve can be classified on how they are actuated. Among them are: [3] Hydraulic Pneumatic Manual Solenoid Motor For a hydraulic system actuator valve is normally used to control a high pressure while Pneumatic system actuator valve is normally used to control a medium pressure in application. Meanwhile low pressure, solenoid or motorized system actuator valve can be used. 2.2.2 Application of Valve Valve can vary widely in form and application. The size of the valve is typically range from 0.1mm to 60cm. Some special valve can have a diameter exceeding 5 metres. The cost for a valve is depending on types of the design, material build, range of temperature and pressure and manufacturer. When a designer, engineer, or user decides to use a valve for an application, he/she should ensure the rated maximum temperature and pressure are never exceeded and that the wetted materials are compatible with the fluid the valve interior is exposed to. [3] The industries in which the majority of valves are used are oil and gas, power generation, water reticulation, sewerage and chemical manufacturing. [3] 2.3 Introduction to Tubing Tubing is pipe or a hollow cylinder for the transmission of fluid (liquid or gas). The term of pipe and tubing can be interchangeable although there are minor distinctions exist- basically, tubing imply tighter engineering requirements than pipe. Both pipe and tubing can be varies in different rigidity and permanence. For examples, a hose is normally portable and flexible. Besides, tubing and pipe can be specified by standard pipe size designation. Types of tubing are specified by the actual inside diameter, outside diameter and the wall thickness. [4] 2.3.1 Types of Tubing Basically, there are few types of tubing can be used in industry. Among them are: Copper Tubing Stainless Steel or Aluminium Tubing Plastic Tubing For copper tubing, there are two basic types of copper tubing, soft copper and rigid copper. Copper tubing can be joined using flare connection, compression connection, or sweat (solder). Soft copper tubing can be bent easily to travel around obstacles in the path of the tubing while a rigid copper cannot be bent and must useà elbow fittingsà to go around corners or around obstacles. Soft copper is the most popular choice for refrigerant lines inà split-systemà air conditioners and heat pumps while rigid copper is most popular choice for water line. [5] For Aluminium Tubing, it is sometimes used in industry because it is resistance to corrosion and solvents, and for its ductility. Besides, aluminium cannot create sparks when there is a transmission of flammable solvent and the weight for aluminium is lighter compare to steel and iron which make it suitable to use in many types of industry. [5] Aluminium tubing can be joined using flare connection, compression connection, or sweat (solder). Aluminium tubing can be used for heat transfer tubing such as in refrigerant systems. [6] For Plastic Tubing, there are few types of plastic tubing which are PVC(polyvinyl chloride) and CPVC, Polyethylene, Rigid Polypropylene, ABS (acrylonitrile butadiene styrene) and Nylon tubing. The most popular for plastic tubing is PVC. It is rigid, and uses thread or glue connections. Besides, it is available in several of pressure range. [5] Plastic tubing is widely used for its light weight, chemical resistance, non-corrosive properties, and ease of making connections. [6] 2.3.2 Types of Tube Fittings There are many types of connection methods for tubing application in industry. The four most common types of tube fttings connections are: Compression Tube Fittings Flare Fittings Bite-Type Tube Fittings Mechanical Grip-Type Tube Fittings The Compression Tube Fitting was the first tube fitting to be introduced, which consist of three components: nut, body and gasket ring or ferrule. The disadvantages of compression tube fittings was it can withstand only minimal pressure and the remake is very difficult due to the contrustion of the sealing ring. [7] CompressionTube Fitting The Flare Fitting was the another variation in tube fittings designs. The fittings is made up from a nut, sleeve and body with a flare or coned end. During installation of a tubing, a special flaring tools are usually required .The disadvantages of flare fittings is that flaring of the tubing may cause stress riser at the base of the flare or cause the axial cracks on thin tubing. [7] Flare Fitting For Bite-Type Tube Fitting , it is used to accommodate higher pressure application over the compression tube fitting design. The fittings is typically made up with a nut, body and ferrule(s) having a sharp leading edge, which give bites into the skin of the tubing to achieve griping and holding ability. There are two types of design for bite-type tube fittings which are the single ferrule and twin ferrule design. In single ferrule bite, the nose of the ferrule performs two functions. The first function is to bite into the tube to hold it and second function is to provide a sealing element for the coupling body.In twin ferrule bite, the back ferrule is used to bite and provide gripping into tube and the front ferrule is used for sealing element for the coupling body. [7] Single-Ferrule Bite-Type Two-Ferrule Bite Type Meanwhile for Mechanical Grip-Type Tube Fittings are typically two-ferrule in design. The front ferrule is used to seals by coining the surface of the tubing and coupling body. While the back ferrule is used holding action. The back ferrule grip the tube for a distance just out-board from tube holding point of the ferrule nose to enhance vibration resistance. The main advantanges of this design compare to the bite-type fittings is that break and remake of the fitting after installation can be more successfully accomplished without damage to either the fitting components or the tubing. [7] Mechanical- Grip Type 2.4 Introduction to Pipe Thread Basically ,there are two types of standard for pipe thread which are : British Standard Pipe- BSP American National Pipe-NPT/NPS Both of British Standard pipe and American National Pipe is designated by trade size rather than actual diameter. Under BSP, there are two basic types of BSP threads which are the BSPT (British Standard Pipe Taper) which is also know as R threads and BSPP (British Standard Pipe Parallel) which is also known as G threads. Both of the BSPT and BSPP have the same thread angle, shapre and pitch ( threads per inch). The only difference for BSPT and BSPP is BSPT threads are tapered and BSPP threads are straight ( parallel). BSP thread have a 55o include angle and have rounded peaks and valleys. On the other hands, for NPT, there are also two basic types of national pipe threads which are NPT ( National Pipe Taper) abd NPS ( National Pipe Straight) . Both NPT and NPS have the same thread angle, shape, and pitch (threads per inch).à However, NPT threads are tapered and NPS threads are straight (parallel).à Both threads have a 60à ° included angle and have flat peaks and valley 2.4.1 NPT vs BSP Pipe NPT thread are widely used in United State but, BSP thread are more widely used in many other countries.The actual specified outside diameters of American National Pipe is slightly different from British Standard Pipe,.NPT/NPS and BSP thread are not compatible with each another. This is due to the differences in their thread forms and pitch . NPT/NPS threads have a 60à ° included angle and have flattened peaks and valleys while a BSP threads have a 55à ° included angle and have rounded peaks and valleys As conclusion, never ever try to mate a BSP fittings with an NPT or NPS fittings if the pressure holding capability is at all critical. CHAPTER 3 HARDWARE AND SETUP DESIGN In this chapter, the hardware components used to setup the hardware would be elaborated and discussed. Each components features and its operation were studied before proceed to the hardware design. These components were tested on breadboard individually with simple program. The main purpose of this is wanted to determine components and algorithms used are work and function properly. Based on these algorithms, a complete program could be designed to make all the components work in the correct manners. The details about software methodology will be explained at next chapter. After all the hardware components passed the testing, a proper design of Printed Circuit Layout (PCB) was needed. A good and neat design of the PCB would ensure all the components work stability and properly to achieve the project primary objectives. During this stage, Electromagnetic Interference (EMI) theory had studied to prevent undesired manners such as noise or crosstalk occurred in the PCB board. Besides , the design drawing of hardware prototype is also had been studied before assembling the hardware prototype. At the last stage, the tubing, fittings, valve, pressures sensor and pressure gauge is assemble carefully in order to prevent gasses leakage from prototype. 3.1 Microcontroller Unit (MCU) A microcontroller is a computer system that runs on a single integrated circuit. It usually consists of Central Processing Unit (CPU), memory unit and Input/Output (I/O) modules. Apart from these, a MCU also contains timers, counters and interrupt scheduling circuitry. Microcontrollers are widely applied in the robotics and embedded system controllers. Different microcontroller models may offer extra peripherals and registers for some applications (eg. UART, SPI, I2C and etc.). They usually run in a fixed oscillating frequency. There are advanced microcontrollers which are 32-bits microcontroller developed nowadays. But, 8-bit microcontrollers are usually sufficient to design a small embedded controller. In this project, Microchip microcontroller had been chosen due to its extra features. For instance, PIC had built-in ADC module to ease the analog to digital signal converting and Universal Synchronous Asynchronous Receiver Transmitter (USART) module to communicate with PC. 3.2 Microchip PIC Microcontroller PIC stand for Peripheral Interface Controller. Until now, Microchip had developed and manufactured multiple families of PIC microcontroller in different packages. They are several families in a certain category such as PIC10, PIC12, PIC16, and PIC18 in 8-bit PIC microcontrollers, PIC24F, PIC24H, dsPIC30 and dsPIC33 in 16-bit PIC microcontrollers and PIC32 in 32-bit PIC microcontroller. The PIC microcontroller that is used in this project is PIC16F877A. One of the reason this PIC microcontroller was choosen because it is in 40-pin DIP package. It was also chosen because it is powerful and yet easy to program CMOS FLASH with only 25 single word instructions based 8-bit microcontroller. With the 20MHz operating frequency, the PIC only need only 200 nanoseconds to execute and instruction.