Professional Documents
Culture Documents
Submitted by:
Aboganda, Al Rafic E.
Aparici, Archie S.
Baylon, Lawrence Brusco C.
Cafe, Felipe B. III
Castillo, Paulo S.
Cioco, Jacob M.
Conge, Leslie R.
Dabuet, Breganne B.
Mastelero, Ronna Mae T.
Mujeres, Cleider Rey B.
Submitted to:
Engr.Adrian U. Gadin
Instructor
Introduction:
This project aims to apply the theories we have learned in our 5 years of studying
as an Electronics Engineering Student here in Samar State University, from the basic
electronics, the logic gates and up to control systems. This is a simple illustration on how
the technology works today; the automation of things through sensors. We were thinking
of a project that is electronics-related to apply our knowledge and at the same time make
something that can raise a fund during certain events for the IECEP Organization, thus
formulating this project.
Methodology:
The above diagram is a simple representation on how the system works, once the coin slot
detect a five peso coin, it will send a signal to the Microcontroller Unit to start the system.
Once the system have started, it will reset the score to zero, start the countdown timer
through the timer display, as well as allowing the proximity sensor to send a signal to the
system once it detects a ball within its area of detection, then, the Microcontroller Unit
will convey this information to the counter display incrementing it by one, meaning the
user have scored, once the 90 seconds timer is up, the system will be deactivated and the
buzzer will buzz for 5 seconds; the system now is at rest and just display the total score of
the user.
System Components:
Arduino (Microcontroller Unit) - is an open-source platform used for building
electronics projects. Arduino is consists of both a physical programmable circuit
board (often referred to as a microcontroller) and a piece of software, or IDE
(Integrated Development Environment) that runs on your computer, used to write
and upload computer code to the physical board.
Coin Slot - a slot through which coins can be inserted into a slot machine and will
create a start signal once a specified coin is inserted.
Power Supply - A power supply unit (or PSU) converts mains AC to low-voltage
regulated DC power for the internal components of the system.
Cost Analysis
Control System
Mechanical
Miscellaneous
TOTAL P 6,760.00
Arduino IDE Codes:
For Counter
//Library
#include "SevenSeg.h"
//Seven Seg
SevenSeg disp (10,9,8,7,6,11,12); //Defines the segments A-G: SevenSeg(A, B, C, D, E, F,
G);
const int numOfDigits =2; //number of 7 segments
int digitPins [numOfDigits]={5,4}; //CC(or CA) pins of segment
//Constants
const int coin = 2;
const int buzzer = 3;
const int dotPoint1=A0; //left digit
const int dotPoint2=A1; //right digit
//Variables
String number="90";
int digit1=0;
int digit2=0;
int start, change, set;
int setPoint=0;
int countdown;
//Useful flags
boolean countFlag=false;
void setup()
{
pinMode(coin, INPUT_PULLUP);
pinMode(buzzer, OUTPUT);
pinMode(dotPoint1, OUTPUT);
pinMode(dotPoint2, OUTPUT);
digitalWrite(buzzer, LOW);
//Defines the number of digits to be "numOfDigits" and the digit pins to be the elements of
the array "digitPins"
disp.setDigitPins ( numOfDigits , digitPins );
//Only for common cathode 7segments
disp.setCommonCathode();
//Control brightness (values 0-100);
disp.setDutyCycle(60);
disp.setTimer(2);
disp.startTimer();
}
void loop()
{
//Read buttons state
start = digitalRead(coin);
//Start counting...
if (start == LOW && setPoint==0
){
delay(500);
if (!countFlag){
countFlag=true;
countdown = number.toInt();
}
else{
countFlag=false;
}
}
//////////Counter Control///////////
if (countFlag){
if (countdown>0 && countdown<=10){
countdown--;
delay(1000);
disp.write("0"+String(countdown));
}
else if (countdown>10){
countdown--;
delay(1000);
disp.write(String(countdown));
}
else if (countdown==0){
disp.write("00");
digitalWrite(buzzer, HIGH);
delay(5000);
digitalWrite(buzzer, LOW);
delay(500);
disp.write(" ");
delay(500);
disp.write("EE");
delay(500);
disp.write(" ");
delay(500);
disp.write("CC");
delay(500);
disp.write(" ");
delay(500);
disp.write("EE");
delay(500);
disp.write(" ");
delay(500);
countFlag=false;
}
}
else{
disp.write(number);
}
}
ISR( TIMER2_COMPA_vect ){
disp.interruptAction ();
}
For Timer
//Library
#include "SevenSeg.h"
//Seven Seg
SevenSeg disp (10,9,8,7,6,11,12); //Defines the segments A-G: SevenSeg(A, B, C, D, E, F,
G);
const int numOfDigits =2; //number of 7 segments
int digitPins [numOfDigits]={4,5}; //CC(or CA) pins of segment
//Constants
const int coin = 3;
const int sensor = 2;
const int dotPoint1=A0; //left digit
const int dotPoint2=A1; //right digit
//Variables
int score=00;
int digit1=0;
int digit2=0;
int start, change, set;
int setPoint=0;
int countdown;
int timer = 0;
//Useful flags
boolean countFlag=false;
void setup()
{
Serial.begin(9600);
pinMode(coin, INPUT_PULLUP);
pinMode(sensor, INPUT);
//Defines the number of digits to be "numOfDigits" and the digit pins to be the elements of
the array "digitPins"
disp.setDigitPins ( numOfDigits , digitPins );
disp.write("0"+String(score));
//Only for common cathode 7segments
disp.setCommonCathode();
//Control brightness (values 0-100);
disp.setDutyCycle(60);
disp.setTimer(2);
disp.startTimer();
}
void loop()
{
Serial.println(score);
int insertcoin = digitalRead(coin);
if (insertcoin==LOW){
delay(500);
if(!countFlag){
countFlag=true;
timer = 90;
score=00;
}
else countFlag=false;
}
if (score<10){
disp.write("0"+String(score));
}
else disp.write(String(score));
delay(1000);
// If no signal print collision detected
}
else{
score=score;
if (score<10){
disp.write("0"+String(score));
}
else disp.write(String(score));
}
timer--;}
else{
countFlag=false;
if (score<10){
disp.write("0"+String(score));
}
else disp.write(String(score));
}
}
ISR( TIMER2_COMPA_vect ){
disp.interruptAction ();
}