Pet Robot Ball

4,297

60

9

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

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:

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

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

This is an entry in the
Robotics Contest

Be the First to Share

    Recommendations

    • Assistive Tech Contest

      Assistive Tech Contest
    • Reuse Contest

      Reuse Contest
    • Made with Math Contest

      Made with Math Contest

    9 Discussions

    0
    None
    iamborg1of1

    10 hours 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.

    0
    None
    BigGene

    2 days ago

    Just spent 10 minutes writing up a comment, but it disappeared somehow. Frustrating! This website has been acting glitchy lately. Anyway, great idea...my 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!

    Motor-Mount-Holes.jpg
    3 replies
    0
    None
    cabuuBigGene

    Reply 1 day 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.

    0
    None
    BigGenecabuu

    Reply 1 day 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.

    0
    None
    cabuuBigGene

    Reply 1 day 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.

    0
    None
    MnMakerMan

    6 days 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

    1 reply
    0
    None
    cabuuMnMakerMan

    Reply 3 days ago

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

    0
    None
    iamborg1of1

    3 days ago

    Its brilliant you should market it my dogs would love this

    1 reply