PIC32 ile masa tenisi sayı belirleme sistemi
Scoreboarding system for table tennis game with using PIC32
Yazar: UFUK ŞANVER
Danışman: PROF. DR. METİN GÖKAŞAN
İstanbul Teknik Üniversitesi / Fen Bilimleri Enstitüsü / Mekatronik Mühendisliği Ana Bilim Dalı
Derece: Yüksek Lisans, 2015
Konu: Mekatronik Mühendisliği = Mechatronics Engineering

Özet:
Spor karşılaşmaları günlük hayatımızın içinde önemli bir yer işgal etmektedir.
Sporun günlük hayatımızdaki yeri ve önemi iki farklı koldan büyümektedir.
Bunların birincisi profesyonel spor karşılaşmalarıdır. Spor endüstrisini oluşturan bu
karşılaşmaların günlük hayatımızdaki önemi arttıkça, spor endüstrisini besleyen maddi
kaynaklar da sürekli büyümektedir. Bu maddi kaynağın büyümesi, profesyonel spor
karşılaşmalarının denetiminde yapılacak hakem hatalarına karşı toleransı minimize
etmektedir. Bu durum sebebiyle, karşılaşma denetimi yapan insan kaynağına
(hakemlere) yapılacak yatırımın yanı sıra karşılaşma denetiminin otomatize edilmesine
yönelik çalışmaların da yapılması bir zorunluluk haline gelmektedir.
Günlük hayatımızda, amatör olarak eğlence veya sağlık amaçlı spor yapmak da
gittikçe yaygınlaşan bir eylemdir. Oturarak çalışılan işlerin toplam istihdamdaki
payının artması, her geçen gün daha fazla insan için vücut sağlığı açısından spor
yapılmasını gerekli kılmaktadır. Belirtilen amçalarla spor yapma ihtiyacını karşılamak
için genellikle üst düzey kural bilgisi gerektirmeyen ve ihtiyaç duyduğu donanımları
kolaylıkla temin edilebilen spor dallarını tercih etmektedir. Masa tenisi uzun yıllardır
bu tanıma oldukça uyan ve yaygın olarak oynanan spor dallarından biridir. Her
ne kadar amatör bir şekilde de yapılsa, karşılaşma sonucunun belirlenmesi, keyifli
ve ciddi bir karşılaşma olabilmesi için bu karşılaşmalar da şüphesiz denetlenmeye
ihtiyaç duymaktadır. Bu sebeple amatör oyuncular karşılaşma için kullanacakları
enerji ve dikkatlerinin bir kısmını karşılaşmaya denetlemek amacıyla kullanmaktadır.
Bu durumu önlemek, spor yapanların tüm enerji ve dikkatlerini karşılaşmaya
odaklamalarını sağlamak amacıyla bu karşılaşmaların denetlenmesi de son derece
önemlidir.
Bu çalışmadaki amaçlanılan masa tenisi karşılaşmalarında alınan sayıların, elde
edilen sonuçların ve maç galibinin otomatik olarak tespit edilmesidir. Bu amaçla
civalı titreşim algılayıcılarından topun masaya çarpıp çarpmadığı anlaşılmış, bu
algılayıcılardan elde edilen bilgi bir karşılaştırıcıda karşılaştırılarak tespit edilen eşik
değere göre ilgili titreşimin, topun çarptığının kabul edilmesi için gerekli değeri geçip
geçmediğine bakılmıştır. Eğer titreşimin şiddeti eşik değerin üzerine çıktıysa bu bilgi
tek yongalı bilgisayara (mikrodenetleyiciye) aktarılmıştır. Burada oyun kurallarından
yararlanılarak geliştirilen algoritma takip edilmiş ve masa tenisi karşılaşmasının hakem
kararları otomatize edilmiştir. Elde edilen sonuçlar yedi segmentli ekran ve LCD
ekran üzerinden gösterilmiştir. Sistemde ayrıca doğrudan kullanıcının müdahale
etmesi amaçlı butonlar konulmuştur. Yine oyuncuları yönlendirmek için sistemde
servis kullanacak olan oyuncuyu gösterme amaçlı olarak ledler kullanılmıştır. Topun
çarpmasıyla birlikte oluşan titreşim bitmeden oyuna tekrar başlanması sağlıksız
sonuçlar doğurabileceğinden dolayı ilgili titreşim periyodunda oyuncuların masanın
sönümlenmesini beklemesi amacıyla sesli uyarı veren gereç kullanılmıştır.
Haberleşme teknolojileri de spor teknolojilerine paralel olarak, hatta ondan çok daha
hızlı bir biçimde gelişme eğilimindedir. Bu çalışmada PIC32 mikrodenetleyicisi
merkezli bir sistemin denetleyici alan ağı üzerinden Masa Tenis Otomasyonu ile,
diğer mikrodenetleyiciler, bilgisayarlar ve diğer sistemler ile de RS-232, RS-485,
Evrensel Seri Veriyolu, ethernet bağlantılarını kullanarak haberleşmesini sağlamak
amaçlanmıştır. Bu çalışmada PIC32 serisinden PIC32MX795F512L adlı ürünün
merkezinde olduğu bir haberleşme sistemi kurulmuştur. Bu sisteme haberleşme
yollarının dışında tuş takımı üzerinden ulaşılabilmekte ve sisteme aktarılan veriler
LCD Ekran üzerinden görüntülenebilmektedir.

