weather station plc project - weebly · web viewfigure 36 lm2576 circuit the lm2576 voltage...

93
Bachelor of Engineering Technology ENB7904 Co-operative Learning Project (Electronics) Hussain Mustafa Student Name: Hassan Radhi Student ID: 20900009 CPR: 910404577 Tutor: David Krause Weather Station PLC Project

Upload: others

Post on 25-Jan-2021

9 views

Category:

Documents


0 download

TRANSCRIPT

Weather Station PLC Project

Bachelor of Engineering TechnologyENB7904Co-operative Learning Project (Electronics)

Table of ContentsTable of Figures2Table of Tables4Abstract:5Introduction:6Industry applications:6Objectives and task description:7Weather station circuit: Mbed circuit:8Pressure sensor circuit:9Wind vane sensor circuit:12The anemometer circuit:13Temperature sensor:167-segment circuit:18Voltage circuit using LM2576:20LEDs circuit:23Humidity circuit:24Thumbwheel switch:25Hardware Fabricarion:26Weather station box:26Printed circuit board:29Board platform:31Software:32Program functionality:32MBED code:33PLC code:41the input/output list:56Virtual Instruments:57SCADA (supervisory and data acquisition):57HMI (Human machine interface):5860Disscusion:61Voltage regulators:61Instrument Amplifier for the pressure sensor:63Temperature sensor:63Pressure simulation mechanism:64Recommantoinas:65Appendix:66Footprints with 3D models66References74

Table of Figures

Figure 1 sensor circuit8

Figure 2 Voltage divider diagram9

Figure 3 Pressure sensor10

Figure 4 Instrumentation amplifierINA126 with pin configuration10

Figure 5 Pressure sensor circuit11

Figure 6 Wind Vane Internal Connection13

Figure 7 Wind speed sensor14

Figure 8 weather head circuit15

Figure 9 4 To 20 mA Current Source (0°C to +100°C) circuit17

Figure 10 temperature sensor LM35DZ17

Figure 11 7-segment circuit18

Figure 12 Decoder Pin Out19

Figure 13 Voltage divider diagram20

Figure 14 LM2576-Adj 5 volt circuit21

Figure 15 LM2576-Adj 10 volt circuit21

Figure 16 Inductor value selection graph guide22

Figure 17 LED circuit24

Figure 18 LinPicco A05 Basic humidity sensor25

Figure 19 Truth table Figure 20 Thumbwheel switch26

Figure 21 Thumbwheel circuit26

Figure 22 Top dimensions (sizes in millimeter)27

Figure 23 Sides and bottom dimensions28

Figure 24 3D model top view of the weather station29

Figure 25 3D model of the Weather head29

Figure 26 PCB of the weather station30

Figure 27 3D model of the weather station PCB31

Figure 28 weather station on the board platform32

Figure 29 SCADA control panel58

Figure 30 Page 1 of the HMI59

Figure 31 Page 2 of the HMI59

Figure 32 Page 3 of the HMI60

Figure 33 Page 4 of the HMI60

Figure 34 Page 5 of the HMI60

Figure 35 Page 6 to 9 of the HMI61

Figure 36 LM2576 circuit62

Figure 37 LM317 circuit62

Figure 38 MC34063 pin out63

Figure 39 MC34063 circuit63

Figure 40 the new temperature circuit64

Figure 41 the pressure sensor connected to the injection via plastic pipe65

Figure 42 To-92 through-hole component Figure 43 Sot -32 surface mounted device67

Figure 44 a footprint of a 16 pin IC socket67

Figure 45 DO-41 3D model Figure 46 DO-41 footprint67

Figure 47 TO-18 3D model Figure 48 TO-18 footprint68

Figure 49 16 pin IC socket 3D model Figure 50 16 pin IC socket footprint68

Figure 51 5mm diameter LED 3D model68

Figure 52 5mm diameter LED footprint69

Figure 53 TO-92 3D model Figure 54 TO-92 footprint69

Figure 55 TO-220 3D model Figure 56 TO-220 footprint69

Figure 57 AXIAL-0.4 resistor 3D model Figure 58 AXIAL-0.4 footprint70

Figure 59 Mbed with 40 pin connector 3D model Figure 60 40 pin connector footprint70

