Design and Development of a real time data aquisition and control system by Emina, E. E Engr. Tech. part 2

July 18, 2017 | Autor: Etomi Emina | Categoria: Electronics and communication, Embedded System
Share Embed


Descrição do Produto

CHAPTER 3 METHODOLOGY The Data Acquisition and Control system designed is made up of several building block which together enables the DAQ to measure, display and control temperature in a process chamber and also display the relative humidity in the process chamber. Found below are the building blocks that make up the Data Acquisition and Control system. 1. Transducers (Temperature and Humidity sensors). 2. Arduino Uno Board (Microcontroller). 3. 16x2 Liquid Crystal Display (LCD). 4. TTL/CMOS to RS232 logic converter (MAX232). 5. Serial to USB converter. 6. PC DAQ application. 3.1

Processing Chamber

The process chamber is a 20 Γ— 14 Γ— 15 π‘–π‘›π‘β„Žπ‘’π‘  wooden box that is used as an oven to test the Data Acquisition and control system designed. At the base of the process chamber is 1000 π‘Šπ‘Žπ‘‘π‘‘π‘  electric stove installed equidistance from each side wall. The heater produces the rise in temperature within the process chamber that is to be measured, displayed, logged and controlled. The process chamber also provides a closed space where temperature rise can cause a change in relative humidity and at the same time the relative humidity can be measured and

1

displayed. At its side wall is a circulatory fan that is used to circulate the heat and also cool the processing chamber. Found at the top and bottom are half inch holes drilled to set up convention current a heat flows from the bottom to the top. Both the temperature and relative humidity transducers are placed at the top and close to the drilled holes to capture the temperature and relative humidity of the process chamber. 3.1.1 Transducers Transducers are devices that converts a physical property into a corresponding electrical signal, the process variables requiring transducer in this project are temperature and humidity. This block makes use of transducers as Temperature senor and Humidity senor to capture data from the process chamber, their respective output signals are then interface with the Microcontroller (Arduino Uno) for processing and interpretation. 3.2

Microcontroller (Arduino Uno Board)

The function of the microcontroller (Arduino Uno Board) in this block is to capture data from the temperature and humidity transducers. The data collected are processed in many ways, one of such processing is the conversion of analogue output of LM35 by one of the six ADC of the microcontroller into a 10 bit binary code that can be used for making decision with the microcontroller. Another is the capturing of the digital output from the DHT11 and storing its value in the microcontroller (Arduino Uno) for processing and display. 2

The processed data from the transducers together with the set point entered through the PC are all sent to the microcontroller and these data are used by the embedded system to control the temperature and the relative humidity of the processing chamber. Temperature control is achieved by the microcontroller (Arduino Uno) automatically, by comparing the set point with the temperature measured and if the measured temperature is greater than or equal to the set point entered from the PC the microcontroller turns off the heater but if less it ensures the heater remains on by de-energizing the relay. Relative Humidity control is also achieved by the microcontroller turning on or off the heater and the vent fan since humidity is dependent on temperature. In its operation, when the relative humidity is less than the set point the microcontroller turns off the process by switching off the heater and the fan on the other hand when the relative humidity is greater than its set point the microcontroller controls turns on the heater. 3.3

16x2 Liquid Crystal Display

This is a 16x2 Liquid Crystal Display screen that is used to display the temperature and relative humidity of the process chamber. It makes use of the HD44780U standard for LCD controller chip. This standard enables the LCD to communicate with the microcontroller (Arduino Uno) using four (4) data line and three (3) command line. Through the use of appropriate binary codes at the 3

command line and ASCII code at the data line, alphanumeric letter communicates to the user how the device can be used by prompts. 3.4

TTL/CMOS to RS232 logic converter (MAX232)

