Slingshot robot game for two players

GigaBrain.io

Install Instructions

GigaBrain Install

GigaBrain Thingiverse Thingiverse 3d printable parts for Robot Slingshot game for two players

GigaBrain Two player game is run with Java and sends PWM control signals to Raspberry PI pins. Currently tested versions Raspberry PI 3 B+ model. Raspbian 4.9 Please test with your Raspberry device and send feedback to gigabrain@tuta.io

How to setup the two player game ?

                  3D Print yourself the parts. Follow the printing instructions 
                  You will also need:
                  - Raspberry Pi
                  - Two of 9g micro servos
                  - 3mm / 4mm / 5mm Neodyum magnet balls if you want extra weight for the cannon balls
                  - 3d Printer and PLA material
			 	  

How to install manually ?

Manually install - Download newest version blocks-0.3.0-RELEASE.jar
Install the PiBlaster from https://github.com/sarfata/pi-blaster
Setup two Micro Servos: Control YELLOW/WHITE to Raspberry Pi Pins: Physical GPIO#11 (BCM17 / GPIO17) and Physical GPIO #12 (BCM18 / GPIO18)
And the servos + RED wire to +5 and - BLACK wire to Ground


You can see different board references here 
You may use different boards as long as you can setup the pins according to PiBlaster configuration

How to run the game with PiBlaster ?

The configuration parameters for PiBlaster pins:
CONTROLLING_ENABLE_PIBLASTER = Boolean (true or false) Turn on Raspberry Pi PiBlaster configuration
CONTROLLING_PIBLASTER_OUTPUT_TAGS = String separated with , List the hashtags that are mapped to pins in the same order as PINS
CONTROLLING_PIBLASTER_OUTPUT_PINS = String separated with , List the pin numbers that are mapped to output GPIO ports in the same order as TAGS
CONTROLLING_USERNAME = String User username
CONTROLLING_PASSWORD = String User BCrypted password 

Run command:
java -jar /home/pi/gigabrain/blocks/blocks-0.3.0-RELEASE.jar --CONTROLLING_ENABLE_PIBLASTER=true --CONTROLLING_PIBLASTER_OUTPUT_TAGS=p1,p2 --CONTROLLING_PIBLASTER_OUTPUT_PINS=17,18 --CONTROLLING_USERNAME=john --CONTROLLING_PASSWORD='{bcrypt}$2a$10$AkKVjmFjr.eTCxiUK5XGr.iD/lFSfs64gU7LhcNz2NbOVAKh0Zp6i' > /home/pi/gigabrain/blocks/logs/blocks.log 2>&1 &

How to run the game with PCA9685 board ?

Connect the PCA9685 board to Raspberry Pi with these instructions. Note that you are required to have an additional power source for the servos. With the configuration you can change the PCA9685 pin numbers, in the run command below there is pin 0 for player 1 and pin 1 for player 2.

Adafruit Raspberry Pi PCA9685 instructions
The configuration parameters for PCA9685 pins:
CONTROLLING_ENABLE_PCA9685 = Boolean (true or false) Turn on Raspberry Pi PCA9685 I2C port configuration
CONTROLLING_PCA9685_OUTPUT_TAGS = String separated with , List the hashtags that are mapped to pins in the same order as PINS
CONTROLLING_PCA9685_OUTPUT_PINS = String separated with , List the pin numbers that are mapped to PCA9685 pins (0-15) in the same order as TAGS. The default I2C bus is 1 and address is 40.
CONTROLLING_USERNAME = String User username
CONTROLLING_PASSWORD = String User BCrypted password 

Run command:
java -jar /home/pi/gigabrain/blocks/blocks-0.3.0-RELEASE.jar --CONTROLLING_ENABLE_PCA9685=true --CONTROLLING_PCA9685_OUTPUT_TAGS=p1,p2 --CONTROLLING_PCA9685_OUTPUT_PINS=0,1 --CONTROLLING_USERNAME=john --CONTROLLING_PASSWORD='{bcrypt}$2a$10$AkKVjmFjr.eTCxiUK5XGr.iD/lFSfs64gU7LhcNz2NbOVAKh0Zp6i' > /home/pi/gigabrain/blocks/logs/blocks.log 2>&1 &

How to Generate a BCrypt password hash ?

Create a BCrypted password manually
	in Command line see reference BCrypt Hash from command line
	in browser JavaScript Browserling Javascript BCrypt tool
	Notice that Browserling uses a local JavaScript BCrypt script
	BCrypt JavaScript library
and add a {bcrypt} in front of the property eg. --CONTROLLING_USERNAME=john --CONTROLLING_PASSWORD='{bcrypt}$2a$04$dl...' In the above run command example username is john and password is "hello"

How the application security is implemented ?

The security is implemented using standard Spring Security libraries to ensure the security and stability of the application.

How to install with a script ?


wget http://gigabrain.io/blocks/GigaBrainBlocksInstallStandalone.sh -O ~/GigaBrainBlocksInstallStandalone.sh
chmod +x ~/GigaBrainBlocksInstallStandalone.sh
~/GigaBrainBlocksInstallStandalone.sh

Open issues

Resolved issues

The wiringPi needs rights to GPIO access, the install script uses sudo rights to start the Spring boot application. WiringPi/Pi4J without sudo in Spring Boot Resolved by using PiBlaster to send control signals to GPIO pins

Before downloading you can read the installation script here

Install script

The script creates folder gigabrain in your home folder and downloads the GigaBrain Standalone version and creates a script for running the service. The log files are created in logs folder. You can launch the Standalone version with script start.sh Connect your Raspberry Pi and a Mobile phone to a Wifi network and open the Raspberry Pi IP address with the Mobile phone browser. The service runs in a port 5003, open up a web browser to your Raspberry Pi IP address: http://RPI_IPADDRESS:5003 or Open a browser in Raspberry Pi and go to localhost:5003