The Smart Wuzzler is an augmented Tabletop-Soccer Game for the student restaurant of the University of Applied Sciences Technikum Wien. It features automatic goal counts, game session management via smart phone user login, audio-visual feedback of game progress and a high score list. Users can register and login via smartphone - the game logic runs on a RaspberryPi4 which also provides a WiFi Hotspot.
This project is based upon the work by Alexander Peters who had the initial idea and made the first implementation in 2017, and Ferdinand Unger who ported the project to a recent version of node.js and Angular.js.
The Tabletop-Soccer game implementation consists of 3 parts, which are built using node.js (Version 12.13.1). The backend (server) connects to a Postgres database to store user and game session data. The graphical frontends (client and display) use and Angular CLI version 8.2.2.
- The Backend: connects to the database and to the low level hardware (via Cylon/Firmata, expects an Arduino with Firmata firmware running at port /dev/ttyACM0). The GPIO pin connections for goal detection and pushbuttons can be found in file "robot.js". The backend detects goals and user interaction and updates the game state for client and display accordingly. It also generates soccer arena sounds to indicate game events (game start, goal, revoked goal, game won).
- The Client: offers a responsive user interface in the web browser in order to create a new user, login, as well as challenge your friends into a 1 vs. 1 at tabletop soccer. The available players are displayed and can be challenged.
- The Display: shows the progress of ongoing games and the high score list on a TV that is mounted behind the soccer table.
Useful scripts (start chromium in kiosk mode, activate/deactivate hotspot, iptables for routing traffic) can be found in subfolder scripts
-
Clone the git repository
-
Navigate to "client" folder and run "npm install" in terminal
-
Navigate to "display" folder and run "npm install" in terminal
-
Navigate to "backend" folder and run "npm install" in terminal
-
Create the database
-
Download and install the newest version of PostgreSQL.
-
Run following commands to create the database user and the wuzzler_db database, using the postgres tool:
sudo su postgres createuser pi -P -s (then input and confirm password 'raspberry') createdb wuzzler_db psql wuzzler_db -f wuzzler_db_9.1.sql
-
exit the postgres tool
-
Optional: you can use the pgAdmin tool to graphically manage the database (see e.g. [here] (https://www.guru99.com/postgresql-create-database.html) for details)
-
Open the file "db.js" with a text editor. In line 8: Verify if user account/password match the credentials you chose in step 5.
-
Navigate to "client" folder and run "npm run dev" in terminal to start the server. All three apps will start automatically. Client and display should open in a webbrowser and the backend should connect to Arduino and database. (Alternatively: start the backend via node app.js)
The client content is served from http://localhost:4200/
, multiple clients can connect to this port in order to show the user frontend. The display is served from http://localhost:4220/
, it is shown in fullscreen (kiosk) mode by the RaspberryPi which also runs the backend. The backend listens on port 4444, where a websocket is used for communication to clients and display.
sudo apt install cec-utils
-
Turn TV (HDMI device 0) on:
echo 'standby 0' | cec-client -s
-
Turn TV (HDMI device 0) to standby:
echo 'on 0' | cec-client -s
-
Switch HDMI Source of TV to 1,2,3:
echo 'tx 4F:82:10:00' | cec-client -s echo 'tx 4F:82:20:00' | cec-client -s echo 'tx 4F:82:30:00' | cec-client -s
See:
https://www.loxwiki.eu/pages/viewpage.action?pageId=23462202
https://www.endpoint.com/blog/2012/11/08/using-cec-client-to-control-hdmi-devices
Pulse-Eight/libcec#202
https://github.com/Pulse-Eight/libcec/blob/00afa793a90dc82c53ffb58622294cf9e06fe348/src/cec-client/cec-client.cpp#L317
https://www.whizzy.org/wp-content/uploads/2012/11/cecsimple.sh_.txt