Pet Robot Ball




Introduction: Pet Robot Ball

About: Arduino, Alexa, etc.

My pet dog loves playing with toys especially ones he can chase! I built a robotic ball that switches on and rolls away automatically whenever he interacts with it, notifies me via my mobile phone which I can then use to control it over WiFi and finally powers down when the fun is over to conserve battery.

The ball is specifically designed to be tough with all the electronics and moving components tucked away safely inside. It could be used just as equally for other pets such as cats.

The ball uses a d1 mini micro-controller, programmed using Arduino and is put together using some 3D-printed parts and some cheap, readily available components.

For this project you will need:

Step 1: Print the Parts

You will require 5 3D printed parts in total. The motor base and cover which hold the 2 motors firmly in place and to which the D1 mini and motor driver board are attached as well as 2 ball heads which attach to the guide arm.

Print with a layer height of around 0.2mm and infill of 20% and they should come out just fine.

Step 2: Solder Wires to the Motors

Solder 2 wires to each of the motors

Step 3: Position and Secure the Motors

Position the 2 DC motors within the motor base and secure using appropriate length M3 screws and the fixing positions (2 for each motor).

Step 4: Attach the Motor Cover

Position the motor cover and secure using 4 x M3 screws.

Step 5: Attach the D1 Mini and Motor Driver Board

Using some M2 screws, attach the D1 mini and the motor drive board to the cover.

Step 6: Connect Components

Connect all the components using the schematic remembering to remove the 2 jumpers from the L298N board as shown. Attach the wheels to the motors. Secure the battery cover to the underside of the motor housing using hot glue. Use hot glue to tidy and secure all the loose cables (You may want to skip to the next section and test everything first!).

A bit of theory...

The shock sensor is attached to the reset pin to enable the D1 mini to wake from deep sleep which we use to save power whenever the robot is not being played with. The transistor is used as a switch to ensure that these signals are not received when the device is switched on or else as soon as the robot ball moves it would simply reset itself again and again.

The transistor requires signal from an output pin of the micro-controller to operate. Fortunately for us, the pin D0 (GPIO16) is automatically set to HIGH when in deep sleep and we can simply set it to LOW as soon as the sketch starts up to prevent any subsequent resets. The pin automatically sets back to HIGH again to 'arm' the sensor as soon as the micro-controller returns to deep sleep.

Step 7: Configure the Sketch

Download the latest Arduino IDE and the latest Arduino sketch which can be found here.

Ensure you have the following libraries installed. These can be installed using the libraries manager from within the Arduino IDE if not. Newer versions may work but have not been tested.

  • FastLED v3.3.2
  • Blynk v0.6.1

The following library must be installed manually by moving its contents into the Arduino libraries folder:

Open the sketch in the Arduino IDE. Change the 3 lines shown below to reflect your own WiFi credentials and your Blynk Auth Token (see Blynk App section to locate this).

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YOUR WIFI SSD HERE";
char pass[] = "YOUR WIFI PASS HERE";

// You should get Auth Token in the Blynk App. // Go to the Project Settings (nut icon).
char auth[] = "YOUR AUTH TOKEN HERE";

NOTE: You will need to remove the pin from D0 before you will be able to upload sketches. Re-connect it after the upload is complete.

Connect the D1 Mini to the PC using a micro-USB, ensure that the settings shown are used, the correct COM Port is set and upload the sketch.

The ball should now reboot and connect to your WiFi network. It will become controllable via your own mobile Blynk app after completing the Blynk section of this guide. To troubleshoot any faults, with the D1 mini connected to the PC, use the Serial monitor in the Arduino IDE to help diagnose.

Step 8: Blynk Mobile App

The ball is controlled using a Blynk web app. Blynk is an IoT platform free for prototyping/non-commercial use.

Begin by downloading Blynk from the Android Play or Apple App Store.

Create an account and Scan the QR-code above from within the app.

Under the project settings locate the projects Auth Token by emailing to your account or using the Copy all feature.

Copy the auth token to the android sketch, upload and you should be good to go!

Step 9: Insert Robot Into the Ball

Gently position the completed electronics into the ball. Once inside, attach the guide arm with a guide ball snapped in place either side.

Note: The photo shows the guide arm and balls in place prior to insertion as a guide only. You will not be able to position the robot into the ball if you do things in this order!

Secure the guide arm in place with a zip tie, velcro strap or rubber band.

Insert 2 x 3.7V batteries, turn on the power switch and close the lid on the ball.

Step 10: Play Away...

Set up your robot ball somewhere for your pet to find and as soon as they start interacting with it watch it come to life and entertain them all by itself. If you prefer, use the mobile app to play back with some skilful moves. Enjoy and if you liked this project please vote for us in the Robot contest. Thanks.

Robotics Contest

Second Prize in the
Robotics Contest

1 Person Made This Project!


  • Crayons Challenge

    Crayons Challenge
  • Microcontroller Contest

    Microcontroller Contest
  • Plywood Contest

    Plywood Contest



Tip 7 months ago

