Quadruped Robot Model for Mars

by Neo_256 in Circuits > Robots

2803 Views, 48 Favorites, 0 Comments

Quadruped Robot Model for Mars

IMG_2055.jpg
IMG_2056.jpg
Quadruped Robot model for Mars

Hello Everyone

In recent years, we could see that NASA has sent different robots like Opportunity and Curiosity to Mars. Both rovers have wheels. Then last year NASA came up with the idea of sending a helicopter to Mars along with the Perseverance rover. The helicopter, which incidentally is called Ingenuity, is supposed to provide more flexibility. The problem, however, is that Mars has a very thin atmosphere, making it very difficult for Ingenuity to fly. So far, it has not been given many measurement results, but mainly test flights. If you want to know more about it, you can click on this link, which will take you directly to Ingenuity.

However, I think that with a quadruped or hexapod robot on Mars you have even more flexibility, since many animals move with legs here on Earth. This means that the robots are only dependent on gravity on Mars and not on the composition of the atmosphere. For this reason, in this Instructable I will describe a model for a quadruped robot on Mars.

Supplies

IMG_2027.jpg

For basic quadruped robot:

  • 1x Arduino Nano
  • 12x Servo Motors
  • 1x Servo Control Board PCA9685
  • 1x Voltage Regulator (UBEC 3A 2-6 LiPo)
  • 4x Feet
  • 4x Leg
  • 4x Hip Joint
  • 1x Body
  • 1x 9-Volt Battery
  • 1x 14.8-Volt Battery (or 4x 3.7-Volt Batteries)
  • Screws and nuts (for servo motors and board)
  • Wires
  • some male headers

For advanced quadruped robot (the material above plus the one described beneath):

  • 2x Servo Motors
  • 1x Ultrasonic sensor (HY-SRF 05)
  • 1x Gas sensor (MQ-2)
  • 1x nRF24L01
  • 1x Temperature and humidity sensor (CNT5)
  • A lot of wires
  • more male headers

For the receiver:

  • 1x nRF24L01
  • 1x "Arduino" Pro micro (acts like an Arduino Leonardo)
  • 1x Resistor 100 ohm
  • 1x Resistor 200 ohm

Software:

  • Arduino IDE
  • Processing

Deeper Information About Quadruped Robots

Quadruped Robot MA.png

By way of introduction, I would first like to explain a few terms. Quadrupeds are animals with four legs. Robots are machines, originally automata, which perform mechanical work. A quadruped robot is therefore a robot with four legs.

Robots exist in many, different fields of application. They work quickly, accurately and without pause. That is why they are quite popular in industry, for example, and are used as part of automated production processes. But robots can also provide valuable services in private households. For example, in recent years, the use of robotic lawnmowers in gardens or robotic vacuum cleaners in homes have become popular.

Quadruped robots, on the other hand, are primarily intended for operations in which impassable terrain is to be opened up and where there is sometimes danger to life and limb. Human lives are very precious and rescuers in emergencies risk their lives for other people. So this task can be performed by a robot on site, while a human controls it from a safe location. For example, quadruped robots could search for people after an earthquake or in a fire, or take rock samples from an alien planet on a space expedition - as shown here.

For conventional robots, however, such tasks pose a problem because they are often designed for flat surfaces or for stationary applications. Industrial robots, for example, are usually stationary and often move only one arm to perform repetitive manufacturing steps. Or other robots move along on tracks. A lawn mowing robot, on the other hand, is more mobile. It can move on a flat grass surface with its wheels. However, none of these types of robots can move outside of a tidy environment. The use of wheels also restricts locomotion. Steps, for example, are often an insurmountable obstacle for robots of this type. We humans, on the other hand, can easily overcome such barriers because we move on two legs. However, walking on two legs requires complex processes to dynamically establish balance during movement. We humans have perfected this from childhood thanks to our sense of balance, our joints and our muscles. For a bipedal robot, on the other hand, this is very difficult to realize. So it is obvious that a higher dynamic balance can be achieved by means of four legs, since the robot can always stand on three legs and use its fourth leg for locomotion. This is roughly comparable to a chair on three legs, which does not fall over in a static state as long as its center of gravity is within the legs. In essence, this explains the basic locomotion of a quadruped robot.

In the picture above you can see my quadruped robot without sensors - so in an early version. You can see the four legs and the basic components very well, which is why I find the picture appropriate.

Printing Out All the Parts

robot_up.png

The first thing to do is to print out all the parts. I don't want to say too much about this, because I want to leave room for personal preferences regarding layer height or support. This step is nevertheless important, because I have attached the files which are needed for this. Except for feet, leg and hip joint I created all models myself. And even the three models I did not make myself I had to adjust because they weren't fitting my motor size.

