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!
Youtube https://youtu.be/xJk1egzS33M
Manual https://eunchan.me/Thumbs-Robot-c88a53a2db2841b4bd836f510a1e1931
Source Code https://github.com/happythingsmaker/ThumbsRobot
3D printing files https://www.thingiverse.com/thing:2844993
Youtube http://youtube.com/EunchanPark
As you can see there is a zip file. Extract all file and double click the source code file.
Arduino Nano
ATmega328P (Old Bootloader)
Plug the USB cable and a new port will appear.
Click the appeared port and hit the upload button
from Thingiverse
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.
I'm gonna 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.
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.
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 can 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.
Cut the wires which are connected with the motors.
and put some paste and put some lead on the cable
from the very left side red yellow and brown
and recover its back side
We need 2 more potentiometers. do the same work for two other motors
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.
You will need to use M2 * 6mm screw bolt.
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.
Make sure the direction. The USB port will be same side with DC jack.
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));
}
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));
}
The 3rd motor is conncected with pin 11
The 3rd potentiometer is connected with A2
#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));
}
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.
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));
}