This block uses MAX232 chip to convert TTL/CMOS signal from the embedded system to RS232 logic signal. Thus it is used to enable communication between the embedded system and the program on the PC. This is because microprocessors found on PC communicate with a negative logic, βˆ’10 𝑉𝐷𝐢 represents a high and 10 𝑉𝐷𝐢 represents a low. Hence the MAX232 severs as a driver that interface the embedded system with the PC so that both system can communicate using their respective logical level. The output of the MAX232 chip is a standard RS232 signal, they can only communicate with PC having serial ports like the DB9 and DB25 found on desktop computers and some laptops using such technology. DB9 and DB25 are serial ports found on desktop computers and some laptops, the β€œD” represents the shape of the plug or port and the 9 represents the number of pin it has. Same goes for the DB25 serial port. They are usually known as printer port, it is commonly used by modem and other data terminal devices for communication. In recent times other standard like the USB standard has become even more common that most laptops use USB technology. The Serial to USB converter is

4

a cable that allows RS232 signals to be converted into USB technology using an adequate driver, thus allowing the hardware designed to connect to the USB port of a PC. 3.5

PC Data Acquisition and control system application software

Data Acquisition and Control systems consist of two parts, a hardware and a software. The hardware consist of the microcontroller (Arduino Uno board) and associated circuitry that enables collection of data from the different transducers. It performs this operation and more by following an algorithm developed within the program memory of the microcontroller. The choice of programming language for the microcontroller (Arduino Uno board) is the C language because the available Integrated Development Environment (IDE) for its development uses C or C++. In other to interface the Arduino board with a PC to control the different process variable a software was developed using VB.net for processing and management of data collected from the embedded system. The VB.net application developed has several function, they are; the display of temperature and relative humidity on the PC, it is used for entering the set point for temperature into the embedded system and through this software data captured can be logged and analyzed at a later time when the system is not operating in real time mode.

5

LCD

Thermal Sensor

Humidity Sensor

Fan

PC

Microcontroller

Serial to USB

(Arduino Uno)

MAX232

Heater

Relay

Figure 3.0: Block diagram of the Data Acquisition and Control System

6

3.6

Circuit Design

The Data Acquisition and control system consist of two parts, the hardware made up of an embedded system with it associated circuitry and a PC application written in VB.net. Both of which together enable data processing, display and storage in .csv file format. The circuit that make up each of these building blocks will be designed here using suitable electrical theories. 3.6.0 Design at Thermal Sensor LM35 is the temperature sensor of choice for the processing chamber. This is because the sensor is a precision integrated circuit temperature sensor that can easily be interfaced with microcontrollers, especially the Arduino Uno, since it has six 10 bit ADC (See figure 3.1) for data capture, it also have a high accuracy 1

3

4

4

of Β± ℃ at room temperature and Β± ℃ over a full βˆ’55 to +180Β°C temperature range (See Appendix A). With its temperature range it is just ideal for this application because a maximum temperature of 100 ℃ is intended to be reach during the testing of the data acquisition and control system.

7

Figure 3.1: Interfacing LM35 with Arduino Uno 3.6.1 Design at the Humidity Sensor The DFRobot (DHT11) Temperature and Humidity Sensor is selected to measure the relative humidity of the process chamber. DHT11 is a 2 in 1 sensor; it can take measurement of temperature as well as relative humidity of the environment it is present in. Within the process chamber it is used solely to measure relative humidity. See appendix B for how DHT11 is interfaced with a microcontroller. The DHT11 uses a resistive-type humidity measurement component and an NTC temperature measurement component, and connects to a high-performance 8-bit microcontroller, offering excellent quality, fast response, anti-interference ability and cost-effectiveness solution. Figure 3.2 shows its interface with the Arduino Uno.

8

Figure 3.2: Interfacing DHT11 with Arduino Uno 3.6.2 Design of Power Supply Unit The power supply required by the Arduino Uno, the LCD, transducers and the relays coils for the switching unit are a regulated +12 VDC and +5 VDC power source (See Appendices for power supply rating of the different components used). Since a fixed positive voltage supply is required by the components on the different sections, the LM78xx family of voltage regulator was chosen to satisfy the power requirement. Thus LM7812 and LM7805 were used in this design to output the required +12 VDC and +5 VDC supply needed by the different components. Figure 3.3 shows the circuit diagram.

9

