Automated Baby-Foot Table Simplified

by MarianeShtly in Circuits > Arduino

568 Views, 0 Favorites, 0 Comments

Automated Baby-Foot Table Simplified

IMG-1559.jpg

In the MECA-Y-403-Mechatronics 1 course given in VUB/ULB Electromechanical Mechatronics master 1 program, Students got the chance to perform a real life project which is building a robot that performs a specific task. They are provided with multiple choices or asked to choose their own. Out of the proposed projects, the choice in this report is the Automated Baby-foot table simplified.

The Football table, also known as baby-foot, is an enjoyable game that requires a minimum of two players in opposing teams to move rods with player dummies. Usually when a football table is played, you need at least two players in order to maneuver the rods of each team.

Like in real life football games, the goal of the players is to kick the ball past the goalkeeper and score a point for the team. But the main aspect of the game that we are stressing on is that it is not meant to be played alone. It is a disappointment for football table fans that they always need a companion to practice their favorite game. The solution is to create an automated system that will play against the human player making it a 1-player game.

Table of Contents

2.Project Motivation

3.Project Working Modes/Functionality/Requirements

4.Conceptual Design

5.High-Level Design / Embodiment Design

6.Mechanical Systems

7.Circuitry & Sensors

8.Software

9.Integration Guide

10.Demo Project Show + Quick Start Guide

11.Review Your Project Critically

12.Sustainability

13.Bill Of Materials

14.Present Your Team

15.Project Repo

16.Annex(Calculations)

Project Motivation

Screenshot 2022-12-31 000836.png

The baby-foot table game is a very popular game where players from different age ranges can play this game and enjoy it. Having an actuated football table to play against the person is really attractive as an Arcade game in game-centers and bars. Teenagers and adults can just pass by and play this game without the need for any company, just alone.  An actuated football table can be also bought as an enjoyable game at home, mostly for the people that do it as a hobby or just like to enjoy playing it in their work breaks, after dinner, or at any free time. 

Rebuilding from sketch a whole project was a real challenge for the group. We are big fans of football games. Building it during the World Cup excited us further. 



Project Working Modes/functionality/requirements

Screenshot 2022-12-29 165144.png

This project have mainly 3 functions : Detect the trajectory of the ball, translate the goal keeper and shoot the ball. This implies a set of requirements to consider while designing arcade automated football gameplay to suit our human customers as much as possible.

When the ball is shot by the human player, the system should detect it and predict its trajectory in order to intercept it by translating the goalkeeper at an exact position then shooting back the ball. 

The customer should be able to play this game in places like his room or in his living room. The geometry of the project should therefore not exceed a limit. The mechanism should also be able to ensure the two motions of the goalkeeper ; translational and rotational motions. It also requires a mechanism to transmit the motion from the actuators to the goalkeeper. In order to power the motors, our prototype needs power supply. Naturally, safety, cost and maintenance requirements are also elements to consider. All of those requirements have not the same level of importance or the same flexibility of tolerance.


Conceptual Design

actuator choice.png
Screenshot 2022-12-26 030307.png
Screenshot 2022-12-29 164922.png

This section is dedicated to identify the main problem of the project from the requirement list in order to design concepts that achieve the requirements.

The chart below summarizes the problem of the project. The main problem is to implement a system that can detect the position from which the ball is coming from. Moreover, the system must have a short response time. In fact the goal keeper must react quickly after detecting a signal in order to intercept the ball. This constraint will be approached with the electronic part of the project.

Both movements of the goalkeeper should be provided by a mechanisms with actuators. The project needs supply, so it should be connected to an electricity plug or includes a battery.

The prototype should also be recyclable.

The first feature is to detect the trajectory of the ball with sensors. There are many ways to perform this according to the sensor. We have a choice between photoresistors, ultrasonic sensor, Lidar sensor, touch sensor, InfraRed sensor, GPS tracker and camera vision system. The cheaper ones with good sensitivity are the photoresistors. The advantages of the photoresistors are that it is possible to place them in a small hole in the field without disturbing the trajectory of the ball unlike the touch sensor and they are easy to manipulate.  

To ensure the motions of the goalkeeper, a mechanism with two motors should be implemented. One for the translation motion and another one for the rotational motion. 

The motors could be stepper motor, servo-motor or DC motor. For this application it is better to use stepper-motors for both motions because it is possible to vary the rotational speed unlike the DC-motor which operates at constant speed. It can reach high speed and it is suitable for our application requirements. 

Since the motors provide only rotational motion, a mechanism is needed in order to transmit rotational motion into translational motion. It is possible to implement Lead Screw Mechanism, Belt-Driven pulley Transmission or again Crank-Shaft Mechanism. The mechanism should provide a fast movement, which will not be the case for Lead Screw Mechanism. The friction loss of the Crank-Shaft Mechanism is very high. The best choice for our application is Belt-Driven pulley Transmission.

To resume, the prototype uses photoresistors for detecting the ball’s trajectory , two stepper motors for the two motions and Belt-Driven pulley transmission mechanism in addition to a limit switch that initializes the goalkeeper position.

