A DIY Rescue Robot With Arduino, 3D Printed, and Lego-compatible Parts

by Tart Robotics in Circuits > Robots

4336 Views, 37 Favorites, 0 Comments

A DIY Rescue Robot With Arduino, 3D Printed, and Lego-compatible Parts

IMG_2885.jpg

Introduction

Rescue robots are designed to assist humans in search and rescue operations. They usually assist rescue crews in tasks such as searching, 2D/ 3D mapping of the search area, removing rubbles and object manipulations, delivering supplies, and or evacuating casualties from disastrous sites. For instance, rescue robots were used in the Fukushima nuclear disaster in 2016. As rescue robots work in disastrous sites, they should be able to move on rough trains. Therefore, their locomotion mechanism should enable them to go over the steps and inclined terrains. They are usually equipped with tracked locomotion mechanisms, as it provides high traction for the rescue robots to move on uneven surfaces. They should also be equipped with a robotic manipulator to enable object grasping and manipulation.

Rescue Robot’s Track and Gripper Mechanisms

Rescue robot’s tracks and gripper.jpg

Rescue robots that are controlled by an operator from a safe distance are called teleoperated robots. In this case, the operator sends command signals to the robot through a communication channel. The robot follows the commands to safely move toward the target locations and, for example, to manipulate objects or to displace rubbles.
If the size of the rescue robot is small, it can be deployed in confined and tiny places where larger rescue robots cannot operate.

General View of Operator Console and Handheld Rescue Robot

Rescue robots that are controlled by an operator.jpg
General view of the handheld rescue robot.jpg
Rescue robot using its gripper to displace a can of coke.jpg

In practice, they’re sent out to find victims or shut off the gas valves in collapsed buildings, or disastrous sites. Hence, they are all equipped with grippers as their primary tool to utilize in the field. The operator’s proficiency in controlling the robot from a distance, agility, and durability of the locomotion mechanism, dexterity of the robotic manipulator or gripper, and the capacity of the communication channel are the main issues affecting the whole rescue operation.

Electrical Assembly

arduino nano and uno.jpg
Wireless remote control.jpg

In this tutorial, we will show you how to make a teleoperated rescue robot out of Lego Technic pieces, Arduino boards, off-the-shelf DC and servo motors, NRF communication modules, and joystick module. The current project uses an Arduino Uno and Nano boards as the main controller of the robot and the operator console, respectively.

The body structure of the robot is made of Lego Technic pieces. Arduino boards and DC and servo motors are then connected to Lego pieces using custom-designed 3D printed parts. The servo motor is in charge of opening and closing the gripper, and DC gear-motors are used to provide the main movements of the robot.

The operator console has a joystick for controlling the robot’s main movements and two pushbuttons for the opening and closing of the gripper. The command signals are transmitted to the robot using the NRF module. The instructions are given in a way that you can easily make one at home.

Materials

Rescue bot Elecreical Part List.jpg
Rescue bot Mechanical Part List.jpg

List of electronic parts

A) 1x 3D Printed Arduino Uno Holder

B) 1x Servo Motor

C) 1x Servo Motor Lego-compatible horn

D) 1x Servo Motor Lego-compatible housing

E) 2x TT Gear Motor

F) 2x 3D Printed Gear Motor Housing

G) 1x Joystick Module

H) 1x Arduino Uno

I) 1x Arduino Nano

J) 1x Breadboard, Mini Size

K) 2x Breadboard, 83 x 52 x 9mm

L) 2x Push Button, Tactile Type

M) 1x Driver Motor

N) 1x Power Jack, Barrel Type

P) 1x Buzzer, Active Type

Q) 2x 3D Printed Lego-Compatible Coupling

R) 1x M3 x 30, 2x M3 x 16 Machine Screw

S) 2x M2 x 16 Screw

T) 4x M3 Flat Washer

U) 1x Mini Switch, Toggle Type

V) 2x NRF 24L01, Antenna Module

