The app sends the sensed data from accelerometer of the phone to the robot via Bluetooth. Data transmitted by the phone is received by the Bluetooth module on the robot. The received data is fed to pin 8 of BOARD1. The microcontroller on BOARD1 processes the received data and drives the motors accordingly. The robot also sends back the status. In the app, you can see a label named ‘Robot’s status’ below which you can see the direction in which the robot is moving and also the kick status.
The software (soccer.ino) for the soccer robot is written in Arduino programming language. The Arduino UNO is programmed using Arduino IDE software. Atmega328 on Arduino UNO comes with a boot loader that allows you to upload new code to it without the use of an external hardware programmer. It communicates using the STK500 protocol. You can also bypass the boot loader and program the microcontroller through the ICSP header, but using boot loader programming is quick and easy. Select the correct board from ‘Tools→Board’ menu in Arduino IDE and burn the program (sketch) through standard USB port in the computer.
Change the kick and initial position (in degrees) of soccer robot’s leg in the source program corresponding to your mechanical arrangement of the leg in the robot as shown below:
Int kick = 50
Int neutral = 170
The procedure for installing the Android app on the phone is as follows:
- Download the app SoccerRobot.apk and copy it to your Android smartphone or tablet.
- Run the file and it will ask you ‘complete action using,’ click on ‘package installer’ and then click ‘install.’
Please note that you have to also change the baud rate of the Bluetooth module on the robot to 57600 using AT command, if it is not set like that already.
Download the PCB and component layout PDFs: click here
Download source code: click here
Construction and testing
A single-side PCB for the soccer robot & and its component layout is shown below. Assemble the circuit on the recommended PCB to save time and minimise assembly errors. Use IC base for motor driver IC1.
Follow the steps below to get the robot running for the first time:
- Switch on the power supply to the robot by connecting the batteries.
- Pair the Bluetooth module with an Android phone. While pairing, it will ask you the password; type ‘1234’ which is the default password of Bluetooth module.
- Run the already installed app in the phone.
- Press ‘SELECT’ (make sure the Bluetooth is on), then select Bluetooth module from the list of scanned Bluetooth devices and press ‘CONNECT.’ It will take 5-10 seconds to connect. After connecting, it will notify you that Bluetooth is connected. Now it is time to play soccer through your phone.
- You can control the robot by rotating the phone; ‘Forward,’ ‘Backward,’ ‘Left,’ ‘Right’ and ‘Stop.’
- Kick the ball by shaking the phone.
To test the circuit for proper functioning, verify correct 5V supply for the circuit at TP1 with respect to TP0. Also check the 9V supply for the motors at TP2. Transmitted data by the Bluetooth can be observed at TP3. The controlling pulses for the servo motor can be seen at TP4.
The article was first published in January 2015 and has recently been updated.