The final prototype doesn't have an electricity plug and a start button.



High-Level Design / Embodiment Design

resourceProvider.ashx.png
Screenshot 2022-12-28 153529.png

Block Diagram:

The Block Diagram for the mechanism and electronics combined with mechanism is attached in the media above. It gives a clear view of how all parts are connected in order to form our whole system.

Assembly of Subsystems:

The subsystems are assembled together in order to create the Full Mechanism. The Subsystems are(also shown clearly in the Block Diagram Attached):

1-Stepper nema-17-42a02c-1 Motor for Rotation Support:

This part is composed of the motor responsible for rotation and it's support pieces. This motor will be driven by pulley-belt transmission mechanism in order to perform both the rotation of the goalkeeper and remain able to translate.

2- Connection between Stepper nema-17-42a02c-1 Rotation and Translation Motors:

The Connection between both motors is established by using sliding linear bearings on rod. To fixate the bearing to rotation motor, the 3D printed Linear bearing support is connected to the downward side of the motor support with M4x20mm screws. It is good to note that shorted screws can be used but there weren't any available, so nuts where used to compensate the part left of the screw which was still unscrewed. In addition, to connected this part to the translation motor, we implement a critical part to lock the belt in its place. Therefore, when the translation motor rotates the timing pulley, it will translate the belt which is connected to the belt lock which is connected to the linear bearing support. Linear bearing Support is also connected to the rotation motor. Thus, the translation and rotation are communicated.

3-Tensioning of Belt:

This is achieved by fixating the Fixators for Rod Supports and then fixating pulley support to it with a screw. The screw can be fastened to the lock nut more to tension the belt more and vice versa.

4- Stepper nema-17-42a02c-1 Motor for Translation Support:

It includes fixing the translation stepper motor that is connected to the pulley holding the belt and translating it. The fixation is achieved by screw with the big supporting plate for the whole table, and of course the motor is fixated to it by its supporting design.

5-Baby-Foot and mechanism connection

The rotation motor connects to goalkeeper's rod by a flexible 5-8mm flexible coupling. Furthermore, the rod supports are fixated beside the table by their Support Fixators that is screwed to the huge plate supporting the table.

5-Electronics part

This part is concerned with fixating the limit switch and the photoresistor to the mechanism in a way photoresistors can detect ball position and limit switch initializes goalkeeper position. Unfortunately, due to time limit, the Electronics part remained uncovered. In addition, there were too many sensitive connections that we need to access often so we decided that we are gonna keep it uncovered instead of speeding up this part and ruining the connections. But, it is great to mention that our initial plan to cover this part was to place it under the field of the baby-foot table.

Mechanical Systems

Screenshot 2022-12-28 153103.png
Screenshot 2022-12-28 153118.png
Screenshot 2022-12-28 153147.png
Screenshot 2022-12-28 154548.png

Model Design on CAD software:

The full design modeling on Solid works is found in STEP 15: Project Repo

Manufacturing Processes for the parts and Materials Selection:

It is recommended to refer to Block Diagram to understand well what each part is.

1.Laser Cutting:

The material in this manufacturing process is mdf wood.

a. For motor Supports(Both Translation and Rotation)

  • Front Side(Shaft of motor on this side)
  • Left and Right sides
  • Back Sides
  • Downward Sides

b. Rods Support

In this part, laser cutting was used since all of the parts were of constant thickness. In addition, laser cutting is a speedy process and it is better for the environment that 3D printing .

2.3D printing:

The material in this manufacturing process is Generic PLA.

a. Pulley Support

  • Pulley Seat
  • Pulley Rod

b. Linear Bearing Support

c. Belt Lock

  • Upper part of Belt Lock
  • Lower part of Belt Lock

d. Supports Fixations

  • 2 hole Fixation
  • 4 hole Fixation

In this part, 3D printing was used since the parts must be detailed and cannot be produced with laser cutter since they aren't of the same thickness. The parts were small parts in a way to speed up the process of printing and waste less material on unwanted space. Thus, they do the required job with minimalistic size.

Circuitry & Sensors

Screenshot 2022-12-29 172450.png
Screenshot 2022-12-29 172503.png
Screenshot 2022-12-29 172515.png
Screenshot 2022-12-29 172900.png
Screenshot 2023-01-13 131621.png
Screenshot 2023-01-13 131540.png
Screenshot 2023-01-13 131601.png
Screenshot 2023-01-13 132158.png

a. photoresistor sensor (GL 5528) 

In this project, the main objective is to move the goalkeeper in order to catch the ball; for that we need to detect the position of the ball at the stadium and to predict its direction in order to move the goalkeeper in front of this direction. In order to realize the detection of the ball, we are going to use as sensor a photoresistor because it summarizes in it all the characteristics for the good functioning of our project ie a low cost, wide spectral ranges, easy implementation, static transfer ratio and high sensitivity. However, in order to be able to predict the direction of the ball, we will establish two lines of photoresistors in front of the goalkeeper and each line consists of 8 photoresistors. We know that to have a straight line we need two points so each photoresistor on the first line constitutes the first point and each photoresistor on the second line constitutes the second point. Therefore, once the ball passes over one of the photoresistors on each line, the direction can be predicted and the goalie will be moved simultaneously in front of this direction. This objective will be reached if we know how to collect the information that will be transmitted to us by the photoresistor in order to be able to move the goalkeeper to the desired place. For that we must know how a photoresistor works and that will be the object of our next paragraphs.  