W) Male to Male Jumper Wire

X) 2x RP-SMA Antenna

List of Lego Technic components

A)Track, 5x1, 5-module

B) Double angular beam, 3x7-module

C) Beam, 9-module

D) Beam, 7-module

E) Beam, 5-module

F) Beam, 3-module

G) T-Beam, 3x3 module

H) Frame, 5x7 module

I) Bushing/axle extender, 2-module

J) Connector peg with friction, 2-module

K) Connector peg with friction, 3-module

L) Axle, 2-module

M) Bushing, 1-module

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

O) Axle with stop, 4-module

P) Axle, 3-module

Q) Double connector peg, 3-module

R) Gear, 40-tooth

S) Sprocket, 40, 7x15 mm

Assembly of Mechanical Parts

General view of gripper’s construction.jpg
DIY Rescue Robot with Lego, Arduino and 3D Printed Parts - Part 1

Let’s start off by assembling the body structure of the robot. The body structure holds everything together including the track mechanism, the gripper, and the electronics. Prepare the Lego Technic pieces according to the Lego part list, and follow the step-by-step video tutorial below.

After the body structure is completed, it’s time to add the gripper. The gripper consists of a pair of gears that rotate in opposite directions. Each gear holds one jaw of the gripper. Inside the gripper mechanism, a servo motor is in charge of the opening and closing of jaws. For snapping the gears in place, note their initial positioning in the assembly instructions video. If they snap lopsided, your gripper won’t work properly.

3D Printed Parts

3D printed Lego Technic compatible DC gear motor coupling and  housing    .jpg
3D printed Lego Technic compatible Arduino holder.jpg
3D printed Lego Technic compatible Servo motor holder and housing.jpg

In order to hold Arduino Uno, DC gear motors, and the servo motor in place and make a proper connection to the Lego pieces, we have used custom-designed, Lego compatible, 3D printed motor housings, Arduino holder, and shaft couplings. Download and print out the Arduino holder, motor housings, couplings, servo motor housing, and servo motor horn. Then get the required Lego parts from the Lego Technic part list and follow the step-by-step mechanical assembly tutorial.

Electronics and Wiring

Rescue_Circuit_bb - MAIN.jpg
Rescue_Circuit_CONTROL_bb.jpg

For this project, you need to assemble both the robot and operator console circuits according to the schematic diagram. So, let’s break down this section into two parts.

For the robot part, download and print out our Lego compatible Arduino Uno holder so that you can properly place your Arduino on your robot. For the rest of this section and for assembling the remote controller just follow the video instructions and the schematics carefully.

Programming

DIY Rescue Robot with Lego, Arduino and 3D Printed Parts - Part 2

Double-check the warnings from the previous section and make sure everything is assembled exactly as the circuit diagram. Now that you have completed the assembly, it’s time to program your robot. Upload the provided codes to your robot and its operator console.

Rescue robot:

/*
  Rescue Robot
    The idea:
    In this project, we will show you how to make a teleoperated rescue robot out of Lego Technic pieces,
    Arduino boards, off-the-shelf DC and servo motors, NRF communication modules, and joystick module.
    The current project uses an Arduino Uno and Nano boards as the main controller of the
    robot and the operator console, respectively
    The circuit:
    - In this circuit, an Arduino UNO is used. Any other types of Arduino
    can be used of course but do not forget to change the pin configurations
    if you want to change the circuit on your preference.
    Visit the Tart Robotics blog for more information:
     https://www.tartrobotics.com/blog

*/

#define servo 2
#define motor_leftpwm 5
#define motor_rightpwm 6
#define motor_left_d 3
#define motor_left_a 4
#define motor_right_a 9
#define motor_right_d 8
#define buzzer A5
#define aux_gnd_1 A4
#define aux_gnd_2 A3
#define aux_vcc A2

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <Servo.h>

RF24 radio(10, 7); // CE, CSN
Servo gripper;

const byte address[6] = "00001";
int gripperPos = 90;

