Prepaid Energy Meter using GSM and Arduino



প্রিপেইড বিদ্যুৎ শক্তি মিটার একটি ভাল ধারণা যা আপনি তার ব্যালেন্স রিচার্জ করতে পারেন, যেমন আমরা আমাদের মোবাইল ফোনে করি। এই প্রকল্পে আমরা Arduino এবং GSM মডিউল ব্যবহার করে একটি স্বয়ংক্রিয় সিস্টেম তৈরি করছি। আপনি কেবলমাত্র একটি এসএমএস পাঠিয়ে এই সিস্টেমের মাধ্যমে বিদ্যুৎ ব্যালেন্স রিচার্জ করতে পারেন। সিস্টেমটিতে কম বা শূন্য ব্যালেন্স থাকলেও এটি হোম পাওয়ার সাপ্লাই সংযোগ বিচ্ছিন্ন করতে পারে। এবং এই সিস্টেমটি শক্তি মিটার রিডিংগুলি পড়বে এবং স্বয়ংক্রিয়ভাবে ব্যবহারকারীর মোবাইল ফোনের কিছু আপডেট যেমন কম ব্যালেন্স সতর্কতা, সতর্কতা বন্ধ, সতর্কতা সতর্কতা এবং রিচার্জ সতর্কতা পাঠাবে।

সার্কিট বর্ণনা:

এই ওয়্যারলেস বিদ্যুৎ মিটার রিডিং প্রকল্পের জন্য সার্কিট সংযোগগুলি, চিত্রটিতে দেখানো হয়েছে; আমরা প্রকল্প ব্যবহৃত সমস্ত জিনিস প্রক্রিয়াকরণের জন্য একটি Arduino ইউএনও ব্যবহার করেছেন। একটি তরল স্ফটিক প্রদর্শন ইউনিট এবং অবশিষ্ট ব্যালেন্স অবস্থা প্রদর্শন করার জন্য ব্যবহৃত হয়। এলসি, এন, ডি 4, ডি 5, ডি 6, ডি 7 এর ডেটা পিনগুলি Arduino ডিজিটাল পিন নম্বর 7, 6, 5, 4, 3, 2 এর সাথে সংযুক্ত। জিএসএম মডিউলের আরএক্স এবং টিএক্স পিনগুলি সরাসরি টিএক্স-এর সাথে সংযুক্ত থাকে এবং যথাক্রমে Arduino এর Rx পিনের। এবং জিএসএম মডিউল একটি 12 ভোল্ট অ্যাডাপ্টার ব্যবহার করে চালিত হয়। ULN2003 রিলে চালক যদিও Arduino এর পিন 12 এ সংযুক্ত করা হয় বিদ্যুৎ সংযোগ স্যুইচ করার জন্য একটি রিলে ব্যবহার করা হয়


ডাল এবং ইউনিট গণনা:
গণনার জন্য এগিয়ে যাওয়ার আগে, প্রথমে আমাদের শক্তি মিটারের পালের হার মনে রাখতে হবে। বিদ্যুৎ মিটারের দুটি পালের হার প্রথমে 1600 আইপি / কেউভি এবং দ্বিতীয়টি হল 3200 আইপি / কেউএইচ। তাই এখানে আমরা 3200 আইপি / KWH পালস হার শক্তি মিটার ব্যবহার করা হয়।

তাই প্রথমে আমরা 100 ওয়াট জন্য ডালপালা গণনা করা প্রয়োজন, অর্থাত্ 100 ওয়াট লোড জন্য এক মিনিটে পালস LED কতটা ঝাপসা হবে মানে।

পালস = (Pluse_rate * ওয়াট * সময়) / (1000 * 3600)

তাই 60 সেকেন্ডে 100 ওয়াট বাল্বের জন্য ডাল, 3200 আইপি / কেউএল পালস হারের শক্তি মিটার নিচের হিসাবে গণনা করা যেতে পারে:

ডাল = 3200 * 100 * 60/1000 * 3600

Pulses = ~ 5.33 প্রতি মিনিটে পালস


এখন আমাদের একক পালের পাওয়ার ফ্যাক্টর গণনা করতে হবে, অর্থাত্ এক পালাতে কত বিদ্যুৎ খরচ হবে!

পিএফ = ওয়াট / (ঘন্টা * পালস)

পিএফ = 100/60 * 5.33

পিএফ = 0.3125 ওয়াট একক পালস


ইউনিট = পিএফ * মোট পালস / 1000

এক ঘন্টার মোট ডাল প্রায় 5.33 * 60 = 320

ইউনিট = 0.3125 * 320/1000

ইউনিট = ঘন্টা প্রতি 0.1

একটি 100 ওয়াট বাল্ব একটি দিনের জন্য আলো হয় তাহলে এটি গ্রাস করবে

ইউনিট = 0.1 * 24

ইউনিট = 2.4 ইউনিট

এবং অনুমান করুন যে আপনার অঞ্চলে ইউনিট হার প্রতি ইউনিট 5 রুপি হয়