Figure 3.3: +12 VDC and +5 VDC Regulated Power Supply From the circuit diagram in figure 3.3 C5, C6 and C8 are recommended by the manufacturers, their values are 0.1πœ‡πΉ, 0.1πœ‡πΉ and 0.33πœ‡πΉ (See Appendix C), it will be noticed that the input voltage required to output a regulated +12 VDC supply is between 14.6 VDC to 30 VDC and the minimum input voltage required by the LM7805 is 7.3 VDC. By choosing an input voltage of 18 VDC will satisfy both devices. The filter of choice is the RC filter circuit; it is recommended that the ripple voltage should be 5 % of the input voltage. Therefore from RC filter equation, the ripple voltage is given by equation (1) π‘‰π‘Ÿ =

5 100

Γ— 18

π‘‰π‘Ÿ = 0.9 𝑉 π‘‰π‘Ÿ =

π‘‰π‘š

(1)

2𝑓𝑅𝐢

π‘‰π‘š = 18 𝑉𝐷𝐢 (Input voltage across RC circuit) 10

𝑓 = 100𝐻𝑧 𝐢 = 2200πœ‡πΉ 𝑅 =? 𝑅=

π‘‰π‘š

(2)

2π‘“πΆπ‘‰π‘Ÿ

Substituting the above values in to equation (2) 𝑅=

18 2Γ—100Γ—2200πœ‡Γ—0.9

𝑅 = 45Ω 𝑅 = 𝑅1 = 45Ω By taking KVL across 𝑉𝐴𝐡 , 𝑉𝐴 βˆ’ 𝑉𝐷 βˆ’ 𝑉𝑅 βˆ’ 𝑉𝐷 = 0 𝑉𝐴 βˆ’ 2𝑉𝐷 βˆ’ 𝑉𝑅 = 0 π‘‰π‘š = 𝑉𝑅 = 18 𝑉 𝑉𝐷 = 0.7 𝑉 (For silicon diode), 𝑉𝐴 βˆ’ 2 Γ— 0.7 βˆ’ 18 =0 𝑉𝐴 βˆ’ 1.4 βˆ’ 18 = 0 𝑉𝐴 βˆ’ 19.4 = 0 𝑉𝐴 = 19.4 𝑉𝐷𝐢 11

But, π‘‰π‘š

π‘‰π‘Ÿπ‘šπ‘  =

√2

Where, π‘‰π‘š = 𝑉𝐴 π‘‰π‘Ÿπ‘šπ‘  =

(Maximum voltage)

19.4 √2

π‘‰π‘Ÿπ‘šπ‘  = 13.72 𝑉𝐷𝐢 π‘‰π‘Ÿπ‘šπ‘  = 14 𝑉𝐷𝐢 Therefore the voltage rating of the transformer is 14 VAC but commercially available transformer closest to 14 VAC is 15 VAC. The effect of using a 15 VAC is shown below. π‘‰π‘Ÿπ‘šπ‘  = π‘‰π‘š √2

π‘‰π‘š √2

= 15

π‘‰π‘š = 15 Γ— √2 π‘‰π‘š = 21.21 𝑉 Since 21.21 VDC is within the range of the input voltage range, the choice of a 15 VAC/220 VAC transformer is good. 𝑃𝐼𝑉 = π‘‰π‘š βˆ’ 𝑉𝐷 𝑃𝐼𝑉 = 21.21 βˆ’ 0.7

12

𝑃𝐼𝑉 = 20.51 𝑉 Thus diode to be selected must have a 𝑃𝐼𝑉 value greater than 20.51 V, the choice of diode for the bridge rectifier is the general purpose rectifier 1N4007 (Appendix D1). 3.6.3 Design of the Switching Unit The switching unit comprises of an electromagnetic relay tired to the collector of a bipolar junction transistor (BJT) as shown in figure 3.4. The BJT selected would operate as a switch moving between the cut off region and the saturation region. It is also connected in the common emitter configuration. When turned on it actuates the relay coil and consequently turns on heater or fan. On the other hand when turned off it de-energizes the relay. Specification for heater Heating element

=

1000 Watts

