Final Minor Report
Final Minor Report
Degree of
Bachelor of Technology
In
Electronics and Communication
-1-
(Annexure II)
CANDIDATE’S DECLARATION
I hereby declare that the work presented in this report entitled “Coin Detection Based Mobile
Charging System”, in fulfillment of the requirement for the award of the degree Bachelor of
Technology in Electronics and Communication, submitted in ECE Department, AIACTR
affiliated to Guru Gobind Singh Indraprastha University, New Delhi, is an authentic record of
my own work carried out during my degree under the guidance of Dr. Garima Shrivastav.
The work reported in this has not been submitted by me for award of any other degree or
diploma.
Date :
Place :
-2-
(Annexure III)
CERTIFICATE
This is to certify that the Project work entitled “Coin Detection Based Mobile Charging System” submitted
by Prateek Goyal, Tushar Rastogi, Abhsihek Ghai and Mayank Sharma in fulfillment for the requirements of
the award of Bachelor of Technology Degree in Electronics and Communication at AIACTR, New Delhi is
an authentic work carried out by his/her under my supervision and guidance. To the best of my knowledge,
the matter embodied in the project has not been submitted to any other University / Institute for the award of
any Degree .
-3-
(Annexure IV)
ACKNOWLEDGEMENT
I express my sincere gratitude to Dr. RK Sharma (HOD,ECE) and Dr. Garima Shrivastav
(A.P,ECE), for their valuable guidance and timely suggestions during the entire duration of my
dissertation work, without which this work would not have been possible. I would also like to
convey my deep regards to all other faculty members of school of ECE, who have bestowed their
great effort and guidance at appropriate times without which it would have been very difficult on
my part to finish this work. Finally I would also like to thank my friends for their advice and
pointing out my mistakes.
-4-
ABSTRACT
In today’s generation, the need for mobile phones is growing exponentially. As we know that mobile phones
are an irreplaceable component of present society, not only they are a source of entertainment but they are
also a big boon to those who are in dire need of help. But the major challenge for mobile phone
manufacturers is their woeful battery problems. So to combat with this problem, we have designed an
efficient, economical and ready-to-go solution for the benefit of people. The aim of the project is to install
these vending machine type installations to charge the mobile phones at a very economical cost.
This solution can be utilized at Airports, Exhibition Centers, Markets, Conference Halls, Rest Stops,
Stadiums, Bus stops etc where people are present in a large number. The idea is also to create an app which
can be used to find a nearby installation of this machine.
-5-
CONTENTS
1. Introduction ...................................................................................... 1
2. Candidate’s Declaration .................................................................. 2
3. Certificate ......................................................................................... 3
4. Acknowledgement ........................................................................... 4
5. Abstract ............................................................................................ 5
6. Introduction ..................................................................................... 7
7. Components Used ........................................................................... 8 - 13
8. Electrical Connections ................................................................... 14
9. Plan and Design .............................................................................. 15 - 16
10. Algorithms/Block Diagrams .......................................................... 17 - 18
11. Project Code .................................................................................... 19 - 36
12. Future Scope .................................................................................... 37
13. Conclusion ........................................................................................ 38
14. References ........................................................................................ 39
-6-
INTRODUCTION
Electricity plays a pivotal role in our life. It forms the backbone of every electronic gadget. One such gadget
is mobile phone. But most of them come with very poor battery life. Through this project we are trying to
address a solution to this problem. Mobile charging vending machines can be installed at every corner of
road and can provide a solution to the stressed techies and needy citizens.
It first takes the image of coins, then with the help of image processing algorithms on MATLAB, this
processed information is sent to the microcontroller. As soon as microcontroller receives the image
processing output, it initiates an interrupt and puts its timer into process. The value of currency signifies the
time duration for which it needs to be charged. The power supply from microcontroller will charge the
device for a predetermined time. Once the time is up, the circuit breaks and the person can take back
charged mobile with a happy and satisfied smile.
This can be of at most importance in rural areas, bus stops, highways etc. Successful implementation of this
project will ensure safety, confidence in the minds of digitally growing population.
-7-
COMPONENTS USED
HARDWARE SPECIFICATIONS:
Arduino Uno
LCD Display (16x2)
Relay Module (6 volts)
HP Webcam
Mobile Charger
LEDs
Buzzer
DC Adapter
Breadboard and Wires
Multimeter
SOFTWARE SPECIFICATIONS:
Arduino IDE
MATLAB
-8-
1. Arduino Board
-9-
2. LCD Display
In an MxN LCD, M denotes number of columns and N represents number of rows. Like if the LCD is
denoted by 16x2, it means it has 16 columns and 2 rows.
3. Relay
The coil of a relay passes a relatively large current, typically 30mA for a 12V relay, but it can be as much as
- 10 -
100mA for relays designed to operate from lower voltages. Most ICs cannot provide this current and a
transistor is usually used to amplify the small IC current to the larger value required for the relay coil.
The relay's switch connections are usually labelled COM, NC and NO:
COM = Common, always connect to this, it is the moving part of the switch.
NC = Normally Closed, COM is connected to this when the relay coil is off.
NO = Normally Open, COM is connected to this when the relay coil is on.
Connect to COM and NO if you want the switched circuit to be on when the relay coil is on.
Connect to COM and NC if you want the switched circuit to be on when the relay coil is off.
4. Webcam
A webcam is a video camera that feeds or streams its image in real time to
or through a computer to a computer network. When "captured" by the
computer, the video stream may be saved, viewed or sent on to other
networks via systems such as the internet, and emailed as an attachment.
When sent to a remote location, the video stream may be saved, viewed or
on sent there. Unlike an IP camera (which connects using Ethernet or
WiFi), a webcam is generally connected by a USB cable, or similar cable, or built into computer hardware,
such as laptops.
Webcams typically include a lens, an image sensor, support electronics, and may also include a microphone
for sound. Various lenses are available, the most common in consumer-grade webcams being a plastic lens
that can be screwed in and out to focus the camera. Fixed-focus lenses, which have no provision for
adjustment, are also available. As a camera system's depth of field is greater for small image formats and is
greater for lenses with a large f-number (small aperture), the systems used in webcams have a sufficiently
large depth of field that the use of a fixed-focus lens does not impact image sharpness to a great extent.
The most popular use of webcams is the establishment of video links, permitting computers to act as
videophones or video conference stations. Other popular uses include security surveillance, computer vision,
video broadcasting, and for recording social videos.
5. Mobile Charger
- 11 -
A mobile battery charger circuit is a device that can automatically
recharge a mobile phone’s battery when the power in it gets low.
Nowadays mobile phones have become an integral part of everyone’s
life and hence require frequent charging of battery owing to longer
duration usage.
Charging methods are classified into two categories: fast charge method and slow charge method. Fast
charge is a system used to recharge a battery in about two hours or less than this, and the slow charge is a
system used to recharge a battery throughout the night. Slow charging is advantageous as it does not require
any charge detection circuit. Moreover, it is cheap as well. The only drawback of this charging system is that
it takes maximum time to recharge a battery.
- 12 -
prototypes or one-offs, cannot easily be reused. A variety of electronic systems may be prototyped by using
breadboards, from small analog and digital circuits to complete central processing units (CPUs).
7. Multimeter
- 13 -
ELECTRICAL CONNECTIONS
- 14 -
PLAN AND DESIGN
Before the proceeding with design and implementation of this project certain points should be noted. For
example the positioning of the camera should be selected appropriately. If not taken care off it would result
in detection of circular coin as elliptical and hence entire process would be a waste. So camera should be
setup at proper height and angle. At a given instant only one coin can be inserted. If we try to insert a
number of coins simultaneously, overlapping of coins will take place and image processing algorithm will
not give desired outcome.
1. Detection of Coins
The implementation of coin detection can be done in several ways. Some of them are listed below:
i. Electromagnetic based system
ii. Sensor based system
iii. Use of image processing algorithms
i. The electromagnetic method makes use of a coil carrying current, which acts as a solenoid. When a coin
passes through it, the coin disturbs the magnetic field in different ways as different coins have different
mass and dimensions. Thus, we can calculate the amount of disturbance in the magnetic field, which
gives us the mass of the coin. Then the coin passes through a infrared emitter and receiver, which can
give us the radius of the coin. This is the same mechanism which is used in the vending machines.
ii. The sensor based system uses a load sensor which can calculate the amount of weight of coin kept on it.
But the major drawback of this system is that it cannot differentiate between different materials of the
coin. For example, it cannot distinguish between two coins having same physical dimensions, but
having different compositions.
iii. For the image processing technique, the real time image of the coin(s) is scanned using a
mountable camera. The appropriate computation strategy uses the object polarity and sensitivity
to determine a range matrix for various coins. According to the algorithm, the captured image is
matched with the computed range matrix. The value(s) of the coin is then indicated to the
microcontroller for further processing.
- 15 -
2. Use of Microcontroller
The output of the image processing stage is fed to the microcontroller, for further processing.
After reception of the value of the coin, the microcontroller puts its timer into operation. It then charges
the mobile phone for a pre-determined time as set during the initialization of the microcontroller. As
soon as the timer, times out the interrupt resets the whole stage and the mobile phone can be removed
safely. It is now ready to accept another coin and repeat the same procedure.
The above procedure can be illustrated by a simple example. Suppose, user X inserts a coin of
denomination ₹ 5, the mounted camera captures the image and from this image, the value of the coin is
detected. This extracted value is then sent to the microcontroller for further computations. The mobile is
then charged for a specified time like 20 or 30 minutes.
3. Circuit Designing
The rectifier stage is designed on a PCB with input AC supply from a socket or a Solar Panel. This input
is then fed to the transformer for the AC-DC conversion. The output is then filtered with the help of
diodes and the DC output is used to power the microcontroller stage.
The microcontroller stage is integrated with a LCD display for displaying of time and some other
parameters. Also, relay is connected for timing synchronization of the charging circuit.
- 16 -
ALGORITHMS / BLOCK DIAGRAMS
1. Image Processing
Image is captured using a camera.
This image is then converted from RGB to Grayscale.
The radius and the center of the coin are found by using different MATLAB commands and then a
circle enclosing the coin is traced.
The image of a coin is then cropped by passing the parameters i.e., diameter on the x and y-axes.
The output of the radius value from the above step is then passed into another function file, which has
the radius of various coins stored already for comparison.
In the output figure, the cropped image with its radius value is displayed.
- 17 -
2. Embedded Systems
The microcontroller receives the detected value on Serial COM port.
It then starts its processing for timer interrupts and displays it on a LCD display.
After the specified time, the user can safely remove his/her phone.
- 18 -
PROJECT CODE
1. MATLAB CODE
main.m
clear all;
close all;
- 19 -
rgb = imread('/home/prateek/Documents/MATLAB/Minor Project Code/image.jpg');
figure
imshow(rgb);
d = imdistline;
delete(d);
% Arduino Communication
arduino=serial('/dev/ttyACM0','BaudRate',9600);
fopen(arduino);
fprintf(arduino, '%d', value);
fclose(arduino);
clear('cam');
- 20 -
radiif.m
% Find the value of the coin by passing the radius value
function f = radiif(rad)
2. ARDUINO CODE
Countimer.cpp
#include "Countimer.h"
#include "Arduino.h"
Countimer::Countimer()
{
_previousMillis = 0;
_currentCountTime = 0;
_countTime = 0;
_isCounterCompleted = false;
_isStopped = true;
_countType = COUNT_NONE;
_startCountTime = 0;
}
Countimer::~Countimer()
{
}
- 21 -
void Countimer::setCounter(uint16_t hours, uint8_t minutes, uint8_t seconds, CountType countType,
timer_callback onComplete)
{
_onComplete = onComplete;
_countType = countType;
setCounter(hours, minutes, seconds);
}
if (_countType == COUNT_UP)
{
// if is count up mode, we have to start from 00:00:00;
_currentCountTime = 0;
}
_startCountTime = _currentCountTime;
}
- 22 -
void Countimer::setInterval(timer_callback callback, uint32_t interval)
{
_interval = interval;
_callback = callback;
}
uint16_t Countimer::getCurrentHours()
{
return _currentCountTime / 1000 / 3600;
}
uint8_t Countimer::getCurrentMinutes()
{
return _currentCountTime / 1000 % 3600 / 60;
}
uint8_t Countimer::getCurrentSeconds()
{
return _currentCountTime / 1000 % 3600 % 60 % 60;
}
char* Countimer::getCurrentTime()
{
sprintf(_formatted_time, "%02d:%02d:%02d", getCurrentHours(), getCurrentMinutes(),
getCurrentSeconds());
return _formatted_time;
}
bool Countimer::isCounterCompleted()
{
return _isCounterCompleted;
}
- 23 -
bool Countimer::isStopped()
{
return _isStopped;
}
void Countimer::start()
{
_isStopped = false;
if(_isCounterCompleted)
_isCounterCompleted = false;
}
void Countimer::pause()
{
_isStopped = true;
}
void Countimer::stop()
{
_isStopped = true;
_isCounterCompleted = true;
_currentCountTime = _countTime;
if(_countType == COUNT_UP)
{
_currentCountTime = 0;
}
}
void Countimer::restart()
{
_currentCountTime = _startCountTime;
_isCounterCompleted = false;
_isStopped = false;
start();
}
- 24 -
void Countimer::run()
{
// timer is running only if is not completed or not stopped.
if (_isCounterCompleted || _isStopped)
return;
if (_countType == COUNT_DOWN)
{
countDown();
}
else if (_countType == COUNT_UP)
{
countUp();
}
else
{
callback();
}
_previousMillis = millis();
}
}
void Countimer::countDown()
{
if (_currentCountTime > 0)
{
callback();
_currentCountTime -= _interval;
}
else
{
stop();
complete();
}
- 25 -
}
void Countimer::countUp()
{
if (_currentCountTime < _countTime)
{
callback();
_currentCountTime += _interval;
}
else
{
stop();
complete();
}
}
void Countimer::callback()
{
if(_callback != NULL)
_callback();
}
void Countimer::complete()
{
if(_onComplete != NULL)
_onComplete();
}
Countimer.h
- 26 -
#pragma once
#ifndef COUNTIMER_H
#define COUNTIMER_H
typedef void(*timer_callback)(void);
class Countimer
{
public:
Countimer();
~Countimer();
enum CountType
{
COUNT_NONE = 0,
COUNT_UP = 1,
COUNT_DOWN = 2
};
// Set up counter time(hours, minutes, seconds), count mode and function to execute if count is
completed.
void setCounter(uint16_t hours, uint8_t minutes, uint8_t seconds, CountType countType,
timer_callback onComplete);
// Starting timer.
void start();
// Stopping timer.
void stop();
// Pausing timer.
- 28 -
void pause();
// Restart timer.
void restart();
private:
// Counting up timer.
void countDown();
void callback();
void complete();
uint32_t _interval = 1;
uint32_t _previousMillis;
// Function to execute.
timer_callback _callback;
main.ino
#include <LiquidCrystal.h>
#include <Countimer.h>
uint32_t period;
uint32_t i;
uint16_t h;
uint8_t m, s;
uint32_t timing(int);
void stopwatch(int);
void refreshClock();
void onComplete();
void doStuff(uint16_t, uint8_t, uint8_t);
int coin_value;
int buzzer = A5;
int relay = 3;
int led1 = 10; // LED1 for coin insertion
int led2 = 11; // LED2 for coin inserted and value of coin detected
int led3 = 12; // LED3 when charging starts
int led4 = 13; // LED4 when charging completes
void setup()
- 30 -
{
Serial.begin(9600);
pinMode(led1,OUTPUT);
pinMode(led2,OUTPUT);
pinMode(led3,OUTPUT);
pinMode(led4,OUTPUT);
pinMode(buzzer,OUTPUT); // Buzzer, for when charging completes
pinMode(relay, OUTPUT); // Relay, for controlling the mobile charger
lcd.begin(16,2);
timer.setCounter(h, m, s, timer.COUNT_DOWN, onComplete);
timer.setInterval(refreshClock, 1000);
// Introduction
for(int i=400; i<=410; i=i+1)
{
lcd.setCursor(0,0);
lcd.print("Coin Detection Based");
lcd.scrollDisplayRight();
lcd.setCursor(0,1);
lcd.print("Mobile Charging System");
lcd.scrollDisplayRight();
delay(i+5);
lcd.setCursor(0,0);
lcd.print("Coin Detection Based");
lcd.scrollDisplayRight();
lcd.setCursor(0,1);
lcd.print("Mobile Charging System");
lcd.scrollDisplayRight();
delay(i+5);
}
digitalWrite(relay, HIGH);
}
- 31 -
void loop()
{
lcd.clear();
lcd.setCursor(1,0);
digitalWrite(led1, HIGH);
delay(500);
digitalWrite(led1, LOW);
delay(500);
digitalWrite(led1, HIGH);
delay(500);
digitalWrite(led1, LOW);
lcd.print("Insert a coin");
delay(5000);
digitalWrite(led1, HIGH);
delay(500);
digitalWrite(led1, LOW);
delay(500);
digitalWrite(led1, HIGH);
delay(500);
digitalWrite(led1, LOW);
delay(500);
lcd.clear();
//char buffer[] = {' ',' ',' ',' ',' ',' ',' '}; // Receive up to 7 bytes
//while(Serial.available()!=0) // Wait for characters
while (!Serial.available());
//Serial.readBytesUntil('n', buffer, 7);
//int coin_value = atoi(buffer);
//Serial.println(coin_value);
- 32 -
//{
int matlabdata=Serial.read(); // read data
int coin_value = matlabdata-48;
Serial.println(coin_value);
//coin_value = Serial.read();
//Serial.println(coin_value);
period = timing(coin_value);
Serial.print(period);
digitalWrite(led2, HIGH);
delay(500);
digitalWrite(led2, LOW);
delay(500);
digitalWrite(led2, HIGH);
delay(500);
digitalWrite(led2, LOW);
delay(500);
lcd.print("CHARGING STARTED");
delay(2000);
digitalWrite(led2, HIGH);
delay(500);
digitalWrite(led2, LOW);
delay(500);
digitalWrite(led2, HIGH);
delay(500);
digitalWrite(led2, LOW);
delay(500);
lcd.clear();
switch (coin_value)
{
- 33 -
case 1:
doStuff(0, 0, 15);
break;
case 2:
doStuff(0, 0, 30);
break;
case 5:
doStuff(0, 0, 45);
break;
}
digitalWrite(led3, LOW);
digitalWrite(led4, HIGH);
delay(500);
digitalWrite(led4, LOW);
delay(500);
digitalWrite(led4, HIGH);
delay(500);
digitalWrite(led4, LOW);
delay(500);
digitalWrite(led4, HIGH);
delay(500);
digitalWrite(led4, LOW);
delay(500);
//}
}
case 2:
i = 0.5 * 60000L;
break;
case 5:
i = 0.75 * 60000L;
break;
case 10:
i = 1 * 60000L;
break;
}
delay(1);
return i;
}
void refreshClock()
{
Serial.print("Current count time is: ");
lcd.print("time: ");
Serial.println(timer.getCurrentTime());
lcd.print(timer.getCurrentTime());
}
void onComplete()
{
- 35 -
Serial.println("Complete!!!");
lcd.print("Complete!!!");
}
digitalWrite(relay, LOW);
//lcd.setCursor(1,0);
//lcd.print("Time Remaining:");
lcd.setCursor(1,0);
timer.run();
if(!timer.isCounterCompleted())
{
timer.start();
}
}
digitalWrite(relay, HIGH);
}
- 36 -
FUTURE SCOPE
This project is made keeping in mind the economic and energy resources of the country. The need of the
hour is to provide access to means of communication to those who are in distress as well as providing a
source of entertainment. By extending the scope of this project, we can even charge batteries of automobiles
and electronic gadgets other than just mobile phones. Some other devices which can be charged through this
installation are camera, laptops etc. If implemented properly they can be installed at every corner of the road
and hence they will provide a suitable means to charge electric vehicles and hence can solve the problem of
air pollution. This project can further be extended to those devices which come enabled with NFC and
wireless charging, and hence can prove to be a revolution in charging history.
An IOT based server can be created which keeps a track of all the installations i.e. locations which are
equipped with this technology. Those who are in need to charge their cellphone can check the location of
this installation and have a peace of mind.
Another application is that once you have placed your mobile phone for charging, user will be provided a
link which can be checked continuously and here user can track all the information such as time remaining
for charging to accomplish, slots available for connecting more cell phones, distance from the installation,
information related to our setup, career , growth and future scope of this project. Information accumulated at
one place not only look soothing to the eyes but also present information in a very manageable way.
- 37 -
CONCLUSION
Through this project we have put our hands into one of the most common problems of this present era. By
providing these charging points we can ensure the safety of our citizens as well as ensure progress in the
growing digital population. Once this battery solution of mobile phones is addressed and solved we can also
provide solutions i.e. charging ports to automobiles which can lead to a healthy environment.
- 38 -
REFERENCES
1. S.B. Sridevi1, A.Sai Suneel2, K. Nalini3, Coin Based Mobile Charger Using Solar Tracking System,
ISSN: 2278909X Volume 2, Issue 9, September 2013.
2. Borkar , S.A.1,Dafle B.B.2, Choche R.A.3, Coin Operated Universal Mobile Charging With Solar
Tracking, ISSN:2278909X, Volume 5, Issue 3, March 2016.
3. Khashman A., Sekeroglu B. And Dimililer K., Intelligent Coin Identification System, Proceedings of
the IEEE International Symposium on Intelligent Control (ISIC06), Munich, Germany, 4-6 October
2006.
4. Saranya das. Y. M, R. Pugazhenthi, Harris Hessian Algorithm for Coin Apprehension, International
Journal of Advanced Research in Computer Engineering Technology (IJARCET) Volume 2, No 5, May
2013.
5. Usha Nandhini Sridhar, G.Swathi , Automated Mobile Phone Charger System with Coin Detection
Using Image Processing, International Journal of Advanced Research Trends in Engineering and
Technology (IJARTET) Vol. II, Special Issue VIII, February 2015 ISSN: 2394-3777 (Print), ISSN:
2394-3785 (Online)
- 39 -