Project tutorial
Arduino Pokéball

Arduino Pokéball

Throw a real-life ball to catch Pokémon in Pokémon Go.

  • 81 respects

Components and supplies

Ph abx00005 iso (1) bavevgguw1
Arduino 101
9V battery (generic)
Adafruit industries ada80 image 75px
9V to Barrel Jack Connector
1434509556 android phone color
Android device
Need to be rooted with BLE support

Apps and online services

About this project

In order to start catching in a more exciting way, some simple steps needs to be taken. First the Arduino Pokéball works by using the accelerometer in the 101 board to sense that it's been thrown, then using the bluetooth on the board, the 101 sends the info to the Arduino PokeBall app on the phone.

Now in the app, when the “Toss mode” is on the app looks for any changes in the values that are being sent to it over the bluetooth. If the value is changed it means the Arduino been thrown.

When the value is changed, the app creates a text file and write the value into it, modifying the text file. That's all the Arduino PokeBall app does.

Running in the background of all of this, there is another app Tasker. Tasker is monitoring the same text file the app writes to, and when the file is modified Tasker sets up  a “Task”, an action, that runs a small line of code. The code line is a “Shell command” containing the following code: input swipe 550 1650 550 900 200.

if (typeof(lightBoxImages) == 'undefined') { lightBoxImages = {}; } lightBoxImages['67313f2b5c'] = [{ URL: '', caption: 'caption (optional)', type: 'image' }];

This code makes a swipe gesture from coordinates 550 ,1650  to 550, 900 the phone screen simulating a real swipe.

This fake swipe is what tosses the ball in Pokémon Go. These coordinates fit right on top of the ball during the catching phase in the game.

So for everything to come together have the Arduino PokeBall app connected to the Arduino 101 running with the tossing code, have the Toss mode active (the mode last for 5 mins) and the Tasker-app ready in the background, now start Pokémon Go. Now catch 'em all with style!

How to make the Arduino Pokéball

Step 1: Rooting your Android phone.

If you already have a rooted phone skip this section.

This project requires a rooted Android phone to work. For those who don't know; rooting a phone gives you extra control over your phone . But take note, rooting your phone may void your warranty and might, in some cases, render the phone useless.

But if you do want to root your phone, start by looking up guides for how to root your phone model.

When your phone is rooted, double check that it's ready with a root checking app like this one: Root Checker

Step 2
if (typeof(lightBoxImages) == 'undefined') { lightBoxImages = {}; } lightBoxImages['d4bde177ef'] = [{ URL: '', caption: '', type: 'image' },{ URL: '', caption: '', type: 'image' },{ URL: '', caption: '', type: 'image' }];

Before any coding is needed you need to figure out what coordinates on your phone fit right over the pokéball in the game. Easiest way to check them, is by activating the developer options on your phone and turn on “Pointer location”. Now you will be able to see the coordinates of the touches at the top of the screen. Write down the two set of coordinates that will make a fitting swipe to flick the ball on your phone. Keep the “Pointer location” on for now, it will be useful for testing.

Step 3
if (typeof(lightBoxImages) == 'undefined') { lightBoxImages = {}; } lightBoxImages['1f0516bd4a'] = [{ URL: '', caption: '', type: 'image' },{ URL: '', caption: '', type: 'image' },{ URL: '', caption: '', type: 'image' },{ URL: '', caption: '', type: 'image' },{ URL: '', caption: '', type: 'image' }];

Download the Tasker app and create a new task. Name it and Select Action Category. Pick Code, then Run Shell. Under “Command” write “input swipe” and your two sets of coordinates, add a 200 to the end. Make sure to check the “Use Root” checkbox. You can test your task by clicking the play button in the lower left corner. If you see the “Pointer location” updating and drawing a line that fits your coordinates it’s working as intended. This part was inspired by Useless Duck Company's similar idea.

Step 4: Arduino setup


The Arduino code is based of the example CallbackLED for the CurieBLE library and the ShockDetect from the CurieIMU library. The code also used some features from the Education shield library.

Before changing anything in both this code and the android code later on, I recommend to read up about how Bluetooth low energy and GATT works, particularly how GATT services and GATT characteristic functions.