a.1. definition:      

A photoresistor is a non-polarized electronic component whose ohmic value varies according to the brightness to which it is subjected. 

a.2. symbol  

As an electronic diagram, it is symbolized as shown in the figure below. And as we can see it is a non-polarized component consisting of 2 pins behaving like a resistor whose value decreases when the brightness increases and therefore the value increases when the brightness decreases. 

(Refer to Figure 1)

a.3. main features 

The main characteristic of a photoresistor is its resistivity-luminosity relationship. In fact, this gives the ohmic value of the photoresistor, depending on the light intensity to which it is subjected. However we will use this characteristic to our ends(purposes) ie the presence of a ball on a photoresistor will create darkness and the absence of the ball on a photoresistor will mark the presence of light; by this fact the new challenge will be to find the way to collect this information in order to communicate it to the two step motor which controls the goalkeeper (in order to move it to the right place). This way will be discussed in the next paragraph.     

(Refer to Figure 2)

a.4. How to connect a photoresistor sensor in an electronic assembly 

As we talked about in the previous paragraph, the goal of this section is to find a way to collect the information collected by the photoresistor on the stadium in order to control the two step motors that control the movement of the goalkeeper. This information that is nothing more than the variation of the value of the resistance of the sensor photoresistor in the presence of light or not. Knowing that a photoresistor is an electronic component with 2 pins whose ohmic value varies (the variation of the resistance is the information collected by the sensor) with the ambient brightness, a simple ohmmeter can measure this value, when this photoresistor is not connected to anything else. However, we wish to use it within an electronic assembly and it is not beneficial for us to use an ohmmeter because we will not be able to transmit this value (information) to the two step motor. In fact, we will have to find a roundabout way to find the value of this photoresistor. As the photoresistor behaves like a variable resistor, we prefer this solution which is to create a voltage divider bridge. We can then connect it in series with another resistor but of fixed value that we will connect both on Arduino board in order to collect the information of the photoresistor which is the variation of its resistance depending on the detection of the ball or not. By the above, we can illustrate the connection of a photoresistor in the way below. 

(Refer to Figure 3)

Vs represents here the signal (voltage) collected by the Arduino because it is a function of the value of the resistance of the photoresistor which is the information necessary to move the goalkeeper.  

       In the first case Vs=(5*R)/(R+Rph)     and   in the second case Vs==(5*Rph)/(R+Rph) 

Where Rph is the resistance of the photoresistor which varies in the presence of light or not. 

a.5. connection of a photoresistor on an Arduino board, with voltage reading Vs 

The assembly below allows to determine the ohmic value of a photoresistor, connected within a voltage divider bridge, by reading the voltage of the latter, via an Arduino analog input. This value will be communicated in real time to the two stepper motors in order to move the goalkeeper to the right place to catch the ball. 

(Refer to Figure 4)

This project contains many electronics component: 16 photoresistors, 16 1,2kΩ resistance for each photoresistor, 2 stepper motors, 2 A4988 Driver module for each Stepper motor, 1 limit switch and 1 power supply. To arrange all the connections that need to be made, it was necessary to divide it in two protoboards. The biggest one is used to connect all the photoresistors to their resistance. Each photoresistor contains 2 pins. One of them must be connected to 5V. the second pin is connected simultaneously to the 1,2kΩ resistance which is connected to the ground, and the other pin is connected to the the analog pin of the Arduino. 

(Refer to Figure 5)

Reference : How to Use a Photoresistor - Arduino Project Hub 

The second smaller protoboard contains the 2 drivers which are used to control the steppers motors. Each step motor has one functionality, one for rotating and the other for translating the goalkeeper.  

(Refer to Figure 6)

Reference : In-Depth: Control Stepper Motor with A4988 Driver Module & Arduino (lastminuteengineers.com)  

Each Drivers has 16 pins in total. by referring to the pin numbering in the above diagram, pin 10 and 9 must be connected to 5V and ground respectively. these pins are used to power the internal logic circuit of the driver. 

 Pins 16 and 15 are used to supply power to the motor. Since the voltage that an Arduino can supply is limited to 5V, it is essential to use a power supply in order to have a good functioning of the motors. a voltage of 8V was optimal in our case.  

The driver also has 2 control input pins which are pins 7 and 8. Pin 7 (STEP) is used to control the microsteps of the motor. each HIGH pulse sent to this pin via the Arduino code drives the motor according to the delay defined between each steps. The lower the delay is, the faster the motor will spins. Pin 8 controls the direction of rotation of the motor. By setting pin 8 to HIGH in the code, the motor rotates in the clockwise direction, while setting it to LOW, the motor rotates in the anti-clockwise direction. For the motor in charge of the translation, we connected the STEP pin to pin 2 of the Arduino and the DIR pin to pin 3 of the Arduino. For the rotation motor, the STEP pin was connected to pin 8 of the Arduino and the DIR pin to pin 9. 

