Stephen Smith's Blog

Musings on Machine Learning…

PiDog a New Member of the Pack

with 2 comments


Introduction

I recently received a SunFounder PiDog robot dog kit. I reviewed the SunFounder PiCar here along with software projects here and here. There are a lot of similarities between the PiCar and the PiDog as they are both controlled by a Raspberry Pi and both share the same robot hat to control the mechanisms, The PiDog is a more advanced kit, as there are more parts and more steps to the assembly than the PiCar. Having already assembled the PiCar was a big help as I was familiar with how SunFounder kits go together which sped up the process quite a bit..

The PiDog has eight servo motors controlling the legs for walking, three servo motors as part of the neck to control the head and a twelfth servo motor to wag the tail. There is a speaker so the PiDog can bark or howl, there is an ultrasonic sensor to detect obstacles, a camera so it can see, as well as a directional microphone so it can hear and tell the direction of the sound. There is also a touch sensor. There is a strip of lights along the front that can add to the PiDog’s expressiveness.

There are a number of sample Python programs included to show all the normal doggy type movements and operations. These then provide a great foundation for you to use to develop your own programs.

Although you can have fun just using the sample programs, writing your own programs to control the PiDog is where the real fun begins. Writing programs to control the PiDog will be the topic of future blog posts.

The PiDog is available for sale on Amazon along with other retailers for around $230CAD.

Assembly

The assembly instructions are fairly clear with good diagrams. But be warned there are 74 steps and a lot of parts.

The PiDog parts dumped on the table ready for sorting.

Some of the steps are quick, like peeling the protective cover from an acrylic part to quite long, usually involving doing something to each of the four legs. Mostly the parts are large enough to install easily. The supplied screw drivers are magnetic which helps in manipulating the smaller screws. I think the most annoying part was installing the screws and nuts that hold the servo motors in place. A younger person with smaller fingers will have no trouble at all. The kit includes screwdrivers and a wrench that fits the various nuts and screws. I found a pair of needle nose pliers to hold some nuts while tightening and a knife to peel off the protective layer on the acrylic parts was helpful.

One nice thing about the SunFounder kits is that they come with lots of extra screws, bolts and washers, so if you drop one, you don’t have to panic about finding it.

The partially completed PiDog with the legs assembled, next the neck assembly.

When assembling the robot, make sure you zero each server after installing it, this will make the robot function better and make the calibration step at the end much easier. There are more details when installing the first servo, which is the motor to wag the tail. The following ones hint at the zeroing process, but make sure you do it for all of them.

It’s Alive

The completed PiDog in its powered off pose.

After assembling the PiDog there is a calibration step, which if you zeroed the servo motors correctly should be quick and painless. The software installation part is done early on in the assembly process, this is needed to zero the servo motors as they are installed. When finished there are a couple more pieces of software if you want to control the PiDog from the SunFounder mobile app running on your phone.

Here is a video of the PiDog interacting with our Chihuahua Pilot.

The dogs are rather nervous of the PiDog. I think dogs view their world through scent and although PiDog acts like a dog, it doesn’t smell like a dog which either confuses or makes them nervous.

The Mobile App

I found the example software and mobile app for the PiDog to be quite good and a step up from the PiCar. The mobile app contains a complete screen to control the PiDog shown below.

Screenshot of the SunFounder mobile app with the PiDog default controls. The view from the PiDog’s camera is in the background.

Using the mobile app is a good way to play with the PiDog and make it perform most of its standard functions.

Sample Software

The other examples, let you control the PiDog via the keyboard on your laptop as well as run a number of behaviors like patrolling and barking when an obstacle is encountered.

Here is the PiDog running the patrol example program:

The various examples show how to use the PiDog’s API and exercise the various functions exposed via the PiDog Python Class. All the Python source code for the PiDog is included and is interesting to browse through. The PiDog class talks to the RobotHat class which turns the various servos and electronics off and on. For the PiDog class to make the dog walk, requires controlling all eight servo motors independently using multiple threads. Inside the class there are quite a few trigonometric calculations and a lot of delicate timing. Walking with four legs is a complicated process.

Summary

All in all the PiDog was fun to assemble and worked right away. There are a lot of great educational uses for this robot including:

  1. Assembling a robot
  2. How a robot works
  3. Basic programming in Python using the PiDog class
  4. More sophisticated programming involving trigonometry and how to program walking, or even galloping

Of course if you just assemble the robot and then use it from the mobile app, it is still lots of fun.

One thing I felt was missing was a working jaw. If there was a jaw then the barking would be more realistic and the PiDog could carry things around in its mouth. I think that would be cool.

It would also be cool if there were some additional parts you could 3D print like a body cover, so the electronics and wires aren’t so exposed. Plus this is another avenue for customization as you could have different looks and colors for the body. The same for the head. Something I might look into down the road.

Written by smist08

February 2, 2024 at 10:24 am

2 Responses

Subscribe to comments with RSS.

  1. […] Last time, the SunFounder PiDog was introduced, this time we’ll introduce how to program the PiDog to do our bidding. Previously, we looked at the SunFounder PiCar and how to program it. Both robots share the same RobotHat to interface the Raspberry Pi with the various servos, motors and devices attached to the robot. For the PiCar this is fairly simple as you just need to turn on the motors to go and set the steering servo to the angle you want to turn. The PiDog is much more complicated. There are eight servo motors that control the legs. On each leg, one servo sets the angle of the shoulder joint and the other sets the angle of the elbow joint. To get the PiDog to walk takes coordinating the setting of each of these servos in a coordinated fashion. SunFounder provides a PiDog Python class that hides most of the complexity, though it does give you direct access if you want to control the legs directly. […]

  2. […] robot, this time the SunFounder GalaxyRVR Mars Rover. I previously reviewed their PiCar and PiDog which both used a Raspberry Pi as their brains. In contrast the Mars Rover uses an Arduino Uno for […]


Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.