Figure 61 10 pin connector 3D model Figure 62 10 pin connector footprint70

Figure 63 Touch screen PanelView Plus 600 3D model71

Figure 64 2x16 LCD 3D model71

Figure 65 Thumbwheel 3D model 72

Figure 66 PCB circuit72

Figure 67 weather station panel 173

Figure 68 weather station panel 273

Figure 69 weather station wiring74

Figure 70 PCB placed on top of the board74

Table of Tables

Table 1 Pin Configuration8

Table 2 Measured voltage v.s Voltage out direction Table11

Table 3 Input Specifications – 1769-HSC14

Table 4 Output Specifications – 1769-HSC14

Table 5 humidity circuit23

Table 6 Digital output of module 6 Table 7 Digital output of module 455

Abstract:

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.

1 | Page

Objectives and task description:

Figure 1 sensor circuit

Weather 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 2 Voltage divider diagram

The calculation of the Rb using the Voltage divider law:

Vout = 3.5V neededVin = 24VRa = 39kΩ

= 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.

Type

Pin

Vcc

1

Output A

2

GND

3

Output B

4

Table 1 Pin Configuration

Figure 3 Pressure sensor

Input voltage: 10 - 12 V

Current consumption: 2 mA

Output signal: 70 mV

Pressure range: ± 0.5

The 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 configuration

Input voltage: 1.35 - 18 V

Current consumption: 175μA

As 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 circuit

Calculation:

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], so

Minimum and maximum of the pressure capabilities:

The pressure range is ± 0.5 in psi about 1, so

Minimum pressure:

Minimum = 14.7 - 0.5 = 14.2 psi

Convert it to

Maximum pressure:

Maximum = 14.7 + 0.5 = 15.2 psi

Convert it to

hPa 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.

Calculation:

The calculation of the gain:

The calculation of the resistor that will produce the gain:

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 Specifications

· Power supply rang: 3.3 - 5.5 Volts (typical supply is 3.3).

Table 2 Measured voltage v.s Voltage out direction Table

Direction

Degree

Voltage Out

Measured Voltage

Resistance Switch ( Ω)

North

0

3.84

3.87

33k

North East

45

2.25

2.27

8.2k

East

90

0.45

0.459

1k

South East

135

0.90

0.911

2.2k

South

180

1.40

1.41

3.9k

South West

225

3.08

3.1

16k

West

270

4.62

4.66

120k

North West

315

4.78

4.37

64.9k

Figure 6 Wind Vane Internal Connection

The 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 specification

· 3.3v to 5v supply voltage

· pulse output type

· Speed detection from 0 to 30 kmh.

· Current draw 0.5mA

Figure 7 Wind speed sensor

The 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 8 weather head circuit

Calculation:

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 transistor

Ohm’s law

The calculation of the R2:

6.8mA is needed, so higher up to 10mA is enough

Ohm’s law

PLC High speed counter Specifications:

attribute

1769-HSC

Input voltage range

2.6…30V DC

On-state voltage, max

30V DC

On-state voltage, min

2.6V DC

On-state current, min

6.8 mA

Off-state voltage, max

1.0V DC

Off-state current, max

1.5 mA

Off-state leakage current, max

1.5 mA

Input current, max

15 mA

Input current, min

6.8 mA

Input impedance, nom

1950 Ω

Pulse width, min

250 ns

Pulse separation, min

131 ns

Input frequency, max

1 MHz

Table 3 Input Specifications – 1769-HSC

attribute

1769-HSC

Output voltage range

5…30V DC

On-state voltage, max

User power – 0.1V DC

On-state current, min

1 mA

On-state voltage drop, max

0.5V DC

Off-state leakage current, max

5 µA

Turn-on time, max

400 µs

Turn-off time, max

200 µs

Reverse polarity protection

30V DC

Table 4 Output Specifications – 1769-HSC

Temperature 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 volts

· Output current 0 to 10mA

· Less than 60 μA current drain

Figure 9 4 To 20 mA Current Source (0°C to +100°C) circuit

Figure 10 temperature sensor LM35DZ

Figure 11 7-segment circuit

7-segment circuit:

Figure 12 Decoder Pin Out

Decoder information:

Input voltage: 3 – 18 V

Max Current: 25mA

The 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 switch

The 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:

38k ≈ 39kΩ