I made this project a while ago! We were very impressed with this Instructable. However, some parts needed to be updated.
Our tips:
-To simplify, we removed the Buzzer, LED, and Shock sensors.
- The wires can easily get tangled if they are not secured well. You might want to consider shortening or securing the wires, especially after installing the guide arm.
- In the chart from this Instructable, all connected power wires can be grouped together. The same is true for all connected ground wires.
- When attaching wires to the L298N Motor Driver Board, it's hard to stick a male jumper wire and a bare wire in GND together, as they can both slip out. The best solution is to solder the wires together and then fit it again.
- The Wemos D1Mini chip we bought did not have holes for screws, so we used Velcro dots.
- We used Velcro dots to glue on the battery pack, but it can be done with hot glue as well. The important part is to position the battery pack at the bottom so it lowers the center of gravity, helping the wheels touch the ball.
- The guide arm was not heavy enough for the wheel to contact the inner surface of the ball all the time, so we added weights (two nuts on each end of the guided arm and two nuts at the bottom next to the battery pack).

Tips for Arduino:
1] Download the latest Arduino IDE as in Instructable.
2] Install library for latest Blynk using Libraries Manager in Arduino IDE.
3] Install ESP8266 (
with Boards Manager in Arduino IDE
  • Start Arduino and open the Preferences window.
  • Enter into the File>Preferences>Additional Boards Manager URLs field of the Arduino IDE. You can add multiple URLs, separating them with commas.
  • Open Boards Manager from Tools > Board menu and install esp8266 platform (and don't forget to select your ESP8266 board from Tools > Board menu after installation).
4] Install CH341ser Driver (
  • Download the Windows CH340 Driver.
  • Unzip the file.
  • Run the installer which you unzipped.
  • Verify it is installed properly.
In your PC Device Manager, you should see a new port once the device (in our case Wemos D1 Mini) is connected.
In the Arduino IDE when the CH340 is connected (or device that has CH340 is plugged in, in our case esp8266,Wemos D1 Mini) you will see a COM Port in the Tools > Serial Port menu, the COM number for your device may vary depending on your system but matching the port in the Device Manager.
5] Set up
Select board LolinDiR2 & Mini
Set up port (Check which one in Device Manager)

6] Test Wemos D1 Mini by running the sample program “Blink”-- you should see build-in LED light twinkle.

Note: if you have not done so already, learn to upload the program to a board. Then for this board specifically, remember to remove any wire on D0 when upload and reconnect as needed after uploading.

- IMPORTANT: THE VERSION OF BLYNK IN THE INSTRUCTABLES IS NO LONGERS SUPPORTED. Instead, after downloading Blynk, you follow these steps:
1) Create an Account
2) Go to Developer Mode
3) Create a new template
4) Go to and log into the account
5) Name and label the template
6) Create 4 data streams, one for each direction, with the "integer" setting
7) Add 4 buttons in the new template, configure the look (text color, size, etc.)
8) Upload the program.
Remember to update the WiFi/hotspot connection information in the code.
- When inserting the robot, it's much easier to unscrew the ball into two halves and put in the robot. Otherwise, it's very hard to insert the guide arm.
We loved working on this project, and it turned out great!

Question 1 year ago on Introduction

Hi, I wanted to ask if you would be willing to sell me the roller ball you already have built.
I am looking for a project.
I leave you my contact email.



2 years ago

Love your idea! Usually I put my hamster inside the ball but your robot does a great job! When I have a dog I will make one of those! Thanks for sharing it :)


Reply 2 years ago

Thanks for the feedback, be sure to let me know if you do ever make your own, would be great to know how you get on.


Reply 2 years ago



2 years ago

since seeing this on telly there was an ad for something similar to this but it was in a UFO shape and not as good as it can get stuck under low tables etc, you should rely try and raise money with crowdfund or similar.


2 years ago

Just spent 10 minutes writing up a comment, but it disappeared somehow. Frustrating! This website has been acting glitchy lately. Anyway, great dog should love it if she's not scared. Recommend using M3x25mm bolts for mounting the motors and M2x6mm for mounting that cover to the motor holder. Also, the top holes for mounting the motors might be off by about .5mm or so...or it could be my 3d printer. Anyway, I used a Dremel to align those holes a bit. I have to wait on a Wemos D1 and the RGB LEDs before I can continue. Once again, thanks for a great project.
Finally managed to upload the image of the motor mounting holes.
Quick question...Can I use a pair of 3.7V type 18650 rechargeable LiPO batteries instead of the ones you used? I have a pair of those on hand. Thanks!


Reply 2 years ago

Thanks for posting your findings, glad you managed to sort the mountings, printer calibrations are often slightly out so maybe I just got lucky with mine. Your batteries are fine so long as you wire them in parallel so you're providing no more than 3.7v to the shield. Good luck and let us know how you get on.


Reply 2 years ago

Appreciate the quick follow-up. It's a little difficult to see how you mounted/tied together the battery holder, LED, and other components to the motor mount, but I should be able to figure it out.


Reply 2 years ago

I used hot glue to stick the batteries to the underside although this won't work in your case as your batteries will be larger and there isn't the clearance. Similarly the led, buzzer and shock sensor are glued wherever they fit, should be plenty of space though. Happy to provide some more photos if you think that'd be useful.


2 years ago

I love it! Great project, thanks for sharing. I might have to make this, I know my dog would have alot of fun with it


Reply 2 years ago

Thanks and no problem, let us know how it goes if you do.


2 years ago

Its brilliant you should market it my dogs would love this


Reply 2 years ago

Thanks so much!