Polydog - Arduino Project

by hugoDurand in Workshop > 3D Printing

2683 Views, 26 Favorites, 0 Comments

Polydog - Arduino Project

Marche rapide
P1530461.JPG
Nouveau_robot_pret.jpeg
robot-synchronise.gif

During the Electronics-Arduino course of the 2nd year of the preparatory cycle at Polytech Nice Sophia, Raphael ANJOU and I had the opportunity to create from A to Z a project of our choice.

Seduced by the quadruped robots, we quickly opted for the construction of a dog robot. Inspired by Spot (Boston Dynamics), Droid (Loki Le Dev), mini cheetah (MIT) and many others, we were able to create our first robot dog prototype.

Here, we present PolyDog, fully made in 3D printing with servo motors (13kg/cm). It measures 17.6 cm wide and 42.4 cm long. It weighs about 2 kilograms.The movement of the legs follows a 4 bars parallelogram mechanism, to keep the motors at the level of the body.

In this instructable, we will show you the manufacturing steps of our robot, so that you can reproduce it.

Tools and Supplies

fer.jpeg
téléchargement (1).jpeg
servo.jpeg

Here is a list of the tools and supplies needed for the build. We were lucky to have a fablab (SoFAB - Fab Lab de Sophia Antipolis) near the school to provide us with all this material :

Tools

  • Vernier caliper
  • Hammers
  • Screwdrivers
  • Allen keys
  • Various wrenches
  • Clamps
  • Files
  • Cutting pliers
  • Cutters
  • Scissors
  • Screwdriver
  • Hacksaw
  • Hot glue gun
  • Soldering iron
  • Voltmeter
  • Self-adhesive label printers
  • Roll tape

Supplies

Electronics ($384) :

  • Servo motors (TowerPro Metal Gear MG995) -- Other servo-motors work better if you put more money into them. You just have to pay attention to the size of these so that it fits in the 3D parts.
  • Servo controller Lynxmotion SSC32
  • Arduino UNO
  • IR remote control
  • Pixy2 Caméra
  • Alimentation de 5V et 30A
  • Electric cable

Other supplies :

  • Screws and Hexagon Nut (provide more details on the length of the screws):
    • M3 : 18 ( body assembly)
    • M3 : 48 (assembly of the legs)
    • M3.5 : 48 (attach motors)
    • M2.5 : 8 (assembly of the legs)
    • M3 : 32 (links the servo and legs)
  • Threaded insert M3 : 18 (body assembly);
  • Metal spreader for servo motor;

3D Printed Part

robot-exploded-view-no-background.png
Cadsgrehtrptdure.PNG
onshape.PNG
patte.jpeg

Our design process

We designed all parts of this robot in a mechanical CAD platform Onshape.

We started off to make the leg #image4. We have researched the most optimal and easy to develop system for paw movement. We wanted the servo motors to be at body level to keep the leg light and avoid running cables through the legs.

We then opted for the parallelogram system. A servo motor moves the knee and lifts the lower part of the leg. A second servo moves the leg at the hip via a spur gear. The two servos are located in a box allowing to move the whole leg laterally with a third servo motor.

After testing the robot with a wooden body, we turned our attention to the creation of a 3D printed body. We started with the shell to protect the central servos and hide the cables above. Then we added two support arms on each side to accompany the rotational movement of the servo motor housings.

Printing of 3D parts

The robot uses 37 3D printed parts.We printed all of these parts on a Prusa Original i3 MK3S+ 3D printer using PETG filament. I have assembled all of the STL files on my Thingiverse page here. If you have a 3D printer at home, we gave you the settings for printing to have a rendering that is not too heavy or too fragile.


Assembly of the Legs

patte3d.PNG
Captdure.PNG
patte_assembly.PNG

Let's start off by assembling the 4 legs of the robot. Each leg is oriented differently so pay close attention to which 3D printed parts you use for each leg.

Moreover, when we move the servo motors of the 4 legs at the same time, they must make the same movement.

It is then preferable to adjust the servo motors all to the 90 angle and then put the legs in the same position (central to the movement).

