Coins Sortingand Counting Machine Project
Coins Sortingand Counting Machine Project
net/publication/370978184
CITATIONS READS
0 3,162
6 authors, including:
Mohammad Aboalfotouh
Helwan University
7 PUBLICATIONS 1 CITATION
SEE PROFILE
All content following this page was uploaded by Mohammad Aboalfotouh on 25 May 2023.
By
Mohammad Abu-Alfotouh Ahmad Qandel
Muhammad Ashraf Hussein Shaaban
Muhammad Jamal Abdel Baset Ali
Mohamed Gamal Fawzy
Muhammad Khaled Imam Abdul Salam
Mohammed Al-Sayed Abdullah
Karim Mahmoud Hussein
Section (7) – Group (1)
Under Supervision of
ABSTRACT
In this dynamic era of new evolution of technology, the systems are moving
towards smart way to improve the utilization and effectiveness of the system. In
this work, an attempt is made to design and develop the coin sorting machine,
which can be extended to a variety of similar applications. Coins are circulated
enormously in public and private transportation sectors, temples and in Retail
shops, where sorting and counting is done manually, which increases the
monotony of the work, less precision and effectiveness. The objective in this
work is to reduce the fatigue faced by human, improving the effectiveness and
utilization of the sorting, and counting process. The first step is to develop the
framework of the coin sorting mechanism using the Lining mechanism, which
will separate the coins, followed by measurement of the coin specification such
as diameter, thickness and weight to identify the value of the coin. A
programmed coin checking and arranging machine model is created by utilizing
ARDUINO as the primary regulator. This work included the structure of the
basic showcase board to show the absolute amount of each coin. The coin
acceptor has been utilized as it goes about as a coin selector to decide the
division of coin and restrict any invalid or undesirable coins. Through the task,
this coordinated structure has superior for coin including and arranging as far as
easy to use and engaging quality.
This machine can be use also in canning and packaging machines and factories
not only in counting coins as it is considered as practical Application. [1]
Page | ii
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
TABLE OF CONTENT
Abstract ........................................................................ ii
TABLE OF CONTENT ................................................. iii
TABLE OF FIGURES.................................................... v
1. INTRODUCTION ..................................................... vi
1.1 Objective .................................................................................... vi
1.2 Applications ............................................................................... vi
2. LITERATURE REVIEW ............................................ 1
2.1 Introduction .................................................................................1
2.2 Coin Discrimination ....................................................................1
2.3 Coin detection and recognition ..................................................1
2.4 Sensor-based coin counting machine ........................................2
3. PROBLEM IDENTIFICATION .................................. 2
3.1 Problem Analysis: .......................................................................2
3.2 Proposed System: ........................................................................2
3.3 Concept of the Project ................................................................2
4. SENSOR SELECTION ............................................. 4
4.1 Choosing criteria of selecting sensor .........................................4
4.2 Working idea ...............................................................................5
5. ACTUATOR SELECTION ........................................ 8
5.1 Servo motor Selection .................................................................8
5.1.1 Working Principle ............................................................................ 8
5.1.2 Motor selection parameters: ........................................................... 9
6. METHODOLOGY&TESTING ................................. 12
6.1 Working principle .....................................................................13
6.1.1 We came with a new Idea!............................................................. 13
6.2 Block diagram............................................................................14
6.3 Process ........................................................................................15
Page | iii
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
Page | iv
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
TABLE OF FIGURES
Figure 1: Coins Sorting Machine Project .............................................................ii
Figure 2: IR Sensor ............................................................................................... 4
Figure 3:IR Sensor Circuit .................................................................................... 7
Figure 4: Servo Motor Block diagram .................................................................. 8
Figure 5: Futaba S3003 Servo Motor ................................................................. 10
Figure 6: Futaba S3003 Standard Servo Design ................................................. 10
Figure 7: Servo Motor Controlling Using PWM ................................................ 11
Figure 8:Screenshots of Programming with Arduino ......................................... 11
Figure 9:Block Diagram of machine................................................................... 14
Figure 10: Circuit Diagram ................................................................................. 18
Figure 11:Screenshots of Programming with Arduino ....................................... 22
Figure 12: First Modeling Design we created .................................................... 23
Figure 13:Second Modeling Design ................................................................... 23
Figure 14:Working Drawing of final Design. ..................................................... 24
Figure 15: Working Drawing 2 of Final Design ................................................. 24
Figure 16: Assembly Drawing of Final Design .................................................. 25
Figure 17: Assembly Drawing of machine with hardware components ............ 25
Figure 18: Closed loop circuit diagram for servomotor ..................................... 26
Figure 19: Servo Motor modeling....................................................................... 27
Figure 20:Lag of LCD Proplem .......................................................................... 31
Figure 21: Making Delay in code to avoid over detecting ................................. 31
Page | v
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
1. INTRODUCTION
Coin sorting and counting machines are increasingly becoming popular due to
their ability to automate the process of sorting and counting coins with high
accuracy and efficiency. These machines are widely used in financial
institutions, casinos, and vending machine businesses. However, they can also
be adapted to other applications that require the sorting, counting, and
packaging of small objects.
This technical report presents the design and implementation of a coin sorting
and counting machine that is based on a ramp design with three holes of
different sizes for each coin. The machine uses IR sensors to detect each coin
and count it using an Arduino Uno microcontroller. The machine also has a tray
box under each slot to collect coins, and servo motors that are coupled to the
tray boxes to flip them 180 degrees to empty them once the IR sensor count
reaches 3 coins. The LCD 16*2 display with I2C module is used to display the
number of coins counted.
Page | vi
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
capsules, or pills of different shapes and sizes. You can also use different
sensors, such as optical sensors or weight sensors, to detect the presence of the
pills.
[4] Sorting and counting seeds: You can modify the size and shape of the
holes in the ramp to accommodate different types of seeds, such as flower seeds,
vegetable seeds, or fruit seeds. You can also use different sensors, such as color
sensors or weight sensors, to detect the presence of the seeds.
[5] Sorting and counting machine parts: Factories that produce small
machine parts, such as screws, bolts, or washers, can use coin sorting and
counting machines to sort and count these parts. This can save time and reduce
errors compared to manual counting.
[6] Sorting and counting electronic components: Factories that produce
electronic components, such as resistors, capacitors, or diodes, can use coin
sorting and counting machines to sort and
[7] count these components. This can improve accuracy and reduce waste
compared to manual counting.
[8] Sorting and counting food products: Factories that produce small food
products, such as candies, nuts, or seeds, can use coin sorting and counting
machines to sort and count these products. This can improve efficiency and
reduce the risk of contamination compared to manual sorting and counting.
[9] Sorting and counting pharmaceutical products: Factories that produce
small pharmaceutical products, such as pills or tablets, can use coin sorting and
counting machines to sort and count these products. This can improve accuracy
and reduce errors compared to manual counting.
Page | vii
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
2. LITERATURE REVIEW
2.1 Introduction
This chapter includes the development of the coin operated machine from its
early invention until the latest modern today. This chapter has also discussed the
concept and theories of the coin operated machine to do the coin counting and
sorting process. Analyzing and understanding from the literature review is
important because it acts as the guidance for the project.
2.2 Coin Discrimination
In the structure of coin discriminators, it contains the structure and part like a
sensor for distinguishing coin, coin entrance, anvil, coin tubes and electronic
circuit. For the method of activity, the coin is supplemented to the coin opening
and through the coin way at that point goes through the sensor which is situated
along the coin way to quantify the coin’s physical properties. The properties of
coins like measurements, weight, elasticity, conductivity, and dropping time are
estimated dependent on the sensor utilized in the coin discriminator. For most of
the part, sensors are used to improve the utilization, which are electromagnetic
sensor, attractive sensor, acoustic sensor, and optical sensor. The most
ordinarily sensor that can be found in the regular coin discriminator is the
Electromagnetic sensor. This sensor is normally the inductive sensor or Hall
Effect sensor. The lasting magnet is typically placed on the coin way and the
area of the attractive sensor is straightforwardly inverse to the perpetual magnet.
A consistent attractive transition and attractive field quality is produced over the
coin way. At the point, when the coin goes and experiences the way, the coin
will differ the attractive motion thickness so that the first type of the attractive
motion thickness in the space is changed. This subsequent determined
difference in the attractive sensor and immediately instigated the electromotive
power (emf). The incited emf’s greatness is impacted dependent on the
metallurgical property like thickness and breadth of the coin. To distinguish the
pinnacle estimation of actuated emf, the attractive sensor is associated with an
electronic sensor. Since various sorts of coin will deliver explicit pinnacle
voltage, it very well may be utilized to check the legitimacy of coin division. [1]
2.3 Coin detection and recognition
Various techniques can be used to recognize and detect the coins of different
denominations. Techniques such as Circular Hough Transform, Artificial neural
networks, heuristics approach have been used for the recognition of coins.
parameters such as size, weight, material have been used as the parameter to
analyze and recognize the denomination of coin. The steps of coin recognition
to detect and recognize the coin is described. First, start the process and make
the data capturing or also the data acquisition. Next, initialize the image
segmentation process after the image is captured. The cropping of the image is
done after the coin image has been segmented. The features of coin images, for
example texture and edge detection has been extracted. The calculation of the
Page | 1
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
threshold value of grey scale image is obtained from the segmentation. [2]
2.4 Sensor-based coin counting machine
The sensor-based coin counting machine is created with the capability of
accepting a number of coins, counting the coins and also displays the value and
result to the end user. The coin counting machine is consisting of a coin
discriminator sensor, a coin hopper with a container for receive numbers of
coins, and a feed for accept the coins in the container to the coin discriminator
sensor, and a controller for calculate the total value of the coins which is
responsive from the coin discriminator sensor [2]
3. PROBLEM IDENTIFICATION
3.1 Problem Analysis:
Existing coin sorting and counting machines are often expensive and may not be
affordable for small businesses or individuals. Additionally, many of these
machines may not be customizable to handle specific coin denominations,
which can limit their usefulness. Another issue is the lack of accuracy of some
existing machines, which can lead to errors in the counting and sorting process.
These issues can lead to delays, lost revenue, and errors in financial reporting.
3.2 Proposed System:
The proposed system is a cost-effective, customizable, and accurate coin sorting
and counting machine that can be used by small businesses or individuals. The
machine will be designed to sort and count multiple coin denominations, have a
intermediate level of accuracy, and be easy to use and maintain. The machine
will use IR sensors to detect each coin and count it using an Arduino Uno
microcontroller. The machine will have a tray box under each slot to collect
coins, and servo motors that are coupled to the tray boxes to flip them 180
degrees to empty them once the IR sensor count reaches n coins. The LCD 16*2
display with I2C module will be used to display the number of coins counted.
3.3 Concept of the Project
The concept of the project is to develop a coin sorting and counting machine
that is affordable, customizable, and accurate. The machine will be designed to
Page | 2
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
automate the process of sorting and counting coins, which will reduce the
likelihood of errors and improve the efficiency of the process. The machine will
be easy to use and maintain and will be designed to handle multiple coin
denominations. The proposed machine will be a cost-effective solution for small
businesses or individuals who handle large volumes of coins on a daily basis.
By developing this machine, the project aims to improve the accuracy and
efficiency of coin sorting and counting processes and reduce the likelihood of
errors.
Page | 3
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
4. SENSOR SELECTION
4.1 Choosing criteria of selecting sensor
Sensor Requirements:
The sensors used in this machine must meet the following requirements:
3. Versatility: IR sensors can detect a wide range of coin types and sizes, which
can make them suitable for use in a variety of coin sorting machines. This can
include machines that sort coins by denomination, weight, size, or other
characteristics.
4. Reliability: IR sensors are generally reliable and have a long lifespan, which
can reduce maintenance costs and downtime. They are also less likely to be
affected by environmental factors such as dust, dirt, or moisture.
Page | 4
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
efficiency of the coin sorting process, while also reducing maintenance costs
and downtime.
To detect the coin movement and count the number of times they pass throw
slots we had to choose a fast response sensor and we choose
IR Infrared Proximity and Object Detection Sensor. And here are the working
ideas and specifications of this Module.
4.2 Working idea
The IR Infrared object detection Sensor Module works by emitting infrared light
and then detecting the reflected light. When an object, such as a coin, passes in
front of the sensor, it reflects some of the infrared light back to the sensor. The
sensor detects this reflected light and sends a signal to the microcontroller to
count the coin. The sensor uses an onboard comparator to convert the analog
signal from the photodiode to a digital signal.
• Specifications
1. When the module detects an obstacle in front of the signal, the green
indicator lights on the board level, while the OUT port sustained low
signal output, the module detects the distance 2 ~ 30cm, detection angle
35 °, the distance can detect potential is adjusted clockwise adjustment
potentiometer, detects the distance increases; counterclockwise
adjustment potentiometer, reducing detection distance.
2. The sensor active infrared reflection detection, target reflectivity and
therefore the shape is critical detection distance. Where the minimum
detection distance black, white, maximum; small objects away from a
small area, a large area from the Grand.
3. The sensor module output port OUT port can be directly connected to the
microcontroller IO can also be directly drive a 5V relay; Connection:
VCC-VCC; GND-GND; OUT-IO
4. Comparators LM393, stable.
5. The module can be 3-5V DC power supply. When the power turned on,
the red power indicator lights.
6. With the screw holes 3mm, easy fixed installation.
7. Board size: 3.2CM * 1.4CM
8. Each module has been shipped threshold comparator voltage adjusted by
potentiometer good, non-special case, do not adjustable potentiometer.
• How it works
− The sensing component in this circuit is IR photo-diode. More the amount of
InfraRed light falling on the IR photodiode, more is the current flowing
through it. (Energy from IR waves is absorbed by electrons at p-n junction of
IR photodiode, which causes current to flow).
− This current when flows through the 10k resistor, causes potential difference
(voltage) to develop. The magnitude of this voltage is given by Ohm’s law,
V=IR. As the value of resistor is constant, the voltage across the resistor is
Page | 5
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
− So, when any object is brought nearer to the IR LED, Photo-Diode pair, the
amount of IR rays from IR LED which reflects and falls on the IR
photodiode increases and therefore voltage at the resistor increases (from the
deduction in previous para).
− We compare this voltage change (nearer the object, more is the voltage at
10K resistor / IR photodiode) with a fixed reference voltage (Created using a
potentiometer).
− In the same manner, when the object moves farther from the IR proximity
sensor, the voltage at non-inverting input reduces and at some point becomes
less than inverting input, which causes OpAmp to turn off the LED.
Page | 6
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
}
void loop() {
int sensorValue = digitalRead(IRsensor); // read the value of the IR sensor
if (sensorValue == LOW) { // if the sensor detects an object
objectCount++; // increment the count
Serial.println(objectCount); // print the current count to the serial
monitor
if (objectCount == 25) { // if 25 objects have been counted
while (true) {} // enter an infinite loop to stop counting
}
delay(500); // wait for half a second to avoid counting the
same object twice
}
}
Page | 7
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
5. ACTUATOR SELECTION
5.1 Servo motor Selection
5.1.1 Working Principle
There are four main components inside of a hobby servo, a DC motor, a
gearbox, a potentiometer and a control circuit. The DC motor is high speed and
low torque, but the gearbox reduces the speed to around 60 RPM and at the
same time increases the torque. The potentiometer is attached on the final gear
or the output shaft, so as the motor rotates the potentiometer rotates as well, thus
producing a voltage that is related to the absolute angle of the output shaft. In
the control circuit, this potentiometer voltage is compared to the voltage.
coming from the signal line. If needed, the controller activates an integrated H-
Bridge which enables the motor to rotate in either direction until the two signals
reach a difference of zero.
A servo motor is controlled by sending a series of pulses through the signal line.
The frequency of the control signal should be 50Hz or a pulse should occur
every 20ms. The width of pulse determines the angular position of the servo and
these types of servos can usually rotate 180 degrees (they have a physical limits
of travel).
Choosing a motor with torque greater than the calculated value can provide
several benefits:
1. Safety Margin: By selecting a motor with a higher torque rating, you create a
safety margin, which can help prevent the motor from stalling or overheating
during operation. This can help ensure the longevity of the motor while
reducing the risk of damage or failure.
2. Load Variations: In real-world applications, the load may vary from the
Page | 8
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
expected value, which can cause the motor to stall or operate inefficiently. By
selecting a motor with a higher torque rating, you can account for load
variations and ensure that the motor can handle unexpected changes in the load.
Page | 9
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
Page | 10
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
Page | 11
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
6. METHODOLOGY&TESTING
Means way of implementing of idea and working principle of project. Project
starts with throwing coins which different in size across ramp which makes
angle of 30 degree and have three slots different in size by the way of coins.
Coins continue in moving under effect of gravity falling in the slot suit to, IR
sensor like a man wait and monitor falling coins to send signal to Arduino
which will count coins until reaching maximum number that we programmed to
move servo motor to empty boxes from coins and start a new cycle from
counting.
• We begin with designing the structure of machine considering the
dimensions of each component and areas which the components can work
throw it such as servo motor.
• We make a brainstorming as team members suggest different designs to
apply.
• At the end we had chosen the principled design.
• The body of the machine is made of cardboard as an initial design
because of its low coefficient of friction.
• Coins are CNC printed with dimensions of 17, 23, 30 mm form Acrylic to
be light to reduce Torque Required by servo then in future we can use
stronger servo to carry metal (real) coins.
• The Ramp was handmade and consists of three holes measuring 18, 24
and 32 mm.
• We follow trial and error method to choose angle of coin sorter (Ramp).
• After choosing the considered angle we begin to specify the heights of
slots and other dimensions.
• We started to write Arduino Code.
• We test the code working with sensors and servos without mechanism.
• The servo motor was connected to the boxes by interlocking the arm of
the motor with the box with wires.
• We finish the mechanical Design and start to test it.
• The sensors were placed on different dimensions of the slope due to the
angle of the slope, considering they are not in the trajectory of the boxes'
flips so as not to interfere with them to calibrate and perform the best
position for detecting coin we use trial-and-error method.
• An electric box was made to put all the electrical components inside, so
that the machine would be closed on itself without any user control over
the connections.
• This electrical box helps to give support for IR sensors and dimensions of
it depending on the height of sensors.
• We begin the test by testing how the mechanism works with hardware
and software components.
Page | 12
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
• Then we test the slot of smaller size which will have the biggest error of
detecting by IR sensors and how Servo motor will perform.
• We decided to use dual IR sensors in each slot to reduce errors.
• We tested the final design of the machine with new additions.
6.1 Working principle
− The working principle of the coin sorting and counting machine involves a
series of steps to accurately sort and count coins. Here's a breakdown of how
the machine works:
− Coins are fed into the machine through a ramp that has three holes of
different sizes. The coins fall through these holes and into designated slots
based on their sizes.
− Each slot has an IR sensor placed under it. When a coin passes over the
sensor, it sends a low signal to the Arduino Uno microcontroller, which
registers the coin and adds it to the count, the code continuously reads the
state of the IR sensors for each coin and increments the corresponding coin
count if either or both sensors detect a coin.
− The count is displayed on the LCD 16*2 display with I2C module, which
shows the number of coins counted for each denomination.
− Under each slot, there is a tray box that collects the coins. Once the IR sensor
count reaches n coins, the servo motor coupled to the tray box flips it 180
degrees to empty the coins.
− Once the tray box is emptied, the counter is reset to zero, and the process
repeats itself for the next set of coins.
Page | 13
Helwan University
Faculty of Engineering, Helwan
Mechatronics Lab
Page | 14
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
6.3 Process
In this block diagram:
❖ Coin Ramp: This is the entrance of the machine where coins are fed into the
system. The ramp has three holes of different sizes that allow the coins to pass
through and be sorted according to their sizes.
❖ IR Sensors: There are Six IR sensors located under each hole on the ramp (2
under each Slot). Six sensors detect the presence of coins and send signals to
the microcontroller.
❖ Servo Motors: There are three servo motors attached to each tray box, which
flip the boxes 180 degrees once they are full of coins. The servo motors are
activated by signals sent from the microcontroller.
❖ Tray Boxes: There are three tray boxes located under each slot on the ramp.
These boxes collect the sorted coins, and once the IR sensors count 10 coins,
the servo motor flips the box 180 degrees, and the coins fall into a container.
❖ LCD Display: The LCD 16*2 display with I2C module displays the number of
coins counted for each denomination. The microcontroller sends signals to the
display to show the current count.
6.3.1 Counting
When a coin is inserted into this Arduino coin counter, it enters the dedicated path
as per the mechanical design and the respective IR sensor senses the coin and
gives LOW output value to the Arduino which can be read by the Digital pins of
Arduino. The IR sensors, which give LOW value, decide the coin value.
We are using 2 IR Sensors for each Slot to reduce error. If one of them or both
detects coin.
Here a 16x2 Alphanumeric LCD is interfaced with Arduino using an I2C module,
to display the number of coins inserted into the box.
After the complete setup and uploading the code, switch ON the DC power
supply. First, a welcome message will be displayed on the LCD and after a few
seconds, a screen with the number of all the available coins will be displayed on
Page | 15
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
LCD. In the beginning, it will show zero as we haven’t inserted any coins yet.
Next, insert any coin at the top of the machine. Now you will see the value of the
coin count must be updated on LCD. Then Insert multiple coins of different
values and check the count of the respective coins on LCD.
6.5 Software
• Arduino IDE.
• AutoCAD.
• SolidWorks.
• PROTEUS.
• TinkerCAD.
6.6 Making Structure for Coin Sorter
Step 1: Taking a cardboard sheet and marking for different coin sizes as shown in
the below figure. Then carefully cut the marked portions. Cutting of these
portions must be done accurately; otherwise, the project may not work perfectly.
Step 2: Place the above arrangement in a slope structure. After making the
arrangement, we check it by inserting different coins on the slope to ensure that
the arrangement is perfectly working. If the coin is not inserting properly, then
slightly increase the size of the hole according to coin and recheck until
successful operation.
Step 3: Place the IR sensors near the output path of individual coin Here, IR
Page | 16
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
sensors are placed at different output paths of the coin sorting machine to sense
the coins. When a coin is inserted into this Arduino coin counter, it enters the
dedicated path as per the mechanical design and the respective IR sensor senses
the coin and gives LOW output value to the Arduino which can be read by the
Digital pins of Arduino. The IR sensor, which is giving LOW value, decides the
coin value. Here a 16x2 Alphanumeric LCD is interfaced with Arduino using an
I2C module, to display the number of coins inserted into the box. This LCD can
also be connected to Arduino directly without using the I2C module, but this
requires a greater number of connections. So to make it simpler, an I2C module is
used along with LCD, which only uses 2 pins, i.e. SCL, SDA for connecting LCD
with Arduino. For powering the Servos, a 5VDC, 2 AMP AC-DC adapter is used,
which can be directly connected to the power jack of Arduino.
Page | 17
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
Page | 18
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
6.8 Code
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Servo.h>
void setup() {
// Initialize the IR sensors
pinMode(IR1A_PIN, INPUT);
pinMode(IR1B_PIN, INPUT);
pinMode(IR2A_PIN, INPUT);
pinMode(IR2B_PIN, INPUT);
pinMode(IR3A_PIN, INPUT);
pinMode(IR3B_PIN, INPUT);
Page | 19
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
lcd.print("Welcome to the");
lcd.setCursor(0, 1);
lcd.print("Coin Sorting Machine");
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Sorting elements:");
void loop() {
// Read the state of the IR sensors for coin 1
int ir1AState = digitalRead(IR1A_PIN);
int ir1BState = digitalRead(IR1B_PIN);
// Increment the coin count if either or both sensors detect a coin
if (ir1AState == LOW || ir1BState == LOW) {
coinCount1++;
Serial.print("Coin count for tray 1: ");
Serial.println(coinCount1);
// Update the LCD display with the current coin count for coin 1
lcd.setCursor(3, 1);
lcd.print(" "); // clear previous count
lcd.setCursor(3, 1);
lcd.print(coinCount1);
// Print the current coin count for tray 1 in the serial monitor
Serial.print("Coin count for tray 1: ");
Serial.println(coinCount1);
// Delay to prevent multiple counts for the same coin
delay(500);
}
Page | 20
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
// Read the state of the IR sensors for coin 3
int ir3AState = digitalRead(IR3A_PIN);
int ir3BState = digitalRead(IR3B_PIN);
// Increment the coin count if either or both sensors detect a coin
if (ir3AState == LOW) {
coinCount3++;
// Update the LCD display with the current coin count for coin 3
lcd.setCursor(11, 1);
lcd.print(" "); // clear previous count
lcd.setCursor(11, 1);
lcd.print(coinCount3);
// Print the current coin count for tray 3 in the serial monitor
Serial.print("Coin count for tray 3: ");
Serial.println(coinCount3);
// Delay to prevent multiple counts for the same coin
delay(500);
}
// Check if the coin count for any tray has reached the threshold
if (coinCount1 >= COINS_PER_TRAY) {
// Flip the tray and reset the coin count
servo1.write(180);
delay(1000);
servo1.write(0);
coinCount1 = 0;
// Update the LCD display to clear the coin count for coin 1
lcd.setCursor(3, 1);
lcd.print(coinCount1);
}
Page | 21
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
Page | 22
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
Figure 12: First Modeling Design we created Figure 13:Second Modeling Design
Page | 23
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
Page | 24
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
Page | 25
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
𝑑𝜃 1
𝜔(𝑡) = , 𝜃 = ∫ 𝜔 𝑑𝑡 , 𝜃(𝑠) = 𝜔 (5)
𝑑𝑡 𝑠
𝐽𝑠𝜔 + 𝑇𝑓 = 𝑇𝑔
𝑁𝑒𝑔𝑙𝑒𝑐𝑡𝑖𝑛𝑔 𝑇𝑓 , 𝑇𝑔 = 𝐽𝑠𝜔
𝐽𝑠𝜔 = 𝐾𝑡 ∗ 𝐼 = 𝑇𝑔
1
𝐼 = 𝐽𝑠𝜔
𝐾𝑡
1 2
𝐹𝑟𝑜𝑚 𝑒𝑞. 2 U = (s J𝜔L + sJr𝜔 + K e K t 𝜔)
Kt
Now factoring ω
𝜔
𝑀(𝑠) = = 𝐾𝑡 (𝑠 2 𝐽𝐿 + 𝑆𝐽𝑟 + 𝐾𝑒 𝐾𝑡 )
𝑈
1 𝜃 𝐾𝑣
𝑀(𝑠) = , =
(𝐾𝑒 (𝑠𝑇𝑚 + 1)(𝑠𝑇𝑒 + 1)) 𝑉 (𝐾𝑒 𝑆(𝑠𝑇𝑚 + 1)(𝑠𝑇𝑒 + 1))
𝐽𝑟 𝐿
𝑊ℎ𝑒𝑟𝑒, 𝑇𝑚 = 𝑎𝑛𝑑 𝑇𝑒 =
𝐾𝑒 𝐾𝑡 𝑟
The transfer function can be used to analyze the dynamics of the servo motor
system and design appropriate control strategies to achieve the desired
performance. For example, a proportional controller can be used to adjust the
PWM signal based on the difference between the desired position of the traybox
Page | 27
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
Now let's move on to the coin counting stage. We can use IR sensors to detect
the presence of each coin in its respective slot. Assuming that the IR sensors are
positioned x cm below the ramp, we can calculate the time it takes for each coin
to reach the sensor as follows:
𝑡 = 𝑠/𝑣𝑖
8.3 IR sensor
Let's assume that you are using a phototransistor as the IR sensor. The
phototransistor is reverse-biased and connected in series with a resistor, and the
voltage across the resistor is measured to detect the presence of a coin. When a
coin is present, it reflects the infrared light emitted by the IR LED and causes
the current through the phototransistor to increase, which in turn causes the
voltage across the resistor to increase. This voltage can be measured and used to
detect the presence of a coin.
where Vout is the output voltage of the sensor, Vcc is the supply voltage, Iphoto
is the current through the phototransistor, and R is the value of the resistor.
Page | 29
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
9. PROBLEMS FACED
One of the biggest problems we faced is the problem of designing the project
structure Where we encountered.
• The problem of determining the slope angle of the ramp.
• The problem of locating the sensor.
• The problem of determining the path of coins from the ramp to the box.
• The design was not fully compatible in the first and second time, so we used
the method of trial and error until we reached a suitable design to reduce the
speed of the coins when they pass through the sensor and make a way for
them to reach the boxes and also to hide all connections and electrical
components.
• The servo motor consumes a lot of current, while the Arduino Uno does not
provide more than 40 mA, so we needed to connect the 3 servo motors to an
external power source.
• We discovered after research that if servo is connected to external power
supply and we need to control it using Arduino we should connect GND of
supply to GND of Arduino
• Occasionally the IR sensor doesn’t read coin falling put 2 IR sensor to cover
all displacement that coin across to.
• Finishing of collecting edges and parts thus poor look: make a new model
and covered parts which join to other by wax by welding tape.
• Some parts are separated from its joining: add a second layer to strength
joining edges.
• In Coding LCD was having Fastest Response as IR detect Coin So LCD
code Should have inserted into if condition of Counting to avoid delay.
• The IR sensor Very fast time response so to avoid multiply counting of
single coin we used function delay with delay of output signal with 500ms
(0.5 s).
Page | 30
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
Before
After
Before
After
Page | 31
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
Page | 32
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
- Knowing the places through which coins may pass, and thus
placing the sensor in front of it.
- And with experience stability is achieved in the place shown in
the system
3- The problem of coins falling out of the box allocated to them is one of the
most difficult problems that we faced in building the final structure of the
system, so we tried as much as possible to reduce the percentage of this
error by:
- Determine the path of the coin from its fall from the slot
designated for it through the sensor to pick it up to its box by
placing many small pieces and edges to force the coin to follow
this path and reduce its speed, which reduces the reasons for its
exit from the box.
11. CONCLUSION
The coin sorter objective is to save time where huge collections of coins are
stored and periodically valued. The proposed model can be extended to any
type and size of coin to value the time value of the individual. The proposed
system improves accuracy and effectiveness. The proposed coin sorting
methodology and model results with exactness in determining the value of the
coin and sorting the same. The fundamental challenging issues are in identifying
and sorting various small size coins universally. This can be addressed with
the help of picture sensor in the start of the slide and having servo engines that
are constrained by Arduino, so the coins don't blend out and out. Further this
work can be expanded by developing automated system by using huge data of
the coins at various position to improve the sorting efficiency and effectiveness
using machine learning algorithm to make the coin sorting system smart
enough.
Page | 33
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
4. Under each tray box we can use Load cell to detect the weight of coins as
additional counting mechanism of empty process.
9. User interface: Improving the user interface of the coin sorting machine can
make it easier to use and reduce the likelihood of errors. This can include the
addition of a touch screen display, intuitive software, and user-friendly
controls.
Page | 34
Helwan University
Faculty of Engineering, Mataria
Mechatronics Lab
13. REFERENCES
[1] Annamalai, Paramasivam & Vidhushini, Prabhu & Arunprakash, N &
Srinivasan, S & Kakulapati, Vijayalakshmi & Subramanian,
Panneerselvan. (2021). Design and Modelling of Coin Sorting Machine.
8202-8208.
[3] Prashanna Rangan R (2018), Machine Vision Based Coin separator and
Counter, Recent trendsin Sensor research and Technology, 5(1), 24-30.
[4] Tesfamikael, Hadish & Fray, Adam & Mengsteab, Israel & Semere,
Adonay & Amanuel, Zebib. (2021). Construction of Mathematical Model
of DC Servo Motor Mechanism with PID controller for Electric Wheel
Chair Arrangement. Journal of Electronics and Informatics. 3. 49-60.
10.36548/jei.2021.1.005.
Page | 35