Then calculated the Rb using the Voltage divider law:

Vout = 5V neededVin = 24VRa = 39kΩ

= 10263.16 ≈ 10kΩ

Figure 13 Voltage divider diagram

The 220 ohm resistor packs will step down the current, to prevent excess current going to the 7-sgements LEDs

The calculation for the resistor packs:

The 7-seg display has maximum current of 15mA, so if I applied ohm’s law on it:

213Ω ≈ 220Ω

Voltage circuit using LM2576:

Figure 14 LM2576-Adj 5 volt circuit

Figure 15 LM2576-Adj 10 volt circuit

The 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 5k

≈ 5v

The calculation for LM2576-Adj +10 volts:

Vref = 1.23V, R1 has to between 1k and 5k

≈ 10v

The calculation of LM2576 components:

Inductor:

The Calculation of the inductorusing the following formula:

= 76.12

= 76.12 μH

load = 2A

Inductance Region = H150

Figure 16 Inductor value selection graph guide

Cout:

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:

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 17 LED circuit

The 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:

1.1 ≈ 1.2kΩ

And the power calculation is:

The 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 18 LinPicco A05 Basic humidity sensor

Input voltage: 8 - 32 V

Current consumption: < 3 mA

Output signal: 0 - 5 V

The 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 5 humidity circuit

Thumbwheel 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 19 Truth table Figure 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 21 Thumbwheel circuit

Hardware 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 user.

Top dimensions:

Thickness: 6mm

Length: 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 22 Top dimensions (sizes in millimeter)

Sides and bottom dimensions:

(Front and back)

Thickness: 6mm

Length: 300 mmWidth: 105 mm(2 pieces)

(Right and left)

Thickness: 6mmwith a 60x60mm square cut

Length: 338 mmWidth: 105 mm(2 pieces)

(Bottom)

Thickness: 6mm

Length: 300 mmWidth: 350 mm(1 pieces)

Figure 23 Sides and bottom dimensions

Figure 24 3D model top view of the weather station

The weather head will be attached to the side of the box.

Figure 25 3D model of the Weather head

Printed 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 26 PCB of the weather station

The 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 27 3D model of the weather station PCB

Board 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 28 weather station on the board platform

Software:Program functionality:

Below are the proposed features, of this weather station project.

The features of the project are:

a) Sensors:

· Anemometer (Wind speed sensor)

· Temperature sensor

· Wind vane/direction sensor

· Humidity sensor

· Atmospheric pressure sensor

b) Display

· 7-segment

· LCD

· Thumbwheel switch to input set points (temperature, humidity, etc.)

c) SCADA

d) Alarms, LEDs, Buzzer

e) Voltage regulator

As 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 warning

int 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 = 0

then

First_Value := count_value;

end_if;

/* count the last value when the timer finishs*/

if Timer_5.dn

then

Last_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_Internal

then

On_LED:=1;

else

On_LED:=0;

end_if;

/* if the On LED turn on the off LED switchs off */

if On_LED

then

Off_LED := 0;

else

Off_LED := 1;

end_if;

/*identifying the direction */

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

if (( 2.55 > value) and (value > 2.45 ))//1.North

then

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;

else

Wind_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 value

end_if;

/* if the wind degrees is equal to 0 turn on the north LED */

if (On_switch or On_Internal) and Wind_degres = 0

then

N_LED := 1;

else

N_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_value

then

Humi_warning := 1;

else

Humi_warning := 0;

end_if;

/* if the temperature value exceeded the thumbwheel value, triggers the warining on the LCD */

if Temp_scale > Output_Number

then

Temp_warning := 1;

else

Temp_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_value

then

Speed_warning := 1;

else

Speed_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_value

then

Pressure_warning := 1;

else

Pressure_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_value

then

Timer_11.TimerEnable:= 1;

else

Timer_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.dn

then

Buzzer := 1;

else

Buzzer := 0;

end_if;

/* if temperature value is bigger than inputted value by the SCADA/HMI turn on an alarm */

if Temp_scale > Output_Number

then

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_value

then

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_value

then

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.DN

then

Timer_11.Reset := 1;

Timer_12.reset := 1;

else

Timer_11.Reset := 0;

Timer_12.reset := 0;

end_if;

if Timer_14.DN

then

