Introduction: What Is Goal Line Var

This is called goal-line sensor. As we can notice from its name, it senses whether the ball goes into the goal or not in soccer. The reason why we need this is even if 99% of the ball is in, but 1% is not, then it’s not a goal. And, the sensor knows if it’s completely in or not.


Things you have to prepare : enough male and female wires, 12 sticks to make a goal, arduino uno, breadboard, USB cable to connect to your laptop, HCSR-04 ultrasonic sensor, and the buzzer

Step 1: Connecting Wires to Arduino and HCSR-04 Ultrasonic Sensor

What you have to do with these wires is you need one wire for the ground which is now wihte wire on the breadboard.

And then, you need to have 3 pins for trigger, echo, and the buzzer. You can see the orange wire that is power. You can use 5V for this project.

in this project, what this ultrasonic sensor does is it sends some signal to certain distance and calculate how it took to get back to it, so that we know if the ball completely passed the goal line into the goal.

Step 2: Connecting the Buzzer to Arduino

For the buzzer, use one side female wires to connect it.

You also can get the sound bigger by making a paper conical.

Step 3: Coding

you will need this code for your Arduino

delay(1000);const int trigPin = 9; const int echoPin= 10; int buzzer= 11; long duration; int distance;

void setup() { pinMode(trigPin, OUTPUT) ; pinMode(echoPin, INPUT) ; Serial.begin (9600);


void loop() { digitalWrite (trigPin, LOW); delayMicroseconds (2);

digitalWrite (trigPin, HIGH); delayMicroseconds (10);

duration = pulseIn (echoPin, HIGH); distance = duration*0.034/2;

Serial.print ("Distance: "); Serial.println(distance);

if (distance > 2 && distance < 450) { noTone(buzzer); delay(1000); } }

some notes: tone doesn't increase the volume, it's literally how high or low the buzzer is. in ' distance > 2 && distance < 450 ' , you can adjust 2 and 450 regarding how big or small your ball. more information will be introduced in the next step.

Step 4: Making the Soccer Goal for Testing

you need to make a soccer goal for when we are testing it. it doesn't have to be very similar with real soccer goal, but should be cuboid. the length, width and height really don't matter, so you can set them as how big ball you have for the test. the important thing is you should use those length, width, and height to your code

Step 5: Placing It

let’s say your ball’s radius is 5cm. The ball should go inside of the goal completely. So, if the sensor is 10cm away from the goal line. The sensor will ring since the ball is exactly in the goal which is admitted as a goal.

Caution: Also the sensor’s limitation length of sensing should be same with the length of the soccer goal. Because if it’s smaller, there would be somewhere that sensor cannot work even if it’s a goal. However, if it’s greater, the sensor would be worked by something outside of the goal.

Step 6: Making a Case & Limitation

you need a case to pack all physical things into it. Also, this particular project has the buzzer. So we make a box case by lazer cutting. The case should have the hole for buzzer to make its sound bigger. Also, other 2 holes are needed for the sensor.

you can refer to make the box and affinity designer app to design it.

Limitation of this project:

Actually, this cannot be used in the real game because the sensor only works by horizontal line. But, the goal is a cubic, not a horizontal. Thus, there are some ways to overcome this problem. The first one is to use lots of sensors that can cover the whole volume of the goal. Yet, it costs too much and useless. The more useful is to use a new sensor that can work with a wider area.