CONTROL 8 SERVO MOTORs USING 8 POTENTIOMETERs (HUMANOID ROBOT EP 02)

5,790

58

Introduction: CONTROL 8 SERVO MOTORs USING 8 POTENTIOMETERs (HUMANOID ROBOT EP 02)

About: Hi, I'm Eunchan Park from S.Korea. I have 3 missions Making Happy Things, Sharing How To Make Happy Things, Copying Happy Things Maker for the world's Happiness In order to pursue my mission, I have a big goal…

In the previous episode, we could control one servo motor by using one potentiometer.

https://www.instructables.com/id/Control-1-Servo-M...

In this episode, we are going to control 8 motors by using 8 potentiometers simultaneously.

Let’s get it started!

[LINKS]

Supplies:

  • https://eunchan.me/CHOOM-02-8-POTENTIOMETER-8-SERV...

    Step 1: PCA9675

    In order to use many servo motors,

    I am going to use this PCA9675 board which has 16 PWM output.

    The only thing we have to do is sending the signal to this board by using I2C communication.

    You may feel it sounds hard but don’t worry. There are so many pre-made source code files.

    Actually, it is pretty simple.

    Step 2: Overall Principal

    This drawing shows its system.

    Let’s make the cable first

    Step 3: Making Cables for Potentiometers

    I am going to make 8 cables for connecting the potentiometers and the Arduino board.

    The cable I use is called Dupont cable. I bought assembled cables.

    Step 4: Overall Schematic

    Now, I am going to assemble all the parts together.

    As I always say, we need to make sure the direction.

    Step 5:

    Now, let’s make a source code for it.

    Basically, the Arduino is going to read analog values and send i2c data.

    Once the PWM module receives the data, it generates PWM signal immediately.

    Step 6: Code

    Let’s take a look into the source code.

    It is short and simple but you may not be familiar with it.

    Step 7: Code Explanation

    The first line means that I will use a pre-made library to control the PWM board.

    Step 8: Code Explanation

    I made an instance of the pwm Driver.

    Step 9: Code Explanation

    These 2 lines are for setting up the board.

    I tested the frequency and it turned out I need to add 1 to the frequency number.

    50Hz is normally used.

    Step 10: Code Explanation

    These 3 lines are most complicating code.

    If you want to know these 2 lines, you better check another video about the PWM driver.

    Step 11: Code Explanation

    Let’s take a look into the setPWM function. It needs 3 parameters.

    The first parameter is for selecting the servo number.

    Step 12: Code Explanation

    The Second and third parameters are for setting the timing of PWM.

    If you don’t understand it, just skip it. Just copy and paste the code and try it.

    Step 13: Failed!

    As you can see, I don’t think it works well. I took a look closely and found the problem.

    ADC and I2C share the same pins.

    We can use A4 and A5 pins as not only ADC, but also I2C. But, we cannot use it simultaneously.

    Step 14: Solution

    That’s why I need to use one more Arduino.

    One Arduino is for getting potentiometer’s value, sending its value to another Arduino through a serial communication.

    Another Arduino is for operating the pwm driver based on the value from the communication.

    Step 15: Communication

    Here is the idea about the communication

    Step 16: Communication

    The leader Arduino sends number 255 as

    meaning that data is coming.

    Step 17: Communication

    And then, sends id number.

    For example, if the leader sends the first potentiometer’s value, the number will be 0.

    Step 18: Communication

    And then, leader sends its angle value

    which range is from 0 to 180

    It is very simple but useful. I hope it works well.

    Step 19: Code

    Upload the source code.

    There are 2 source code files for each Arduinos

    Source Code

    Leader ] https://github.com/happythingsmaker/MotionCapture...
    Follower ] https://github.com/happythingsmaker/MotionCapture...

    Step 20: Test!!

    Oh, it works pretty well. I put some delay code to the leader Arduino

    Next video, I am going to show how to communicate it without any wire.

    Wireless communication is so useful as you know.

    If you have any question, feel free left a comment on this Instructables

    Make it Move Contest

    Participated in the
    Make it Move Contest

    Be the First to Share

      Recommendations

      • Toys & Games Contest

        Toys & Games Contest
      • Big vs Small Challenge

        Big vs Small Challenge
      • Fix It Challenge

        Fix It Challenge

      Comments