• Control algorithm used for motors

In S-drive controller I used a 10-bit encoder. The encoder is connected to the output shaft of the BLDC motor. There is no encoder on the output shaft after the reducer. That means that one revolution of BLDC is equal to 1024 ticks of the encoder. One mechanical revolution of the motor relates to electrical resolutions by a number of pole pairs. For example, here I will use a motor with 11 pole pairs (22 poles). Now when we know the number of pole pairs of our motor we generate a sine table or space vector table that has a number of sine waves * number of pole pairs and fit it in an array of 1024 elements ( equal to our encoder resolution ). Link to the generator for that table (Matlab), (Python)

**This image is for 7 pole pair motor**

Max amplitude value of those sine and space vectors will be equal to the max duty cycle of our PWM module (it usually depends on the frequency we are switching our pwns) In my example, we are using 40khz switching and we have a max duty range of 0-1800 ( 0 – 100% duty cycle).

We can then adjust our sines amplitude by just dividing values in our table by some constant.

Now we need to create 90 deg magnetic field between the robot and stator. To do that we first align the rotor field to the stator by applying PWM on all the phases from sine table and offsetting them by 120 deg. For example, we have 11 pole pair motors. One period of the sine wave will be represented by 1024/11 = 93 elements of the array. Now to align the motor we will apply the value of sine table[0] to phase 1. For phase 2 we will apply sinetable[0] + 120 deg offset. If 93 represents 360 deg; 120 deg = 93 / 3 = 31 so value of phase 2 will always be offset for + 31 from phase 1. That means that phase 3 will be offset from phase 2 for 31, or for 62 from phase 1. After we did this alignment rotor and stator fields will have 0 deg between them, They will be locked in position. Now we tell our encoder that this current position is equal to 0. After that, We map encoder ticks to the sine table but with an extra 90 deg offset ( 90 deg is equal to 93 / 4 = 22)!! So for example for encoder position 0 we would use element value sinetable[encoder_tick + 0 deg offset + 90 deg offset] that would equal in our case  sinetable[ 0 + 0 + 22] for phase 2 it would be sinetablae[ 0 + 31 + 22], for phase 3 it would be sinetablae[ 0 + 31 + 44] And that is it, Motor is now acting like DC motor where we can regulate speed by changing the amplitude of our sine waves (Dividing values from sine table by some value). All code is here.

• Current sense method used

In this project, I used the simplest current sensing method and that is low side global current sensing. It is cheapest but generally used when you need to detect faults or some current limits. Not really good for torque control. Not really use din FOC

Here are the methods I will use in the next iteration.

The low-side configuration allows the use of a low-power op-amp as the common mode is close to the ground. This topology is largely used in FOC. The third current measurement branch is optional and can be calculated in the controller. The limitation is that low-side current sensing can only be executed while the low-side transistor of that leg is on.

This current measurement offers the best information that can be used in feedback motor control, in order to optimize motor performance. As the shunt resistance is placed directly in line with the PWM driver, it uses dedicated current sensing, which rejects the fast common mode variation. The main advantage of this topology is that the current can be read without a strong linkage to the PWM status and without timing limitations in the case of very small PWM applied to the phase.

• Mechanical design of the robot

General idea was to make as much as I can 3d printed without sacrificing weight. Idea was to make all joint links made out of aluminum extrusions. That was possible for the connection of joint2 and joint3. That way weight of the arm was drastically reduced, it has improved stiffness, and is cheaper. I planned to make the forearm use aluminum extrusions also but it was hard to do that and have a spherical wrist at the same time. That is definitely on the to-do list for the next iteration of the robot.

Infill used for the most parts was around 50%. The total weight of the arm is around 5KG. The weakest point is 3d printed wrist part as you can see from the picture below where it hit my arm during testing and broke.

Aluminum profiles that are on the base of the robot (joint 1) are used to secure the robot to the tables by using clamps or you can place weights on the aluminum profiles to hold the arm in place.

• General idea of the robot

So this is more a story about how I decided to build this robot and why. Before the CM6 robotic arm, I made Faze4 robotic arm

Faze4 is a massive 6 axis 3d printed robotic arm that weighed 15 kg. It uses 3d printed cycloidal gearboxes and stepper motors. It was designed to look nice and clean (let's not kid ourselves CM6 is crude and all over the place) but Faze4 was too massive and stiff for what I had planned to do with robotic arms. I could have closed the stepper loop with encoders but I still had problem of using heavy and inefficient steppers and not to mention high gear ratio cycloidals that are hard to backdrive. I wanted to build robotic arm like BLUE from UC Berkeley.

BLUE used high torque density BLDC motors, custom-made drivers, and belts to get more torque. That combination gave it quasi-direct drives, making the robotic arm compliant, able to change its stiffness, and interact safely with the environment.

Another project that inspired me was that of Ben Katz, where he used legs of his mini cheetah to create 2 arms that performed bilateral teleoperation.

• Connection scheme

BLDC drivers are connected to connector board using modified IDC cables. More can be found in this folder: https://github.com/PCrnjak/CM6_COBOT_ROBOT under building instructions

• RX1 = PIN0
• TX1 = PIN1
• RX2 = PIN7
• TX2= PIN8
• RX3= PIN15
• TX3 = PIN14
• RX4= PIN16
• TX4 = PIN17
• RX5 = PIN21
• TX5 = PIN20
• RX6 = PIN25
• TX6 = PIN24

Each distribution board is connected to 24V thru screw terminals. Also each distribution board needs to be connected to 5V and GND.

• BLDC driver needed libraries

Added folder with needed libraries for S-drive bldc driver.

• Distribution/connector board info!

A Connector board is used to connect the S-drive BLDC driver to the 24 power supply and to the teensy microcontroller.  They are designed to be stacked one on one with brass spacers.