Counting/Sorting Machine

 

About the device:

Money counter is a device which can count the number of coins and cash. Also it can sort the coin of different value. Let suppose we have 10 pcs of each coin (1Rs, 2Rs, 5Rs, 10rs), now we have to put all the coins together in the coin inlet tray. Within seconds it will sort all the coins and show the final number of each coin on the screen. Similarly in case of cash it will count the number of cash but not sort the different denominations.





Code:

#include <LiquidCrystal_I2C.h>

#include <LcdKeypad.h>

#include <LiquidCrystal.h>

#include <Wire.h>

#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,16,2);

int f1=0,f2=0,f3=0,f4=0,f5=0;

int c1=0,c2=0,c3=0,c4=0,c5=0;

void setup()

{

lcd.backlight();

lcd.setCursor(0,0);

lcd.print(" ARDUINO BASED ");

lcd.setCursor(0,1);

lcd.print(" COIN SORTING ");

delay(2000);

lcd.clear();

}

void loop()

{

int s1=analogRead(A0);

int s2=analogRead(A1);

int s3=analogRead(A2);

int s4=analogRead(A3);

int s5=analogRead(A4);

lcd.setCursor(0,0);

lcd.print("1: 2: 5: 10 cash");

if(s1>=200 && f1==0)

{

f1=1;

}

else if(s1<200 && f1==1)

{

f1=0;

c1++;

}

if(s2>=200 && f2==0)

{

f2=1;

}

else if(s2<200 && f2==1)

{

f2=0;

c2++;

}

if(s3>=200 && f3==0)

{

f3=1;

}

else if(s3<200 && f3==1)

{

f3=0;

c3++;

}

if(s4>=200 && f4==0)

{

f4=1;

}

else if(s4<200 && f5==1)

{

f4=0;

c4++;

}

if(s5>=200 && f5==0)

{

f5=1;

}

else if(s5<200 && f5==1)

{

f5=0;

c5++;

}

lcd.setCursor(0,1);

lcd.print(c1);

lcd.setCursor(3,1);

lcd.print(c2);

lcd.setCursor(6,1);

lcd.print(c3);

lcd.setCursor(9,1);

lcd.print(c4);

lcd.setCursor(12,1);

lcd.print(c5);

}


Ref:Arduino.org.in and its examples, circuitdigest.com/Arduino_projects, Exploring Arduino: Tools and Techniques for Engineering Wizardry by Jeremy Blum


©Muzafer|Saad Ahmed|Shinas

Comments

Popular Posts