Finally, pins 11 12 13 and 14 are output pins. They are supposed to be the link between the stepper motor and the driver. 

pins 2 3 and 4 are the micro step selections pins. they are used to configure the number of steps. if we are working in full step mode as we are, we can leave these 3

pins empty.  

(Refer to Figure 7)

b. Limit switch  

A limit switch is a mechanical device that requires physical contact of an object with the switch actuator to change the contact state (open/closed). 

In our project, it will allow us to define the limit of displacement of our goalkeeper to the left in order to recalibrate it to the center of the goal to avoid the accumulation of displacement errors in our code. 

(Refer to Figure 8)

Strategy:

Draw 1: 

Let’s assume that the ball will have to pass through 1 photoresistor in each line. In order to be able to stop the ball and prevent it from entering the goal, it is necessary to calculate the distance X (referring to the drawing above) that separates the destination of the ball from the center of the goal.  

By the property of similar triangles, we know that: 

(Refer to Figure 9)

P can be calculated by the same property: 

(Refer to Figure 10)

By substituting P in the first equation, we get our x: 

(Refer to Figure 12)

After calculating each x-distance for each of the possible photoresistor combinations, it is important to store this data in an efficient way in order to assign the goalkeeper the distance to be covered between the center of the goal and the trajectory of the ball after each shot of the player. 

as a first step, we decided to store in a square matrix of dimension 8x8 the distance X for each combination of 2 photoresistors, with in column the number of photoresistors of row 1 and in row the (number of photoresistors of row 2) -8 

Draw 2:  

However, it must be taken into account that the goalkeeper has a non-negligible width and that the foosball table at our disposition is relatively small with a limited size of the goal. It happens that for several different combinations of photoresistors, the goalkeeper can stop the ball with one and the same movement. 

Draw 3: 

So we set up 13 different positions for the goalkeeper, with position 7 being the middle one (the goalkeeper must not move), position 1 being the one on the far right and position 13 the one on the far left. We then made a more manual calculation (by drawing straight lines) to determine the position where the goalkeeper should be (and not anymore the distance X between the trajectory and the middle of the goal) according to all the possible combinations of the photoresistors. 

Draw 4 : 

we know that to move from the middle of the cages to its extremity (from position 7 to position k=1 or k=13), the number of steps the motor needs is stepsPerRevolution/2 where stepsPerRevolution is the number of steps needed for 1 revolution of the motor. as there are 6 positions between the middle and the extremities, the number of steps for each position k is given by this formula: 

(Refer to Figure 11)

Software

In order to simplify the implementation of the code as much as possible, we created 4 functions that we tested separately before assembling them together for the final code.  

Int line_one()/int line_two() :  

these 2 functions allow to return the photoresistor by which the ball passed for respectively the 1st and 2nd line of photoresistor. the integer which they return is the number of the photoresistor of each line. They have exactly the same structure and that's why we'll describe them as one for both functions.  

At the beginning of the function, the value that each photoresistor returns is read and stored in a variable for each sensor. This value will be compared to the calibration value that was measured at the beginning of the code in the setup for each photoresistor. When the ball rolls over one of the photoresistors, the value it returns is supposed to decrease. When the value that one of the photoresistors receives is decreased by 50 compared to the calibration value measured at the beginning of the game, it means that the luminosity has decreased significantly at this photoresistor, which means that the ball has passed over or near this sensor. the function will therefore return the number of the photoresistor in question. 

void Move_and_Kick(int line1,int line2) : 

this function is used to move the goalkeeper on the trajectory of the ball and make a rotation of 45 degrees in order to push the ball away from the goal. 

this function is used to move the goalkeeper on the trajectory of the ball and make a rotation of 45 degrees in order to push the ball away from the goal. it takes as argument line1 and line2 which are the numbers of the photoresistors that have detected the presence of the ball. thanks to these 2 arguments, the function will search in a matrix defined at the beginning one to which the goalkeeper has to move from his line point for the photoresistors line1 and line2. this value is an integer and will be stored in an internal variable K. if the value of K is less than or equal to 7, this means that the ball will arrive at a position to the left of the keeper. If it is higher than 7, the goalkeeper will then have to move to the right and the Dirpin will therefore be defined appropriately. The exact number of revolutions that the motor must do in order to position the keeper in the correct position is calculated and stored in the variable Z. The function will then turn the motor loaded with the proper translation so that the goalkeeper is positioned on the trajectory of the ball. He will then have to rotate the goalie to hit the ball to push it back. 

void Move_To_Limit() :  

this function will allow the keeper to place himself in the middle of the goal at the beginning of each game and after each stop. The goalie will move slowly to the right until the limit switch is hit. It will mean that the guard has reached the end of the field. we also calculated the exact number of revolutions that the goalie must perform in order to move from the end of the field towards the middle of the goal. Indeed, since we did not implement a system that allows us to detect the exact position of the keeper after each movement, we decided that the guard had to get back in the middle of this way in order to avoid an accumulation of error. 

