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:
- 17cm diameter Hamster Ball (https://amzn.to/2PShVKr)
- 2 x DC Motors and Wheels (https://amzn.to/2PQkm0n) Or (https://www.banggood.com/custlink/GKmGBes7RB)
- Wemos D1 Mini (https://www.banggood.com/custlink/GDmv4JTGLi)
- WS2812B RGB LED (https://www.banggood.com/custlink/KK3GBr7RcZ)
- 2N2222 Transistor (https://www.banggood.com/custlink/DDm3eJ7DbH)
- Buzzer (https://www.banggood.com/custlink/Dv33g6N1hQ)
- KY-002 Shock Sensor (https://amzn.to/2oOvHTm)
- 2 x 14500 3.7V Li-Ion Batteries (https://www.banggood.com/custlink/m33GB6n1Jv)
- AA Battery Holder with switch (https://www.banggood.com/custlink/mGDv4BnTpt)
- L298N Motor Driver Board (https://amzn.to/2pM7PAd) Or (https://www.banggood.com/custlink/mvGG0gbTco)
- Various length wires
- Vaious M2 and M3 screws
- 5 x 3D-Printed parts
3D-Printed 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.
The printed parts are available from thingiverse.
Solder Wires to the Motors
Position and Secure the Motors
Attach the Motor Cover
Attach the D1 Mini and Motor Driver Board
Connect Components
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:
- ESP8266WiFi Library v2.4.2 – https://github.com/esp8266/Arduino
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.