This means that since the wattage of the heating element is 1000Watts the contact rating of the relay to be used for its switching must be higher than 1000 Watts. Therefore a miniature PCB/QC Heavy Duty Power Relay was selected (See Appendix E1). Relay rating Contact rating:

250 VAC, 45A

13

Coil resistance:

155 Ω

Thus, The power handling capacity of relay contacts is given by, 𝑉𝐼 = 250 𝑉 Γ— 45 𝐴 = 11,250 𝑉𝐴 From figure 3.4 taking the output loop equation 𝑉𝐢𝐢 βˆ’ 𝐼𝐢 𝑅𝐿1 βˆ’ 𝑉𝐢𝐸 = 0

(3)

At saturation when the transistor (BJT) is turned on, 𝑉𝐢𝐸 = 0 Therefore, 𝑉𝐢𝐢 βˆ’ 𝐼𝐢 𝑅𝐿1 = 0 𝐼𝐢 =

𝑉𝐢𝐢

(4)

𝑅𝐿1

Where 𝑉𝐢𝐢 = 12 𝑉𝐷𝐢 π‘Žπ‘›π‘‘ 𝑅𝐿1 = 155 Ω From equation (5) 𝐼𝐢 =

12 155

𝐼𝐢 = 77 π‘šπ΄ Common emitter Gain of BJT, 𝛽=

𝐼𝐢 𝐼𝐡

14

𝛽 = 100 𝐼𝐡 = 𝐼𝐡 =

(Chosen)

𝐼𝐢 𝛽 77 π‘š 100

𝐼𝐡 = 770 πœ‡π΄ In

other

to

drive

the

transistor

deep

into

saturation

𝐼𝐡 π‘šπ‘’π‘ π‘‘ 𝑏𝑒 π‘”π‘Ÿπ‘’π‘Žπ‘‘π‘’π‘Ÿ π‘‘β„Žπ‘Žπ‘› 770 πœ‡π΄ Taking the input loop equation by Kirchhoff’s Voltage Law, 𝑉9 βˆ’ 𝐼𝐡 𝑅2 βˆ’ 𝑉𝐡𝐸 = 0

(5)

Where, 𝑉𝐡𝐸 = 0.7 𝑉 𝑉9 = 𝑉𝑂𝐻 = 5 𝑉 By Substitution of 𝑉13 and 𝑉𝐡𝐸 into equation (5) 5 βˆ’ 770 πœ‡π‘…2 βˆ’ 0.7 = 0 4.3 βˆ’ 770 πœ‡π‘…2 = 0 770 πœ‡π‘…2 = 4.3 𝑅2 =

4.3 770 πœ‡

𝑅2 = 5.58 𝐾Ω 15

𝑅2 π‘šπ‘’π‘ π‘‘ π‘Žπ‘™π‘ π‘œ 𝑏𝑒 𝑙𝑒𝑠𝑠 π‘‘β„Žπ‘Žπ‘› 5.58 𝐾Ω in other to drive the transistor deep into saturation. The nearest commercially available value was selected. 𝑅2 = 5.1 𝐾Ω Specification for vent fan Rated voltage of fan:

12 𝑉𝐷𝐢

Current input:

0.09 𝐴

Power:

1.09 π‘Šπ‘Žπ‘‘π‘‘π‘ 

Relay Specification The relay selected for the fan is the smallest commercially available on shelf. (See Appendix F1); Coil rating:

12VDC

Relay contact rating:

400 Ω

Contact rating:

250 VAC, 10 A

Therefore in terms of the power that can be drawn from the contact, 𝑉𝐼 = 250 Γ— 10 = 2,500 π‘Šπ‘Žπ‘‘π‘‘π‘ 

16

Comparing the power of the fan with that of the relay contact rating, it is evident that the relay can switch on the fan without the relay suffering damage from over load of its contact. By applying KVL to the output circuit the following equation results. 𝑉𝐢𝐢 βˆ’ 𝐼𝐢 𝑅𝐿2 βˆ’ 𝑉𝐢𝐸 = 0

(6)

