Pet Robot Ball – Build

Introduction

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

More details for this project can be found at instructables and thingiverse.

Parts Required

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:

3D-Printed Parts

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

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.

The printed parts are available from thingiverse.

Solder Wires to the Motors

Solder 2 wires to each of the motors

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).

Attach the Motor Cover

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

Attach the D1 Mini and Motor Driver Board

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

Connect Components

Connect all the components using the schematic. 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!).

Configure the Sketch

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.

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”;

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.

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!

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.

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.

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.