void setup() {

  Serial.begin(115200);
  pinMode(servo, OUTPUT);
  pinMode(motor_left_a, OUTPUT);
  pinMode(motor_left_d, OUTPUT);
  pinMode(motor_right_a, OUTPUT);
  pinMode(motor_right_d, OUTPUT);
  pinMode(motor_rightpwm, OUTPUT);
  pinMode(motor_leftpwm, OUTPUT);
  pinMode(buzzer, OUTPUT);
  pinMode(aux_gnd_1, OUTPUT);
  pinMode(aux_gnd_2, OUTPUT);
  pinMode(aux_vcc, OUTPUT);

  digitalWrite(motor_left_a, HIGH);
  digitalWrite(motor_left_d, HIGH);
  digitalWrite(motor_right_a, HIGH);
  digitalWrite(motor_right_d, HIGH);
  digitalWrite(aux_gnd_1, LOW);
  digitalWrite(aux_gnd_2, LOW);
  digitalWrite(aux_vcc, HIGH);
  gripper.attach(servo);
  gripper.write(90);
  radio.begin();
  radio.openReadingPipe(0, address);
  radio.setPALevel(RF24_PA_MIN);
  radio.startListening();
}

void loop() {
  if (radio.available()) {
    char message[32] = "";
    radio.read(&message, sizeof(message));
    if (message[0] == '1')closeGripper();
    else if (message[1] == '1')openGripper();
    if (message[2] == '1')digitalWrite(buzzer, HIGH);
    else digitalWrite(buzzer, LOW);
    driveRobot(message[3], message[4], message[5], message[6]);
  }
}

// Gripper
void closeGripper() {
  gripperPos++;
  gripper.write(gripperPos);
  delay(10);
}

void openGripper() {
  gripperPos--;
  gripper.write(gripperPos);
  delay(10);
}

//Driverobot
void driveRobot(char X_dir, char Y_dir, char X, char Y) {
  int X_val, Y_val;
  if (X == '4')X_val = 240;
  else if (X == '3')X_val = 180;
  else if (X == '2')X_val = 120;
  else if (X == '1')X_val = 60;
  else if (X == '0')X_val = 0;
  if (Y == '4')Y_val = 240;
  else if (Y == '3')Y_val = 180;
  else if (Y == '2')Y_val = 120;
  else if (Y == '1')Y_val = 60;
  else if (Y == '0')Y_val = 0;
  if (X_dir == '1')X_val *= -1;
  if (Y_dir == '1')Y_val *= -1;

  float r = 0.75 * sqrt(pow(X_val, 2) + pow(Y_val, 2));
  float theta = atan2(Y_val, X_val);
  if (theta < 0)theta += 2 * PI;
  float rightMotorVal, leftMotorVal;
  float slope = 4 / PI;
  if (theta <= PI / 2) {
    leftMotorVal = 1;
    rightMotorVal = -1 + slope * theta;
  } else if (theta <= PI) {
    leftMotorVal = 1 - slope * (theta - PI / 2);
    rightMotorVal = 1;
  } else if (theta <= 3 * PI / 2) {
    leftMotorVal = -1;
    rightMotorVal = 1 - slope * (theta - PI);
  } else if (theta <= 2 * PI) {
    leftMotorVal = -1 + slope * (theta - 3 * PI / 2);
    rightMotorVal = -1;
  }

  leftMotorVal *= r;
  rightMotorVal *= r;

//Motors
  int rightMotorDir = rightMotorVal < 0 ? 1 : 0;
  int leftMotorDir = leftMotorVal < 0 ? 1 : 0;
  rightMotorVal = floor(abs(rightMotorVal));
  leftMotorVal = floor(abs(leftMotorVal));

  if (rightMotorDir) {
    digitalWrite(motor_right_a, HIGH);
    digitalWrite(motor_right_d, LOW);
    analogWrite(motor_rightpwm, rightMotorVal);
  } else {
    digitalWrite(motor_right_a, LOW);
    digitalWrite(motor_right_d, HIGH);
    analogWrite(motor_rightpwm, rightMotorVal);
  }

  if (leftMotorDir) {
    digitalWrite(motor_left_a, LOW);
    digitalWrite(motor_left_d, HIGH);
    analogWrite(motor_leftpwm, leftMotorVal);
  } else {
    digitalWrite(motor_left_a, HIGH);
    digitalWrite(motor_left_d, LOW);
    analogWrite(motor_leftpwm, leftMotorVal);
  }
}