The foot is assembled on the male end of the tibia, adding glue inside the hole with a glue gun. Then on the other end of the tibia, we insert the tendon fixed with a M2.5 screw. At the other end of the tendon, the knee is attached with an M2.5 screw. Then the hip and femur are fixed with 3 M3 screws by inserting the knee between the two pieces. It is important to make sure that these two pieces fit together well, leaving a space for the rotation of the knee. The center of the tibia is attached to the femur with an M3 screw, completing the parallelogram system.

On the other side, we attach the two servo motors to the housing. This part is a little bit tricky, we did not design the location of the screws correctly. It is difficult to fix the nuts on the other side. Feel free to modify the part to make it easier. On our second version, we fixed this problem.

Finally, we assemble the leg to the servo motors of the housing with the central screw provided by the servo motor manufacturer and the 4 M3 screws at the knee. We add the gear pinion on the other servo motor that will drive the hip movement. You will probably notice it once the assembly is done, but the gear pinion is always on the side of the central servo motors of the body.

Make sure that the servo motor cables come out of the holes provided for this purpose

Body Assembly

part-body.PNG
insert.PNG
insert_cote.PNG
step3.PNG
themostimportantpart.PNG
inserer-patte.PNG

Gather 25 threaded inserts, and all the 3D robot parts. Using a heated soldering iron, insert the inserts into all the holes that need them :

  • #image2 : Add 10 inserts to the support plate and to the bottom side where indicated. These inserts will then be used to attach the top of the body, the support arms.
  • #image3 : Add 4 inserts to the bottom side. These inserts will attach the support arms to the bottom of the robot.

When you attach the leg to the 3rd motor (shoulder motor). Be sure to put it in the same position for each leg.

Now we can start assembling the pieces together. You can hang the legs on the support tray. And you can add the bottom part, but only with screw on the side inserts. You have to wait until you add the support arms to screw it all together.

Once this is done, you can take the cables out of the central servomotors and place them in the center. Then, you take the 4 cables on each side, coming out of the motors of the boxes. You pass them through the crevices of the support arms to make them come out of the central hole. You can now attach the holding arms to the rest of the body.

We just have to connect the different cables on the central cards and it's done. We will do this in the next step. And, at the end you will close the cover with 4 screws to hide the cables

Electronics !

electronics.PNG
cable.jpeg
WhatsApp Image 2022-06-26 at 20.31.41.jpeg

Let's move on to the heart and brain of the project, the electronics! You have in the picture1 a diagram showing how everything has to be connected. You can choose which pin to connect the servo motor cables to, trying to make it a bit harmonious in the layout.

Overview of the different electronic components and connection :

  • Lynxmotion SSC-32U Servo Controller : We can consider it as the heart of our robot, it is the one that pumps the information from the brain to the servo motor through the tricolor cables. It is a card that allows to make the link between the servo motors and the card that sends the orders (Arduino UNO). It has a high resolution (1uS) for accurate positioning and smooth movements. The range is 0.50 to 2.50 mS for a range of about 180°. It has improved power and communication management. The SSC-32U servo controller can control up to 32 servos, which are laid out as two separate sections of 16 servos. For our robot, we supply the 6 servo motors on the left side on the VS1 Screw Terminal and the right side on the VS2 Screw Terminal. This card is powered by a 5V and 30A power supply connected to the mains. The card can be easily controlled using the SSC-32 Servo Sequencer Utility. This is available as a free downloadable utility which makes it simple to experiment with robotics and animatronics (download it here).
  • Arduino UNO : This card is the brain and memory of our dear dog. Through the USB port, we transfer the C++ code to the Arduino board which transmits the data to the servo controller serial. Thus, we need two things. On the one hand, we power the Arduino board by connecting two cables to pin 5V and GND of the servo controller which is powered by the mains. On the other hand, we connect the Tx (transmits the signal) and the Rx (reads the signal output). It will be necessary to connect the bluetooth module, but later. For the moment, by writing a very simple code, we are able to order the robot to execute pre-programmed sequences.
  • Pixy 2 camera : This module is the eye of our robot. More seriously this intelligent camera is sold already programmed for color recognition. It is oriented to the place where it sees the color. As far as connection is concerned, it looks complicated to connect on the schematic of the image1. In reality, the wires are already connected to each other and we only need to make one connection.
  • Arduino infrared remote control kit : The infrared receiver is connected to an OUTPUT pin, to 5V and to GND. It is now ready to receive the codes sent by the infrared remote control.