if (typeof(lightBoxImages) == 'undefined') { lightBoxImages = {}; } lightBoxImages['98ced534db'] = [{ URL: '', caption: '', type: 'image' },{ URL: '', caption: '', type: 'image' },{ URL: '', caption: '', type: 'image' },{ URL: '', caption: '', type: 'image' },{ URL: '', caption: '', type: 'image' },{ URL: '', caption: '', type: 'image' }];


As the MDF casing used in the first video was damaged during testing, a colleague created a 3d print for a pokéball that can host the arduino and the power supply. The files for the pokéball is provided further down. 

Besides the case, all you need to do is to connect the 9v battery to the board though the 9V to Barrel Jack Connector, to make the connector fit inside the case, remove the black casing on the jack. Also remove the black casing around the dc jack to make it stick out less or just plugin the 9v battery directly into the Vin and ground pin.

Would recommend you to screw or glue the 101 board to the ball.

Step 5: Android setup
if (typeof(lightBoxImages) == 'undefined') { lightBoxImages = {}; } lightBoxImages['47af51ccf3'] = [{ URL: '', caption: '', type: 'image' },{ URL: '', caption: '', type: 'image' }];

The code for the Arduino Pokéball based off the BluetoothLeGatt  sample provided with Android Studio.

Added some functions to connect to the GATT service and characteristic of that use setup in the Arduino code. In, we have an AsyncTask that starts when clicking the “Start Toss mode” button. AsyncTask is basic background thread, that here is used to read what the bluetooth is sending once per second for 5 minutes.

The data from the bluetooth ends up in the displayData method where, if its not empty, is sent to the saveFile method. If you like to skip the Tasker app, some commented code in displayData does the same Shell command that was set up in Tasker.

With the saveFile method, we first check if the data has been updated, and if so the file_name.txt file is updated with the new data. If it's the first time the app is running on that phone, the app creates the txt file. Also note that the phone used for my setup has a SD card, so if yours only has an internal memory should be a bit different. Read about it here

Step 6: Tasker round 2
if (typeof(lightBoxImages) == 'undefined') { lightBoxImages = {}; } lightBoxImages['b306e02462'] = [{ URL: '', caption: '', type: 'image' },{ URL: '', caption: '', type: 'image' },{ URL: '', caption: '', type: 'image' },{ URL: '', caption: '', type: 'image' },{ URL: '', caption: '', type: 'image' },{ URL: '', caption: '', type: 'image' },{ URL: '', caption: '', type: 'image' },{ URL: '', caption: '', type: 'image' },{ URL: '', caption: '', type: 'image' }];

After setting up the app on your phone, connect it to the 101 board running the pokéball code and start the “Toss mode”. Test it out by shaking the board around a bit. There are several Logs in the app code, under the TEST tag you should find help with eventual errors.

Now, go back to the Tasker app.

Go to the Profiles tab and create a new profile. Pick Event → File → “File Modified”. Click on the Magnifying glass icon to open a file navigator, find the txt file that was created by the Pokéball app, this should be in folder the file navigator started at.  Pick the txt file and go back a step in Tasker. Now you should be prompted to pick a task, so pick the toss task you created earlier.

Next test so everything is ready by starting the toss mode again, and shake the board. You should get a small Toast, saying that Tasker has been granted certain permissions, and the “Pointer location” should show that a swipe has been made.

If everything works as intended you can turn off the “Pointer location” setting.  

Step 7

Now start Pokémon Go. Now catch 'em all with style!


Arduino Pokéball
Need Android studio to install the Android app

Custom parts and enclosures

Arduino Pokéball 3d print
Arduino Pokéball 3d print


Similar projects you might like

Voronoi101: Light Your Lamp!

Project tutorial by Gregory O. Voronin

  • 30 respects

Android Controlled Toy Using Raspberry Motor Shield

Project tutorial by Volkan Sarıoğlu

  • 24 respects

Pedometer (Arduino 101)

Project tutorial by Bruno Gabriel

  • 24 respects

Healthy Arduino

Project tutorial by Sachin Dwivedi and Sandeep Dwivedi

  • 18 respects

Arduino101 / tinyTILE BLE: Match-Making Sunglasses

Project tutorial by Kitty Yeung

  • 52 respects

Valentine's Sunflower

Project tutorial by team

  • 47 respects
Add projectSign up / Login