But at saturation 𝑉𝐢𝐸 = 0 and 𝑉𝐢𝐢 = 12 𝑉𝐷𝐢 (Coil rating) Therefore, 𝑉𝐢𝐢 βˆ’ 𝐼𝐢 𝑅𝐿2 = 0 𝐼𝐢 = 𝐼𝐢 =

𝑉𝐢𝐢 𝑅𝐿2 12 400

𝐼𝐢 = 30 π‘šπ΄ Where gain of a common emitter configuration CE is given as, 𝛽=

𝐼𝐢 𝐼𝐡

𝛽 = 100 (πΆβ„Žπ‘œπ‘ π‘’π‘›) 𝐼𝐡 = 𝐼𝐡 =

𝐼𝐢 𝛽

30 π‘šπ΄ 100

𝐼𝐡 = 300 πœ‡π΄ 17

But 𝐼𝐡 π‘šπ‘’π‘ π‘‘ 𝑏𝑒 π‘”π‘Ÿπ‘’π‘Žπ‘‘π‘’π‘Ÿ π‘‘β„Žπ‘Žπ‘› 300 πœ‡π΄ to drive the transistor deep into saturation. Applying KVL, the input loop equation is given as, 𝑉10 βˆ’ 𝐼𝐡 𝑅3 βˆ’ 𝑉𝐡𝐸 = 0

(7)

Where 𝑉10 = 5 𝑉 π‘Žπ‘›π‘‘ 𝑉𝐡𝐸 = 0.7 𝑉 5 βˆ’ 300πœ‡π‘…3 βˆ’ 0.7 = 0 4.3 βˆ’ 300 πœ‡π‘…3 = 0 𝑅3 =

4.3 300 πœ‡

𝑅3 = 14.33 𝐾Ω 𝑅3 π‘šπ‘’π‘ π‘‘ 𝑏𝑒 𝑙𝑒𝑠𝑠 π‘‘β„Žπ‘Žπ‘› 14.33 𝐾Ω, to drive the transistor deep into saturation. Appendix G1 shows the resistor next to this value, selected to do that selected 13 𝐾Ω. Also transistor BC547 was selected because its gain is 200 and saturation current is 200 π‘šπ΄ (See Appendix H) and a transient (flyback) diode of 1N4007 was used for both relays (Appendix I).

18

Figure 3.4: Circuit Diagram of the Switching Unit 3.6.4 Design at the πŸπŸ” Γ— 𝟐 LCD The 16 Γ— 2 LCD selected uses the HD44780U standard that allows easy interface of the display with microcontrollers. Figure 3.5 shows how the Arduino is interfaced with the 16 Γ— 2 LCD. The top of the screen will be used to display the temperature while the bottom will be used to display the relative humidity. This size of screen also allows for prompts to direct user on the product.

19

Figure 3.5: Interfacing πŸπŸ” Γ— 𝟐 LCD with Arduino Uno This standard makes use of three control lines and 4 or 8 Input/output data lines or bus. The 3 control lines and 4 data lines are made use of here to manage the ports of the Arduino Uno. (See datasheet at Appendix J).

20

3.7

Design at the MAX232

The MAX232 chip is a TTL/CMOS to RS232 logic converter that enables communication between the PC and the Arduino Uno. From the manufacturers data sheet it consist of capacitor C1, C2, C3 and C4 and has a recommended capacitance of 0.1πœ‡πΉ (See Appendix K).

Figure 3.6: Interfacing the PC with an Arduino Uno

21

Figure 3.8: Circuit Diagram of a real time Data Acquisition and Control System 22

3.7

Algorithm

Arduino Uno is the choice of microcontroller for the design of the data acquisition and control system. It is designed to be open source software and uses a simplified version of c language for on chip programming of the Arduino Uno board through its integrated development environment (IDE). The second part of this design which is the computer interface application enable serial data from the MAX232 chip and the Serial to USB cable to be captured from the buffer, displayed and logged by a program written in VB.net. Together it gives rise to two computer algorithms for the data capture, display and logging process. 3.7.1 Algorithm

for

the

data

acquisition

and

control

system

