Documente Academic
Documente Profesional
Documente Cultură
CHAPTER-1 INTRODUCTION
1 | P a g e N I L O T PA L M R I N A L
INTRODUCTION
In this project an attempt has been made to observe consumption of Electrical energy by means of an energy meter and the data is sent to a computer. Energy meter is generally of the electro-dynamic type. An electronic type of energy meter is used. The calculation circuit is a PCB which calculates the power consumption of each appliance which is connected, explicitly. CALCULATION CIRCUIT would be installed at the back of switch boxes. Two transformers a voltage and a current transformer each samples current and voltage is used to deliver voltage and current to calculate energy consumed in KWH. The circuit can handle up to 20A current. The meter converts energy consumed to pulses of resolution 6.4 Imp/Wh. The pulses converted are then transmitted to modulator and communicated via a non-linear channel to the demodulator circuit. At demodulator circuit, connected to personal computer, signal is demodulated and using a microcontroller sent to personal computer via LPT. A VB6 program reads port and saves the received data to an .dat file. A power supply unit delivers the power required by the I Cs at demodulator circuit. Power supply unit consists of a transformer and 78XX series voltage regulators for regulated supply at +5V. Demodulation Circuit would be at back side of PC and DATA COLLECTION SOFTWARE in PC. Altogether the energy consumption at switches will be recorded on PC.
2 | P a g e N I L O T PA L M R I N A L
3 | P a g e N I L O T PA L M R I N A L
In this chapter the idea and conceptual block diagram will be demonstrated to provide clear understandings of the project.
2.1 CONCEPT
CALCULATION CIRCUIT is installed at the back side of switch boxes, and DATA COLLECTION SOFTWARE at PC. The calculation circuit is a PCB which will calculate the energy consumed by each appliance which is connected. The calculation circuit is in parallel with every switch and is to be assembled behind switch box.
4 | P a g e N I L O T PA L M R I N A L
5 | P a g e N I L O T PA L M R I N A L
2.2.4 Computer
A simple PC is used with Windows Platform installed with Pratham v7.1, a VB6 program to control and receive data from parallel port of computer. Demodulator is connected to PC with less than 3ft D25 connector cable. Pratham v7.1, program reads port automatically and saves the received data to an .ini file.
6 | P a g e N I L O T PA L M R I N A L
CHAPTER-3 WORKING
7 | P a g e N I L O T PA L M R I N A L
In this chapter the circuit diagrams will be explained for all of the constituent circuits. First is calculation circuit.
Figure 3.1: Calculation Circuit A potential and a current transformer is used to sample current and a microcontroller based energy kit CD2299 is used to convert energy usage into pulses of resolution 6.4Im/Wh. An electro mechanical interface shows the traditional readings. An analog MUX converts pulses into ASK. The ASK is then transmitted to demodulator circuit that is remote to the calculation
8 | P a g e N I L O T PA L M R I N A L
circuit. An oscillator using LM353 creates sine wave at frequency 43.3 KHz. This sine wave is used as carrier for ASK message signal. Due to most of the transmission lines are non linear the ASK is best suited for non synchronous modulation. However the error in ASK generation and detection results in change of pulse width but the relevant change in pulse width does not affect the outcome. The frequency of pulse is too small, in order of few hertz hence, practically the outcome of project merely depends upon the number of pulses which on the later circuit will be counted after demodulation inside microcontroller programmed to perform interfacing with computer. Error in modulation scheme is hence avoided by using microcontroller based counter.
9 | P a g e N I L O T PA L M R I N A L
The output of calculation circuit is provided to opto-coupler which provides electric isolation between circuits. The output of opto-coupler is fed to an comparator using uA741 which demodulates ASK. A microcontroller AT89C4051 is used to count pulses and convert the count to hexadecimal. The hexadecimal number represents the energy consumed in resolution of 10 Wh/unit. 74244 buffer is used to interface the output data of microcontroller to computers parallel port using D25 connector. The buffer provides reading of output nibble-wise. i.e. The hexadecimal output is read one nibble at a time by VB program. The program then joins the data and makes byte form nibbles.
10 | P a g e N I L O T P A L M R I N A L
Power Supply Unit consists of a Transformer rated 15-0-15, three 78XX series voltage regulators and it provide required power for the circuitry. First a Bridge Rectifier converts AC into DC. The rectified output from bridge rectifier is then regulated and filtered using 78XX series voltage regulators. 7815 produces +15V, 7915 produces -15V and 7805 produces +5V. Altogether the constituents provide a stable and reliable power supply unit for I Cs. Transformer chosen is a 15-0-15, 1 Amp type. For input and output filtering capacitors are used so that the ripple in output can be reduced. All diodes are 1N4001/1N4007.
3.4 SOFTWARE
A simple PC is used with Windows Platf orm installed with Pratham v7.1, a VB6 program to control and receive data from parallel port of computer. Demodulator is connected to PC with less than 3ft D25 connector cable. Pratham, program reads port and saves the received data to a .dat file. Snapshot of the program is depicted in Figure 6.
11 | P a g e N I L O T P A L M R I N A L
The software can work in two modes one is automatic another is manual. The software itself is capable of logging data with date and time. It converts the data received to Watt-Hour and logs it in a file at application directory under name of data.dat. It reads output nibble by nibble and then by using a function joins nibbles to form a complete byte.
12 | P a g e N I L O T P A L M R I N A L
13 | P a g e N I L O T P A L M R I N A L
Figure 4.1: uA741 Pin Detail LM741 is used as same as non inverting summer and for demodulation of PWM and ASK. 4.1.2 LF353 The LF353 is a JFET input operational amplifier with an internally compensated input offset voltage. The JFET input device provides with bandwidth, low input bias currents and offset currents.
14 | P a g e N I L O T P A L M R I N A L
Pin Details:
Figure 4.2: LF353 Pin Detail LF353 is used in differential amplifier and sine wave oscillator used in ASK. It has a high slew rate for around 30V/us, that is why it is used in sine wave generation. The circuit diagram for sine wave generator is depicted below if Figure 15. Oscillation Circuit :
Figure 4.3: Oscillation Circuit Diagram We need Vout = +/5 V thus Vcc = +/- 5V. To limit the output we use diodes so that forward current is assumed to be 1mA.
15 | P a g e N I L O T P A L M R I N A L
Design: Requirement, Vcc = +/- 15V, Vout = +/- 5V, f = 43.3 KHz Assume, R = 170E , C = 1 / ( 2 * pi * 2.44 * 43.3K) ...Equation 5
Therefore, chosen C = 0.1uF. For Vout = +/- 5V, Assume, Id = 1mA, R1 = 3V / (29 * 1mA) R3 = 2 * Vf / Id = 2 * 0.7V / 1mA, R3 = 1k4 ......Equation 6 ..Equation 7
16 | P a g e N I L O T P A L M R I N A L
Pin Diagram:
17 | P a g e N I L O T P A L M R I N A L
Schematic Diagram:
4.4 TRANSFORMER
A transformer is a static or stationary device which transfers electrical power from one circuit to another without change of frequency. The principle of working of transformer is mutual induction between two circuits linked by a common magnetic flux. It consists of two separate coils placed on a laminated core. These coils are electrically separated and magnetically linked through a path of low reluctance. The two coils possesses high mutual inductance. If any one of the two coils called primary is connected to a source of alternating voltage, and alternating flux with the same frequency of as that of supply voltages will set up in the wave. Most of alternating flux will be linked with the other coil called secondary and have mutually induced EMF is produced in it. According to the faradays law of electromagnetic induction, if the secondary circuit is closed with a load, impedance then a current flows through it. Hence electrical power is transferred from primary to secondary without change of frequency. In an ideal transformer, the induced voltage in secondary
18 | P a g e N I L O T P A L M R I N A L
winding (Vs) is in proportion to the primary voltage (Vp), and is given by the ratio of the number of turns in the secondary (Ns) to the number of turns in the primary (Np) as follows:
Vs/Vp=Ns/Np
Figure 21 : Figure 4.5: Transformer Winding Based on voltage transformation ratio or turns ratio, a transformer may be Step-up transformer for which number of turns on secondary is greater than number of turns on primary and in Step-down transformer, the number of turns on secondary is less than that of primary.
19 | P a g e N I L O T P A L M R I N A L
20 | P a g e N I L O T P A L M R I N A L
21 | P a g e N I L O T P A L M R I N A L
CJNE, DJNZ, JB, JNB, JC, JNC, JBC, JZ, JNZ. With these conditional branching instructions the same rule above applies. Again, violating the memory boundaries may cause erratic execution. For applications involving interrupts, the normal interrupt service routine address locations of the 80C51 family architecture have been preserved. POWER-DOWN MODE In the power-down mode the oscillator is stopped and the instruction that invokes powerdown is the last instruction executed. The on-chip RAM and Special Function Registers retain their values until the power-down mode is terminated. The only exit from power-down is a hardware reset. Reset redefines the SFRs but does not change the on-chip RAM. The reset should not be activated before VCC is restored to its normal operating level and must be held active long enough to allow the oscillator to restart and stabilize. Pin Diagram:
22 | P a g e N I L O T P A L M R I N A L
5.2 PROGRAM
The program for microcontroller is written in C. The reg51.h header file is included for embedded C for Atmel series microcontroller operations. At P3.4 the pulses are detected and counter is initialized to count up to 64. Then at 65th pulse P1 is incremented. AT80C4051 is 20 pin I C with only two ports P1 and P3. An interrupt service routine is used as subroutine for incrementing P1. CODE: #include<reg51.h> unsigned char i=0; void incrii() interrupt 1 { i++ ; } void main () { P1=00; T0=1; TMOD=0x06; TF0=0; TL0=-64; IE=0x82; TH0=-64; i=0; TR0=1;
while(1) { P1=i; } }
23 | P a g e N I L O T P A L M R I N A L
In this program T0 is set as up counter to count 64. P3.4 is chosen to receive pulses from demodulator output. After receiving 64 pulses P1 i.e. port 1 is incremented by 1. An interrupt service routine is called for incrementing P1. Using an ISR makes it possible for microcontroller to work in multitasking mode The objective of counting 64 is to change the resolution to 10WH. Later the transmitted data is received at parallel port and converted to KWh.
24 | P a g e N I L O T P A L M R I N A L
25 | P a g e N I L O T P A L M R I N A L
6.1 MODULATION
CD4051 is used to generate ASK. CD4051 is analog MUX. Select lines is connected so that S2 at pin 11 and S1 at pin10 is connected to ground. S0 at pin 9 is connected to output of PWM. The signal when high gives output of sine wave of 43.3 KHz at pin as I1 at pin is fed with output of LF353 oscillator. The circuit diagram of ASK generation is shown in Figure 23. CIRCUIT DIAGRAM:
26 | P a g e N I L O T P A L M R I N A L
6.2 Demodulation
Demodulation is done using uA741 in comparator mode. The output swings between +/-15V for +/- Vsat. The output of comparator gives back the PWM. The circuit diagram of demodulator is shown in Figure 23. CIRCUIT DIAGRAM:
27 | P a g e N I L O T P A L M R I N A L
28 | P a g e N I L O T P A L M R I N A L
7.1 APPLICATION
The project can be used in large malls and commercial building where monitoring is impossible by inspection.
In large area of installation we can easily set it up by use of amplification circuit on lines.
29 | P a g e N I L O T P A L M R I N A L
company are not home. A website supporting java platform can be part of centralized power monitoring system. Such as Gmail when password is entered it will let to decide which switch to close/open and when?. So a simple idea can be turned into industry.
30 | P a g e N I L O T P A L M R I N A L
31 | P a g e N I L O T P A L M R I N A L
CONCLUSION
In this project work an attempt has been made and succeeded in monitoring power consumption remotely via telephone cable. The PC can be designed in such a way that with minimum configuration it can handle the system only.
RESULT
Observed Reading on PC
Conversion Constant
Time (sec)
Energy Measured
Time (sec)
(Watt-Hour)
1000
10
2000
10
Table 1: Result
32 | P a g e N I L O T P A L M R I N A L
BIBLIOGRAPHY
References: David A Bell, Op-Amps and Linear I Cs, Fourth Edition, 2006, Prentice Hall India, New Delhi. K Sam Shamugham, Digital and Analog Communication, Fourth Edition, 2006, John Wiley and Sons, New York. Jan Axelson, Parallel Port Complete, First Edition, Lakeview Research, Madison (USA).
33 | P a g e N I L O T P A L M R I N A L
Appendix I SOFTWARE
34 | P a g e N I L O T P A L M R I N A L
a. Pratham v7.0
Pratham v7.0 is installed on PC with windows operating system. This software is made in VB 6. It can be used on any port and baud rate. This software uses an active x control in VB6. It is for mere illustration and test of the circuit. The user friendly and more compatible version can be made using C. The software is so simple that it can be made free source. Further it can be used to put a switch on and off thus, creating a powerful tool. The same can be used to communicate data over the internet.
b. Code
FRMMAIN.FRM
Option Explicit Const Start% = 8 Const HighNibbleSelect% = &H10 Dim DataIn%(0 To 7) Dim ChannelNumber% Dim LowNibble% Dim HighNibble%
Private Sub cmdReadPorts_Click() Dim EOC% For ChannelNumber = 0 To 7 'Select the channel. DataPortWrite BaseAddress, ChannelNumber
35 | P a g e N I L O T P A L M R I N A L
'Pulse Start to begin a conversion. DataPortWrite BaseAddress, ChannelNumber + Start DataPortWrite BaseAddress, ChannelNumber 'Wait for EOC Do DoEvents LowNibble = StatusPortRead(BaseAddress) EOC = BitRead(LowNibble, 6) Loop Until EOC = 1 'Read the byte in 2 nibbles. DataPortWrite BaseAddress, ChannelNumber + HighNibbleSelect HighNibble = StatusPortRead(BaseAddress) DataIn(ChannelNumber) = MakeByteFromNibbles() Next ChannelNumber DisplayResult End Sub
Private Sub DisplayResult() For ChannelNumber = 0 To 7 lblADC(ChannelNumber).Caption = Hex$(DataIn(ChannelNumber)) & "h" Next ChannelNumber End Sub
36 | P a g e N I L O T P A L M R I N A L
End Sub
Private Function MakeByteFromNibbles%() Dim S0%, S1%, S2%, S3%, S4%, S5%, S6%, S7% S0 = (LowNibble And 8) \ 8 S1 = (LowNibble And &H10) \ 8 S2 = (LowNibble And &H20) \ 8 S3 = (LowNibble And &H80) \ &H10 S4 = (HighNibble And 8) * 2 S5 = (HighNibble And &H10) * 2 S6 = (HighNibble And &H20) * 2 S7 = HighNibble And &H80 MakeByteFromNibbles = S0 + S1 + S2 + S3 + S4 + S5 + S6 + S7 End Function
37 | P a g e N I L O T P A L M R I N A L
Frmnewportaddress.frm
Option Explicit
Private Sub cmdOK_Click() Dim NewPortAddress% Dim IndexOfNewPort% Dim Character$ Dim ValidEntry% ValidEntry = True IndexOfNewPort = 3 'Read the port address entered by the user. 'If the address is within the accepted range, hide this form, 'enable the port's option button, and display the address. 'If the address is out of range, display a message. 'If the text box is empty, disable the port's option button. Select Case txtAddressOfNonStandardPort.Text Case "" NewPortAddress = 0 Port(IndexOfNewPort).Address = 0
38 | P a g e N I L O T P A L M R I N A L
Port(IndexOfNewPort).PortType = "" Port(IndexOfNewPort).Enabled = False frmSelectPort.optPortName(0).Value = True frmNewPortAddress.Hide UpdateLabels Case Else NewPortAddress = CInt(Val("&h" & txtAddressOfNonStandardPort.Text)) If NewPortAddress > 0 And NewPortAddress < &H800 Then Port(IndexOfNewPort).Address = NewPortAddress Port(IndexOfNewPort).Enabled = True frmSelectPort.optPortName(IndexOfNewPort).Value = True frmNewPortAddress.Hide UpdateLabels Else MsgBox "The port address must be between 0 and 7FFF. Leave the address blank if there is no port." End If End Select End Sub
Private Sub Form_Load() Left = (Screen.Width - Width) / 2 Top = (Screen.Height - Height) / 2 End Sub
39 | P a g e N I L O T P A L M R I N A L
Frmselectport.frm
Option Explicit
Private Sub cmdAddPort_Click() 'Display a text box to enable user to add a port 'at a nonstandard address. frmNewPortAddress.Show End Sub
Private Sub cmdFindPorts_Click() 'Test the port at each of the standard addresses, 'and at the non-standard address, if the user has entered one. Dim Index% Dim PortExists% Dim Count% Index = 0 'First, test address 3BCh Port(Index).Address = &H3BC PortExists = TestPort(Index) 'If there is a port at 3BCh, increment the index.
40 | P a g e N I L O T P A L M R I N A L
If Not (Port(Index).Address) = 0 Then Index = Index + 1 End If 'Test address 378h Port(Index).Address = &H378 PortExists = TestPort(Index) 'If the port exists, increment the index. If Not (Port(Index).Address) = 0 Then Index = Index + 1 End If 'Test address 278h Port(Index).Address = &H278 PortExists = TestPort(Index) 'Disable option buttons of unused LPT ports For Count = Index + 1 To 2 optPortName(Count).Enabled = False Port(Count).Enabled = False Next Count If Not (Port(3).Address = 0) Then PortExists = TestPort(Index) Else optPortName(3).Enabled = False End If End Sub
41 | P a g e N I L O T P A L M R I N A L
Private Sub cmdTestPort_Click() Dim PortExists% Dim Index% 'Get the address of the selected port Index = -1 Do Index = Index + 1 Loop Until optPortName(Index).Value = True PortExists = TestPort(Index) Select Case PortExists Case True MsgBox "Passed: Port " + Hex$(BaseAddress) + "h is " + Port(Index).PortType + ".", 0, "Test Result:" Case False MsgBox "Failed port test. ", 0, "Test Result:" End Select
End Sub
42 | P a g e N I L O T P A L M R I N A L
Top = (Screen.Height - Height) / 2 'Load the combo boxes with the ECP modes. For Index = 0 To 3 cboEcpMode(Index).AddItem "SPP (original)" Next Index For Index = 0 To 3 cboEcpMode(Index).AddItem "bidirectional" Next Index For Index = 0 To 3 cboEcpMode(Index).AddItem "Fast Centronics" Next Index For Index = 0 To 3 cboEcpMode(Index).AddItem "ECP" Next Index For Index = 0 To 3 cboEcpMode(Index).AddItem "EPP" Next Index For Index = 0 To 3 cboEcpMode(Index).AddItem "reserved" Next Index For Index = 0 To 3 cboEcpMode(Index).AddItem "reserved" Next Index For Index = 0 To 3 cboEcpMode(Index).AddItem "test"
43 | P a g e N I L O T P A L M R I N A L
Next Index For Index = 0 To 3 cboEcpMode(Index).AddItem "configuration" Next Index 'Enable the option buttons for existing ports. For Index = 0 To 3 optPortName(Index).Enabled = Port(Index).Enabled Next Index UpdateLabels End Sub Private Sub optPortName_Click(Index As Integer) 'Store the address and index of the selected port. Dim Count% BaseAddress = Port(Index).Address IndexOfSelectedPort = Index EcpDataPortAddress = BaseAddress + &H400 EcrAddress = BaseAddress + &H402 For Count = 0 To 3 cboEcpMode(Count).Enabled = False Next Count cboEcpMode(Index).Enabled = True End Sub The code above is only VB6 code for Pratham v7.0. The required dlls can be found on windows website. There are three forms in application as depicted before. Modules can be added to fulfill the port logic control using microprocessor of PC itself.
44 | P a g e N I L O T P A L M R I N A L
Thanks to,
Texas Instruments and National semiconductors for online support. Watt-hour meter is original idea from National Data Handbook, Prentice Hall USA, 1993. Google Images. Department of Electrical and Electronics Engineering, SIT, Tumkur.
45 | P a g e N I L O T P A L M R I N A L