[Arduino Robot] How to Make a Motion Capture Robot | Thumbs Robot | Servo Motor | Source Code

by HappyThingsMaker in Circuits > Robots

3537 Views, 18 Favorites, 0 Comments

[Arduino Robot] How to Make a Motion Capture Robot | Thumbs Robot | Servo Motor | Source Code

[Arduino Robot] How to make a Motion Capture Robot | Thumbs Robot | Servo Motor | Source Code
20180401_164314_capture.png
00_ThumbsRobot.mp4_20180401_140042.122.jpg

Thumbs Robot. Used a potentiometer of MG90S servo motor. It is very fun and easy! The code is very simple. It is only around 30 lines. It looks like a motion-capture.

Please leave any question or feedback!

[ Instruction ]

[ About the maker ]

ARDUINO PARTS

1.png
3.png
2.png

Install Arduino IDE

Install CH340 Driver (for Chinese version)

DOWNLOAD - source code

Select board / Processor / Com port

  • Arduino Nano
  • ATmega328P (Old Bootloader)

Plug your arduino nano

  • Plug the USB cable and a new port will appear.

Find / select emerging com port

  • Click the appeared port and hit the upload button
  • Hit the upload button

3D PRINTING PARTS

4.png

Download 3d modeling files from Thingiverse

Print all parts one by one

Circuit Part

5.png

Use the Arduino Nano Expansion Board. Because the Arduino Nano itself doesn't have many pins, you will need to use an expansion board.

When you look at the wiring connected to the motor, you can see three colors. Yellow, Red and Brown. Brown must be connected with G (Ground).

In the following steps, we will look it closely again.

HARDWARE PART - Prepare All the Parts

6.png

Modify 3 Servo Motors Into Position Sensor

Following steps show you how to modify a servo motor into position sensor. basically most servo motors have a potentiometer or encoder for getting an angle value.

We will use that potentiometer itself. we need to open the case, disassemble the board and rewire it again.

Unscrew 4 Bolt on the Backside and Open the Front Case

7.png
8.png

You will need a small screw driver because they are too small. The motor has 3 parts - front, body and back.

When you open the front side, you will see the gears. Actually, we don't use this motor as "motor". So, the gears are not necessary anymore theoretically. But we will use some part of them so that the operation angle still has limitation of rotation.

Remove the 3rd Gear

9.png
10.png
11.png
12.png
13.png
14.png

The potentiometer in the servo motor has angular limitation which is around 180 degree. The potentiometer has its own limitation mechanism but it is so weak. It is easily broken often. In order to protect it, the gear gives another mechanism. The first gear has a plastic bumper which will be contact with second gear.

We definitely need the first gear for the overall frame, the second gear is needed for the limitation. So, we cannot get rid of them. Instead of them, we can remove the third gear.

You may wonder why we need to remove a gear. These three servo motors will be used for getting angle information. If there are gears in them, the movement will be stiff. So, we must get rid of one of gear from them.

Re-wiring / Soldering

15.png

Cut the wires which are connected with the motors.

Use a Soldering Tool and Detach the Board

16.png
17.png

Cut a Wire and Prepare for Soldering

18.png
19.png

and put some paste and put some lead on the cable

Solder It

20.png
21.png
22.png
23.png

from the very left side red yellow and brown

Put Some Glue on It

24.png
25.png

and recover its back side

We need 2 more potentiometers. do the same work for two other motors

Make the First Joint Basement

26.png
27.png
28.png
29.png
30.png

I used a cooking board for making this project. it is cheap and firm to use it. In order to fix the frame on the board, you will need to use screws which has sharp end. It makes hole and thread at the same time.

There are 6 motors. 3 motors on the left side is the original motors. on the other hand, there are 3 motors which are modified in before step.

Make the Yaw Joint

31.png
32.png

You will need to use M2 * 6mm screw bolt.

Assemble the Yaw Joint With the First Motor

33.png
34.png

As you can see the last picture, you will need to put the joint in horizontal direction. And the location should be 90 degree of the both motor and potentiometer.

In other words, you can rotate those yaw-joint 90 degree clockwise and counter clockwise from that location.

Assemble the Arduino Nano With Arduino Nano Expansion Board

35.png
36.png

Make sure the direction. The USB port will be same side with DC jack.

The First Layer Connection