Depending on which of the quadruped robots you're building you have to look in the list of the supplies which models you have to print out.

Showing the Circuit and Building the Robot

advanced quadruped robot circuit.png
basic quadruped robot circuit.png

Now it should be time to discuss the circuit that will be soldered. First of all, I would like to note that I tried to make it as modular as possible, so that in case of malfunction you can replace everything as quickly as possible.

For the basic quadruped robot you need a board, on which you put the Arduino and solder some male header pins, so you can connect it with some jumper wires to the servo control board.

For the advanced quadruped you need an additional board, on which I soldered the nRF24L01 module directly and connected the other sensors with jumper wires.

The robot is mainly held together by the servo motors and the associated screws. The parts for the advanced quadruped robot are glued to the body. When assembling, make sure that the motors can move up to the physical limit of the parts. The boards should also be able to be screwed onto the printed parts. As an aid to assembly, I have attached an approximate model to show where each part goes.

Ultrasonic Sensor

IMG_2082.jpg

If a quadruped robot has no sensors, it will run into anything. To counteract this, I attached an ultrasonic sensor to it, which can be rotated on two axes by two motors. This should allow the robot to detect obstacles and avoid or walk over them. In addition, it should look in two directions and recognize in which direction is more space to turn there and walk further.

In order for the principle to also work on Mars, it is necessary to know or measure how the atmosphere on Mars is composed so that the speed of sound can be calculated as accurately as possible and the ultrasonic sensor can thus provide values that are as exact as possible. To apply it to the model as well, I included temperature when calculating velocity. To do this, I used the function that shows the velocity as a function of temperature. I found this in this source. The line in the code looks as follows:

distance_cm = ((0.03316 + temperatureC * 0.00006) / 2) * duration_us2; //sound depending on the temperature

The ultrasonic sensor will be oriented downward when running to detect any obstacle. When this event occurs, the sensor will go up and first measure whether or not the Quadruped Robot will get over the obstacle. If it can't get over, it looks left and right to see how much room it has and chooses the side with more room. You can see the whole thing in the video from the beginning.

Gas Sensor

IMG_2083.jpg

A gas sensor can measure at least one gas in the air. Depending on the sensor, this can be different. The MQ-2 gas sensor can measure three gases: 

  • LPG (liquified pertoleum gas), which is found in heaters and is highly flammable and carcinogenic.
  • CO (carbon monoxide), a transparent, odorless and toxic gas, which is produced by incomplete combustion, i.e. when there is not enough oxygen during combustion.
  • Smoke is produced by fire and is a thick, aerosolized gas.

I chose the MQ-2 gas sensor because I can run the quadruped robot around in different places and see if there is a fire somewhere or if a heater is leaking. However, it is also clear to me that other gas sensors are needed on Mars.

In the search for life on Mars, the gas sensor may prove to be very useful as one can measure the composition of the air. If you then additionally measure the composition of the soil or fluids on Mars, you can combine valuable information and try to create life with the Miller-Urey experiment for example.

Temperature and Humidity Sensor

IMG_2086.jpg

Knowing the temperature around you is essential. In my model, I need it to determine the speed of the sound.

With the air humidity it is also possible to say from "a distance" whether it has rained or not. "From a distance" means that I don't necessarily have to see the quadruped robot, but only need to have a connection so that these values are displayed to me on the computer.

On Mars it is important to measure the temperature, because above a certain temperature some components need to be cooled. According to this source, the humidity on Mars seems to be high enough to consider life as conceivable. This information combined with the gases provide a lot of information which combined should make life possible on Mars in the future. So, a place on Mars that meets the conditions still needs to be found. This is almost the hardest task and for this the research needs time and we as interested people need patience.

(inverse-)Kinematics

kinematics.png
ending point.png
coordination calculations.png

Kinematics generally deals with the description of the motion of objects and not with the cause of the motion. In robotics, kinematics also plays a very important role, since it is a matter of describing a movement, which is executed by actuators (for example motors). In the case of a quadruped robot it is about the description of the movement of the legs. 

There are three motors so three DOF (degrees of freedom). You have a start and an end point and want to calculate the angles of the motors. There are alpha, beta and gamma. The points and angles are drawn at the top of the picture. Next I chose a coordinate system, because with it I can consider the coordinates as location vectors and with vectors angles can be calculated very well. How I have calculated exactly you can look up in the program, which I have attached. It's written in java but due to problems with uploading it it's now a .txt file. The program makes it possible that the calculations are executed automatically and you only have to specify the end point as shown in the picture above.

