How to Build LEGO®-compatible Quadruped Robot

Quadruped Robot with Arduino, 3D printed, and LEGO®-compatible parts.
How to Build LEGO®-compatible Quadruped Robot

Introduction

Legged robots have always been one of the most interesting creations in the robotic industry as they could help us in exploring mysterious lunar caves and other space exploration missions. In fact, legged robots are mobile robots with articulated leg mechanisms that provide locomotion on rough trains. As compared with wheeled robots, they can move on different terrains, although at a slower speed.

Legged robots are often complicated to be made and controlled, as it requires precise control of each leg to maintain its balance. In this project, we are aiming to make a fun and easy-to-build four-legged robot with LEGO®-compatible and an Arduino board (Fig. A).

To do so, we take advantage of interesting mechanical mechanisms that simulate the walking pattern of a real animal, with only one DC gear motor. The result is quite interesting.

The LEGO®-compatible Quadruped robot
Fig. A – General view of the Quadruped robot

In this tutorial, we will make the body and the leg mechanisms of the robot using LEGO®-compatible parts. Then, an off-the-shelf DC gear motor will be connected to the leg mechanism to move the legs.

In the next step, we will need to add a brain to our robot to control its motions. Therefore, we will use Arduino Nano as an intelligent brain (Fig. B). Arduino enables us to expand our Quadruped’s possibilities with various commercially available motors and sensors.

Use Open-source platforms such as Arduino to build quadruped robot
Fig. B - An Arduino Nano board

To enhance the performance of the robot, we used an ultrasonic sensor as the eyes of the robot (Fig. C). By using the ultrasonic sensor, the robot can avoid obstacles. Thanks to the open-source nature of the Arduino board that allows such developments.

LEGO®-compatible four-legged robot with Ultrasonic sensor
Fig. C - An Ultrasonic sensor as the eyes of the robot

WWhat materials do you need to build a Quadruped robot?

Electronic and electromechanical components
Fig. D - Electronic and electromechanical components
  1. TT Gear Motor
  2. 3D Printed Gear Motor Housing
  3. 1x Arduino Nano
  4. 1x Breadboard, Mini Size
  5. 1x Power Jack, Barrel Type
  6. 1x Ultrasonic Sensor
  7. 3D Printed Lego-compatible Coupling
  8. 1x MOSFET
  9. 1x M3 x 25 Machine Screw
  10. 2x M3 x 10 Machine Screw
LEGO®-compatible block to build quadruped robot
Fig. E - LEGO®-compatible components
  1. Frame, 5x7 module
  2. Gear, 40-tooth
  3. Gear, 24-tooth
  4. Gear, 20-tooth and double bevel
  5. Bevel gear, 12-tooth
  6. Gear, 8-tooth
  7. Beam, 9-module
  8. Beam, 5-module
  9. Beam, 3-module
  10. Angular beam, 3x5 module
  11. Axle, 7-module

    K2) Axle, 6-module

    K3) Axle with stop, 4-module

    K4) Axle, 3-module
  12. Bushing/axle extender, 2-module

  13. T-Beam, 3x3 module

  14. Angular block 2, 180°

  15. Connector peg with friction, 3-module
  16. Connector peg with friction, 2-module

    P2) Connector peg with friction/axle, 2-module

  17. Beam with cross hole, 2-module
  18. Double cross block, 3-module

  19. Bushing, 1-module
  20.  Axle and pin connector perpendicular
  21. Connector peg with axle, 2-module
  22. Bushing, 1/2 module
  23. Angular block 1, 0°
  24. Axle connector with axle hole
  25. Angular block, 6 (90°)
  26. Liftarm, 2 x 4 L-Shape Thick

    Z2) Universal Joint 3L

    Z3) Axle, 2-module

How to use building blocks to assemble the robot?

Let’s start off by assembling the body structure and leg mechanisms of the Quadruped robot. The body structure holds everything together, including the gears, Legs, and electronics. Prepare the LEGO®-compatible pieces according to Fig. E, and follow the step-by-step video tutorial below.

What 3D printed parts do you need?

In order to hold the DC gear motor in place and make a proper connection to the LEGO®-compatible pieces, we have used custom-designed, LEGO®-compatible 3D printed motor housings and shaft couplings (Fig. F). Download and print out the motor housings, couplings. Then prepare the required Lego-compatible parts from Fig. E, and follow the step-by-step mechanical assembly tutorial.

Fig. F - 3D printed LEGO®-compatible DC gear motor coupling and housing

Electronics and wiring

Prepare your screwdriver and soldering iron and carefully follow the video instructions below. Make sure you properly implement the schematic circuit diagram shown in Fig. G so you don't end up toasting your Arduino board and motor driver.

Fig. G - Schematic diagram of the Quadruped robot circuit

Programming your DIY robot

You can pick up Lego-compatible pieces and let your imagination go limitless. Of course, coding is also the part that you can have lots of fun and be the most creative. You can go to Arduino IDE and write your own code to tell the Quadruped robot to do. But for now, let's start with this code.


  #define VCC 4            // This pin define as Vcc
  #define TRIG 5           // Ultrasonic sensor Trig pin
  #define ECHO 6         // Ultrasonic sensor Echo pin
  #define GND 7           // This pin define as GND
  #define MOTOR 3      // Motor pin
  
  const int dist = 15;     // Desired distance in cm
  
  float duration, distance;
  
  void setup() {
    pinMode(TRIG, OUTPUT);
    pinMode(ECHO, INPUT);
  
    pinMode(VCC, OUTPUT);
    pinMode(GND, OUTPUT);
  
    digitalWrite(VCC, HIGH);
    digitalWrite(GND, LOW);
    delay(5000);
  }
  
  void loop() {
  //  This section is related to Ultrasonics sensor
  /*
    digitalWrite(TRIG, LOW);
    delayMicroseconds(2);
    digitalWrite(TRIG, HIGH);
    delayMicroseconds(10);
    digitalWrite(TRIG, LOW);
    duration = pulseIn(ECHO, HIGH);
    distance = (duration * .0343) / 2;
    if (distance < dist)
      analogWrite(MOTOR, 200);
    else
      analogWrite(MOTOR, 0);
    delay(50);
  */
  
    analogWrite(MOTOR, 200);
  }