Are your games of fetch with your pooch leaving you panting? David Crookes catches up with a Raspberry Pi Pico solution in The MagPi 112
Dogs love to play fetch and it’s a wonderful way to exercise your pooch. Trouble is, constant ball throwing isn’t half exhausting for human arms, which is perhaps why there’s a growing number of automatic ball launchers on the market.
Rather than buy one of those, however, seasoned maker Brankly has created one of his own. “My dog loves to play with blue toy balls and I wanted him to have a little more fun,” he tells us. “I also want him to be able to play fetch when we are busy by encouraging him to load the balls himself.”
While training his dog to do so is still ongoing, work on the ball launcher is complete. It makes use of a Raspberry Pi Pico microcontroller board which is something of a departure for Brankly who has previously used Arduinos for his projects. “I just wanted to try something new,” he says. “I love how simple it is to program.”
Before getting down to coding, however, he spent time experimenting. “I started with the motor mount to test if that would launch the balls,” he explains. “After that, I designed the other parts and, in the end, the case. I played around with different shapes and found that a sphere design looked the best. It was also small enough for my 3D printer to print.”
The case was designed in Fusion 360. “I like 3D printing because you can design everything first, send it to the printer, and have the part after some hours,” Brankly says. “Most of the time, you have to change small parts, but it’s a pretty straightforward process.” Indeed, he refined the project as he went along, such as the rollers that accelerate the ball.
“The first version had a profile printed on them, but the friction was not enough to grab the ball when it was wet from my dog’s saliva,” Brankly says. “I also had to change the mount for the sensor a couple of times because the first two sensors I tried didn’t work.”
So how does the launcher work? When a ball is placed into its funnel, it is prevented from falling into the launch channel by a piece of plastic that’s controlled using an SG90 servo. The ball is then detected by a sensor, prompting Raspberry Pi Pico to get ready for launch.
“I used a motor controller to be able to randomise the speed of the motors with a pulse-width modulation (PWM) signal,” explains Brankly. “For each cycle, Raspberry Pi Pico generates a random number between 40,000 and 65,000, and this gets sent to the controller as a PWM value.
“This will vary the distance of the ball each time so it’s more fun for my dog. After the motors are started, the ball releases and gets shot out. The motors turn off, the servo blocks the entrance again and the machine is ready for the next ball.”
The approach adds an element of uncertainty and means a dog won’t know exactly when the ball is going to launch, or how far it’s going to travel. “I’m really happy with the end result,” Brankly says. “I think the design looks pretty cute and my dog really loves it. He gets all excited when he hears the machine starting up.”
Subscribe to The MagPi worldwide!
Subscribe to The MagPi today at magpi.cc/subscribe and never miss an issue. Our twelve-month print subscription is available globally and it comes with a free Raspberry Pi Zero 2 W.