You are on page 1of 8

Republic of the Philippines

Samar State University


College of Engineering
ECE 514M

A Final Requirement for ECE 514M


(Basketball Arcade)

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.

Proximity Sensor - A proximity sensor is a sensor able to detect the presence of


nearby objects without any physical contact. A proximity sensor often emits an
electromagnetic field or a beam of electromagnetic radiation (infrared, for
instance), and looks for changes in the field or return signal.

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.

LED - A light-emitting diode (LED) is a two-lead semiconductor light source. It is


a pn junction diode that emits light when activated.

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

Material Amount Quantity Total


Arduino P 650.00 4 P 2600
Proximity Sensor P 500.00 2 P 1000
Coin slots P 178.00 2 P 356
Connecting wires P 7.50 100m P 750
LEDs P 5.00 103 P 515
Resistors P 1.50 28 P 42
12-V Transformer P 120.00 1 P 120
Diodes P 5.00 4 P 20
Regulators P 35.00 1 P 35
Capacitors P 40.00 1 P 40
PCB P 46.00 1 P 46

Mechanical

Material Amount Quantity Total


Plywoods -- -- -----
Nylon Tie P 25.00 1 P 25
Shelf Brackets P 10.00 4 P 40
Paint Spray P 120.00 1 P 120
Flexible Hose P 6.00 6 P 36
Nails P 40.00 1 P 40
Locks P 25.00 2 P 50
Stud Bolt P 3.00 35 P 105
Buzzers P 85.00 2 P 170
Relay P 35.00 2 P 70

Miscellaneous

Material Amount Quantity Total


Soldering Lead P 12.00 10 P 120
Electrical Tape P 40.00 1 P 40
Balls P 70.00 6 P 420

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 (timer > 0){


if(digitalRead(sensor)==LOW) {
score++;

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 ();
}

You might also like