in the code, limitSwitch.getState() corresponds to the state of the switch. if it is equal to 1, this means that the switch is not affected, while if it is equal to zero, the switch is affected. we have defined in the function a variable p. this is initialized to zero and will be equal to when the limitswitch is affected. when p is equal to 1, this will allow the code to exit the while loop and stop the slow translation of the guard to the right. this will give access to the following code which means the transfer of the keeper from the midfield to the middle of the goal.  

void loop() : 

thanks to the definition of all these functions above, this allows us to have a much lighter code in the loop. at the beginning of the code the variable q is initialized to zero, which means that the code will enter the first if condition and call the move to limit function. This is the first thing the goalie has to do at the beginning of the game, to stand in the middle of the cages. a faith that ends, the code will go out of the if function and will not return to it until the variable q is reinitialized to 1, that is to say when the guardian will have made a stop. After that, the code will wait for a photoresistor of each line to detect the presence of the bullet in its surroundings. When this is done, the code will enter the condition and will launch the move and kick function according to the 2 parameters line 1 and line 2. a faith this done, we consider that the guardian will have made a stop, we reinitialize the variable to zero so that the code can re-enter the first condition if and reinitialize the position of the keeper in the middle of the cages. 


Arduino Code:(Also Uploaded on the Drive Found in Step 15)

#include <ezButton.h>


ezButton limitSwitch(7);


const int LDR0 = 0;
const int LDR1 = 1;
const int LDR2 = 2;
const int LDR3 = 3;
const int LDR4 = 4;
const int LDR5 = 5;
const int LDR6 = 6;
const int LDR7 = 7;
const int LDR8 = 8;
const int LDR9 = 9;
const int LDR10 = 10;
const int LDR11 = 11;
const int LDR12 = 12;
const int LDR13 = 13;
const int LDR14 = 14;
const int LDR15 = 15;


int lightcalib0;
int lightcalib1;
int lightcalib2;
int lightcalib3;
int lightcalib4;
int lightcalib5;
int lightcalib6;
int lightcalib7;
int lightcalib8;
int lightcalib9;
int lightcalib10;
int lightcalib11;
int lightcalib12;
int lightcalib13;
int lightcalib14;
int lightcalib15;


int line1=50;
int line2=50;


const int dirPin = 2;
const int stepPin = 3;
const int stepsPerRevolution = 270;
const int dirPin2 = 10;
const int stepPin2 = 12;
//int y=0;
float z ;
// matrix that will be used to know which position the goal keeper should have to intercept the ball
int matrix[8][8] = {{0,0,0,0,0,0,0,0},
                    {12,13,0,0,0,0,0,0},
                    {1,6,12,13,0,0,0,0},
                    {0,1,4,8,13,13,0,0},
                    {0,0,0,1,4,11,13,0},
                    {0,0,0,0,1,1,7,11},
                    {0,0,0,0,0,0,1,3},
                    {0,0,0,0,0,0,0,7}};


int p = 0;
int q = 0;
int state;


void setup() {
  pinMode(LDR0, INPUT);
  pinMode(LDR1, INPUT);
  pinMode(LDR2, INPUT);
  pinMode(LDR3, INPUT);
  pinMode(LDR4, INPUT);
  pinMode(LDR5, INPUT);
  pinMode(LDR6, INPUT);
  pinMode(LDR7, INPUT);
  pinMode(LDR8, INPUT);
  pinMode(LDR9, INPUT);
  pinMode(LDR10, INPUT);
  pinMode(LDR11, INPUT);
  pinMode(LDR12, INPUT);
  pinMode(LDR13, INPUT);
  pinMode(LDR14, INPUT);
  pinMode(LDR15, INPUT);


 
  lightcalib0 = analogRead(LDR0);
  lightcalib1 = analogRead(LDR1);
  lightcalib2 = analogRead(LDR2);
  lightcalib3 = analogRead(LDR3);
  lightcalib4 = analogRead(LDR4);
  lightcalib5 = analogRead(LDR5);
  lightcalib6 = analogRead(LDR6);
  lightcalib7 = analogRead(LDR7);
  lightcalib8 = analogRead(LDR8);
  lightcalib9 = analogRead(LDR9);
  lightcalib10 = analogRead(LDR10);
  lightcalib11 = analogRead(LDR11);
  lightcalib12 = analogRead(LDR12);
  lightcalib13 = analogRead(LDR13);
  lightcalib14 = analogRead(LDR14);
  lightcalib15 = analogRead(LDR15);


  pinMode(stepPin, OUTPUT);
  pinMode(dirPin, OUTPUT);
  pinMode(stepPin2, OUTPUT);
  pinMode(dirPin2, OUTPUT);

  Serial.begin(9600);
  limitSwitch.setDebounceTime(50);


}