Abstract:
When a system does the works or missions of people partly or completely, these systems
are called as automatized systems.
First it was tried to automatize the systems, which need only power of people.
After this process it was tried to automatize the systems, which are intelligent.
There are some reasons to automatize the systems. The power of people, the data
process capability of people and the working speed of people are very restricted.
Furthermore each products mostly can not have the same quality because the working
quaility of workers can often change. In addition to these reasons, workers can lose
their concentration while they are working. All these reasons show signifance of
automation.
The automation has a large history Allthough industrial control systems are a part of
improved history since 19th century, there are automation applications which were
done by civilizations in Ancient Greece and Ancient Time Arabic Groups. Water
clocks, oil lamps and improved water depots are example of these applications.
The steam machine, which was improved by James Watt in 1788 opened a new age,
the industrial age. There were a lot of studies and improvements for steam machine
in 19th century. Maxwell equations and researches which had succesful results had
an important role in improving of industrial automation. After these improvements
a lot of technologic products were produced especially in branch of transportation,
manifacturing, power plants.
After 1950s Numerical Controlled devices were produced. After 1970s PLC have
begun to have an important place in industrial production.
The improvements in automation industry has begun to open new horizonts in another
areas. Sports is one of them. Since 1960s electronic devices and different control
systems have a role in sport industry. And this place has grown regularly.
The monetary sources which are controlled by sports industry has grown. This
growing makes it less tolerant to incorrect decisions of referee. Because of this reason
the automation is very important in sport industry. The automation applications in
sport industry started with application in golf sports. There are lots of automation
applications in football industry. Both the ball and players move in football games. It
makes hard to automatize the systems.
There are also a lot of imporovements in automation industry of basketball games.
Image processing is often used in applications in basketball industry.
Baseball is not popular in Turkey but very popular in some countries like USA. Sets
and rules help to improve automation systems. There are a lot of applications also
in this area. They are also another applications and researchs in other sports such as
volleyball, handball, tennis.
Table tennis (ping-pong) is also an important game in the world. A lot of people play
table tennis as a hobby. And table tennis is also an important professional olympic
game. And because of this importance it is needed to improve the system, which
has the mission of referee in amateur games and which helps referee in professional
matches. There are some studies and applications in this area to automatize the role
of referee. Three methods were actively used in these automation systems. They are
image processing, audio pocessing and applications with pressure or tilt sensors.
Table tennis players usually play fast. And the methods which are based on image
or audio processing need high improved processors for online control of table tennis
matches. The studies and applications which are based on image processing usually
analyse videos after matches. And the methods which use audio processing methods
need to teach to detect the position of ball. Because of these reasons the most effective
methods are the ones which use pressure or tilt sensors. To make assembly in these
methods is easier than other methods. And the make assembly can be done via
unquallified workers.
Table tennis is a game, which is played on a table. The length of table should be 2.74
m and the width of table should be 1.525m. The diameter of table tennis ball should
be 40mm and the weight of ball has to be 2,7g. There are three main situations in table
tennis game: Ralli, service and let.
The decision automation system of table tennis which is improved in this study use
PIC18F4580 microcontroller, eleven tilt switches,7 segment displays, buttons, leds
and buzzer. This system needs a microcontroller which can take informations from
eleven vibration (tilt) sensors, which has possibility to communicate in Controller
Area Network line via a CAN transmitter, which can give information to four different
Seven Segment Displays. Including CAN pins, this systems needs 31 pins. One of the
most effective and cheap microcontroller in these conditions is PIC18F4580. Vibration
sensors understand that ball hits on the table and than they send this information to
microcontroller. With information about time microcontroller use this information and
decide the result. The vibration sensors which are used in this study are mercury
based tilt sensors. These sensors are integrated with a comparator circuit. With this
comparator circuit it is possible to decide the threshold level. This threshold level
decides that the level of pressure is enough to accept that the ball hit or does not hit
strong enough to be accounted for a hit. This threshold level can be changed via a
trimpot. Seven segment displays are often used in automation and control systems.
The use and control of these displays are easy and they are virtual equipments. They
are two leds in this system. They show, which player should use service. And if the
buzzer beeps, players have to wait till the buzzer is silent. The voice of buzzer shows
that there is vibration in this system. When the vibration is dumped by table, the buzzer
stops beeping.
If a player or referee of match wants to change the result which was given by Table
Tennis Automation, this person can change the results manuel via buttons.
It is also aimed to communicate this table tennis scoreboarding system with computers.
There is PIC32MX795F512L microcontroller in the center of this communication
system. There is a connection between this microcontroller and table tennis
automation system via Controller Area Network (CAN). Controller Area Network is
a communication protocol which was founded by Robert Bosch Reseach Center to do
more basic communication between Micro Controller Unit and sensors in automotive
industry products. The CAN Communication Line needs only two cable. Before
CAN, each sensor was connected to Micro Controller Unit via different cables. And
it made this communication very hard. After cars and other automotive industry
products, CAN is often used in another areas such as industrial automation. Both
PIC32MX795F512L and PIC18F4580 have the capability of communicate via CAN.
The PIC32MX795F512L microcontroller has also connections with computer via
Universal Asynchronus Reciever Transmitter (UART), Ethernet and Universial Serial
Bus. Systems can be communicate via UART line RS-232 communication protocol.
This communication method has some advantages. Both devices can send data.
Because of this, this system is a full-duplex communication system.
USB communication has a very important place in life nowadays. Since 1990s this
communication system has improved. First USB was version USB 0.7.Version USB
3.0 is in use nowadays. Allthough USB3.0 is possible to find and USB3.0 is faster
than USB2.0 is the USB version, which is used more than other versions. USB is
a half-duplex communication protocol. In USB communication one of the devices
should be master while the other is device slave. At the same time only two devices
can communicate in a USB Line.
Ethernet is also a very important and commonly used communication protocol. Via
ethernet communication the devices can have connections with global network.
This Table Tennis Scoreboarding System has between 93% and 99% successful rate.
It is aimed to improve a computer software, which can show the place of ball virtually
and can give more datas for analize this match. It is also aimed to improve mobile
applications, which can take data from system and send commands from mobile
communication device.