Timer_13.Reset := 1;

Timer_14.reset := 1;

else

Timer_13.Reset := 0;

Timer_14.reset := 0;

end_if;

if Timer_16.DN

then

Timer_15.Reset := 1;

Timer_16.reset := 1;

else

Timer_15.Reset := 0;

Timer_16.reset := 0;

end_if;

if Timer_18.DN

then

Timer_17.Reset := 1;

Timer_18.reset := 1;

else

Timer_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)

then

Fault_LED := 1;

else

Fault_LED := 0;

end_if;

This is a sub routine is used to control the 7-segment strobing using ladder logic code.

This is a sub routine is used to control the thumbwheel switch strobing using ladder logic code.

This 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.TT

then

Humi_LED := 1;

Number := Humidity_scale;

else

Humi_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.TT

then

Pressure_LED := 1;

Number := Pressure_value;

else

Pressure_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.TT

then

Temp_LED := 1;

Number := Temp_scale;

else

Temp_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.TT

then

Speed_LED := 1;

Number := KM;

else

Speed_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.

the input/output list:

these are the inputs and outputs list of the PLC.

Digital Outputs Module (6)

Tag Name

Address

Off_LED

Local:6:O.Data.0

On_LED

Local:6:O.Data.1

Fault_LED

Local:6:O.Data.2

E_LED

Local:6:O.Data.3

NE_LED

Local:6:O.Data.4

NW_LED

Local:6:O.Data.5

N_LED

Local:6:O.Data.6

SW_LED

Local:6:O.Data.7

W_LED

Local:6:O.Data.8

SE_LED

Local:6:O.Data.9

S_LED

Local:6:O.Data.10

Humi_LED

Local:6:O.Data.11

Pressure_LED

Local:6:O.Data.12

Speed_LED

Local:6:O.Data.13

Temp_LED

Local:6:O.Data.14

Buzzer

Local:6:O.Data.15

Digital Outputs Module (4)

Tag Name

Address

7_seg_A

Local:4:O.Data.0

7_seg_B

Local:4:O.Data.1

7_seg_C

Local:4:O.Data.2

7_seg_D

Local:4:O.Data.3

seg _Strobe_1

Local:4:O.Data.4

seg _Strobe_2

Local:4:O.Data.5

seg _Strobe_3

Local:4:O.Data.6

seg _Strobe_4

Local:4:O.Data.7

Blank_1

Local:4:O.Data.8

Blank_2

Local:4:O.Data.9

Thumb_Strobe_1

Local:4:O.Data.10

Thumb_Strobe_2

Local:4:O.Data.11

Temp_warning

Local:4:O.Data.12

Pressure_warning

Local:4:O.Data.13

Humi_warning

Local:4:O.Data.14

Speed_warning

Local:4:O.Data.15

Table 6 Digital output of module 6Table 7 Digital output of module 4

Digital Inputs Module (5)

Tag Name

Address

Thumb_A

Local:5:I.Data.0

Thumb_B

Local:5:I.Data.1

Thumb_C

Local:5:I.Data.2

Thumb_D

Local:5:I.Data.3

On_switch

Local:5:I.Data.4

Analog Inputs Module (2)

High speed counter Module (1)

Tag Name

Address

Tag Name

Address

Wind_Vane_In

Local:2:I.Ch0Data

counter_acc

Local:1:I.Ctr0CurrentCount

Humidity_In

Local:2:I.Ch1Data

-

-

Pressure_in

Local:2:I.Ch2Data

-

-

Temprature_In

Local:2:I.Ch3Data

-

-

Table 8 Digital inputs of module 5

Table 9 Analog in and HSC inputs modules

Virtual Instruments: 

SCADA (supervisory and data acquisition):

Figure 29 SCADA control panel

the 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 30 Page 1 of the HMI

The 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 31 Page 2 of the HMI

The 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 32 Page 3 of the HMI

The third page conjtains the real-time values of the analog sensors and each sensor has its own numaric display.

Figure 33 Page 4 of the HMI

The fourth page conjtains the average values of the analog sensors and each sensor has its own numaric display.

Figure 34 Page 5 of the HMI

the 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.

The 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.

Figure 35 Page 6 to 9 of the HMI

Disscusion: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:

· LM2576

· MC34063

· LM317

