Академический Документы
Профессиональный Документы
Культура Документы
Group Number 06
Name Thilakarathnae H.L.M. Senevirathna W.K.O Pilapitiya P.G.N.S.S. Jayathunga D.P. Chandrasena W.A.K.H.
Declaration
I declare that this thesis is my own work and has not been submitted in any form for another degree or diploma at any university or other institution of tertiary education. Information derived from the published or unpublished work of others has been acknowledged in the text and a list of references is given. Name of student(s) Thilakarathnae H.L.M. Senevirathna W.K.O Pilapitiya P.G.N.S.S. Jayathunga D.P. Chandrasena W.A.K.H. Date: Signature of student(s)
Date:
Dedication
We would like to dedicate our project to our lecture panel of computer science & technology degree program, who encourage & advise us to become our project success until it ends.
Acknowledgement
We highly acknowledge to our lecture panel who always guide us until the success of our project, 4th year Mechatronic students who support us for implement the hardware parts, Our CST colleagues who always encourage us for the success of our project and all the other people who support us
Abstraction
Problem Statement:In todays world electricity has become main power source in island wide. Without electricity the day today life events will be wrack and ruin. But it has several problems . Some problems are; user cant update with his bill balance. user dont know about limitations of his electricity usage. Ceylon electricity board has to use large number of workers to make the electricity bill by reading meter user have no idea about what are the points bill get increased.
Proposed solution:Electricity bill automate system is consisting with IR sensor with GSM module and a sever machine.IR sensor is attached to the electric meter as an outside device to get the readings of the electric meter. Online database is always updated according to values of the sensor. Current bill is automatically calculated. User can interact with the system by using normal mobile phone. Just need to send a sms to get information. System responses to user by sending a sms. Users allow to know their current amount of electrical bill and warning massages when they exceeding 90 units.
It will provide easy accessible way for electricity user to get know about his electricity usage and bill amount. It will be easy to use ,one and only thing to do is get the Electricity bill automate system with registration and get the unique user ID and password. Server machine will generate profile for each of the joined electricity user.so after registering user can get his bill balance and his electrical usage just from predefined sms. This will be save valuable time and minimize labor pool.
Table of Content
Introduction..6 Methodology and design .8 Implementation.....12 Testing and Evaluation.16 Conclusion....17 References....18 Appendix ..19
Introduction
In todays world electricity has become main power source in island wide. Without electricity the day today life events will be wrack and ruin. But it has several problems . Some problems are; user cant update with his bill balance. user dont know about limitations of his electricity usage. Ceylon electricity board has to use large number of workers to make the electricity bill by reading meter user have no idea about what are the points bill get increased. So our target is to solve these problems with making easy way to read the electric meter and help user to get know about his electricity bill generation. User can get his bill balance and his electrical usage just from sending predefined sms. This will be save valuable time and minimize labor pool of Ceylon electricity board.
Objectives
Provide facility to user to get awareness of electric consumption (units) and the bill via mobile phone in any time. Provide facility to user to get warning alerts when they are exceeding their average unit limit. Process of reading the electric kwh meter is happening automatically. Give facilities such as pay online, view user bill through the internet
Achievements
1)Our web application make user friendly interface. Our web application will provides these facilities. If customer is a registered user he can log on to the web and see his bill details. And also new users can registered with the system by creating new account. His Electricity bill number will be the user name. Pay online their bills calculate Bill themselves Get details about our services View their Bill (including the Past months)
2) Our hardware part consist with Ardunio ,IR sensor and sonyEricsson phone. By using IR sensor, it gets the counts of the color change of plate in electricity meter and Using Ardunio and Sony Ericcson k700i phone(act as a gsm modem) sends signals to main data base. Data base get the count of the meter reading. 3)Our SMS based system will provide these facilities User can registered with the system When user registered it will give confirmation message. User can check his bill balance and electricity usage. Also user have facility to change his phone number User will get warning messages when the exceed max electricity usage
Implementation of Web system As an additional objective web system was developed to give more services to the user such as View user account page View user Bill (including the Past months) calculate Bill themselves Pay online bills Get details about services
Any user can register in web system by using their unique pin number which is given by Electricity Board through the bill. According to the database whenever user want to view his/her account it will review with following features; Pin number Name Address Phone number Number of Units that consumed in current month
Also bill of current month and also past two month can be viewed by user and it will open as pdf format. Bill is calculated according to the updated units which are received
9
from IR sensor withing a month and it can be viewed by using user pin number and password which user entered to register in web system.
Calculate bill themselves option can be used to enter the units which was consumed in a month to check whether the calculation done by the system is correct or incorrect.
Pay online bill option is added to for easiness of user payments. Since it cost to get a gateway it only design to validate the credit card or debit card of visa card and save it in the database with other user details such as, Pin number Amount of money Credit card number In here user can have this facility only if user registered in web system. If not, user first has to register before getting this facility,
10
Implementation
Hardware Implementation
Requirements 01) Arduino UNO 02) T5000 IR Reflect sensor 03) GSM Shield (or an old mobile phone) Methodology According to our idea we need to get the reading from the electric meter and send the reading to the main database controlled by the hosting company. So for that we use TRC5000 IR Sensor to detect the reading. We used the ring inside the meter to get the reading. The ring inside the meter has a mark which we use to detect a point and count the used units. And then we had to send those readings to base database to store and do other processors. For that we use an alternative for a GSM shield that is a mobile phone (we use Sony Ericsson K700i phone). When we use a phone we can use two methods. Those are 01) FBus 02) AT commands But using AT commands much more easily than using FBus commands. Because AT commands more like to English language. There for we use AT command supporting mobile phone. We used AT command and serial connection through Rx and Tx with ground. And programed arduino to get the reading from the IR sensor and send reading using mobile phone.
Arduino UNO
11
Software Implementation
User Registration Before using this application user have to register, So then only he can access those message facilities provided by the application. So he has to follow predefined message type creating message and then send it to server machine. Example: type reg user_pin send it to server machine (0720719564) then user informed by the message including that successfully registered.
Check Balance This facility only allowed for registered users, if user is not a registered user then user informed to register to use this messaging system, so then only he can access this application by sending sms. Then user can get electricity bill amount at anytime anywhere, only he need to send message to the server machine. Example: type bal user_pin send it to server machine(0720719564) then user informed by the message including that his bill amount.
Warning Messages This facility also provided for registered user in this system. The main advantage is, user no need to send any messages to server machine to get warning messages, because user is automatically updated by warning messages if relevant user is being reached to predefine unit amount. Example: user get warning message by server machine (0720719564) including that You are reached unit 80
Change User Phone Number This facility also given for registered user in message application. According to our messaging system user is uniquely recognized by the user pin, So pin number is not changed and it is fixed user identification number, So if user want to change his previous phone number then he can send message to the server machine to change into new phone number. Example: type cha user_pin send it to server machine(0720719564). Then user informed by the message including that successfully changed
13
Error Detection If user is unable to follow the correct instructions, he/she is informed by error notification message. So user can easily interact with this system without misleading to do his task according to his/her preference.
Web Implementation
Methodology According to our project we need to provide user friendly web based interface for electricity users.We make a web site for doing these things.We use following concepts to make our web. AJAX PHP JQUERY HTML OOP Concepts
User can get register with our system by using his electricity bill number as the user name and he can create his own password.By using web user can pay their bills online(by using credit card).And also he can get know about his bill balance ,about his previous payments, about his no of used electricity units and searching bill balance.
14
Tested the software and hardware parts separately whether it works correctly and checked that it fulfill our project objectives. And combined those software and hardware parts and checked whether it work properly.
15
Conclusion
Using this device we can do the work that done by digital electric meter with low budget than the digital meter. Can use every domestic electric users without touching the inside of the electric meter. But there are some limitations when using mobile phone and RDUNO than the using of GPS modem.
16
References
http://www.arduino.cc/ http://getbootstrap.com/ http://www.ceb.lk/
17
Appendix
C program for phone #include <SoftwareSerial.h> SoftwareSerial phone(2,3); const int button1Pin = 7; const int ledPin = 13; void setup() { Serial.begin(9600); pinMode(button1Pin, INPUT); pinMode(ledPin, OUTPUT); phone.begin(9600); Serial.println("Modem connected."); delay(1000); phone.println("AT+CMGF=0"); Serial.println("Initialization..."); delay(100); phone.println("AT+CPMS=\"ME\",\"ME\",\"ME\""); delay(500); //phone.println("AT+CNMI=2,3,0,0,0"); //delay(500); Serial.println("Ok."); phone.flush(); delay(500); }
18
void loop() { const String PDUheaderConst "069149170033F411000A9270913974070000AA0CC8F71D14969741F977FD07"; Serial.println("PDUHeader started"); int button1State = digitalRead(button1Pin); if (phone.available() > 0) { char sms = phone.read(); Serial.print(sms); Serial.println("Read sms"); } else { if (button1State == LOW) { =
Serial.println(""); digitalWrite(ledPin, HIGH); String convertText "069149170033F411000A9270913974070000AA0CC8F71D14969741F977FD07"; Serial.println("Sms converted"); String returnedSMS = sendSMS(convertText, PDUheaderConst); Serial.println(" "); //If function returns sucessfully (aka = 1)
19
String sendSMS(String text, String PDUheader) { Serial.println("Sending sms........"); char asc_msg[text.length()+1]; text.toCharArray(asc_msg, text.length()+1); int getStringLength = text.length(); int asc_len = strlen(asc_msg); int i, j; int pdu_len; byte outchar; char inchar; int outbit; String PDUoutput;
20
char buffer[200]; pdu_len = 0; outbit = 0; outchar = 0; for (i = 0; i < asc_len; i++) { inchar = asc_msg[i]; for (j = 0; j < 7; j++) { outchar >>= 1; outchar |= (inchar & 1) << 7; inchar >>= 1; if (++outbit == 8) { sprintf(buffer,"%02x", outchar); PDUoutput += buffer; if (pdu_len++ % 16 == 15) { } else { } outbit = 0; outchar = 0; } } } if (outbit < 8) { ++pdu_len; while (outbit++ < 8) {
21
outchar >>= 1; } sprintf(buffer,"%02x", outchar); PDUoutput += buffer; } //SMS Sending! //Calculate HEX on string length String hexStr = String(getStringLength, HEX); sprintf(buffer, "%d", pdu_len); //Start to compose the PDU message phone.print("AT+CMGS="); //Add in PDU length phone.println(pdu_len + 14); //Thinking time! delay(3000); //Compose the PDU string phone.print(PDUheader+hexStr+PDUoutput); //Thinking time! delay(3000); //CTRL-Z (aka 26) phone.write(26); //Done! return "1"; }
22
C program for IR int ledPin = 13; int inPin = 10; int valor = 0; int count = 0; int state = 0;
} } Java programs for connect with database package _3rdyear; import java.sql.Connection; import java.sql.DriverManager; public class DB { private static Connection con; public static Connection connect()throws Exception{ Class.forName("com.mysql.jdbc.Driver").newInstance(); con=DriverManager.getConnection("jdbc:mysql://localhost:3306/electricity","root","123"); return con; } }
24
Java program for send sms package _3rdyear; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintStream; import java.util.Enumeration; import javax.comm.CommPortIdentifier; import javax.comm.SerialPort; import org.smslib.OutboundMessage; import org.smslib.Service;
public class SendMessage { static CommPortIdentifier id; public static SerialPort sp; static OutputStream os; static InputStream is; static Enumeration pl; static PrintStream ps; public static OutputStream f1;
//main class
public void doIt() throws Exception { ReadMessages rm = new ReadMessages(); of readmessage class
25
if(rm.num==1) { OutboundMessage msg = new OutboundMessage(rm.number, "registered successfully"); Service.getInstance().sendMessage(msg); System.out.println(msg); } else if(rm.num == 2) { OutboundMessage msg = new OutboundMessage(rm.number, "changed successfully"); Service.getInstance().sendMessage(msg); System.out.println(msg); } else if(rm.num == 3) { OutboundMessage msg = new OutboundMessage(rm.number, rm.total+""); Service.getInstance().sendMessage(msg); System.out.println(msg); } else if(rm.num == 4) { OutboundMessage msg = new OutboundMessage(rm.number, "incorrect input"); Service.getInstance().sendMessage(msg); System.out.println(msg); }
26
else { OutboundMessage msg = new OutboundMessage(rm.phnum, "reach to unit 70"); Service.getInstance().sendMessage(msg); System.out.println(msg); } } } Java program for receive sms package _3rdyear; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import java.util.List; import org.smslib.AGateway; import org.smslib.AGateway.Protocols; import org.smslib.IInboundMessageNotification; import org.smslib.InboundMessage; import org.smslib.InboundMessage.MessageClasses; import org.smslib.Message.MessageTypes; import org.smslib.Service; import org.smslib.modem.SerialModemGateway;
27
//main class
static String unit, phnum; static String number; static InboundMessage msg; static InboundMessage msg1; static int num,total;
28
System.in.read(); } ////////////////////////////////////////////////////////////////////////////////
while (r.next()) { int pinval = Integer.parseInt(r.getString("pin")); ResultSet r1 = con.createStatement().executeQuery("select phone from register where pin='" + pinval + "'");
29
String reg[] = msg1.getText().split(" "); if (reg[0].equals("reg")) { PreparedStatement p = con.prepareStatement("insert into register values('" + reg[1] + "','" + number + "')"); p.executeUpdate(); p.close() PreparedStatement p2 = con.prepareStatement("update user set phone='" + number + "' where pin='"+reg[1]+"'"); p2.executeUpdate(); p2.close(); num = 1; SendMessage a = new SendMessage(); a.doIt() } else if (reg[0].equals("cha")) { PreparedStatement p1 = con.prepareStatement("update register set pin='" + reg[1] + "', phone='" + number + "' ");
30
p1.executeUpdate(); p1.close(); PreparedStatement p2 = con.prepareStatement("update user set phone='" + number + "' where pin='"+reg[1]+"' "); p2.executeUpdate(); p2.close();
num = 2; SendMessage a = new SendMessage(); a.doIt(); }else if (reg[0].equals("bal")) { ResultSet r2 = con.createStatement().executeQuery("select unit from user where pin='" + reg[1] + "' and phone='"+number+"'"); if (r2.next()) { unit = r2.getString("unit"); if(Integer.parseInt(unit) < 30) { total=Integer.parseInt(unit)*3; } else if((Integer.parseInt(unit) > 30) && (Integer.parseInt(unit) < 90)) { total=90+(Integer.parseInt(unit)-30)*5; } else if(Integer.parseInt(unit) > 90) { total=90+300+(Integer.parseInt(unit)-90)*10;
31
a.doIt(); } }else{ num = 4; SendMessage a = new SendMessage(); a.doIt(); } } catch (Exception e) { } try { //delete read msg after sending
Service.getInstance().deleteMessage(msg);
32
} catch (Exception e) { e.printStackTrace(); } } } public static void main(String args[]) { while (true) { try { ReadMessages app = new ReadMessages(); object of this class app.doItforme(); reference //create //main method
33
Updated units Payments details units pin_id prev_reading_date prev_reading current date current reading total units
Month bill
34