void loop() {
 
  limitSwitch.loop();
 


  if (q==0){
    limitSwitch.loop();
   
    Move_To_Limit(); // place the goal keeper in the center
   
    }
  line1 = line_one();  //read which photoresistors are in darkness in line 1
  line2 = line_two();  //read which photoresistors are in darkness in line 2


  if(line1 != 50 && line2 != 50){  // if photoresistors are touched
   
    line1 = 50;
    line2 = 50;
    Move_and_Kick(line1,line2);  // move to the right position and kick
    p=0;
    q = 0;
    Move_To_Limit();   // return in the center of the goal
    p = 0;
    q = 0 ;
   
    }
   
}


/*----------------------functions----------------------*/

// function that returns which photoresisor is in darkness in line 1
int line_one(){
  int LDRValue0 = analogRead(LDR0);
  int LDRValue1 = analogRead(LDR1);
  int LDRValue2 = analogRead(LDR2);
  int LDRValue3 = analogRead(LDR3);
  int LDRValue4 = analogRead(LDR4);
  int LDRValue5 = analogRead(LDR5);
  int LDRValue6 = analogRead(LDR6);
  int LDRValue7 = analogRead(LDR7);


 

 
  if (LDRValue0 <= lightcalib0 - 50){
 
     digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
     line1=0;
      }
  if (LDRValue1 <= lightcalib1 - 50){
   
     digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
     line1=1;
      }
  if (LDRValue2 <= lightcalib2 - 50){
   
     digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
     line1=2;
      }
  if (LDRValue3 <= lightcalib3 - 50){
   
     digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
     line1=3;
      }
  if (LDRValue4 <= lightcalib4 - 50){
   
     digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
     line1=4;
      }
  if (LDRValue5 <= lightcalib5 - 50){
   
     digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
     line1=5;
      }
  if (LDRValue6 <= lightcalib6 - 50){
     
     digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
     line1=6;
      }
  if (LDRValue7 <= lightcalib7 - 50){
     
     digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
     line1=7;
      }
 
 
    return line1 ;
  }


// function that returns the number of the photoresisor in darkness in line 2
  int line_two(){


  int LDRValue8 = analogRead(LDR8);
  int LDRValue9 = analogRead(LDR9);
  int LDRValue10 = analogRead(LDR10);
  int LDRValue11 = analogRead(LDR11);
  int LDRValue12 = analogRead(LDR12);
  int LDRValue13 = analogRead(LDR13);
  int LDRValue14 = analogRead(LDR14);
  int LDRValue15 = analogRead(LDR15);
 


 
 
  if (LDRValue8 <= lightcalib8 - 50){
   
     digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
     line1=8;
      }
  if (LDRValue9 <= lightcalib9 - 50){
     
     digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
     line2=9;
      }
  if (LDRValue10 <= lightcalib10 - 50){
     
     digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
     line2=10;
      }  


   if (LDRValue11 <= lightcalib11 - 50){
     
     digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
     line2=11;
      }
   if (LDRValue12 <= lightcalib12 - 50){
   
     digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
     line2=12;
      }
  if (LDRValue13 <= lightcalib13 - 50){
     
     digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
     line1=13;
      }
  if (LDRValue14 <= lightcalib14 - 50){
     
     digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
     line1=14;
      }
  if (LDRValue15 <= lightcalib15 - 50){
   
     digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
     line1=15;
      }
 
    return line2 ;
   
  }
// function that translate the goal keeper to the corresponding position and then rotate it to shoot the ball
void Move_and_Kick(int line1,int line2){  
  int k = matrix[line1][line2-8];


  if (k<=7){
    digitalWrite(dirPin, HIGH);
    z = (170/2)*(7-k)/6;
  }
  if (k>7){
    digitalWrite(dirPin, LOW);
    z = (170/2)*(k-7)/6;  
    }
  for(int x = 0;  x < z ; x++)
  {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(1000);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(1000);
  }
 
  digitalWrite(dirPin2, LOW);
  Serial.println("up");
  for(int x = 0; x < 200/4; x++)
  {
    digitalWrite(stepPin2, HIGH);
    delayMicroseconds(2000);
    digitalWrite(stepPin2, LOW);
    delayMicroseconds(2000);
  }
  Serial.println("pause");
 


  digitalWrite(dirPin2, HIGH);
  Serial.println("down");
  for(int x = 0; x < 200/4; x++)
  {
    digitalWrite(stepPin2, HIGH);
    delayMicroseconds(2000);
    digitalWrite(stepPin2, LOW);
    delayMicroseconds(2000);
  }
  Serial.println("leaving for");
 
  }

// function that place the goalkeeper at the center of the goal using a limit switch.
void Move_To_Limit() {


  Serial.println("past in move to limit");
 
 limitSwitch.loop();
  if(limitSwitch.getState()==0){
       p=1;
      }
 
  while(p==0){
    Serial.println("on the while");
    limitSwitch.loop();
    digitalWrite(dirPin, LOW);
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(5000);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(5000);
   
    state = limitSwitch.getState();
   
    if(state==0){


      p=1;
                   }            
  }
  digitalWrite(dirPin, HIGH);
   
    for(int x = 0; x < stepsPerRevolution; x++)
  {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(1000);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(1000);
  }
    q=1;
       
   }

