Weather Station PLC Project



0-691515righttop Hussain MustafaStudent Name: Hassan RadhiStudent ID: 20900009CPR: 910404577Tutor: David Krause 40000100000 Hussain MustafaStudent Name: Hassan RadhiStudent ID: 20900009CPR: 910404577Tutor: David Krause Bachelor of Engineering TechnologyENB7904Co-operative Learning Project (Electronics)-1524004530725Weather Station PLC Project900007300Weather Station PLC ProjectTable of Contents TOC \o "1-3" \h \z \u Table of Figures PAGEREF _Toc389398570 \h 2Table of Tables PAGEREF _Toc389398571 \h 4Abstract: PAGEREF _Toc389398572 \h 5Introduction: PAGEREF _Toc389398573 \h 6Industry applications: PAGEREF _Toc389398574 \h 6Objectives and task description: PAGEREF _Toc389398575 \h 7Weather station circuit: Mbed circuit: PAGEREF _Toc389398576 \h 8Pressure sensor circuit: PAGEREF _Toc389398577 \h 9Wind vane sensor circuit: PAGEREF _Toc389398578 \h 12The anemometer circuit: PAGEREF _Toc389398579 \h 13Temperature sensor: PAGEREF _Toc389398580 \h 167-segment circuit: PAGEREF _Toc389398581 \h 18Voltage circuit using LM2576: PAGEREF _Toc389398582 \h 20LEDs circuit: PAGEREF _Toc389398583 \h 23Humidity circuit: PAGEREF _Toc389398584 \h 24Thumbwheel switch: PAGEREF _Toc389398585 \h 25Hardware Fabricarion: PAGEREF _Toc389398586 \h 26Weather station box: PAGEREF _Toc389398587 \h 26Printed circuit board: PAGEREF _Toc389398588 \h 29Board platform: PAGEREF _Toc389398589 \h 31Software: PAGEREF _Toc389398590 \h 32Program functionality: PAGEREF _Toc389398591 \h 32MBED code: PAGEREF _Toc389398592 \h 33PLC code: PAGEREF _Toc389398593 \h 41the input/output list: PAGEREF _Toc389398594 \h 56Virtual Instruments: PAGEREF _Toc389398595 \h 57SCADA (supervisory and data acquisition): PAGEREF _Toc389398596 \h 57HMI (Human machine interface): PAGEREF _Toc389398597 \h 58 PAGEREF _Toc389398598 \h 60Disscusion: PAGEREF _Toc389398599 \h 61Voltage regulators: PAGEREF _Toc389398600 \h 61Instrument Amplifier for the pressure sensor: PAGEREF _Toc389398601 \h 63Temperature sensor: PAGEREF _Toc389398602 \h 63Pressure simulation mechanism: PAGEREF _Toc389398603 \h 64Recommantoinas: PAGEREF _Toc389398604 \h 65Appendix: PAGEREF _Toc389398605 \h 66Footprints with 3D models PAGEREF _Toc389398606 \h 66References PAGEREF _Toc389398607 \h 74Table of Figures TOC \h \z \c "Figure" Figure 1 sensor circuit PAGEREF _Toc389398472 \h 8Figure 2 Voltage divider diagram PAGEREF _Toc389398473 \h 9Figure 3 Pressure sensor PAGEREF _Toc389398474 \h 10Figure 4 Instrumentation amplifierINA126 with pin configuration PAGEREF _Toc389398475 \h 10Figure 5 Pressure sensor circuit PAGEREF _Toc389398476 \h 11Figure 6 Wind Vane Internal Connection PAGEREF _Toc389398477 \h 13Figure 7 Wind speed sensor PAGEREF _Toc389398478 \h 14Figure 8 weather head circuit PAGEREF _Toc389398479 \h 15Figure 9 4 To 20 mA Current Source (0°C to +100°C) circuit PAGEREF _Toc389398480 \h 17Figure 10 temperature sensor LM35DZ PAGEREF _Toc389398481 \h 17Figure 11 7-segment circuit PAGEREF _Toc389398482 \h 18Figure 12 Decoder Pin Out PAGEREF _Toc389398483 \h 19Figure 13 Voltage divider diagram PAGEREF _Toc389398484 \h 20Figure 14 LM2576-Adj 5 volt circuit PAGEREF _Toc389398485 \h 21Figure 15 LM2576-Adj 10 volt circuit PAGEREF _Toc389398486 \h 21Figure 16 Inductor value selection graph guide PAGEREF _Toc389398487 \h 22Figure 17 LED circuit PAGEREF _Toc389398488 \h 24Figure 18 LinPicco A05 Basic humidity sensor PAGEREF _Toc389398489 \h 25Figure 19 Truth table Figure 20 Thumbwheel switch PAGEREF _Toc389398490 \h 26Figure 21 Thumbwheel circuit PAGEREF _Toc389398491 \h 26Figure 22 Top dimensions (sizes in millimeter) PAGEREF _Toc389398492 \h 27Figure 23 Sides and bottom dimensions PAGEREF _Toc389398493 \h 28Figure 24 3D model top view of the weather station PAGEREF _Toc389398494 \h 29Figure 25 3D model of the Weather head PAGEREF _Toc389398495 \h 29Figure 26 PCB of the weather station PAGEREF _Toc389398496 \h 30Figure 27 3D model of the weather station PCB PAGEREF _Toc389398497 \h 31Figure 28 weather station on the board platform PAGEREF _Toc389398498 \h 32Figure 29 SCADA control panel PAGEREF _Toc389398499 \h 58Figure 30 Page 1 of the HMI PAGEREF _Toc389398500 \h 59Figure 31 Page 2 of the HMI PAGEREF _Toc389398501 \h 59Figure 32 Page 3 of the HMI PAGEREF _Toc389398502 \h 60Figure 33 Page 4 of the HMI PAGEREF _Toc389398503 \h 60Figure 34 Page 5 of the HMI PAGEREF _Toc389398504 \h 60Figure 35 Page 6 to 9 of the HMI PAGEREF _Toc389398505 \h 61Figure 36 LM2576 circuit PAGEREF _Toc389398506 \h 62Figure 37 LM317 circuit PAGEREF _Toc389398507 \h 62Figure 38 MC34063 pin out PAGEREF _Toc389398508 \h 63Figure 39 MC34063 circuit PAGEREF _Toc389398509 \h 63Figure 40 the new temperature circuit PAGEREF _Toc389398510 \h 64Figure 41 the pressure sensor connected to the injection via plastic pipe PAGEREF _Toc389398511 \h 65Figure 42 To-92 through-hole component Figure 43 Sot -32 surface mounted device PAGEREF _Toc389398512 \h 67Figure 44 a footprint of a 16 pin IC socket PAGEREF _Toc389398513 \h 67Figure 45 DO-41 3D model Figure 46 DO-41 footprint PAGEREF _Toc389398514 \h 67Figure 47 TO-18 3D model Figure 48 TO-18 footprint PAGEREF _Toc389398515 \h 68Figure 49 16 pin IC socket 3D model Figure 50 16 pin IC socket footprint PAGEREF _Toc389398516 \h 68Figure 51 5mm diameter LED 3D model PAGEREF _Toc389398517 \h 68Figure 52 5mm diameter LED footprint PAGEREF _Toc389398518 \h 69Figure 53 TO-92 3D model Figure 54 TO-92 footprint PAGEREF _Toc389398519 \h 69Figure 55 TO-220 3D model Figure 56 TO-220 footprint PAGEREF _Toc389398520 \h 69Figure 57 AXIAL-0.4 resistor 3D model Figure 58 AXIAL-0.4 footprint PAGEREF _Toc389398521 \h 70Figure 59 Mbed with 40 pin connector 3D model Figure 60 40 pin connector footprint PAGEREF _Toc389398522 \h 70Figure 61 10 pin connector 3D model Figure 62 10 pin connector footprint PAGEREF _Toc389398523 \h 70Figure 63 Touch screen PanelView Plus 600 3D model PAGEREF _Toc389398524 \h 71Figure 64 2x16 LCD 3D model PAGEREF _Toc389398525 \h 71Figure 65 Thumbwheel 3D model PAGEREF _Toc389398526 \h 72Figure 66 PCB circuit PAGEREF _Toc389398527 \h 72Figure 67 weather station panel 1 PAGEREF _Toc389398528 \h 73Figure 68 weather station panel 2 PAGEREF _Toc389398529 \h 73Figure 69 weather station wiring PAGEREF _Toc389398530 \h 74Figure 70 PCB placed on top of the board PAGEREF _Toc389398531 \h 74Table of Tables TOC \h \z \c "Table" Table 1 Pin Configuration PAGEREF _Toc389396308 \h 8Table 2 Measured voltage v.s Voltage out direction Table PAGEREF _Toc389396309 \h 11Table 3 Input Specifications – 1769-HSC PAGEREF _Toc389396310 \h 14Table 4 Output Specifications – 1769-HSC PAGEREF _Toc389396311 \h 14Table 5 humidity circuit PAGEREF _Toc389396312 \h 23Table 6 Digital output of module 6 Table 7 Digital output of module 4 PAGEREF _Toc389396313 \h 55Abstract:The main purpose of the project is to design and construct a model of weather station using programmable logic controller (PLC) to control its functionality. It is proposed that the model will be used as an educational resource within the PLC system courses at Bahrain polytechnic. Two different options have been considered of doing the project which is programming it either by the Mbed or the PLC. The benefits of the PLC outweigh the benefits of the other option. The model will consist of these main components circuits, sensors, SCADA and the PLC. The Gantt chart will show the schedule of carrying out the project phases.Introduction:This is a co-op industry student engineering program for the final year student which is to make a project with the purpose to implement the experience gained throughout the Engineering Bachelor of five years to make an industry project. The project will be used as an educational resource for the students that will enroll in the PLC (Programmable Logic Controller) course at the Polytechnic.The project was proposed by the tutor, which was to make a weather station to be used in the PLC course by the students to test the students comprehension of the PLC programming and its difficulty. For the project to be approved by the Bahrain Polytechnic an interview will be held at the tutor’s office, the student will get acquainted with room designated by the Polytechnic to work in and the student can complete the project with is confidence. After choosing the desired project, the proposal report will be handed to the tutor for the approval of the project.As for this project, this report will describe the process of designing the weather station, which was requested by the student, it will show information on how both software and hardware were designed and integrated together. Industry applications:The purpose of the weather station in the industry is to auto control and interlock with the instruments and equipment via SCADA or special software. The instruments and equipment can are fully operational respectively in specific order to be able to manage the turning on and off of the process flow. During failure throughout the process, the machine or the computer that controls the system make different responses if any problems with it and alarms/sirens. Both SCADA and HMI VIs are implemented for convenience for the operator. It also simultaneously display the condition of the system both on the computer and on the weather station project.Objectives and task description:Figure SEQ Figure \* ARABIC 1 sensor circuitWeather station circuit:Mbed circuit:The Vcc of the LCD is connected to Vout of the Mbed which has a 3.3v output. The 1k resistor is used for the contrast of LCD, LED- is connected to ground and the LED+ is the back light of the LCD, at first the LCD directly took about 270mA which is considered as a high current draw component comparing to others, so a 5?/1 watt resistor was placed to lower the current. The voltage supply for the LED+ in the LCD is given by the output of the LM2576 switching regulator.The PLC digital output pins is voltage 24v and the digital inputs of the Mbed is at least3.3v to 5v, therefore a voltage divider is used to drop the 24v of the PLC output to 3.5v for the digital inputs in order for them to work properly as the inputs will display the conditions of the weather sensors on the LCD such as (humidity, temperature, air pressure and wind speed warnings). Mbed voltage divider Figure SEQ Figure \* ARABIC 2 Voltage divider diagramThe calculation of the Rb using the Voltage divider law:Vout = 3.5V neededVin = 24VRa = 39k? VOut=RaRb+Ra x Vin3.5=39kRb +39k x 24Ra= 6658.54 ≈ 6.8k?After making much calculation and according to the available resistors at the polytechnic I choose Ra as 39k and Rb as 6.8k, because it was the closest value I found near to the calculations and I measured the current and it was 0.0546 mA between the voltage divider to the Mbed.Pressure sensor circuit:Note: this sensor will simulate the barometer which measures the differential air pressure, because I didn’t find a cheap/efficient barometer to purchase that is suitable for the PLC.The 24PCEFA6Dpressure sensor provides reliable differential pressure sensing performance in a compact package. The sensor features a proven sensing technology that utilizes a specialized piezo resistive micro-machined sensing element. The low power, non-amplified, non-compensated Wheatstone bridge circuit design provides inherently stable mV outputs ±0.5 psi sensing range.TypePinVcc1Output A2GND3Output B4Table SEQ Table \* ARABIC 1 Pin ConfigurationFigure 3 Pressure sensorInput voltage: 10 - 12 VCurrent consumption: 2 mAOutput signal: 70 mVPressure range: ± 0.5The output signal was too low, so an amplifier was used to make the output signal from 0– 70mV to 0 – 10V to be used on the PLC.Instrumentation Amplifier The INA126 is a precision instrumentation amplifier is used for accurate, low noise differential signal acquisition. The op-amp design provides excellent performance with very low current (175μA/channel). This combined with a wide operating voltage range of {1.35V to 18V}.Figure 4 Instrumentation amplifierINA126 with pin configurationInput voltage: 1.35 - 18 VCurrent consumption: 175μAAs seen the pressure sensor is connected to the amplifier the Vcc is 10V. Output A (the positive) is connected to the Vin+ of the amplifier and Output B (the negative) is connected to the Vin- of the amplifier. The amplifier also can operate on 10V with an adjustable gain controlled by the RG. Figure 5 Pressure sensor circuitCalculation:The normal air pressure is 14.7 psi (pound-force per square inch) to convert it to hPa (hectopascal) 1 hectopascal [hPa] = 0.014503773773 psi [psi], sohPa= psi0.014503773773= 14.70.014503773773= 1013.53 hPaMinimum and maximum of the pressure capabilities:The pressure range is ± 0.5 in psi about 1, soMinimum pressure:Minimum = 14.7 - 0.5 = 14.2 psiConvert it to hPa= psi0.014503773773= 14.20.014503773773= 979.06 hPaMaximum pressure:Maximum = 14.7 + 0.5 = 15.2 psiConvert it to hPa= psi0.014503773773= 15.20.014503773773= 1048 hPahPa calculation:First scale down the PLC analog in percentage from 10000 to 10 by diving it by 1000 to get the voltage and then convert the voltage to hPa with minimum and maximum decided with equation.Output Signal =voltage -0.6 x 7.35 +979.06Calculation:The calculation of the gain:Gain= VoutVin= 1035m= 285.7The calculation of the resistor that will produce the gain:Gain=5+ 80kRGRG= 80k285.7-5= 285.2?Wind vane sensor circuit:The wind vane sensor (p/n 80422) will indicate the direction of the wind. It has eight switches, each connected to a different resistor. An external resistor can be used to form a voltage divider, producing a voltage output that can be measured with an analog to digital converter. The switch and resistor arrangement?Resistance values for all 8 possible positions are given in are used in the project .Resistance values for positions between those shown in the diagram are the result of two adjacent resistors connected in parallel when the vane’s magnet activates two switches simultaneously.The sensor SpecificationsPower supply rang: 3.3 - 5.5 Volts (typical supply is 3.3).Table SEQ Table \* ARABIC 2 Measured voltage v.s Voltage out direction TableDirectionDegreeVoltage OutMeasured VoltageResistance Switch (?Ω)North03.843.8733kNorth East452.252.278.2kEast900.450.4591kSouth East1350.900.9112.2kSouth1801.401.413.9kSouth West2253.083.116kWest2704.624.66120kNorth West3154.784.3764.9kFigure 6 Wind Vane Internal ConnectionThe anemometer circuit:The wind speed sensor uses the rotations to calculate the speed of the wind. The wind speed is detected with pulses and the wind direction is detected with voltage. The time between transition pulse to the output and the next pulse is used to calculate the speed. For example, if the time between the pulses is one second, the speed is going to be around 2.4km. The speed detection range is from 0 to 30Kmh. The wind speed blade rotates and each rotation the magnet connects the output to the Vcc input 5v and creates a pulse.The sensor specification3.3v to 5v supply voltagepulse output typeSpeed detection from 0 to 30 kmh.Current draw 0.5mAFigure 7 Wind speed sensorThe current of the anemometer is too low for the high speed counter of the PLC, a circuit was used to upscale the current atlest above 6.8mA to work on the HSC.To measure the maximum speed of the anemometer, an Anemometer Wind Speed Meter was used. Were it was found that it is at 10Hz which is equal to 30km/h.In order for the wind directoin sensor to work, a 10k pull-up is connected the input signal with 5v and then connected the direction signal to the analog In of the PLC. Same goes for the anemometer connected the input signal with a 10k pull-up resistor with 5v and then connected the anemometer signal to the high speed counter of the PLC.The current of the anemometer was too low for the high speed counter of the PLC, a current step-up circuit is used that would upscale the current atlest above 6.8mA to work on the HSC in this case 10mA.Figure SEQ Figure \* ARABIC 8 weather head circuitCalculation:The calculation of the R1:The voltage of the signal is 5v minus the voltage of transistor base 0.7v and divided by the current of the transistorOhm’s law R= VI= 5-0.7200m= 21.5 ≈22?The calculation of the R2:6.8mA is needed, so higher up to 10mA is enoughOhm’s law R= VI= 2410m= 2.4k?PLC High speed counter Specifications:attribute1769-HSCInput voltage range2.6…30V DCOn-state voltage, max30V DCOn-state voltage, min2.6V DCOn-state current, min6.8 mAOff-state voltage, max1.0V DCOff-state current, max1.5 mAOff-state leakage current, max1.5 mAInput current, max15 mAInput current, min6.8 mAInput impedance, nom1950 ΩPulse width, min250 nsPulse separation, min131 nsInput frequency, max1 MHzTable SEQ Table \* ARABIC 3 Input Specifications – 1769-HSCattribute1769-HSCOutput voltage range5…30V DCOn-state voltage, maxUser power – 0.1V DCOn-state current, min1 mAOn-state voltage drop, max0.5V DCOff-state leakage current, max5 ?ATurn-on time, max400 ?sTurn-off time, max200 ?sReverse polarity protection30V DCTable SEQ Table \* ARABIC 4 Output Specifications – 1769-HSCTemperature sensor:The LM35DZ is an integrated-circuit temperature sensor with an output voltage which is linearly proportional to the Celsius temperature.Features:Calibrated directly in ° Celsius Operates from 4 to 30 voltsOutput current 0 to 10mALess than 60 μA current drainFigure 9 4 To 20 mA Current Source (0°C to +100°C) circuitFigure 10 temperature sensor LM35DZFigure SEQ Figure \* ARABIC 11 7-segment circuit7-segment circuit:Figure SEQ Figure \* ARABIC 12 Decoder Pin OutDecoder information:Input voltage: 3 – 18 VMax Current: 25mAThe CD4511 is a BCD to 7-segment decoder driver. Its function is to convert the logic states at the outputs of a BCD, which will drive a 7-segment display. The display shows the decimal numbers 0-9 and is easily understood.The 7-segment circuit (Fig 30) holds 4x 7-segment Decoder CD4511, 4x 220 ohm resistor pack, 4x 7-segment displays and voltage dividers and the header that will be inputted to the PLC output module. The decoder converts the binary coded decimal from the ABCD pins to 7-segment lights. The 10k resistors are pull down resistors to prevent any leakage or false readings on another switchThe Vcc and the LT pins of the CD4511 7-segment decoder will be connected to the +5v coming from the LM2576 switching regulator. The voltage has to be stepped down from 24v coming from the PLC outputs to 5vin order for the BCD inputs, blanks and strobes in the decoder to able to read a signal.The calculation of the Ra value by using Ohm’s law:V=I x RRa=VI= 24 - 50.5m= 38k ≈ 39k?Then calculated the Rb using the Voltage divider law:Vout = 5V neededVin = 24VRa = 39k? VOut=RaRb+Ra x Vin5=3.9kRb+3.9k x 24Rb= 10263.16 ≈ 10k?Figure SEQ Figure \* ARABIC 13 Voltage divider diagramThe 220 ohm resistor packs will step down the current, to prevent excess current going to the 7-sgements LEDsThe calculation for the resistor packs:The 7-seg display has maximum current of 15mA, so if I applied ohm’s law on it:V=I x RR=VI= 5-1.815m= 213? ≈ 220?Voltage circuit using LM2576:Figure SEQ Figure \* ARABIC 14 LM2576-Adj 5 volt circuitFigure SEQ Figure \* ARABIC 15 LM2576-Adj 10 volt circuitThe LM2576 switching regulator circuit is inclulded in the prjoect to get 5v out from a 24v input. It is used to supply the main components such as, temperature, CD4511 decoder, Mbed, wind vane and the anemometer. The other LM2576 circuit is used to supply the pressure sensor and its instrument amplifier with 10v. The components of the LM2576 are calculated due to the recommantations of the datasheet. The calculation for LM2576-Adj +5 volts:Vref = 1.23V, R1 has to between 1k and 5kVout= Vrefx 1+ R2R1x Vout1.23 x 1+ 68002200=5.03 ≈ 5vThe calculation for LM2576-Adj +10 volts:Vref = 1.23V, R1 has to between 1k and 5kVout= Vrefx 1+ R2R1x Vout 1.23 x 1+ 130001800=10.11≈ 10vThe calculation of LM2576 components:Inductor:The Calculation of the inductorusing the following formula:L=Vin-VoutxVoutVinx1000F(in Khz)L=24-5x524x100052 = 76.12L = 76.12 μHIload = 2AInductance Region = H150 Figure SEQ Figure \* ARABIC 16 Inductor value selection graph guideCout:The value of the output capacitor together with the inductor defines the smooth the switching regulator loop. To stable the operation of the regulator, the capacitor must be calculated as the following:Cout=13000xVinVout x L(uH)Cout=13000x245 x 220=283.63 uF However, for acceptable output ripple voltage select:COUT ≥ 680 μF COUT = a 1000 μF 35V electrolytic capacitor was choosen due to datasheet recomandation.The capacitor's voltage rating should be at last 1.5 times greater than the output voltage.Diode:The diode current rating must be at least 1.2 times greater than the maximum load current.in this case a 2.4A current rating is adequate. The avialable at the polytechnic is schottkey diode (1N5822).The LM2576 regulator needs the 1N5822 diode to provide a return route for the inductor current when the circuit is off. This diode should be located close to the LM2576 using short leads and short printed circuit traces.CIn:The 100 μF aluminum electrolytic capacitor is palced at the input voltage and ground pins to provide stable operation and forsufficient bypassing of voltage. LEDs circuit:Figure SEQ Figure \* ARABIC 17 LED circuitThe circuit will be connected from the PLC outputs to the PCB via 20pin headers. The LEDS will include North West, North, North East, West, East, South West, South, South East, on, off, fault, temperature, pressure, humidity and wind speed LEDs.The PLC voltage 24V, Voltage drop on the LED is 2V.The calculation for the LED resistor:The LED has maximum current of 20mA, so if I applied ohm’s law on it:V=I x RR=VI= 24-220m= 1.1 ≈ 1.2k?And the power calculation is:P=V x IP=24 x 20m=0.48 wattThe 1.2k was chosen because; it had the best outcome of all resistors in luminosity and current value and it needs at least a 1 watt power rating, the polytechnic has only 3 watt resistors.Humidity circuit: A humidity sensor is a device which consists of a special plastic material whose electrical characteristics change according to the amount of humidity in the air.?Figure SEQ Figure \* ARABIC 18 LinPicco A05 Basic humidity sensorInput voltage: 8 - 32 VCurrent consumption: < 3 mAOutput signal: 0 - 5 VThe Vcc of the sensor will be connected to the 24v of the PLC and both grounds will be common with the PLC and the analog out of the sensor will connected to the analog in 0 - 5v of the PLC which will give the relative humidity in % range (0-100).Table SEQ Table \* ARABIC 5 humidity circuitThumbwheel switch:The thumbwheel is a rotary device that allows an operator to input numerical information into a counter which uses binary coded decimal (BCD). Figure SEQ Figure \* ARABIC 19 Truth table Figure SEQ Figure \* ARABIC 20 Thumbwheel switch For the diodes for the thumbwheel the 1N4148 diodes were used, because they are high fast recovery diodes. In this circuit, diodes have been added to prevent the switch settings of one switch from creating false readings on another switch and prevent reverse voltage. The 8,4,2,1 are the input switches to the PLC and both of the Cs will also be connected to the PLC as strobes for the tens and units.Figure SEQ Figure \* ARABIC 21 Thumbwheel circuitHardware Fabricarion:Weather station box:The weather station box was designed to be portable and to fit the all the weather station compoents with enough height to make sure that the HMI doesn’t touch the bottom of the box and a square cut was made to pass the wiring of the control panel.The weather station box is user friendly and it is designed to be elegant and in a way to tidey the wire. Also holes were made to pass the wiring under the board, to make more appleying for the dimensions:Thickness: 6mmLength: 300mmWidth: 350mm(1 pieces)The 73x25.60rectangle cut is for the LCD to be placed, the 41x15rectangle cut is for the four 7-segment displays, the 6.5 holes are for the LEDs, the 25x55 rectangle cut is for the thumbwheel switch, the 23 hole is for the buzzer and the 158x125rectangle cut is for the touch panel.Figure SEQ Figure \* ARABIC 22 Top dimensions (sizes in millimeter)Sides and bottom dimensions:(Front and back)Thickness: 6mmLength: 300 mmWidth: 105 mm(2 pieces)(Right and left)Thickness: 6mmwith a 60x60mm square cutLength: 338 mmWidth: 105 mm(2 pieces)(Bottom)Thickness: 6mmLength: 300 mmWidth: 350 mm(1 pieces)Figure SEQ Figure \* ARABIC 23 Sides and bottom dimensionsFigure SEQ Figure \* ARABIC 24 3D model top view of the weather stationThe weather head will be attached to the side of the box.Figure SEQ Figure \* ARABIC 25 3D model of the Weather headPrinted circuit board:Routing the PCB with Altuim Designer. This is the LEDs circuit that will be connected to the direction LEDs of the weather station. P9 and P5 connectors will be connected to the PLC and P6, P7, P8 and P10 will be connected to the LEDs to the resistors loads (1.2k?/3 watt).The MBED circuit will be connteced to the LCD screen with DS5 and pins p21 - p24 will be connected to the PLC via P2 connected to voltage divder resistors values of 39k? and 6.2k?.The 7-segment circuit will be connected both the PLC and 7-segment displays. DS1 – DS4 will be connected to the 7- segment display. P1 will be connected to the strobes, blanking and the ABCD pins of the decoders which are U1, U3, U5 and U7 to the PLC. The PCB was made to make the outputs on the right side and the inputs on the left side with minimum jumpers as possible and to be more compacted.Figure SEQ Figure \* ARABIC 26 PCB of the weather stationThe purpose of the 3D model of the circuit, was to make sure that the components had their real-life sizes with the respect of the correct footprints to prevent any conflict between them.Figure SEQ Figure \* ARABIC 27 3D model of the weather station PCBBoard platform:The board platform was made to place the weather on top it,including the PCB circuit with the connections to the PLC. Holes were made on the board to allow the wiring to be placed neatly and Cable ties were used to tidey the wiring.Figure SEQ Figure \* ARABIC 28 weather station on the board platformSoftware:Program functionality:Below are the proposed features, of this weather station project.The features of the project are: Sensors:Anemometer (Wind speed sensor)Temperature sensorWind vane/direction sensorHumidity sensorAtmospheric pressure sensorDisplay7-segmentLCDThumbwheel switch to input set points (temperature, humidity, etc.)SCADAAlarms, LEDs, BuzzerVoltage regulatorAs the weather station starts working all sensors will work simultaneously to give readings both on the7-segment and the SCADA program. The LCD will display warnings of the sensors if they reached a specific value. The SCADA software displays the state operation of the weather station components such as sensors, displays and alarms onto a single PC and will also contain the average value of the sensors over a period of time. Also alarms will be made if the sensors either went below or above the placed values in the Program and also the values are set point can be inputted into the PLC program. The SCADA program will display both the system information and system state. The sensors will be placed on a platform and the 7-segment, LCD displays and the circuits will also be placed under a plastic casing on the platform. The HMI (Human machine interface) will display the systems condition, graph of the sensors, real-time values, average values and inputted values chosen by the user to set the sensors alarm range. MBED code:/*********************************************************//*??ENB7904?Co-operative?Learning?Project?(Electronics)? ?*//*??Weather?Station?project???????????????????????????? ??*//*??Done?by:?Hassan?Radhi?????????????????????????????? ??*//*********************************************************/#include?"mbed.h"#include?"TextLCD.h"/*?identifying?the?inputs*/TextLCD?lcd(p15,?p16,?p17,?p18,?p19,?p20);DigitalIn??w_hum(p21);??//Humidity?warningDigitalIn?w_temp(p22);??//Temperature?warningDigitalIn?w_pres(p23);??//Air?Pressure?warningDigitalIn?w_speed(p24);?//Wind?Speed?warningint?main(){????/*?Start?the?program?by?displaying?Name,?ID?and?Date?for?5?seconds?*/????lcd.printf("N:?Hassan?Radhi\n");????lcd.printf("ID:?20900009\n");????wait(5);????lcd.cls();????lcd.printf("Date:?14/04/2014\n");????wait(5);????lcd.cls();????while(1)?{????????/*?incase?a?signal?turns?on,?a?warning?displayed?on?the?LCD*/????????if?(w_hum?==?1?&&?w_temp?==?0?&&?w_pres?==?0?&&?w_speed?==?0)?{????????????/*?Humidity?Warning??*/????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n?High?Humidity");????????????wait(1);????????????lcd.cls();????????}?else?if?((w_hum?==?0?&&?w_temp?==?1?&&?w_pres?==?0?&&?w_speed?==?0))?{????????????/*?Temperature?Warning??*/????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\nHigh?Temperature");????????????wait(1);????????????lcd.cls();????????}?else?if?((w_hum?==?0?&&?w_temp?==?0?&&?w_pres?==?1?&&?w_speed?==?0))?{????????????/*?Air?Presure?Warning??*/????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\nHigh?Air?Presure");????????????wait(1);????????????lcd.cls();????????}?else?if?((w_hum?==?0?&&?w_temp?==?0?&&?w_pres?==?0?&&?w_speed?==?1))?{????????????/*?Wind?Speed?Warning??*/????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\nHigh?Wind?Speed");????????????wait(1);????????????lcd.cls();????????}?else?if?((w_hum?==?1?&&?w_temp?==?1?&&?w_pres?==?0?&&?w_speed?==?0))?{????????????????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n?High?Humidity");????????????wait(1);????????????lcd.cls();????????????lcd.printf("???!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\nHigh?Temperature");????????????wait(1);????????????lcd.cls();????????}????????else?if?((w_hum?==?1?&&?w_temp?==?0?&&?w_pres?==?1?&&?w_speed?==?0))?{????????????????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n?High?Humidity");????????????wait(1);????????????lcd.cls();????????????lcd.printf("???!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\nHigh?Air?Presure");????????????wait(1);????????????lcd.cls();????????}????????else?if?((w_hum?==?1?&&?w_temp?==?0?&&?w_pres?==?0?&&?w_speed?==?1))?{???????????????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n?High?Humidity");????????????wait(1);????????????lcd.cls();????????????lcd.printf("???!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\nHigh?Wind?Speed");????????????wait(1);????????????lcd.cls();????????}?else?if?((w_hum?==?0?&&?w_temp?==?1?&&?w_pres?==?1?&&?w_speed?==?0))?{????????????????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\nHigh?Temperature");????????????wait(1);????????????lcd.cls();????????????lcd.printf("???!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\nHigh?Air?Presure");????????????wait(1);????????????lcd.cls();????????}????????else?if?((w_hum?==?0?&&?w_temp?==?1?&&?w_pres?==?0?&&?w_speed?==?1))?{????????????????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\nHigh?Temperature");????????????wait(1);????????????lcd.cls();????????????lcd.printf("???!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\nHigh?Wind?Speed");????????????wait(1);????????????lcd.cls();????????}?else?if?((w_hum?==?0?&&?w_temp?==?0?&&?w_pres?==?1?&&?w_speed?==?1))?{????????????????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\nHigh?Air?Presure");????????????wait(1);????????????lcd.cls();????????????lcd.printf("???!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\nHigh?Wind?Speed");????????????wait(1);????????????lcd.cls();????????}????????else?if?((w_hum?==?1?&&?w_temp?==?1?&&?w_pres?==?1?&&?w_speed?==?0))?{?????????????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n?High?Humidity");????????????wait(1);????????????lcd.cls();????????????lcd.printf("???!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\nHigh?Temperature");????????????wait(1);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\nHigh?Air?Presure");????????????wait(1);????????????lcd.cls();????????}?else?if?((w_hum?==?1?&&?w_temp?==?1?&&?w_pres?==?0?&&?w_speed?==?1))?{???????????????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n?High?Humidity");????????????wait(1);????????????lcd.cls();????????????lcd.printf("???!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\nHigh?Temperature");????????????wait(1);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\nHigh?Wind?Speed");????????????wait(1);????????????lcd.cls();????????}????????else?if?((w_hum?==?1?&&?w_temp?==?0?&&?w_pres?==?1?&&?w_speed?==?1))?{???????????????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n?High?Humidity");????????????wait(1);????????????lcd.cls();????????????lcd.printf("???!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\nHigh?Air?Presure");????????????wait(1);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\nHigh?Wind?Speed");????????????wait(1);????????????lcd.cls();????????}????????else?if?((w_hum?==?0?&&?w_temp?==?1?&&?w_pres?==?1?&&?w_speed?==?1))?{????????????????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\nHigh?Temperature");????????????wait(1);????????????lcd.cls();????????????lcd.printf("???!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\nHigh?Air?Presure");????????????wait(1);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\nHigh?Wind?Speed");????????????wait(1);????????????lcd.cls();????????}????????else?if?((w_hum?==?1?&&?w_temp?==?1?&&?w_pres?==?1?&&?w_speed?==?1))?{????????????????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n?High?Humidity");????????????wait(1);????????????lcd.cls();????????????lcd.printf("???!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\nHigh?Temperature");????????????wait(1);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\nHigh?Air?Presure");????????????wait(1);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\n");????????????wait(0.5);????????????lcd.cls();????????????lcd.locate(3,0);????????????lcd.printf("!Warning!\nHigh?Wind?Speed");????????????wait(1);????????????lcd.cls();????????}????????else?{????????????/*?Display?all?sensors?are?normal?if?there?are?no?probelms??*/????????????lcd.printf("All?sensors?are?Normal");????????????wait(1);????????????lcd.cls();????????}????}}PLC code:This is the main routine of the weather station program using structure code in Rslogix5000. /* jump to sub-routine for switching 7 segment display */jsr(Switching_Seg_Routine);/* jump to sub-routine for 7-segment display */jsr(Seven_Seg_Routine);/* jump to sub-routine for Thumbwheel switch */jsr(Thumbwheel_Routine);/*pressure sensor */Pressure_scale := Pressure_in / 1000;Pressure_value :=((Pressure_scale - 0.6) * 6.49) + 979;/*Temprature sensor */Temp_scale := Temprature_In / 10;/* humidity sensor */Humidity_scale := Humidity_In/100;/* count the first value when the timer starts*/counter_enable := 1;count_value := counter_acc;if Timer_5.acc = 0thenFirst_Value := count_value;end_if;/* count the last value when the timer finishs*/if Timer_5.dnthenLast_Value := count_value;/* then calculate the speed in rpms */Speed := ((Last_Value - First_Value)/100) * 60;end_if;/*calculate the speed in KM/h */KM := (2*3.14*0.08881*Speed*60)/1000;/* Timer for anemometer */RTOR ( Timer_5);Timer_5.pre := 5000;Timer_5.TimerEnable := not Timer_5.dn;Timer_5.Reset := Timer_5.dn;/* equation to scale the wind direction in understandable values */scale := Wind_Vane_In / 1000;value := (scale/2)*0.66;/* either the on switch turns on the system or the from the SCADA/HMI */if On_switch or On_InternalthenOn_LED:=1;elseOn_LED:=0;end_if;/* if the On LED turn on the off LED switchs off */if On_LED thenOff_LED := 0;elseOff_LED := 1;end_if;/*identifying the direction *////////////////////////////////////////////////if (( 2.55 > value) and (value > 2.45 ))//1.Norththen Wind_degres := 0;else Wind_degres := Wind_degres;end_if;//////////////////////////////////////////////////////////////////////////////////////////////if (( 1.55 > value) and (value > 1.45 ))//2.North East then Wind_degres := 45;else Wind_degres := Wind_degres;end_if; /////////////////////////////////////////////// ///////////////////////////////////////////////if (( 0.35 > value) and (value > 0.29 ))//3.East then Wind_degres := 90;else Wind_degres := Wind_degres; end_if;//////////////////////////////////////////////////////////////////////////////////////////////if (( 0.65 > value) and (value > 0.55 ))//4.South East then Wind_degres := 135;elseWind_degres := Wind_degres;end_if;//////////////////////////////////////////////////////////////////////////////////////////////if (( 0.95 > value) and (value > 0.85 ))//5.South then Wind_degres := 180;else Wind_degres := Wind_degres;end_if;//////////////////////////////////////////////////////////////////////////////////////////////if (( 2.05 > value) and (value > 1.95 ))//6.South West then Wind_degres := 225;else Wind_degres := Wind_degres;end_if;//////////////////////////////////////////////////////////////////////////////////////////////if (( 3.03 > value) and (value > 2.93 ))//7.West then Wind_degres := 270; else Wind_degres := Wind_degres; end_if;////////////////////////////////////////////////////////////////////////////////////////////// if (( 2.9 > value) and (value > 2.7 ))//8.North West then Wind_degres := 315;else Wind_degres := Wind_degres;// if the wind degree gone to a invalid value gives it the last valid valueend_if; /* if the wind degrees is equal to 0 turn on the north LED */if (On_switch or On_Internal) and Wind_degres = 0thenN_LED := 1;elseN_LED := 0;end_if;/* if the wind degrees is equal to 45 turn on the north east LED */if (On_switch or On_Internal) and Wind_degres = 45 then NE_LED := 1; else NE_LED := 0;end_if;/* if the wind degrees is equal to 90 turn on the east LED */if (On_switch or On_Internal) and Wind_degres = 90 then E_LED := 1; else E_LED := 0;end_if;/* if the wind degrees is equal to 135 turn on the south east LED */if (On_switch or On_Internal) and Wind_degres = 135 then SE_LED := 1; else SE_LED := 0;end_if;/* if the wind degrees is equal to 180 turn on the south LED */if (On_switch or On_Internal) and Wind_degres = 180 then S_LED := 1; else S_LED := 0;end_if;/* if the wind degrees is equal to 225 turn on the south west LED */if (On_switch or On_Internal) and Wind_degres = 225 then SW_LED := 1; else SW_LED := 0;end_if;/* if the wind degrees is equal to 270 turn on the west LED */if (On_switch or On_Internal) and Wind_degres = 270 then W_LED := 1; else W_LED := 0;end_if;/* if the wind degrees is equal to 315 turn on the north west LED */if (On_switch or On_Internal) and Wind_degres = 315 then NW_LED := 1; else NW_LED := 0;end_if;/* if the Humidity value exceeded the inputted value in the touch panel/SCADA, triggers the warining on the LCD */if Humidity_scale > Humidity_Inputed_valuethenHumi_warning := 1;elseHumi_warning := 0;end_if;/* if the temperature value exceeded the thumbwheel value, triggers the warining on the LCD */if Temp_scale > Output_NumberthenTemp_warning := 1;elseTemp_warning := 0;end_if;/* if the wind speed value exceeded the inputted value in the touch panel/SCADA, triggers the warining on the LCD */if KM > Speed_Inputed_valuethenSpeed_warning := 1;elseSpeed_warning := 0;end_if;/* if the Pressure value exceeded the inputted value in the touch panel/SCADA, triggers the warining on the LCD */if Pressure_value > Pressure_Inputed_valuethenPressure_warning := 1;elsePressure_warning := 0;end_if;/* Humidity average Senor Value Add - on */Average_filter( Humidity_average_addOn );Humidity_average_addOn.Start := 1;Humidity_average_addOn.Sensor_value := Humidity_scale;Humidity_average := Humidity_average_addOn.Average_Sensor;/* Pressure average Senor Value Add - on */Average_filter( Pressure_average_addOn );Pressure_average_addOn.Start := 1;Pressure_average_addOn.Sensor_value := Pressure_value;Pressure_average := Pressure_average_addOn.Average_Sensor;////////////////////* Temperature average Senor Value Add - on */Average_filter( Temperature_average_addOn );Temperature_average_addOn.Start := 1;Temperature_average_addOn.Sensor_value := Temp_scale;Temperature_average := Temperature_average_addOn.Average_Sensor;/* Wind Speed average Senor Value Add - on */Average_filter( WindSpeed_average_addOn );WindSpeed_average_addOn.Start := 1;WindSpeed_average_addOn.Sensor_value := KM;WindSpeed_average := WindSpeed_average_addOn.Average_Sensor;/* if humidity value is bigger than inputted value by the SCADA/HMI turn on an alarm */if Humidity_scale > Humidity_Inputed_valuethen Timer_11.TimerEnable:= 1;elseTimer_11.TimerEnable:= 0;end_if ;/* when one of these timers are done turn on the alarm */if Timer_13.dn or Timer_11.dn or Timer_15.dn or Timer_17.dnthenBuzzer := 1;elseBuzzer := 0;end_if;/* if temperature value is bigger than inputted value by the SCADA/HMI turn on an alarm */if Temp_scale > Output_Numberthen Timer_13.TimerEnable:= 1;else Timer_13.TimerEnable:= 0;end_if ;/* if wind speed value is bigger than inputted value by the SCADA/HMI turn on an alarm */if KM > Speed_Inputed_valuethen Timer_15.TimerEnable:= 1;else Timer_15.TimerEnable:= 0;end_if ;/* if pressure value is bigger than inputted value by the SCADA/HMI turn on an alarm */if Pressure_value > Pressure_Inputed_valuethen Timer_17.TimerEnable:= 1;else Timer_17.TimerEnable:= 0;end_if ;/* humidity alarm */TONR (Timer_11);Timer_11.PRE:= 500;Timer_11.reset := Timer_12.dn;TONR (Timer_12);Timer_12.PRE:= 500;Timer_12.TimerEnable:= Timer_11.dn;Timer_12.reset := Timer_12.dn;/* temperature alarm */ TONR (Timer_13);Timer_13.PRE:= 250;Timer_13.reset := Timer_14.dn;TONR (Timer_14);Timer_14.PRE:= 250;Timer_14.TimerEnable:= Timer_13.dn;Timer_14.reset := Timer_14.dn;/* wind speed alarm */TONR (Timer_15);Timer_15.PRE:= 125;Timer_15.reset := Timer_16.dn;TONR (Timer_16);Timer_16.PRE:= 125;Timer_16.TimerEnable:= Timer_15.dn;Timer_16.reset := Timer_16.dn;/* pressure alarm */TONR (Timer_17);Timer_17.PRE:= 750;Timer_17.reset := Timer_18.dn;TONR (Timer_18);Timer_18.PRE:= 750;Timer_18.TimerEnable:= Timer_17.dn;Timer_18.reset := Timer_18.dn;/* Rest the Timers */if Timer_12.DNthenTimer_11.Reset := 1;Timer_12.reset := 1;elseTimer_11.Reset := 0;Timer_12.reset := 0;end_if;if Timer_14.DNthenTimer_13.Reset := 1;Timer_14.reset := 1;elseTimer_13.Reset := 0;Timer_14.reset := 0;end_if;if Timer_16.DNthenTimer_15.Reset := 1;Timer_16.reset := 1;elseTimer_15.Reset := 0;Timer_16.reset := 0;end_if;if Timer_18.DNthenTimer_17.Reset := 1;Timer_18.reset := 1;elseTimer_17.Reset := 0;Timer_18.reset := 0;end_if;/* if either the pressure sensor or the wind direction sensor gets unplugged from the analog module turn a fault LED */if (Pressure_value <= 975) or (scale <= 0.1)thenFault_LED := 1;elseFault_LED := 0;end_if;This is a sub routine is used to control the 7-segment strobing using ladder logic code.-404480442202200-37213919081000844554061460000-63500-276860460375000-24505131862200This is a sub routine is used to control the thumbwheel switch strobing using ladder logic code.-298302-14461700This is a sub routine written in struturce text used to display the sensors value each one at a time for 10 seconds in a loop./* this routine changes the 7-segment values each sensor at a time*//* Timer for the Humidity */RTOR ( Humidity_Timer);Humidity_Timer.pre := 10000;Humidity_Timer.TimerEnable := On_switch or On_Internal ;Humidity_Timer.Reset := Anemometer_Timer.DN;/* start displaying the humidity value for 10 sec on the 7-segment and turn on its LED */if Humidity_Timer.TTthenHumi_LED := 1;Number := Humidity_scale;elseHumi_LED := 0;end_if;/* Timer for the Pressure */RTOR ( Pressure_Timer);Pressure_Timer.pre := 10000;Pressure_Timer.TimerEnable := Humidity_Timer.DN and (On_switch or On_Internal);Pressure_Timer.Reset := Anemometer_Timer.DN;/* start displaying the Pressure value for 10 sec on the 7-segment and turn on its LED */if Pressure_Timer.TTthenPressure_LED := 1;Number := Pressure_value;elsePressure_LED := 0;end_if;/* Timer for the Humidity */RTOR ( Temprature_Timer);Temprature_Timer.pre := 10000;Temprature_Timer.TimerEnable := Pressure_Timer.DN and (On_switch or On_Internal);Temprature_Timer.Reset := Anemometer_Timer.DN;/* start displaying the Pressure value for 10 on the 7-segment sec and turn on its LED */if Temprature_Timer.TTthenTemp_LED := 1;Number := Temp_scale;elseTemp_LED := 0;end_if;/* Timer for the anemometer */RTOR ( Anemometer_Timer);Anemometer_Timer.pre := 10000;Anemometer_Timer.TimerEnable := Temprature_Timer.DN and (On_switch or On_Internal);Anemometer_Timer.Reset := Anemometer_Timer.DN;/* start displaying the speed value for 10 sec on the 7-segment and turn on its LED */if Anemometer_Timer.TTthenSpeed_LED := 1;Number := KM;elseSpeed_LED := 0;end_if;This is an add-on in ladder logic used to average the values of the sensors over time which takes 6 values and divdies them over 6 to get an average.-276860411289500-28765521082000-415290-6413500the input/output list:these are the inputs and outputs list of the PLC.Digital Outputs Module (6)Tag NameAddressOff_LEDLocal:6:O.Data.0On_LEDLocal:6:O.Data.1Fault_LEDLocal:6:O.Data.2E_LEDLocal:6:O.Data.3NE_LEDLocal:6:O.Data.4NW_LEDLocal:6:O.Data.5N_LEDLocal:6:O.Data.6SW_LEDLocal:6:O.Data.7W_LEDLocal:6:O.Data.8SE_LEDLocal:6:O.Data.9S_LEDLocal:6:O.Data.10Humi_LEDLocal:6:O.Data.11Pressure_LEDLocal:6:O.Data.12Speed_LEDLocal:6:O.Data.13Temp_LEDLocal:6:O.Data.14BuzzerLocal:6:O.Data.15Digital Outputs Module (4)Tag NameAddress7_seg_ALocal:4:O.Data.07_seg_BLocal:4:O.Data.17_seg_CLocal:4:O.Data.27_seg_DLocal:4:O.Data.3seg _Strobe_1Local:4:O.Data.4seg _Strobe_2Local:4:O.Data.5seg _Strobe_3Local:4:O.Data.6seg _Strobe_4Local:4:O.Data.7Blank_1Local:4:O.Data.8Blank_2Local:4:O.Data.9Thumb_Strobe_1Local:4:O.Data.10Thumb_Strobe_2Local:4:O.Data.11Temp_warningLocal:4:O.Data.12Pressure_warningLocal:4:O.Data.13Humi_warningLocal:4:O.Data.14Speed_warningLocal:4:O.Data.15Table 6 Digital output of module 6Table 7 Digital output of module 4Digital Inputs Module (5)Tag Name AddressThumb_ALocal:5:I.Data.0Thumb_BLocal:5:I.Data.1Thumb_CLocal:5:I.Data.2Thumb_DLocal:5:I.Data.3On_switchLocal:5:I.Data.4Analog Inputs Module (2)High speed counter Module (1)Tag Name AddressTag NameAddressWind_Vane_InLocal:2:I.Ch0Datacounter_accLocal:1:I.Ctr0CurrentCountHumidity_InLocal:2:I.Ch1Data--Pressure_inLocal:2:I.Ch2Data--Temprature_InLocal:2:I.Ch3Data--Table 8 Digital inputs of module 5Table 9 Analog in and HSC inputs modulesVirtual Instruments:?SCADA (supervisory and data acquisition):Figure SEQ Figure \* ARABIC 29 SCADA control panelthe scada program displays and control the weather station via computer. The 7-segment will display the humidity, air pressure, temperature and wind speed.Each sensor has 10 seconds to be displayed on the 7-segment with the corrponding LED of the sensor being displayed to know which sensor value is it. For the wind direction a pattern of circuilar LEDs will display the wind direction with each direction has its own LED and the On,Off and fault shows the status of the system.The LCD displays the warnings of the 4 main sensors, if they went over their input ranges which can be contreolled by the SCADA a warning will be displayed on the LCD with its own alarm on the buzzer. The On/Off switch turns on/off the system, the thumbwheel value controls the temperature inputted value and if the temperature value exceed a warning will be displayed on the LCD. The graph shows the history and present data of the sensors and with each one has its own scale.HMI (Human machine interface):Figure SEQ Figure \* ARABIC 30 Page 1 of the HMIThe first page of the HMI will display the system status via LED indicators, the 7-segment display which holds the sensors values, the start/stop button, Next and Before button to go back or to go forward between pages and the system shutdown button shutsdown the HMI.Figure SEQ Figure \* ARABIC 31 Page 2 of the HMIThe second page include the LEDs of the wind vane sensor, as the wind vane points in a specifiec direction the LED corrspoing to it lights up.Figure SEQ Figure \* ARABIC 32 Page 3 of the HMIThe third page conjtains the real-time values of the analog sensors and each sensor has its own numaric display.Figure SEQ Figure \* ARABIC 33 Page 4 of the HMIThe fourth page conjtains the average values of the analog sensors and each sensor has its own numaric display. Figure SEQ Figure \* ARABIC 34 Page 5 of the HMIthe fiveth page has the inputted values,where a any centrian value can be placed , then the value gets compared with sensor value and if sensor value is bigger a warning will be displayed on the LCD.13589005350510Figure SEQ Figure \* ARABIC 35 Page 6 to 9 of the HMI00Figure SEQ Figure \* ARABIC 35 Page 6 to 9 of the HMIThe pages from six to nine, each sensor has its own graph and it will be plotted on it with the x-axis will be time and the y-axis will the sensor's value.30492702510790-1619252606040-8953527305316611041910Disscusion:Voltage regulators:These are the voltage regulators that were used to make a comparison, to choose which one is more suitable for the weather station project:LM2576MC34063LM317Voltage regulator: LM2576, adjustableInput voltage range: 3v – 60vOutput voltage range: 1.23v – 37vOutput current range: 3AFigure SEQ Figure \* ARABIC 36 LM2576 circuitThe LM2576 voltage regulator is a step-down regulator that is capable of 3A load and load regulation. The LM2576 series are available in fixed output voltages of 3.3V, 5V, 12V, 15V, and an adjustable output version.Voltage regulator: LM317, adjustableInput voltage range: 3v – 40vOutput voltage range: 1.2v – 37vOutput current range: 1.5AFigure SEQ Figure \* ARABIC 37 LM317 circuitThe LM317 voltage regulator is an adjustable 3 pin regulator has an input range of 3v to 40v with a 1.2v to 37v output voltage range/ 1.5A output current and if the chip gets overheated or current limited it shutdown to protect the chip.Voltage regulator: MC34063, adjustableInput voltage range: 3v – 40vOutput voltage range: -12v – 30vOutput current range: 1.5AFigure SEQ Figure \* ARABIC 38 MC34063 pin outFigure SEQ Figure \* ARABIC 39 MC34063 circuit The MC34063A is a DC to DC converter IC. Its primary purpose is to step-up/step-down the voltage depending on the circuit design. Its internal structure contains comparator, controlled duty cycle oscillator with a current limit circuit and an internal temperature compensated reference. Also it can incorporate an External Current Boost circuit.The LM2576 voltage regulator was choosen, because it fits the project criteria in the current load 3A. where the other voltage regulators, the LM317 and the MC34063 had a 1.5A load which is not suffient to supply the project, so the best choice was the LM2576. Instrument Amplifier for the pressure sensor:The instrument amplifier INA126 was chosen over the LM358, because it is made specifically for instruments for accurate and precise amplification, low noise and low offset differential signal acquisition.Temperature sensor:The problem that was encountered with temperature sensor was about the temperature circuit, after connecting the circuit it didn’t work as expected and didn’t find any solution, because all the components seemed fine and works properly on their own circuit, to solve my sensor problem I connected the temperature circuit by its own.Figure SEQ Figure \* ARABIC 40 the new temperature circuitPressure simulation mechanism:An injection will be used to simulate air pressure and by pressing and pulling on it. The plastic pipe will act as the medium for the air flow to the pressure sensor.Figure 41 the pressure sensor connected to the injection via plastic pipeAfter testing the 3ml injector it had a lot of psi force about 19.53 psi it was found that the smaller injector the better control of air flow to the pressure sensor. The smaller the injector the better control on the pressure air flow.Recommantoinas:The project can be enhanced by:A better and more clearer graphic design for both the SCADA and HMI.Enable the system to store daily statistics for future decision making. Include reverse polarity circuit to prevent reverse voltage.Include better quality sensors for more precision and accuracy in the weather station. Include more weather sensors such as rain gauge and light intensity. Appendix:Footprints with 3D modelsFootprints are the physical layout that is required on the?printed circuit board?in order to mount a component or physical attachment. It can be anything from?through-holes,?such as TO-92 package to?surface mounted device (SMD), such as Sot-32 package. Figure 42 To-92 through-hole component Figure 43 Sot -32 surface mounted device Figure 44 a footprint of a 16 pin IC socketThe footprints will be the physical layout of the components in order to mount them by soldering them on top of the PCB. The 3D models will confirm the footprints dimensions and will be used in the box concept of the weather station in SolidWorks.The diode 1N4003 comes in a DO-41 package. Figure 45 DO-41 3D model Figure 46 DO-41 footprintThe PNP transistor 2N2907 comes in a TO-18 package. Figure 47 TO-18 3D model Figure 48 TO-18 footprintThe resistor pack and the 7-segment decoder come in 16 Duel-in-line package (DIP) so they can be placed on top of the socket. Figure 49 16 pin IC socket 3D model Figure 50 16 pin IC socket footprintThe 5mm diameter LED with a pitch of 2.54mm.Figure 51 5mm diameter LED 3D modelFigure 52 5mm diameter LED footprintThe Temperature sensor LM35DZ comes in a TO-92 package. Figure 53 TO-92 3D model Figure 54 TO-92 footprintThe Voltage regulator LM317 comes in a TO-220 package. Figure 55 TO-220 3D model Figure 56 TO-220 footprintThe ? watt resistor comes in an Axial-0.4 package. Figure 57 AXIAL-0.4 resistor 3D model Figure 58 AXIAL-0.4 footprintThe Mbed will be placed on top of a 40 pin connector. Figure 59 Mbed with 40 pin connector 3D model Figure 60 40 pin connector footprintThe 10 pin connector will be used to connect the 7-segment to the PCB. Figure 61 10 pin connector 3D model Figure 62 10 pin connector footprintThese components will be used in the box concept that will hold the weather station to get the exact dimensions needed.Figure 63 Touch screen PanelView Plus 600 3D modelFigure 64 2x16 LCD 3D modelFigure 65 Thumbwheel 3D modelFigure SEQ Figure \* ARABIC 66 PCB circuitFigure SEQ Figure \* ARABIC 67 weather station panel 1Figure SEQ Figure \* ARABIC 68 weather station panel 2Figure SEQ Figure \* ARABIC 69 weather station wiringFigure SEQ Figure \* ARABIC 70 PCB placed on top of the boardReferences ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download