Voltage regulator: LM2576, adjustable

Input voltage range: 3v – 60v

Output voltage range: 1.23v – 37v

Output current range: 3A

Figure 36 LM2576 circuit

The 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, adjustable

Input voltage range: 3v – 40v

Output voltage range: 1.2v – 37v

Output current range: 1.5A

Figure 37 LM317 circuit

The 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, adjustable

Input voltage range: 3v – 40v

Output voltage range: -12v – 30v

Output current range: 1.5A

Figure 38 MC34063 pin out

Figure 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 40 the new temperature circuit

Pressure 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 pipe

After 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:

1. A better and more clearer graphic design for both the SCADA and HMI.

2. Enable the system to store daily statistics for future decision making.

3. Include reverse polarity circuit to prevent reverse voltage.

4. Include better quality sensors for more precision and accuracy in the weather station.

5. Include more weather sensors such as rain gauge and light intensity.

Appendix:

Footprints with 3D models

Footprints 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 socket

The 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 footprint

The PNP transistor 2N2907 comes in a TO-18 package.

Figure 47 TO-18 3D model Figure 48 TO-18 footprint

The 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 footprint

The 5mm diameter LED with a pitch of 2.54mm.

Figure 51 5mm diameter LED 3D model

Figure 52 5mm diameter LED footprint

The Temperature sensor LM35DZ comes in a TO-92 package.

Figure 53 TO-92 3D model Figure 54 TO-92 footprint

The Voltage regulator LM317 comes in a TO-220 package.

Figure 55 TO-220 3D model Figure 56 TO-220 footprint

The ¼ watt resistor comes in an Axial-0.4 package.

Figure 57 AXIAL-0.4 resistor 3D model Figure 58 AXIAL-0.4 footprint

The 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 footprint

The 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 footprint

These 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 model

Figure 64 2x16 LCD 3D model

Figure 65 Thumbwheel 3D model

Figure 66 PCB circuit

Figure 67 weather station panel 1

Figure 68 weather station panel 2

Figure 69 weather station wiring

Figure 70 PCB placed on top of the board

Referenceshttp://www.bobtech.ro/tutoriale/componente-electronice/43-calculator-online-mc34063a-mc34063-step-down-step-up-inverterhttp://appnote.avrportal.com/calculator/lm2575

http://www.electronics-lab.com/articles/LM317/

VCC

1

Output A

2

Output B

4

GND

3

P15

Pressure Sensor

V+

7

Vin+

3

Vin-

2

V-

4

Ref

5

Vo

6

RG

1

RG

8

U11

Instrumental Amp

+10V +10V

GND GND GND

150

R50

Q2

BC547B

22

R58

2.4K

R55

+24V

GND

Wind Direction

1

Anemometer

2

GND

3

P11

Weather Head

GND

10K

R56

10K

R57

+5V

+5V

D9

Diode 1N4003

402

R52

62.5

R53

4.7k

R51

Vout

2

GND

3

Vcc

1

U15

Temp LM35

Out

2

ADJ

1

In

3

U13

LM317

Q1

2N2907

GND

+5V

50

R54

Res Tap

GND

1

VIN

2

VB

3

nR

4

P5/MOSI

5

P6/MISO

6

P7/SCK

7

P8

8

P9/TXD/SDA

9

P10/RXD/SCL

10

P11/MOSI

11

P12/MISO

12

P13/TXD/SCK

13

P14/RXD

14

P15/AIN

15

P16/AIN

16

P17/AIN

17

P18/AIN/AO

18

P19/AIN

19

P20/AIN

20

P21/PWM

21

P22/PWM

22

P23/PWM

23

P24/PWM

24

P25/PWM

25

P26/PWM

26

P27/RXD/SCL

27

P28/TXD/SDA

28

P29/CANTD

29

P30/CANRD

30

USB D+

31

USB D-

32

ETH TD+

33

ETH TD-

34

ETH RD+

35

ETH RD+

36

IF+

37

IF-

38

VU

39

VOUT

40

U10

MBED

LED-

16

LED+

15

D7

14

D6

13

D5

12

D4

11

D3

10

D2

9

D1

8

D0

7

E

6

RS

4

Vo

3

R/W

5

GND

1

Vcc

2

P3

LCD 2x16

1K

R25

GND