Integration Guide

  1. Connect the Stepper nema-17-42a02c-1 rotation motor and Stepper nema-17-42a02c-1 translation motor to their supporting laser cut plates using M3x25 flat head screws to connect side to front and back sides and M4x5 to screw front side to the motors. All parts other than mentioned are made female-male connection, like Legos they only require a little force of hand to push them together. In addition, the design of the plates was made in a way to connect to their downward plate and remain fixated without the need of glue.
  2. Stepper nema-17-42a02c-1 translation motor is fixed on the huge plate supporting the whole assembly by M4x20 wood screws.
  3. Connect the Stepper nema-17-42a02c-1 rotation motor to the linear bearings using M4 x20 flat head screws: u can use shorted screw without the need of Nuts, but due to the non-availability of enough medium lengthened screws we decided to go with 20 mm length and add nuts to compensate for the unused screw part.
  4. Connect the linear bearing support by the already placed screws and then connect this support to the upper belt lock. place the GT2.5 timing belt inside the belt lock and then place the downward part and screw using M4x20 flat headed screws.
  5. place the belt on both GT2.5 timing pulleys. One pulley is fastened to the Stepper nema-17-42a02c-1 translation motor and the other is fastened to the pulley seat with placement of rod inside side holes.
  6. The pulley seat is fixated to the rod supports with M4x20 flat headed screws, M4 nut, and M3x5 screw.
  7. The rod supports are fixated to the huge plate supporting all baby-foot table using the 3D printed fixators and M4x20 wood screws. In addition using M4x20 flat head screws and hex M4 nuts to fix them vertically and keep them perpendicular. The other side as well but using fixator with 2 holes instead of the 4 holed one.
  8. Slide the rods to first rod supports, then to the linear bearings, and at the end to the other rod supports.
  9. Attach Limit Switch to the Translation Motor by using M2x5 wood screws. Place photoresistors in the holes of the field.

Demo Project Show + Quick Start Guide

Automated Baby-Foot Table Simplified
Funny Fail Before Fixing-Automated baby-foot Table Project(Watch till the end!)

Above you can find the youTube video for the Demo of the Automated baby-foot Simplified.

Also a funny fail before fixing( second video recommended by our supervisor)

Review Your Project Critically

Our prototype meets all the operating requirements of an automated table football. However, the requirements from an aesthetic, safety and optimizations' point of view were not finalized due to time constraints. 

 From an aesthetic and safety point of view, the electronic part (the two test boards, Arduino Uno, cable) had to be placed under the table football in order to avoid the player to be in permanent contact with the conductors and to disconnect them unknowingly which would lead to a malfunction of the prototype; Furthermore, the mechanical part (consisting of the two step motors, limit switch, pulley, belt, support, mechanism etc.) had to be entirely covered with a wooden device. 

 From an optimization point of view, we had to use a 12v battery with charger (in order to be able to play the game even in a place where there is no 220v plug to feed the power supply) instead of using a power supply which is physically bigger and takes more space. 

Sustainability

The two main aspects that we considered for the sustainability of the project are: being eco-friendly, and using materials with the capacity to last long without losing its performance or degrading. We used mostly recyclable parts, is important that the prototype was developed with a good impact on the environment. We chose mostly wood for realizing supports and parts using MDF, which is possible to recycle in a specific center. For linking together all subsystems we used SCREWS, which can be recycled selling them to metal recycling facilities. The electronic parts are more complex because you have to extract and divide all different components and metals, but you can bring them too to specific company for recycling. We used PLA (polylactic acid) through 3D printer for realizing supports of the rods or for fixing the belt to the motor. It is recyclable, but because it has a melting point that is lower than other types of plastics it isn’t usually recycled. The ball, the players and the Belt are made of PP (polypropylene) that can be recycled into many different types of products, including fibers for industrial materials, clothing, kitchenware and more. We used roads which are made of steel and therefore can be recycled without many issues.

Bill of Materials

Screenshot 2022-12-30 165754.png

 A very important aspect that we had to considered was the choice of materials used on the design of the prototype. We had to evaluate the best ratio between cost, availability, manufacturing process.

 Other than these prices we have to include the cost of manufacturing, time spent on the design, the electricity consumed for using the 3D Printer or the laser cutter. The assembly time can be estimated at 5h of work, with the laser cutter and 3D printer that need other 3h to print and cut all the parts that we used.

Present Your Team

Nora Laaroussi

Hey, my name is Nora, I got a bachelor’s degree in ULB. Now I am studying mechatronics engineering in the BRUFACE program. In this project I helped imagining the design for the mechanisms, modeling the parts in SolidWorks, connecting the whole circuits, …

I really enjoyed working on this project and spending time in the fablab to build the prototype.

Mariane Shhaitly