(Microcontroller) 1. Declare pins to control fan, heater, DHT11, LM35 and 16 x2 LCD screen. 2. Initialize the 16 x 2 LCD screen. 3. Initialize DHT11 sensor. 4. Declare fan and heater as output devices. 5. Set cursor to first row ready for display. 6. While the set points for temperature and relative humidity are not set check serial port for data from PC. 7. Set LCD cursor to first row and print β€œSet Temp:” 8. Print the value of set point on LCD and set cursor position to second row first column. 23

9. Print on LCD β€œSet Humi:” and display set point value on the screen. 10.Repeat step 6 to 9 until set point is obtained from the VB.net interface 11.Display Set point for one second. 12.Initialize LCD. 13.Read data from DHT11 and LM35. 14.Set cursor to first row and column. 15.Display β€œTemp:” on LCD and Print the value of the temperature next to it. 16.Set cursor position to second row first column. 17.Display β€œHumi:” and print the value of the relative humidity next to it 18.Check the serial port if VB.net sent a reset or emergency shut down command, if yes go to step 6 else continue. 19.Transmit the value of temperature and relative humidity serially to VB.net interface. 20.Analyse the temperature and relative humidity captured, if relative humidity is less than set point, turn off heater and fan else if temperature is less than set point, turn on heater and turn off fan else turn on heater and turn off fan. 21. Repeat step 12 to 21.

24

3.7.1 Algorithm for VB.net program 1. Import System.IO.Ports, Import System.Threading. 2. Declare Temperature, Relative humidity, Set Point Temperature and Set Point Relative Humidity as integer. 3. When application opens retrieve Baud available for selection of baud rate. 4. Declare file as System.IO.StreamWriter. 5. Create file named DAQ.csv on desktop. 6. Write a headers on to file as follows: Temperature, Relative humidity, Set Point Temperature and Set Point Relative Humidity. 7. Display a prompt β€œPlease configure serial port”. 8. If connect button is pressed Configure serial port parity to none, data bits to 8 and stop bit to 1. 9. Open Serial port and prompt β€œEnter temperature Set Point” 10.If button 0 to 9 is pressed send their vales to microcontroller and display set point on text box. 11.Read data from serial port and display the first three bytes after β€œA” as temperature on a text box. 12.Read data from serial port and display the first three bytes after β€œB” as Relative Humidity on a text box. 13.Read data from serial port and display the first three bytes after β€œC” as Temperature set point on a text box.

25

14.Read data from serial port and display the first three bytes after β€œD” as Relative Humidity set point on a text box. 15.Repeat 11 to 15 each time receive event is fired. 16.If Reset button is pressed send shut down command to microcontroller and enable button 0 to 9. 17.If Emergency shut down is pressed send shut down command to microcontroller. 3.8

Arduino Uno Program in c language for the Data Acquisition and

Control system Below is a section of the sketch (program) written in c language that is used by the; real time Data Acquisition and Control System. #include #include #define fan 8 #define heater 7 float temp; LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // initialize the library with the numbers of the interface pins int tempPin = A0; // variable to store the value coming from the sensor

26