GND

15 / 1watt

R34

+5V

+5V

GND GNDGND

39k

R29

6.2k

R33

GND

39k

R28

39k

R27

39k

R26

6.2k

R32

6.2k

R31

6.2k

R30

12

34

56

78

910

P2

Header 5X2

GND

LCD circuit

Weather head circuit

Pressure sensor circuit

Temrature sensor circuit

9

10

11

12

13

14

15

161

2

3

4

5

6

7

8

U2

Resistor Pack 220

+5V

GND

+5V

+5V

+5V

39k

R8

GND

e

9

d

10

c

11

b

12

a

13

g

14

f

15

16

LT

3

BI

4

LE

5

A

7

B

1

C

2

D

6

GND

8

DD

V

U1

7-Seg Driver

39k

R7

GND

39k

R6

10k

R10

GND

39k

R5

10k

R9

GND

39k

R13

GND

39k

R2

10k

R4

GND

+5V

+5V

+5V

+5V

GND

GND

GND

39k

R1

10k

R3

GND

39k

R16

GND

39k

R15

GND

39k

R19

GND

10k

R24

GND

10k

R23

GND

10k

R22

GND

10k

R21

GND

1 2

3 4

5 6

7 8

9 10

P1

Header 5X2

9

10

11

12

13

14

15

161

2

3

4

5

6

7

8

U4

Resistor Pack 220

9

10

11

12

13

14

15

161

2

3

4

5

6

7

8

U6

Resistor Pack 220

9

10

11

12

13

14

15

161

2

3

4

5

6

7

8

U8

Resistor Pack 220

e

9

d

10

c

11

b

12

a

13

g

14

f

15

16

LT

3

BI

4

LE

5

A

7

B

1

C

2

D

6

GND

8

DD

V

U3

7-Seg Driver

e

9

d

10

c

11

b

12

a

13

g

14

f

15

16

LT

3

BI

4

LE

5

A

7

B

1

C

2

D

6

GND

8

DD

V

U5

7-Seg Driver

e

9

d

10

c

11

b

12

a

13

g

14

f

15

16

LT

3

BI

4

LE

5

A

7

B

1

C

2

D

6

GND

8

DD

V

U7

7-Seg Driver

10k

R20

10k

R18

10k

R17

10k

R14

10k

R12

10k

R11

10k

R59

GND

10k

R60

GND

10k

R61

GND

10k

R62

GND

10k

R64

GND

10k

R63

GND

GND

1 2

3 4

5 6

7 8

9 10

P4

Header 5X2

GND

1 2

3 4

5 6

7 8

9 10

P12

Header 5X2

GND

1 2

3 4

5 6

7 8

9 10

P13

Header 5X2

GND

1 2

3 4

5 6

7 8

9 10

P14

Header 5X2

Vout

2

GND

3

Vin

1

Feedback

4

ON/Off

5

U12

LM2576T-ADJ

6.8K

R69

D10

Diode 1N5822

220uH

L1

Inductor

100uF

C1

1000uF

C2

GND

GND

GND

GND

2.2K

R70

GND

+5V

+24V

1

2

P7

Header 2H

GND

Vout

2

GND

3

Vin

1

Feedback

4

ON/Off

5

U14

LM2576T-ADJ

13K

R65

D11

Diode 1N5822

220uH

L2

Inductor

100uF

C3

1000uF

C4

GND

GND

GND

GND

1.8K

R66

GND

+10V

+24V

1.2K

R35

1.2K

R36

1.2K

R37

1.2K

R38

1.2K

R47

1.2K

R48

1.2K

R49

1.2K

R39

1.2K

R40

1.2K

R41

1.2K

R42

1.2K

R43

1.2K

R44

1.2K

R45

1.2K

R46

1 2

3 4

5 6

7 8

9 10

11 12

13 14

15 16

17 18

19 20

P6

Header 10X2H

1 2

3 4

5 6

7 8

9 10

11 12

13 14

15 16

17 18

19 20

P5

Header 10X2H

GND

PLC LEDs

Vcc

4

Analog Out

3

GND

2

Signal GND

1

U9

Humidity Sensor

+24V

GND

Analog In

Vout

2

GND

3

Vcc

1

U15

Temp LM35

82k

R53

+5v

GNDGND

Analog In