Hey! you can call me Mariane. Before I came to Belgium, I completed 4 years of Mechanical Engineering in Lebanese University. Now I'm resuming my studies in polytechnic in Electromechanical Engineering Mechatronics. My main contribution in this project was designing the Mechanism, executing it on Solid Works, 3D printing, laser cutting the parts, assembling them. I would say that I have a good experience in CAD modeling, this is why designing the mechanism especially was enjoyable for me. I also contributed in helping my group members when they needed assistance and mostly organizing the teamwork all-together. This project was very beneficial for me since I also gained experience in Arduino.

Ange Ngueta Ntolale

Hello, my name is Ange NGUETA NTOLALE, I have a Bachelor's degree in Physical Sciences and a Master's degree in Physics from the University of Douala in Cameroon. After this course, I nourished a deep interest for engineering sciences particularly in the field of electromechanics, hence my coming to Belgium at the Université Libre de Bruxelles in Master in Civil Engineering - Robotics and Mechatronics - Construction. However, in this project, I participated in the choice of electronic components (sensor, motor, etc..), in the study of the electronic circuits and its implementation so that the project is feasible, I also brought ideas on solidworks modelling of the parts to have a perfect assembly of our prototype.

Alessandro Simonelli

Hi I’m Alessandro, I’m from Italy, Rome, where I attended my bachelor and started a master in Electrical Engineering at La Sapienza. I came in Brussels for an Erasmus experience, for filling up my lack of experience in laboratory work. In fact unfortunately, due to my background almost exclusively theoretical, I didn’t have much experience in practical work regarding mechanical or electronic engineering , but after these months I acquired lots of knowledge in both fields. I contributed at the beginning of the project on testing some Arduino functions and then helped design some support using Solid Works. I assembled and disassembled parts of the baby foot, did lots of manual work, run tests and have been almost always available to help others group members if they needed help or assistance. I really enjoyed the team work, merging different experiences and abilities on one project, finding solutions step by step and managing to achieve very important results.

Anis Fouad

My contribution in this project was essentially in electronics part. I worked on the stepper motor, I did some test in sensors like photoresistor, proximity sensor, limitswitch, etc … to see their reliability for our project. I also program the main code for the project helped by my teammate in accordance with the keeper’s strategy that we agreed with the whole group.

The project was very cool, I really enjoyed spending time on programming certain functionality of the project and seeing the result immediately, it was really challenging. I also really enjoyed working with this teammate, the ambiance between us was very good. 

Project Repo

All CAD folders and Arduino Programs can be found in the following google drive to download as one Zipped Folder:

Automated_Football_Files - Google Drive

Annex(Calculations)

Screenshot 2022-12-30 172254.png
Screenshot 2022-12-30 172351.png

The Motor Calculations can be found here:

A main requirement is the maximum distance the goalkeeper rod can move in order to know the maximum lateral motion the motors must provide for the goalkeeper rod. Figure 1 displays the measure maximum lateral movement for the goalkeeper rod and distance between the opposing player and the goalkeeper. The maximum rotation range for our application is between -45° and +45°(Figure 2). In lateral move, as shown in Figure 3, considering the distance between the ball and goal is about S=150 mm, every angular error (Theta)e= 0.5° mistake makes about Error= S*tan((theta)e)= 1.3mm. When the maximum error in the destination is 1.3 mm,it is still possible that the goalkeeper misses shooting the ball and it goes toward the goal. The deviation of hitting point from central axis of the ball is Error Emax=±0,14 mm The ball velocity Vball=12 m/s Distance between human controlled bar and actuated goalkeeper bar is Sbar= 31 cm.

Maximum movement of goalkeeper is Srod=11.2 cm The passing time from a bar to the next one in straight shot is Tpass=Sbar/Vball=26 ms The time for reaction is less than 26 ms and depends on the processing unit, reaction time of motor and speed of the rod’s moves. Taking a good estimation, the time for two third of the distance between the two adjacent rods considered for processing time and command to the actuator and the other one third for the rod’s move to reach the ball. It means 17.3 ms for the processing and command and 8.7ms left for the rod to catch the ball by the goalkeeper. According to previous researches, if the puppet hits the ball at the theta e=8°, then the ball will lose 1 percent of its forwarding speed(Figure 4). The maximum time for the goalkeeper to catch a ball is Tmax=8.7 ms. then the necessary speed for lateral move will be: Vrod=Srod/tmax=1.3 m/s and acceleration to reach this velocity would be a=13 m/s2. Therefore, the angular velocity for the rod is w= v/r=(1.3m/S)/(4mm)=325 rad/s (r being the radius of the goalkeeper rod) In addition, considering the goalkeeper’s leg for the angular accuracy is important.Often, foosmen feet are 16 mm in length. The Angular deviation error is usually considered ±3mm for the most accurate output according to some researches(mohebi, 2022). Refer to Figure 5 for a clear diagram of this point.

Reference: Mohebi, Dani. ‘The Study of Semi-Automated Foosball Table’. Fi=AMK-opinnäytetyö sv=YH- examensarbete en=Bachelor’s thesis , 2022. http://www.theseus.fi/handle/ 10024/745224