00527612

download 00527612

of 7

Transcript of 00527612

  • 8/2/2019 00527612

    1/7

    MICROCONTROLLER-BASED AUTOMATED BILLING SYSTEM

    **S.A. Al-Qatari A.R. nu-AliSaudi Aramco, Box 8452 EE. Dept., KFWM, Box 32 3Dhahran 3 1311, Saudi Arabia Dhahrm 3 1261, Saudi Arabia

    AbstractThis paper presents an integrated single board AutomatedMeasurem ent and Billing Sy stem for Public Utilities (Electricity,Waiter, Gas, and Telephone services). The proposed system iscomposed of hardware and software structures. The hardwarestructure consists of a digital energy meter module, a digitalwater (gas) meter module and a telephone call meter module,all of which are interfaced to a sing le chip microcontroller. Thesystem is equipped with a credit card reading capability to readand charge automatically the customer's services consumptionon site. Also, all service metering modules are facilitated withan automatic service connection and disconnection based on theavailable credit. The software structure commands the wholeprocess via the microcontroller input/output ports. Theintiegrated system was im plemented and tested, an d has provento be stable, reliable and easy to maintain.IntroductionTraditional billing systems for public utilities [Electricity,Water (Gas)' , and Telephone] have several disadvantages andcan be summ arized as follows:0 Electricity and water (gas) consumption are read directlyfrom the meters. This leads to inaccurate readings and costestimations by the utilities, specially when the meters are

    inside the home o r in a hard-to-access place [1,2].Getting into customers houses may cause disturbance tothem.The collected data from the electricity and water (gas)meters are manually fed to a computer to generatestatement charges This may lead to typing errors.The statement charges for the utilities [electricity,water(gas), and telephone] are sent to th e custom ers by mailor via utilities personnel, which may lead to addressingerrors.Customers are not aware of the costs and serviceconsumption until the statement charges are received Thismight create problems for the customer at the time ofpaymentPayment is required by the customer periodically at a fixedperiod If the customer does not pay within that period, theservice is disconnected manually until payment is made.

    *

    -' VVater and gas bilhng are interchangeable,since both of them are fluldan d using the same concept of metering andbillingCorrespondingAuthor

    (1-7803-2646-6

    e The billing systems require manpower, which significantlyincreases the netwo rk operation costsThe existing equipment for the utilities at the customer'shouse are not secured. Steeling electricity, water (gas), andtelephone: services can be easily d oneBased on the above, the traditional billing systems are

    discrete, inaccurate, costly, slow , and lack flexibility as well asreliability. Therefore, several attempts were m ade to auto matethe billing systems [2, 3, 41. However, none of these systems'was cost-effective and feasible for wide range implementation.As an example, one of the most efficient attempt is throughremote metering. Even though accurate and fast readings areobtained, billis payment is still performed based on the old billingprocedure. In addition, remote metering is very expensive forwide range implementation,

    This paper presents an integrated single board automatedmeasurement and billing system to overcome the problemsassociated with the traditional billing systems as well asautomated systems. The proposed system hardware, as shownin Figure 1, consists of three major blocks, namely: a utilityservice circuitry modules, a user and maintenance interfacemodules, and a microcontroller module. The utility servicecircuitry modules consist of an energy meter, a water (gas)meter, a telephone call meter and a utility serviceenereizatio~~~eenergizationircuits. The user and maintenanceinterface modules consist of a credit card reader, a kry pad,alarms, an RS-232 port and a matrix display Themicrocontroller is a single chip which has built-in I/O ;~r ts ,eight 8-bit A/D converters, timers, ROM, EEPROM, and P A M

    - 17 -

    Energy Meter ModuleA modified version of a digital sampling wattmeter is

    recommended for the proposed system. The digital samplingtechnique can be used in all cases where harmonics does ordoes not exist in the signals.Digital sampling wattmeter circuitThe digital sampling wattmeter is very attractive whenharmonics are in the load current and voltage source.The basic configuration of the digital sampling wattmeter forthree ph ase feeder is shown in Figure 2. The signal conditioningcircuit is composed of a current transformer (CT) w hich is usedto reduce the load current to a low level. A parallel low valueresisior is required at the secondary to convert the current tovoltage signals. A voltage transformer (VT) is also required toreduce the primary voltage to be compatible with themicrocontroller. The output of the CT is converted to voltageby passing it through a low value resistor. The current andvoltage waveforms are fed to sample and hold (SM)circuits,which are triggered by the microcontroller at the sampling rate.

  • 8/2/2019 00527612

    2/7

    The sampling rate is given by

    SignalperiodT ~ IO-~ SS)

    For th e case where no harmonics present, the simulation resultsare tabulated in Table 1.

    # of # of Sampling Sampling ErrorCycles Samples period delay Yom ~7-(1o-~sec) ( ~ O - ~ S ~ . )

    mTNA T = -

    Signaluenod

    Therefore, the energy due to the real power for ( k mT ) isgiven byk N k N

    P = C A T C V ] , l , ,= A T CCV , > l ] ,

    3P A T ~ ~ [ v , J ! f l ] r +v2]zz2]2 +v3]?3,r2 1 (3 )

    (2)I 1 7 1 1 1 1 1

    Then, the energy fo r three-phase feeder IS given byk N

    ] 1 1 1A timer is used to trigger the sampling operation everym7- ec The required time for scanning the three AD C shouldNbe less than AT

    #o f # o f Sampling Sampling ErrorCvcles Samoles uenod delay YO

    The following two conditions are required to provide accurateresults [ 5 , 61:

    T(io-Sec.)16 6716.6716.67

    12

    The sampling must occur ove r an integral number ofwaveforms.The waveform s are stationary for the duration ofmeamrement.

    m AT(iO-Sec.) (lO-Sec.)1 29 0.575 0 2 . 7 9 ~O- *1 12 1.389 0 10.14

    0 18.163 5.557

    This technique was simulated under different sampling rate,sampling precision, and sampling delay for two casesharmonics present, and 2) In the presence of harmonics.

    r-

    I 1

    0

    h

    Table 1, Simulation results with no harmonics

    The above table shows that as the sampling rate significantdigits increases, the error is reduced. Also, as the number ofsamples decreases, the error increases; however, this error canbe decreased by increasing the number of significant digits ofthe sampling rate. Moreover, if a delay is induced between thecurrent and voltage samples, the error increases. Therefore, thismethod requires a very precise sampling pulse trigger generator.Also, the number of samples N < 29 can be chosen; however,the number of samples should be chosen in such a way toprovide stability measurement and simplify the sampling pulsegenerator circuit that is used to trigger the A D onverters.Moreover, the sampling technique requires that both currentand voltage to be sampled simultaneously. This can b e achievedby providing two AD converters triggered at the same time forconversion or two sample and hold circuits, one analogmultiplexer and one AD onverter.

    Fo r the case where the voltage and cu rrent waveforms bothhave harmonics present. The voltage and current w aveform maybe expressed as

    wherev,= Amplitude of harmonic voltageI,,= Amplitude o f harmonic curren tn=Harmonic orderb n= Phase angle of the harmonic

    Assuming the voltage consists simply of the fundamental andthe load current consists of several harmonics, the real po wer isgiven byP = -J vs in (wt> EI , s i n(myt + e,yt (6 )1 T oUsing digital sampling technique, it is possible to measure thereal power including the harmonics effects. The simulationresults for different number of samples are tabulated in Table 2.

    - 18 -

  • 8/2/2019 00527612

    3/7

    From the above table, it is concluded that the number ofsamples should be large enough to accommod ate the harmonics.Billing methodConsumers are charged for the electrical energy. The energyfo r ;a period of ( m T ) , using the digital sampling technique, isgiven by

    mTW, = jvs(t)is(t)dt (7)lo

    This can be approximated by the summ ationN(watt. ec ) = A T E v,i, ( 8 )#= IThus, the consum ed energy costs is calculated by

    Energy Cost = W, x ___ x ~ lKWH x Rate (9 )3600Sec IOOOwattr 7 -I d0

    2 0a

    i.

    Walter (Gas) Meter ModuleAn electronic, magnetic, turbine flow meter is used tomeasure the flow rate Q( Zztlmin The magnetic turbine flowmeiter is recommended to achieve the required accuracy forwater (gas) flow metering (+O 5 ) The proposed circuitconfiguration is shown in Figure 3 The water (gas) flow rate isconverted to frequency by the turbine flow meter A fiequencyto voltage converter is used to convert the frequency to dcvoltage. Then, the output dc voltage is read using A/Dconverter The volume flow rate i s given by

    fo r to to t ,N

    (12)ater (gas) consumption = A T C Qz,meosuedwherea=Liinearity slope for the frequency t o voltage converterp= Linearity slope for the flowmeter

    ,= I

    A solenoid valve is used to automatically disconnect or connectthe water (gas) service. This valve is controlled by themicrocontroller to disconnect the service, if the customer hasbelow threshold.Billing methodThe water (gas) consumption for a period of time ( T ) is givenbyWater Consumption = J ~ ( t ) c i tThis can be approximated by the summationWater Consumption (litre / min) = D T ( m i n ) z Q lQ,= Instantaneous water (gas) volume rate

    T

    (13)to

    N(14)

    ,= I

    Thus, the consum ed water (gas) costs is calculated byWater Cost = Water C0n.x x Rate (15)Rate = Price for lkgaZZon

    1 galloni o 3 x 3.78Zitre

    Water/GasSource

    S o l e n o i d o u t p u tVa1"e pcrt

    Micr-controlelectronic^ hpFFl, &qFlowmeter voltage

    FIGURE 3. WATEWGAS METER & CONTROLCIRCUIT CONFIGURATION

    Telephone Calls Meter ModuleThe designejd circuit is based on receiving the coin controlpulse as an ackinowledgment from the central ofice. The coincontrol pulse generator co nsists of a normal battery fed circuitand a reverse battery fed circuit. Either of these circuits isactivated according to the battery polarity required In normalpolarity, the normal current I , is active. In reverse polarity,the reverse current I , is active. Thus, the subscriber line- 19 .-

  • 8/2/2019 00527612

    4/7

    current I , is given as I , I N - I . The reverse current istwice as the normal current and the pulse time is equal to0.8 Sec. [ 7 ] . The circuit configuration is shown in Figure 4.The telephone line is controlled by the microcontroller via arelay. The line is connected to the user phone set through apolarity protection rectifier bridge. Also, the line is connected toan offion-hook detector from which it is connected to aninterrupt request to indicate the user phone status The coinpulse from the Central Ofice (CO) is detected by using a pulsedetector circuit, which consists of an opto-isolator circuit. Thedetector output is connected to an interrupt which is used tosense the pulses.Billing methodThe telephone call charge for a period of time (t o t o t , ) isgiven byTelephone Call Charge = R x ra t (16)whereCullDurution ( t , - t o )

    Pulse SpeedR= Number of pulses for a callrat = Number of units per pulse (fixed)

    a

    a

    D2P

    Credit Card Memory FormatThe proposed memory format for the magnetic card isshown in Figure 5.1. The magnetic-stripe is divided into threetracks [SI as follows:

    e Track 1 in this trac k, the service code which can be pow er,water (gas), and/or telephone is stored.Track 2 this track of the magnetic stripe is used to store therate structure and the rate level This is useful for energyand water (gas) services The rate may be one of thefollowings

    e

    1 fixed charge with flat rate consum ption.2. different rate level for different consumption3 various demand consideration.The rate structure can be changed at the time of any newcredit purchase.Track 3: the new credit of purchase is stored in this track

    Track 1, Service Code

    Track 3, Service purchase amount

    FIGURE 5.1FORMATMAGNETIC-STRIP

    A card reader is used to read the credit card and passes thecode information to the microcontroller. The card reader isdesigned to be able to decode the encoded data on themagnetic-stripe. A card is detected via interrupt pin conn ection.After the card is read, the rate value and the credit amount arestored in the microcontroller EEPROM, The card reader systemconfiguration is shown in Figure 5.2.

    Micro-Controller

    inputport

    Card-in indicator IR QCard

    Device Alarm 1,. 4 nputport !

    FIGURE 5.2CARD READER CONFIGURATIONCIRCUITSystem IntegrationThe three meter circuits and the card reader circuit areintegrated in one single board as show n in Figure 6. The digitalsampling wattmeter, the water (gas) flow meter, the telephonecalls meter, and the card reade r are integrated with a high speedmicrocontroller. The serial port is used to access the system formaintenance and trouble shooting It is also used for softwareparameters update in EEPROM. A battery backup is used tooperate the system in case of electrical power failure. Analphanumerically display is used to display the servicesconsumption costs, the ava ilable credit, and the servicesconsumption Various alarms are used to indicate any systemmalfunction, such as low credit, service disconnection, overloadcurrent, microcontroller failure, and card reader failure. Alarmsare also available externally to extend the alarms to the desiredlocation.- 20 -

  • 8/2/2019 00527612

    5/7

    External Alarms,_*c1=6 BUZZER-7c3 -

    ( Serial port ~

    Card Reader inputportlCard-in indicatorCard eject portlCard eraze outputport2

    IRQ2Coin pulse indicator IRQ3- port3Relay

    Alphanumeric display-outputports -port4 Relay

    port2 Phase Iport3port4

    Phase I1Phase I11

    Phase I: VT1, CTIPhase 11: VT2, CT2Phase 111: VT3, CT3-

    Rom, software Water FlowmeterRam, temprarEEPROM, *elaysystem statuMicrocontroller

    Software DevelopmentFigures 7.1 to 7. 5 show the general flowcharts for theproposed system metering procedure. The microcontrollerstarts by loading the initial startup values, such as rates,maximum load current, customer credit and system status(services consumption costs) from the internal EEPROM.Also, the water (gas) timer is initialized with a sampling periodfor triggering the routine to calculate water (gas) consumptionand cost s. Then, alarms will be generated for overdue, overloador any system failure, If the customer has previously low creditand the grace period has passed for one or more services, theservice will be automatically disconnected. The power timerthat is used to trigger the energy routine for calculating theenergy consumption and costs is loaded with the samplingperiod. The power sampling period is measured from themaximum current frequency of the three phases. On water (gas)timer interrupt, the w ater (gas) flow is m easured, the costs arecalculated, and the result are displayed on the alphanumericscreen. On power timer interrupt, the electric energy ismeasured and calculated, the costs are calculated, the maximumcurrent frequency is measured and loaded to the power timerinterrupt, and the results values are displayed on th ealphanumeric display. On the coin pulse interrupt, th e availablecre.dit is deducted by one unit. On card-in interrupt, the card isrea.d and decoded, and the credit and the rate are loaded to theassociated service code and displayed on the alphanumericscreen. The data on the magnetic-stripe is erased and the card isejected. Then, the program loops back by checking the systemalarms and servicing the various interrupts.

    The following conditions are assumed in the program:e 'The digital samplin g wattm eter for three phases is used.A threshold Grace period is included.The credit value is the available credit for each service and

    is checked for availability for each se rvice separately.A current overload is included.

    Prolposed System ImplementationA prototype of the proposed automated billing system wasbuilt and tested using a single chip microcontroller In general,the main objective of the prototype is to test and evaluate eachindividual module as a stand-alone unit under different loadsand conditions Then, the overall system is te3ted and evaluatedThe test results are tabulated in the following tables .Table 3, 'Voltage measurement ( RMS, V )

    0 790 87ump

    - 21 -

  • 8/2/2019 00527612

    6/7

    LoadLamp 1Lamp 2PumpSaw machine

    I Load I Measuredby I Measuredby I Error I

    Measured by Measured by ErrorOscilloscope Proposed System %

    0 00 1 5 0 0 030 00 1 70 0 0412 50 12 45 0 045 50 5 45 0 09

    Lamp 1Lamp 2PumpSaw machine

    Power Meter Proposed System %SO 80 50 12 0 13100 61 100 96 0 35112 21 112 34 0 06160 78 162 33 0 96

    #

    IOUf ,FIV Turbine Flow Q Fl ow Q Error

    ( " ) Measured Prouosed

    Convcfier Frequency Calculated Measured %( H z ) Litimin by

    A I

    1234

    Update periodT

    using SystemOscilloscope Litimin

    1.20 333.33 4.33 4.30 0 690.85 238.10 3.09 3.10 0.321.00 285.71 3.71 3.68 0.800.62 166.61 2.11 2.1s 0.92

    Disconnect servlce

    Read cwrcnt and voltage forththree phaer

    Calculate encrgy and COIU

    Display v d u c s

    Ies IA IDisconnect elecv l c servtce an

    read the max current freq

    load ismer intempt with newSamollng penod

    F IG URE 1.2, P O WER METERF LO W CH ART

    on watedgar tuner l"terruPt

    111

    M c ~ w cnd cdcu la te meterficqucncy

    Calculate flowate and cost

    Display Y ~ U C .

    FIGURE 7.4, WATER (G AS)METER F LO W CH ARTIGURE 7.1, MAIN PROGRAM FLOW CHART - 22-

    1n Coin pulse signal l"tCMp1

    Meawe and calculate pulser lpecd1

    meane and calculate call pen

    Calculate call charge and Displ

    F IG URE 7.3, TELEP H O NE CALLSMETER F LO W CH ART

    Read card data

    decode datai"lcomecl service and clem pcno'-

    IGURE 7.5, CREDIT READINGFLOW C H A R T

  • 8/2/2019 00527612

    7/7

    System real time operation and test resultsThe integrated system has been tested for 24-hours and thesystem has proven to be stable within its accuracy. Thecommutative results for the system are tabulated in Tab le 8.

    _.MeterTable 8. Test results over 24-hours

    Measured byMechanical Proposed System__ _ -Energy-Flow

    Meters20kU11 125kU11 4 173 12k-ga l l o 3 31k-ga l lon 60 9

    Telephone call meter moduleThe telephone line is isolated from the digital ground using

    a 1.1 isolation transformer. Also, an opto-isolator is used forthe off/on hook detector circuit to provide grounding isolation.Thie off/on hook circuit has been des igned to consume very lowcurrent, so that does not load the customer local loop and causean off hook error This module has proven to be reliable formeasuring telephone call period

    In general, the errors are due to the digital resolution andtruncation (i e A/D converters and microcontrollercalculations), induced noise from surroun ding, heat creating andwiring, circuits non-linearity and instrumen ts used formeasurementsConclusionsA new a utomated measu rement and billing system for publicutilities (Electricity, Water (Gas), and Telephone) is designed,built and tested. It is proposed to re place the existing traditionaldiscrete systems with an integrated system. The new systemprovides the flexibility and reliability for customers to pay anytime using a credit card. Also, the system reduces significantlythe overall utility network operation costs. It uses a digitalwatthour meter for energy consumption metering and a digitalflow meter for water (gas) metering. Further, a modifiedversion of the digital sampling technique is propose d fo r thedigital watthour meter implementation. Also, the coin pulsemethod is recommended for the telephone calls metering. Aprototype system is designed, built, and evaluated underdifferent loads. It has pro ven to be stable, reliable and easy t omaintain within its accuracy. The prototype system can beintlagrated for actual implementation in a cabinet, as shown inFigure 8. The initial size estimate for the cabinet is 50cm by40cm.AcknowledgmentAcknowledgment is due to King Fahd University ofPetroleum and Minerals and Saudi Arabian Oil Company(SAUDI ARAMCO) for thier suppor t

    Door Sensor Cabinet

    Electrical Power Measurementand Control Circuds

    FIGURE 8, PROPOSEDSYSTEM LAYOUT FO R ACTUAL IMPLEMENTATION

    REFIERENCE!S~ ~"Alternative to R emote M eter Read ing", American City &Country, February 1992 , pp. 42.Dennis J. Gaushell, "Automating the Power Grid", IEEESpectrum, October 1985, pp. 39-45.John Reason , "Scada cap abilities used t o handle, billingdata", Electrical World, October 1991, pp. 40-42.John J. Hill and W.E. Alderson, "Design of aMicroprocessor-Based Digital Wattmeter", IEEETransaction on Industrial Electronics and ControlInstrumentation, Vol. IECI-26, No. 3, August 1981, pp.180-184.Andrew C Corney and Royce T Pullman, "DigitalSampling Laboratory Wattmeter", IEEE Transaction onInstrumentation and Measurem ent, Vol IM-36, No 1,Ma rch 19137, pp 54- 59Raymond S Turgel, "Digital Wattmeter Using SamplingMethod", IEEE Transaction on Instrumentation andMeasurem ent, Vol IM -23, No 4, December 1974, pp337-341M. Akata, Y . Nagataki, K. Koyabu, K. Mukai, S .Yoshida, S . Morisaki, M. Eda, I. Ueki and T. Matsui, 'I ANo-Trimming SLIC Two-Chip Set with Coin TelephoneSignaling Facilities", IEEE Journal of Solid-state Circuits,Vol. 25, No. 2, April 1990, pp. 458-465.I S 0 7 8 I1/1,2,3&4, "Identification Cards-RecordingTechnique", International Organization forStandardization (ISO), First Edition, December 15 , 1985

    - 23 -