Calibrate the Servos

angleservo.jpeg
robot-synchronise.gif
entraindecoder.jpeg

Before starting to ask him to walk, it is necessary to make sure that each leg is calibrated in the same way, otherwise he risks limping. To be more precise, the servo motor has a range of motion of 180 degrees. It is necessary that the starting point for each leg is the same, so that we have the same place of stop. We must then fix the legs by taking a mark. We chose the prone position, because the robot never extends the leg more than 180 degrees forward. Some use software to run only one servo motor to test them one after the other. But we did it one by one by changing the pin value. It's a bit laborious, but we do it only once, so it's ok. It is also necessary to put the shoulders (the boxes) at the same level, although we use only 60 degrees of amplitude on the 180.

Then we switch to the default setting in the code. There are still some offsets of a few degrees. We define constants in the code, to level each leg:

Exemple :

// Constants for LEG A
int OFFSET_KNEE_A = 165;

int OFFSET_HIP_A = 165;

int ANGLE_MIN_SHOULDER_A = -40;

int ANGLE_MAX_SHOULDER_A = 132;

The left side legs have an offset of 165 and the right side legs have an offset of 0. Because otherwise they will not go in the same direction.

Robot Program

code.PNG
dvsfgdhjtuk.PNG
Capqfzrgethture.PNG

We have chosen to work with PlatformIO. This allows us to configure different environments with specific options such as the type of board used and to be able to work with VsCode which is much more convenient than the Arduino editor.

We have organized our code using 3 classes written in c++: Leg.cpp, CustomServo.cpp and PolyDog.cpp.

  • Leg.cpp :
    • Allows you to control each motor in a leg without worrying about offsets. For example, the hip motors do not have the same orientation between the left and the right. To allow synchronization of the 4 legs motors, we have for some of them, added an offset of 165° (as explained in the servo motors calibration part.

  • CustomServo.cpp :
    • This class allows to communicate with the SSC32 by indicating only an angle. We instantiate an object of this class from a pin number. Through the Arduino board, we send commands to the Serial commands on the Serial of the ssc-32. The message sent is of the form " #{pin_number} P {position between 500 and 2500} T {time} We do not use the time parameter in the move function. This allows us to have the freedom to to vary the time in the methods coding the robot movements of the robot. The write function returns the move function by converting the 500-2500° amplitude into 0-180°. This facilitates the physical understanding of the robot's of the robot.
    • void CustomServo::move(int position, int time)
      { Serial.print("#"); Serial.print(_pin); Serial.print(" P"); Serial.print(position); Serial.print(" T"); Serial.println(time); delay(time); }

    • void CustomServo::write(int angle)
      { move(map(angle, 0, 180, 500, 2500), 0); }

  • PolyDog.cpp :
    • This class is a kind of directory of methods that will allow to give life to our dog.
    • We define the method self_balancing(), hold_shoulder(), move_forward(), move_right(), move_left(), etc
    • The angles of each of the servo motors are chosen after numerous tests to optimize the movement of the of the leg. Here is a simple example of a method in the Polydog class:
    • void PolyDog::hold_shoulders() { legA.move_shoulder(90); legB.move_shoulder(90); legC.move_shoulder(90); legD.move_shoulder(90); }
    • This method keeps the legs perpendicular to the ground. We notice that this method uses the Leg class to manage the offsets due to our servo motor installation.

Using the Remote Control

infrared-communication.png
infrared-remote.png

We added an infrared remote control to change the movements of the robot more easily. When we press a button, the remote control sends a code to the receiver, which we can retrieve in the INPUT pin. For example, for the button *, it is the code 0xFF42BD. So we get all the numerical codes of each button and we make a switch case to perform the corresponding function.

List of commands we have implemented on the remote control :

* button : The robot is in a waiting movement -> dog.self_balancing();

# button : The robot is doing a little excitement thing -> dog.excitement();

UP button : The robot is going forward -> dog.move_forward();

RIGHT button : The robot is going to the right -> dog.move_right();

DOWN button : The robot is going backward -> dog.move_backright();

LEFT button : The robot is going to the left -> dog.move_left();

OK button : The robot is static -> dog.start();

We still have a lot of buttons on the remote control that do not make any movement. So you have the freedom to write your own functions on the remaining ones.