37.png
38.png

The potentiometer is connected with Analog 0 pin of the Arduino. You must plug it in correctly. This Arduino Nano has 8 channel ADC (Analog Digital Converter). Basically, the potentiometer gives analog level or volatage. You can read that volt value by using ADC pins

One the other hand, the servo motor is connected with Digital 9 of the Arduino. Servo motors can be controlled by using PWM (Pulse Width Modulation). The Arduino Nano has 6 channel PWM pin (pin 9, 10, 11, 3, 5 and 6) . So, we can use up to 6 servo motors.

In this step, the source code looks like this

#include <Servo.h>

Servo servo[6];
void setup() {
pinMode(A0, INPUT);
servo[0].attach(9);
}

int tempADC[3] = {0};
void loop() {
tempADC[0] = analogRead(A0);
servo[0].write(map(tempADC[0] , 0, 1023, 0, 180));
}

Assemble the Second Layer

39.png
40.png
41.png
42.png

The second layer is also simple to make. What you need to be careful of is putting it in the correct location when you plug the cable into the Arduino.

  • The left Servomotor is connected with pin 10
  • The right potentiometer is connected with A1

#include <Servo.h>
Servo servo[6];
void setup() {
pinMode(A0, INPUT);
pinMode(A1, INPUT);
servo[0].attach(9);
servo[1].attach(10);
}
int tempADC[3] = {0};
void loop() {
tempADC[0] = analogRead(A0);
servo[0].write(map(tempADC[0] , 0, 1023, 0, 180));
tempADC[1] = analogRead(A1);
servo[1].write(map(tempADC[1], 0, 1023, 0, 180));
}

Assemble the 3rd Layer Frames

43.png

Assemble the Frame With the 2nd Motor / Potentiometer

44.png
45.png
46.png
47.png

Assemble the 3rd Motor Into the Joint Frame

48.png
49.png

Plug the Cable Into the Arduino

50.png
51.png

  • The 3rd motor is conncected with pin 11
  • The 3rd potentiometer is connected with A2

code looks like this

#include <Servo.h>
Servo servo[6];
void setup() {
pinMode(A0, INPUT);
pinMode(A1, INPUT);
pinMode(A2, INPUT);
servo[0].attach(9);
servo[1].attach(10);
servo[2].attach(11);
}
int tempADC[3] = {0};
void loop() {
tempADC[0] = analogRead(A0);
servo[0].write(map(tempADC[0] , 0, 1023, 0, 180));
tempADC[1] = analogRead(A1);
servo[1].write(map(tempADC[1], 0, 1023, 0, 180));
tempADC[2] = analogRead(A2);
servo[2].write(map(tempADC[2], 0, 1023, 0, 180));
}

Assemble the Thumbs Frame

52.png
53.png

Test and Adjust Angle

54.png
55.png
56.png

Put the USB cable into any power source and the robot will be turned on soon. The angle may be slightly different. Adjust the angle one by one.

One More Robot?

57.png
58.png

If you want to make one more robot, you can make it. Plug servos into 3, 5 and 6.

#include <Servo.h>
Servo servo[6];
void setup() {
pinMode(A0, INPUT);
pinMode(A1, INPUT);
pinMode(A2, INPUT);
servo[0].attach(9);
servo[1].attach(10);
servo[2].attach(11);
servo[3].attach(3);
servo[4].attach(5);
servo[5].attach(6);
}
int tempADC[3] = {0};
void loop() {
tempADC[0] = analogRead(A0);
servo[0].write(map(tempADC[0] , 0, 1023, 0, 180));
servo[3].write(map(tempADC[0] , 0, 1023, 0, 180));
tempADC[1] = analogRead(A1);
servo[1].write(map(tempADC[1], 0, 1023, 0, 180));
servo[4].write(map(tempADC[1], 0, 1023, 0, 180));
tempADC[2] = analogRead(A2);
servo[2].write(map(tempADC[2], 0, 1023, 0, 180));
servo[5].write(map(tempADC[2], 0, 1023, 0, 180));
}

Done!

00_ThumbsRobot.mp4_20180401_140052.166.jpg
00_ThumbsRobot.mp4_20180401_140056.368.jpg
00_ThumbsRobot.mp4_20180401_140111.742.jpg

If you have any question, please feel free to leave it :)