Operator console:

/*
Operator Console:
    The idea:
    In this project, we will show you how to make a teleoperated rescue robot out of Lego Technic pieces,
    Arduino boards, off-the-shelf DC and servo motors, NRF communication modules, and joystick module.
    The current project uses an Arduino Uno and Nano boards as the main controller of the
    robot and the operator console, respectively
    The circuit:
    - In this circuit, an Arduino nano is used. Any other types of Arduino
    can be used of course but do not forget to change the pin configurations
    if you want to change the circuit on your preference.
    Visit the Tart Robotics blog for more information:
     https://www.tartrobotics.com/blog

*/

#define js_click A0
#define js_y A1
#define js_x A2
#define yellow_button 5
#define green_button 4
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

RF24 radio(9, 10); // CE, CSN
const byte address[6] = "00001";
int jsY_offset, jsX_offset;

void setup() {
  Serial.begin(115200);
  pinMode(js_click, INPUT_PULLUP);
  pinMode(js_y, INPUT_PULLUP);
  pinMode(js_y, INPUT_PULLUP);
  pinMode(yellow_button, INPUT_PULLUP);
  pinMode(green_button, INPUT_PULLUP);
  radio.begin();
  radio.openWritingPipe(address);
  radio.setPALevel(RF24_PA_MIN);
  radio.stopListening();
  jsY_offset = analogRead(js_y);
  jsX_offset = analogRead(js_x);
}

void loop() {
  int jsX = jsY_offset - analogRead(js_y);
  int jsY = jsX_offset - analogRead(js_x);
  int jsC = digitalRead(js_click);
  int yellowButton = !digitalRead(yellow_button);
  int greenButton = !digitalRead(green_button);
  char yellowButton_char = yellowButton == 0 ? '0' : '1';
  char greenButton_char = greenButton == 0 ? '0' : '1';
  char jsY_dir = jsY > 0 ? '0' : '1';
  char jsX_dir = jsX > 0 ? '0' : '1';
  char jsC_char = jsC == 0 ? '1' : '0';
  char jsY_abs, jsX_abs;
  if (abs(jsY) > 400)jsY_abs = '4';
  else if (abs(jsY) > 300)jsY_abs = '3';
  else if (abs(jsY) > 200)jsY_abs = '2';
  else if (abs(jsY) > 100)jsY_abs = '1';
  else if (abs(jsY) > 0)jsY_abs = '0';
  if (abs(jsX) > 400)jsX_abs = '4';
  else if (abs(jsX) > 300)jsX_abs = '3';
  else if (abs(jsX) > 200)jsX_abs = '2';
  else if (abs(jsX) > 100)jsX_abs = '1';
  else if (abs(jsX) > 0)jsX_abs = '0';

  const char message[] = {yellowButton_char, greenButton_char,
                          jsC_char, jsX_dir, jsY_dir, jsX_abs, jsY_abs
                         };
  radio.write(&message, sizeof(message));
}

You are all set. Your robot is ready to go.

Run Your Rescue Robot

Rescue Robot with Lego, Arduino and 3D Printed Parts

Please let us know what you think about this tutorial by commenting below. Your feedback will help us to improve our future work.

Please visit Tart Robotics for more DIY creative projects and STEAM-related educational content. Our Socials: Tart Robotics website, YouTube, Instagram, Facebook, Twitter, Pinterest, LinkedIn