Control 1 Servo Motor Using 1 Potentiometer (Humanoid Robot EP 01)

by HappyThingsMaker in Circuits > Robots

4430 Views, 49 Favorites, 0 Comments

Control 1 Servo Motor Using 1 Potentiometer (Humanoid Robot EP 01)

슬라이드1.PNG

This is the first step for making a motion capturing robot. The robot’s name is Choom, which means “dancing” in Korean.

Goal

슬라이드2.PNG

If you follow these Instructables, you will be able to control one motor by using one sensor. If you follow all these tutorials, you will be able to make a motion capturing robot set.

Motion Capturing!

Have you seen this robot? I build and shared all of them. This is a kind of motion capturing. These robots are a simple example.

Motion Capturing for a Humanoid Robot

슬라이드4.PNG

I thought that it could be nice if I make a humanoid robot in this way.

The right picture is a humanoid that I build 4 years ago. You can download all of the design files as well.

Anyway, in order to control this kind of robot, you need to make a motion set that takes a lot of time and energy like a stop motion animation.

If it is controlled by using motion capturing, it will be easy and fun to play with it.

Final Goal for the Project

슬라이드5.PNG

The final goal for this project is to make two kinds of robots.

One robot will be a leader robot that has sensors on the body. The robot doesn’t have any motors.

The only role for the mater robot is reading all the angles of its joints, and sending the values to the follower robots.

Other robots will be follower robots that have motors. They are going to move based on the leader robot

Following Steps

슬라이드6.PNG

To make robots, we need to understand the overall system.

  1. We will test only one servo by using one potentiometer, which will be easy. In the stage, we don’t need any other board but the Arduino.
  2. use 8 sensors for 8 motors with some extra boards.
  3. send its data through wireless communication.
  4. Use 20 motors and 20 potentiometers for the humanoid robot.

If you are worried about the source code, circuit, or 3d files, don’t worry. I will share everything.

Part List

슬라이드7.PNG

These parts are the parts that we will use. It can be changed to some extent.

https://eunchan.me/CHOOM-01-1-POTENTIOMETER-1-SERV...

Overall Principal of This Episode

슬라이드21.PNG
슬라이드9.PNG

This is the basic overall principal in this episode. How can we get an angle from a joint of the body? A straightforward way is to put a potentiometer on the joint. As the joint rotates, the potentiometer rotates as well.

The Arduino reads the analog value of the potentiometer and sends the signal to the servo motor.

Schematic

슬라이드10.PNG

This schematic shows how to connect with each component. The most essential thing in the schematic is the direction. The board can be damaged if you put the cable in the wrong direction.

Making the Circuit

슬라이드11.PNG

I used the Dupont cables. I slightly cut the end of the terminal so that it could be tight. Plug the cables like this video, and glue it

Code

슬라이드12.PNG

Here is the source code we will upload

  • copy the source code and paste your Arduino IDE
  • upload the code
  • include Servo.h which is a library
  • make a servo instance,
  • attache it pin number 9.
  • read Analog 0 value
  • map the range from 10 bit analog value to 180 degree
  • write the pwm value to the servo.

Test (1)

슬라이드15.PNG

It seems good, but it needs calibration. The potentiometer has a wider range than the servo.

Code Modification (Angle Calibration)

슬라이드16.PNG

To fix this problem, I added some code for check the analog value

Getting Values From the Arduino

슬라이드17.PNG

Now that I can read the analog value, I will check the value when the potentiometer points 180 degrees. The value is around 843; on the other hand, 0 degree of the potentiometer is about 113.

Final Code

슬라이드18.PNG

Code URL: https://github.com/happythingsmaker/MotionCapture_...

I put the number on the source code line 13.

It means the limit value of the potentiometer is from 113 to 842.

And map the range of the analog value to angle, which is from 0 to 180.

For example, when the potentiometer value is 113, the angle is 0 degree.

Final Test

슬라이드19.PNG

I uploaded the code and tested it. It looks good.

Now that we knew how to handle one joint, we can make this up to 8 joints and 8 motors by using Arduino Nano.

Next tutorial, we will control more than 8 motors with extra board which will be awesome.

Video Instruction and Part List