int humi, hundred, ten, unit, hundredH, tenH, unitH, hundredST, tenST, unitST; int hundredSH, tenSH, unitSH, convert_temp, s_temp, s_humi; int st_hundred, st_ten, st_unit, sh_hundred, sh_ten, sh_unit; dht11 DHT11; byte no; int set_point_temp; int count=0; int set_point_humidity; int c=0; int c1,c2,c3,c4,c5,c6; void setup() { lcd.begin(16, 2); // set up the LCD's number of columns and rows: Serial.begin(9600); DHT11.attach(6); pinMode(fan,OUTPUT); pinMode(heater,OUTPUT); lcd.setCursor(0, 0); } void loop() 27

{ while(c < 6) { readVB(); lcd.setCursor(0, 0); lcd.print("Set Temp:"); update_stemp(); lcd.setCursor(0, 1); lcd.print("Set Humi:"); update_shumi(); } delay(1000);

The complete sketch (program) is in Appendix K.

28

3.9

VB.net code for Data Acquisition and Control system

This shows a section of the VB.net code used for the display, control and logging Imports System Imports System.ComponentModel Imports System.Threading Imports System.IO.Ports Public Class frmMain Dim myPort As Array 'COM Ports detected on the system will be stored here Delegate Sub SetTextCallback(ByVal [text] As String) 'Added to prevent threading errors during receiveing of data

Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'When our form loads, auto detect all serial ports in the system and 'populate the cmbPort Combo box. myPort = IO.Ports.SerialPort.GetPortNames() 'Get all com ports available cmbBaud.Items.Add(9600) 'Populate the cmbBaud Combo box to common baud rates used cmbBaud.Items.Add(19200) cmbBaud.Items.Add(38400) cmbBaud.Items.Add(57600) cmbBaud.Items.Add(115200) For i = 0 To UBound(myPort) cmbPort.Items.Add(myPort(i))

29

Next cmbPort.Text = cmbPort.Items.Item(0) 'Set cmbPort text to the first COM port detected cmbBaud.Text = cmbBaud.Items.Item(0) 'Set cmbBaud text to the first Baud rate on the list btnDisconnect.Enabled = False 'Initially Disconnect Button is Disabled End Sub Private Sub btnConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConnect.Click SerialPort1.PortName = cmbPort.Text 'Set SerialPort1 to the selected COM port at startup SerialPort1.BaudRate = cmbBaud.Text 'Set Baud rate to the selected value on 'Other Serial Port Property SerialPort1.Parity = IO.Ports.Parity.None SerialPort1.StopBits = IO.Ports.StopBits.One SerialPort1.DataBits = 8

'Open our serial port

SerialPort1.Open() btnConnect.Enabled = False btnDisconnect.Enabled = True

'Disable Connect button 'and Enable Disconnect button

End Sub

Find the complete VB.net code in Appendix L

30

CHAPTER 4 TEST AND DISCUSSION OF RESULTS 4.1

Testing of the Real time Data Acquisition and Control System

In other to test the data acquisition and control system after the design was completed, a 20 x 14 x15 wooden box was built to act as the process chamber were temperature and relative humidity can be controlled. At the base of the wooden box a 1000 π‘€π‘Žπ‘‘π‘‘π‘  heater was bolted equidistant from its walls to provide the rise in temperature needed to demonstrate the operation of the DAQ and control system. Found at the top of the process chamber is the temperature and humidity transducers to take measurement at that point, also attached to the left side wall is 4 Γ— 4 inches vent fan. Evenly distributed at the top and bottom are 2 inches holes that is intended to set up conventional current flow from top to bottom and an even distribution of heat within the process chamber. 4.1.1 Temperature test and Relative Humidity test The process starts by plugging the DAQ and control system hardware to a wall socket and turning on the power switch. Once turned on the LCD prompts β€œEnter Set point temp:” at the first row of the screen and β€œEnter Set point Humi:” at the second row of the 16 Γ— 2 LCD screen. 31

Running the DAQ program opens the graphical user interface (GUI) of the real time DAQ and control system. Just above the right hand corner, the DAQ prompts β€œPlease Configure Serial Port”, the serial port was set to COM1 and 9600 baud rate by clicking on the connect button (See figure 4.2). The prompt now displays β€œEnter Temperature Set Point”, a temperature set point of 50 ℃ and 30 % was set through the buttons 0 to 9. At this point the LCD and the VB.net interface started showing the temperature and relative humidity of the processing chamber. The process was run for seven minutes and the temperature and relative humidity value are logged automatically. Figure 4.1 shows the graph of how the temperature and humidity varies during the process. Chart Title 100 90 80 70 60 50 40 30 20 10

1 7 13 19 25 31 37 43 49 55 61 67 73 79 85 91 97 103 109 115 121 127 133 139 145 151 157 163 169 175 181 187 193 199 205

0

Temperature

Relative Humidity

Relative Humidity Set Point

Time

Temperature Set Point

Figure 4.1: Variation of temperature and relative humidity within the process chamber 32

Figure 4.2: Graphical user interface of the real time Data Acquisition and control system interface 33

4.1.3 Data logger test To test the data logging ability of the real time data acquisition and control system the hardware was connected and the prompt followed as explained in section 4.1.2. Once the data starts streaming into the VB.net program the process of data logging commence and a .csv file was noticed to have been created on the desktop. After running the process for a period of seven minutes, the serial connection was disconnected through the disconnect button and the .csv file opened to view the results obtained. The results are as shown in Appendix M. 4.2

Discussion on the results obtained from the transducers

It would be noticed from the graph in figure 4.1 that the temperature of the process chamber increased from ambient temperature 30 ℃ to 50 ℃ and started decreasing again to 48 ℃ and increased to 50 ℃. This because at the start of the process the processing chamber was at room temperature and once the set point of 50 ℃ was set the heating element was turned on as a result increasing the temperature of the processing chamber till it gets to 50 ℃, at this point the temperature was noticed to fall to 48 ℃, this is because the microcontroller turned off the heater and switched on the vent fan for cool to occur. The further rise in temperature from 48 ℃ to 50 ℃ again result because the heater was turned on to maintain the

34

temperature at about 50 ℃. The process thus maintains the temperature of the processing chamber within this range. Also it would be notice that there is a slight fall in relative humidity during the process as the temperature rises. This is expected as increase in temperature causes reduction in relative humidity in air. 4.2.1 Using Microsoft Excel for data analysis The logged data in .csv file format can be displayed directly with Microsoft Excel. To do this, Excel request for the source of data at the first opening of the file. This was configured for Excel to recognize β€œ,” as separation of values. The result is as shown in Appendix M, also with excel the graph in figure 4.1 was plotted to shows the variation of relative humidity and temperature with time.

35

Table 4.1: Cost of Materials for Data Acquisition System S/N

Quantity

Materials

Cost (N)

1

1

Arduino Uno Board

7000

2

2

Thermal Sensor (LM35)

500

3

1

Humidity Sensor (DHT11)

1000

4

1

MAX232

350

5

1

Serial to USB cable

3000

6

1

Heater

3000

7

1

Fan

800

8

2

Relay

200

9

1

Power Relay

150

10

6

Capacitors (1 Γ—2200 πœ‡πΉ), 6Γ—0.1πœ‡πΉ

60 120

Resistors 3Γ—30 K𝛺, 45𝛺, 13 𝛺,

11

90

2Γ— 100𝛺 12

4

Diodes

40

13

2

Transistors

60

14

6 yards

Cable

1500

15

2

LCD

1200

36

17

1

Casing

1000

18

1

Plug

300

19

1

Transformer

500

20

1

Veroboard

150

21

1

Cabinet

12000

Miscelleanous

12000

22

Total

44,920

CHAPTER 5 CONCLUSION AND RECOMMENDATION 5.1

Recommendation

From the results obtained, it was noticed that the temperature within the processing chamber dropped from the set value of 50 ℃ to 48 ℃ rather than being maintained precisely at 50 ℃. This 2 ℃ variation can be reduced further by developing a variable vent that reduces rapid heat loss from the processing chamber and by using PWM for the fan to control the rate of heat loss. Also it was notice that there is a short time interval between the on/off of the relay this has the effect of spark at the relay terminal as such over a long period of with time the relay contact will go bad and need replacement. A remedy for this is to either use a solid state relay or design for a, upper and a lower set point, as the will

37

prevent much bouncing of the contact since it will take some time for the temperature to rise and drop. In this design only temperature and relative humidity was captured processed and logged, the microcontroller (Arduino Uno) can handle as much five more analogue transducers (Process variable) and about three digital transducer if connected to it. Such could serve as a cheaper system used in industry to control specific processes rather than using expensive programmable logic controller (PLC). 5.2

Conclusion

The real time data acquisition and control system using a microcontroller (Arduino Uno) and PC has proven to be an accurate and cost effective way for temperature and relative humidity control. Also with the .net framework library in VB.net has a good library that makes data capture process and logging from an embedded system becomes even easier.

38

Lihat lebih banyak...

ComentΓ‘rios

Copyright Β© 2017 DADOSPDF Inc.