For each leg, you must enter the coordinates into the program as if the body did not exist. So you have to calculate the angles for each leg relative to the origin of the coordinates so that they are correct. You can see this in the picture above, which has the body in the center and many coordinates outside. The blue coordinates show where the body is located relative to the start position. The orange coordinates show the position of the legs relative to the coordinates of the body. If a yellow +50 is there, this leg has made a step and in the further calculation must be calculated for x +50. The individual coordinates of the legs (the orange ones) must be entered into the program, inserted into the Arduino program and then calculated by another function in the Arduino program. Everything concerning the Arduino program can be fund in step 9.

When entering the alpha angle into the Arduino program, you must be careful that it is the correct distance. For the front legs you have to calculate the value - 180. The body of the Quadruped Robot must be moved for stable lifting of one leg because of the preservation of the center of gravity.

Downloads

Efficient Way of Walking

max values.png

I could enter PWM values and then measure the angles with the geo triangle and change the values until they are correct. But the problem is that it takes a long time and is not very efficient. So I thought about measuring the maximum and minimum values and then using the map() function to turn the angles into PWM values. This functions then looks like this:

// you probably have to change these values according to your motors
int map_values(int index){
  //front right
  if(index == 0)
    pwm[0] = map(angle[0], 20, 270, 550, 100);
  if(index == 1)
    pwm[1] = map(angle[1], 35, 325, 100, 680);
  if(index == 2)
    pwm[2] = map(angle[2], 35, 210, 130, 650);


  //front left
  if(index == 8)
    pwm[8] = map(angle[8], 20, 300, 100, 600);
  if(index == 9)
    pwm[9] = map(angle[9], 35, 320, 650, 100);
  if(index == 10)
    pwm[10] = map(angle[10], 45, 210, 650, 170);


  //back right
  if(index == 4)
    pwm[4] = map(angle[4], 40, 270, 180, 650);
  if(index == 5)
    pwm[5] = map(angle[5], 45, 320, 650, 100);
  if(index == 6)
    pwm[6] = map(angle[6], 85, 215, 650, 250);


  //back left
  if(index == 12)
    pwm[12] = map(angle[12], 20, 300, 650, 200);
  if(index == 13)
    pwm[13] = map(angle[13], 25, 325, 100, 650);
  if(index == 14)
    pwm[14] = map(angle[14], 80, 210, 100, 520);


  //ultrasonic sensor
  if(index == 7)
    pwm[7] = map(angle[7], 45, 200, 100, 600);
  if(index == 3)
    pwm[3] = map(angle[3], -90, 65, 170, 650);


  //return a value
  return pwm[index];
}

Thanks to this function you only have to enter the corresponding angles, i.e. angle[0] = 200; and the program works. This is very handy to quickly go from running forward to running backward and to go sidewards.

Final Arduino Code for Quadruped Robot

arduino code.png

The code works in such a way that the temperature, humidity and the three gases are measured and sent to the receiver. After that, the distance is measured and it is decided whether the robot runs forward or backward. If it goes back, it turns the ultrasonic sensor in both directions and measures on which side it has more space to then turn there.

The code is split into as many functions as possible to keep the code in the loop as small as possible and thus more manageable.

Now I would like to talk a little bit about the required libraries. The wire library is needed for the I2C connection to the servo control board. The control board also has its own library that allows the motors to hold their position and is therefore highly recommended. MQ2 is the gas sensor, through which the different gases can be measured individually. SPI is needed by the connection of the nRF24L01 module and also its own library to establish a connection. The DHT library is for the temperature and humidity sensor.

Receiver Idea and Circuit

IMG_2078.jpg
receiver circuit.png

To receive the data that the quadruped robot collects far away - that is on Mars - you need a receiver. This receiver consists of an Arduino Pro Micro, a nRF24L01 module and a voltage divider, which reduces the output voltage of the Arduino to 3.3 volts, so that the module does not break.

Receiver Arduino Code

The receiver gets the data from the robot and then puts it on the serial interface. From there the processing program accesses it and can output the data for the user. The goal is to put most of the values on the interface so that they can be read and output directly by Processing.

Processing

processing program.png
robot_down.png
robot_up.png

Processing should be used to process the data in such a way that the user can read everything nicely presented at the end. For this purpose I have designed the window as shown in the picture above. Everything that has to do with the blue font are values directly from sensors. The yellow written always looks different, because it changes depending on what the quadruped robot does. This way you can follow what it is doing. The picture on the lower right side shows if the ultrasonic sensor is up or down.

The important thing to know here is that Processing runs through a list of serial ports and selects one from the list. The corresponding line in the code looks like this:

  //open the port
  port = new Serial(this, Serial.list()[2], 9600); //you might have to adjust this

You can look this up in the device manager of the laptop and then try it out. This can take several attempts. The Arduino Pro Micro should be the last one. The formula for calculating would be n-1 where n is the number of available ports.

After all these steps and this intense work, you can sit back and enjoy your autonomous quadruped robot that might one day walk around on Mars.