আপনি 2.4 ইউনিট জন্য পরিশোধ করতে হবে Rs।

রূপ = 2.4 * 5 = 1২ রুপি
English 
Prepaid Electricity Energy Meter is a good concept in which you can recharge its balance, like we do in our mobile phones. In this project we are building a automated system by using Arduino and GSM module. You can recharge the electricity balance through this system, just by sending a SMS. It can also disconnect the home power supply connection. And this system will read the energy meter readings and automatically send some updates to the user's mobile phone like low balance alert, cut off alert, resume alert and recharge alert.es

Prepaid Electricity Energy Meter is a good concept in which you can recharge its balance, like we do in our mobile phones. In this project we are building a automated system by using Arduino and GSM module. You can recharge the electricity balance through this system, just by sending a SMS. It can also disconnect the home power supply connection. And this system will read the energy meter readings and automatically send some updates to the user's mobile phone like low balance alert, cut off alert, resume alert and recharge alert.

Circuit Description:

Circuit connections for this Wireless Electricity Meter Reading Project, are shown in the diagram; We have used an Arduino UNO for processing. A liquid crystal display was used for displaying the status of units and remaining balance. Data pins of LCD namely RS, EN, D4, D5, D6, D7 are connected to Arduino digital pin number 7, 6, 5, 4, 3, 2. And Rx and Tx pins of GSM module are directly connected to the Tx and Rx pins of Arduino respectively. And the GSM module is powered by a 12 volt adapter. A relay is used for switching power connection which is connected on pin 12 of Arduino though ULN2003 relay driver.


How to Connect Energy Meter with Arduino:

First user needs to buy an Analogue Electricity Energy Meter. After it user needs to open it and find the pulse LED or Cal LED's terminals (cathode and Anode). Now solder two wires at both the terminals and take it out from the energy meter and then close energy meter and tight the screws.
Now user needs to connect anode terminal of LED at pin number 1 of Optocoupler and cathode terminal to pin 2. Pin number four of optocouper. A LED and a pull-up resistor are connected at pin number 5 of optocoupler. And the same terminal should go to the Arduino pin 8 too.

Calculation of Pulses and Units:
Before proceeding for the calculations, first we have to keep in mind the pulse rate of energy meter. There are two pulse rates of energy meter first is 1600ct / kwh and second is 3200ct / kwh. So here we are using 3200 imp / kwh pulse rate energy meter

So first we need to calculate the pulses for 100watt, means how many times pulse LED will blink in a minute, for the load of 100 watts.

Pulse = (Pluse_rate * watt * time) / (1000 * 3600)

So pulses for 100 watt bulb in 60 seconds, with energy meter of 3200 imp / kwh pulse rate can be calculated as below:

Pulses = 3200 * 100 * 60/1000 * 3600

Pulses = ~ 5.33 pulse per minute


Now we need to calculate Power pulse of a pulse,

PF = watt / (hour * Pulse)

PF = 100/60 * 5.33

PF = 0.3125 watt in a single pulse


Units = PF * Total pulse / 1000

Total pulses in an hour is around 5.33 * 60 = 320

Units = 0.3125 * 320/1000

Units = 0.1 per hour

If a 100 watt bulb is light for a day then it will consume

Units = 0.1 * 24

Units = 2.4 Units

And suppose unit rate is your region is 5 TK per unit then

You have to pay for 2.4 units:

TK = 2.4 * 5 = 12 TK

Code

#include <EEPROM.h>
#include <LiquidCrystal.h>
LiquidCrystal LCD (7,6,5,4,3,2);

int lead = 13;
#define pulsein 8
#define relay 12
unsigned int pusle_count = 0;
float units = 0;
unsigned int rupees = 0;

 float watt_factor = 0.3125;
unsigned int temp = 0, i = 0, x = 0, k = 0;
char str [70], flag1 = 0, flag2 = 0;

String bal = "";

void setup ()
{
  lcd.begin (16,2);
  Serial.begin (9600);
  pinMode (led, OUTPUT);
  pinMode (pulsein, INPUT);
  pinMode (relay, OUTPUT);
  digitalWrite (pulsein, HIGH);
  lcd.setCursor (0,0);
  lcd.print ("Automatic Energy");
  lcd.setCursor (0,1);
  lcd.print ("Meter");
  delay (2000);
  lcd.clear ();
  lcd.print ("Circuit Digest");
  delay (2000);
  lcd.clear ();
  lcd.print ("Initilizing GSM ...");
  gsm_init ();
  lcd.clear ();
  lcd.print ("System Ready");
  Serial.println ("AT + CNMI = 2,2,0,0,0");
  init_sms ();
  send_data ("System Ready");
  send_sms ();
  delay (1000);
  digitalWrite (led, LOW);
  lcd.clear ();
// EEPROM.write (1,0);
 // rupees = EEPROM.read (1);
}

