Pokemon Go became one of the most insanely popular mobile games all over the world. There are many hacks and tricks for catching pokemon, but today we will build an Arduino Pokemon Go car to hatch eggs with less effort. The Pokemon Go Egg Hatching Car is designed to assist Pokemon Go players in hatching their in-game eggs. This is done with the vehicle carrying their phones. We’ll modify a regular RC Car and load components like HC06 for bluetooth control and HC-SR04 distance sensors to detect objects and make a turn before running into something. The game has 3 types of eggs and the car has adjustments to accommodate different distances. In this tutorial, we’ll cover 2 types of eggs (3km & 5km).
Component Overview
I. H-bridge
Figure 1: L9110S H Bridge Stepper Motor Dual DC Driver Controller
Figure 2: H-bridge overview schematic
The “H” of the H-bridge comes from the above figure where 4 switches of motors are connected in an H shape. The main reason we use H-Bridge instead of direct GPIOs of the Arduino is because we want to supply the power for the motor(s) from an external power source so we don’t put any strain on the Arduino’s power supply.
The table below shows how the H-bridges operate based on the switch status. S1 and S2 are the terminals of the front motor while S3 and S4 are the terminals of the back motor.
S1 | S2 | S3 | S4 | Result |
1 | 0 | 0 | 1 | Motor moves right |
0 | 1 | 1 | 0 | Motor moves left |
0 | 0 | 0 | 0 | Motor is not used |
0 | 1 | 0 | 1 | Motor brakes |
1 | 0 | 1 | 0 | Motor brakes |
1 | 1 | 0 | 0 | Short circuit |
0 | 0 | 1 | 1 | Short circuit |
1 | 1 | 1 | 1 | Short circuit |
Table 1: H-bridge switch table
II. Ultrasonic sensor
Figure 3: HC-SR04 Ultrasonic sensor
The classic HC-SR04 ultrasonic sensor is used for an obstacle avoidance functionality. The Ultrasonic Sensor sends out a high-frequency pulse and then calculate how long it takes for the pulse’s echo to reflect back. The time corresponds to the distance between the sensor and the nearest obstacle. The sensor has 2 openings: One that transmits ultrasonic waves and the other that receives them.
III. Bluetooth Module
Figure 4: HC06 Bluetooth Module
If you’re looking for a low-cost Bluetooth module, HC06 is the one. Despite the low coverage range it provides (10 meters), it could be used in a project that requires low power consumption.
HC-06 module has two modes: master and slave. The master device has a function of remembering the last paired slave device. The master will search for the last paired slave device until the connection is built. If the WAKEUP button is pressed, the module will lose the memory and search for a new slave device.
In our project, we’ll make a remote controller (mobile phone) the master and an RC Car the slave. The RC Car will connect automatically to the master once it’s in the range of connection.
For this project, I have decided to buy an RC Car and open it and modify a little so I can add in other components previously mentioned. You can use any cars available to you. After all, it’s just a car with 2 motors (each with 2 terminals).
Figure 5: RC Car before modification
Figure 6: RC car (bottom view)
What I’m trying to do here is to remove all the plastic coverings/decorations since we won’t be using them. I can simply unscrew the screws on each side of the RC car to remove them.
Figure 7: Exposed RC Car with its main controller board
After removing the cover, you can see some wires and the main controller board. We won’t be using its main controller board so we can remove it. We need to keep the wires of the motor which are mechanically connected to the tires. We can get rid of the rest of wires.
Figure 8: RC Car Base
You can see the 2 wires coming out of each motor. You can test it easily by connecting the positive terminal of a 9v battery to one wire and ground to the other wire. If you don’t want to go through such steps of finding the motor wire terminals, you can buy 2 plastic tire wheels with DC 3-6v gear motors attached like this one.
We will use a simple bluetooth terminal app to send data and check if the module catches the data on the serial monitor.
First, we have to wire the module as shown below.
Figure 9: HC06 Bluetooth Module wiring with Arduino UNO /© c-sharpcorner
Upload this Sketch and make sure to disconnect TX and RX while uploading your sketch since these pins are responsible for UART communication with the PC.
https://github.com/formus14/PokemonGO/tree/master/Milestone%20sketches/BluetoothTest
If you’re not familiar with Arduino communication protocols, feel free to check out our Arduino Communication Protocols Tutorial!
After uploading successfully, reconnect TX and RX as in the wiring diagram. Then download this app: Bluetooth Terminal HC-05
This app allows us to control the RC Car via bluetooth, and you can send any type of commands using the app’s terminal. The app comes with 5 buttons where you can choose specific commands to be sent when the buttons are pressed.
When you open the app, it will automatically search for available devices. You will find your module under the name of “HC-05” or “HC-06” depending on your module version. Connect to the module and you’ll see the embedded LED blinking.
Once the app is connected to the module as shown below, the embedded LED will stop blinking and will be turned on steady during the whole connection. This is how you can tell if the bluetooth is paired successfully or not!
Now try to write any text and notice what’s happening on the serial monitor of the Arduino.
Let’s try writing “test ..” and see what happens.
Set the baud rate in the serial monitor to 9600 and you will see the text on the screen.
Note: Keep the serial monitor open with the 9600 baud rate before sending your text.
In case of any issues, recheck the wiring and the embedded LED if it’s glowing in unstable mode.
Create control buttons from the app
The same app allows you to add buttons that can send specific data. For example, button “Press Here” can send a string “I love Pokemon GO” or whatever you command.
I have chosen to use the 5 buttons for 5 different functionalities: 2 buttons to control the directions (left and right); 1 button to stop the vehicle and 2 buttons to control the distance the vehicle covers till you find your pokemon (3km or 5km).
To choose the button name and data to be sent, press hard on any button and the control window will open.
You can specify the Name of the button (I have chosen “Left”) and in the command section you assign the data or the character that you would like to send from the app. I have chosen “l”, which I can recheck later on the Arduino code if I did receive “l” or not.
It’s the same idea as in the Left button. You can specify your button name and data to be sent. It doesn’t matter what character you send as long as it matches to the character you have assigned in the Arduino code. It’s recommended that you make characters uniform (i.e. “r” for Right, “l” for Left, etc.) to avoid confusions.
Button 3 Km sends character “3” to the Arduino to activate the timer that starts calculating the distance covered by the vehicle once the character is received.
Button 5 Km sends character “5” to the Arduino to activate the timer that starts calculating the distance covered by the vehicle once the character is received.
Character “s” commands the vehicle to stop. This button is added in case of emergency and/or to simply stop the vehicle.
Now we’ve added 5 buttons.
You can also activate the same functionalities of the buttons by writing characters or commands as we did previously by sending “testing..” . I added functionality for the car to move backward by typing “b”. You can create your own functionality by mixing multiple functions with the sensors (e.g. auto parking).
You need to connect your H-bridge to 2 motors and the Arduino board as shown below:
Figure 10: H-bridge wiring
Sketch :
https://github.com/formus14/PokemonGO/tree/master/Milestone%20sketches/Hbridge
The simplest way to determine the distance covered is by speed x the duration of time.
Figure 11: velocity, distance and time relation
I have used an external method to determine the average speed of the car, assuming constant speed of the car. There are other ways to determine the distance covered: It could be done using GPS module, measuring the RPM of the wheel by rotary encoder or using hall effect sensor. These all consume energy from the main battery which I would like to avoid as much as possible. You can simply measure speed of the vehicle manually by highlighting a start point and a stop point and defining the distance between the 2 points then measuring the time elapsed by the vehicle to cover this range.
Figure 12: Measuring fixed distance for the car to be covered
I marked multiple fixed distances for the car to be covered and then measured the elapsed time to calculate the average speed of the car.
In my case the vehicle covered 1.1 m in 2 seconds with velocity = (1.1) / (2)= 0.55 m/sec.
I ran a couple of experiments again to check the speed. I got almost the same speed for every trial. With these numbers we can calculate how much time it will take for the vehicle to accomplish the desired distance:
1.1 meter — 2 sec ( 2/60 minutes)
5 meters — 9 sec ( 9/60 minutes)
3,000 meters ( 3 Km) — 1.5 hrs
5,000 meters ( 5 Km) — 2.5 hrs
These numbers correspond to 3 important factors: the motors power, the battery’s power and the whole weight of the vehicle with the added components.
I have used a plastic phone case and rubber bands to secure it to the car as shown in Figure 13. You can also 3D print the phone case or you can simply use any case that serves the same purpose.
For this project, we don’t have to include any libraries. All required functions are in the main sketch.
Don’t forget to change the defined car speed to match your car speed in the defined section as shown below:
Figure 13: Final Pokemon Go Car (side view)
Figure 14: Final Pokemon Go Car (top view)
Here we have built a functional low-cost, low-power Pokemon Go Car. It was easy to put it together but still there is a lot of room for improvement. We can add in more sensors for advanced functionalities and can upgrade the motors and batteries to speed up the car. We can also use a long-range Bluetooth module to enable long-distance control. Stay tuned for further developments on this fun project! Please feel free to share your suggestions for improvements, if you have any!