void loop ()
{
    serialEvent ();
    rupees = EEPROM.read (1);
    units = rupees / 5.0;
    lcd.setCursor (0,0);
    lcd.print ("Units:");
    lcd.print (units);
    lcd.print ("");
    lcd.setCursor (0,1);
    if (rupees <15)
    lcd.print ("LOW Balance:");
    else
    lcd.print ("Balance:");
    lcd.print (rupees);
    lcd.print ("");
    read_pulse ();
    check_status ();
    if (temp == 1)
    {
     decode_message ();
     send_confirmation_sms ();
    }
}
void serialEvent ()
{
  while (Serial.available ())
  {
    char ch = (char) serial.read ();
    str [i ++] = ch;
    if (ch == '*')
    {
      temp = 1;
      lcd.clear ();
      lcd.print ("Message Received");
      delay (500);
      break;
    }
  }
}

void init_sms ()
{
   Serial.println ("AT + CMGF = 1");
   delay (200);
   Serial.println ("AT + CMGS = \" + 8801723673803 \ "");
   delay (200);
}

void send_data (String message)
{
  Serial.println (message);
  delay (200);
}

void send_sms ()
{
  Serial.write (26);
}

void read_pulse ()
{
    if (! digitalRead (pulsein)
    {
      digitalWrite (led, HIGH);
      // count ++;
      // units = watt_factor * count / 1000;
      if (units <1) {}
      else
      units--;
      rupees = units * 5;
      EEPROM.write (1, rupees);
      while (! digitalRead (pulsein));
      digitalWrite (led, LOW);
     // delay (2000);
    }
}

void check_status ()
{
      if (rupees> 15)
      {
        digitalWrite (relay, HIGH);
        flag1 = 0;
        flag2 = 0;
      }
      if (rupees <15 && flag1 == 0)
      {
       lcd.setCursor (0,1);
       lcd.print ("LOW Balance");
       init_sms ();
       send_data ("Energy Meter Balance Alert:");
       send_data ("Low Balance \ n");
       Serial.println (rupees);
       delay (200);
       send_data ("Please recharge your energy meter soon. \ n Thank you");
       send_sms ();
       message_sent ();
       flag1 = 1;
      }
      if (rupees <5 && flag2 == 0)
     {
      digitalWrite (relay, LOW);
      lcd.clear ();
      lcd.print ("Light Cut Due to");
      lcd.setCursor (0,1);
      lcd.print ("Low Balance");
      delay (2000);
      lcd.clear ();
      lcd.print ("Please Recharge");
      lcd.setCursor (0,1);
      lcd.print ("UR Energy Meter");
      init_sms ();
      send_data ("Energy Meter Balance Alert: \ nLight cut due to low balance \ nPlease recharge your energy meter soon. \ n Thank you");
      send_sms ();
      message_sent ();
      flag2 = 1;
    }
}

void decode_message ()
{
  x = 0, k = 0, temp = 0;
     while (x <i)
     {
      while (str [x] == '#')
      {
        x ++;
        bal = "";
        while (str [x]! = '*')
        {
          bal + = str [x ++];
        }
      }
      x ++;
    }
    bal + = '\ 0';
}

void send_confirmation_sms ()
{
    int recharge_amount = bal.toInt ();
    rupees + = recharge_amount;
    EEPROM.write (1, rupees);
    lcd.clear ();
    lcd.print ("Energy Meter");
    lcd.setCursor (0,1);
    lcd.print ("Recharged:");
    lcd.print (recharge_amount);
    init_sms ();
    send_data ("Energy Meter Balance Alert: \ nYour energy meter has been recharged:");
    send_data (bal);
    send_data ("Total Balance:");
    Serial.println (rupees);
    delay (200);
    send_data ("Eelctricity Has Been Connected \ nThank you");
    send_sms ();
    temp = 0;
    i = 0;
    x = 0;
    k = 0;
    delay (1000);
    message_sent ();
}

void message_sent ()
{
  lcd.clear ();
  lcd.print ("Message Sent.");
  delay (1000);
}

void gsm_init ()
{
  lcd.clear ();
  lcd.print ("Finding Module ..");
  boolean at_flag = 1;
  while (at_flag)
  {
    Serial.println ("AT");
    while (Serial.available ()> 0)
    {
      if (Serial.find ("OK"))
      at_flag = 0;
    }
    delay (1000);
  }

  lcd.clear ();
  lcd.print ("Module Connected ..");
  delay (1000);
  lcd.clear ();
  lcd.print ("Disabling ECHO");
  boolean echo_flag = 1;
  while (echo_flag)
  {
    Serial.println ("ATE0");
    while (Serial.available ()> 0)
    {
      if (Serial.find ("OK"))
      echo_flag = 0;
    }
    delay (1000);
  }

  lcd.clear ();
  lcd.print ("Echo OFF");
  delay (1000);
  lcd.clear ();
  lcd.print ("Finding Network ..");
  boolean net_flag = 1;
  while (net_flag)
  {
    Serial.println ("AT + CPIN?");
    while (Serial.availabl

Download Full Project CLICK HERE


No comments

Theme images by Dizzo. Powered by Blogger.