Skip to content

Week 16

Motor driver DRV8251ADDAR

I made the PCB according to the example from Neil, but I never really looked into the details of the current sensing and limiting features. Now was the time to take a closer look, to understand the logic and do some testing.

According to the datasheet, the current sensing and regulation feature is called IPROPI. The resistor, that is connected between pin 7 (IPROPI) and ground, is to generate proportional voltage and compare it to the reference voltage pin 4 (VREF).

VIPROPI=IIPROPIRIPROPI

For current limitation, the chopping threshold is calculated with the formula

IIPROPIAIPROPI=VVREF/RIPROPI

In my case, I have a 5 V microcontroller, so I can control VVREF in the range fron 0 V to 5 V.

AIPROPI is the gain of the circuit defined in the datasheet.

For my motor, I want to limit the current to 1,5 A or less. Below is a graph, showing the relationship between Reference Voltage and Trip Current with the 1 kΩ resistor.

V_VREF vs I_TRIP

I wrote a function to set all four PWM pins according to the input of the trip current.

// Calculate and set reference voltage for DRV8251 for current limit
void itripset (float itrip){
  float coeff = 1.575;   // Correlation factor
  int   pwm   = 255;     // PWM range 0 - 5V
  int   vref  = floor(itrip*coeff*pwm/5);
  analogWrite(VREFM1D1,vref);
  analogWrite(VREFM1D2,vref);
  analogWrite(VREFM2D1,vref);
  analogWrite(VREFM2D2,vref);
  mySerial.print("PWM set to: ");
  mySerial.println(vref);
}

After having tested and verified that part of the code, I went ahead and decided to test the standard Stepper.h stepper motor library.

The setup is easy and I created a loop to run the motor five rotations forward and reverse, with delay in between.

It works!

It runs quite smoothly and you can hardly see the housing's rotation on the base plate.

Because I could feel the h-bridges heating up and I don't need the holding function of the stepper motors, I decided to turn off the coils, when the motor isn't running by adding another function.

void motorstop(){
  digitalWrite(M1D1IN1, LOW);
  digitalWrite(M1D1IN2, LOW);
  digitalWrite(M1D2IN1, LOW);
  digitalWrite(M1D2IN2, LOW);  
  digitalWrite(M2D1IN1, LOW);
  digitalWrite(M2D1IN2, LOW);
  digitalWrite(M2D2IN1, LOW);
  digitalWrite(M2D2IN2, LOW);    
}

Design fault

When assembling the parts for the harmonic drive I realized, I made a fundamental mistake in the design. It is quite obvious, when thinking about it afterwards: There are three main components in the harmonic drive that rotate relativly to each other.

  • Wave generator - connected to the motor
  • Circular spline - connected to the foundation
  • Flex spline - connected to ... ?

I forgot to connect the flex spline!

As with the current desing - there is no drive. The gear can rotate freely, because the connection from the flex spline to the main housing is missing.

Because the housing takes the longest time to print and I don't want to make a new at this stage - I'm going to design a fix for this prototype. The only area accessible for the connection is between the two large bearing. I'm going to try and glue an adaptor piece there. Now I realize, that the timing belt is too narrow for the design I had in mind. The next best solution is to try and 3D print the flex spine.

Here is the design I came up with:

Flex spline

Let's see if the flexure in the circumference will allow the spline to flex sufficiently.

After having printed the new flexure and some more components I also got my base plate cut at a local shop and started with the most rewarding part - assembling new equipment.

Base plate with spirit level and circular spline. Note the notches for aligning north-south during installation.

Base plate

New flex spline inserted (red). I still have to decide on how to secure it in place. I might add some dovel pins rather then glueing it (for maintenance).

Flex spline

Here I printed another flex spline and secured it with six Ø3 mm dovel pins.

Flex spline secured

The video shows how the internals of the harmonic drive move.

Designing the cover

Because I found the name for my final project in week 14, I thought it was a good idea to give the product some artistic touch. I'm not very good at drawing, but fortunately my co-student Ólöf Hannesdóttir is very good at it. I asked her if she could draw a wolf that is about to swallow the sun and here is her drawing.

Drawing from Ólöf

I really liked it and imported it into Fusion, arranged things a bit and changed the font.

Here is how it looks.

Cover in Fusion

Encoder breakout boards

Because I haven't fully decided on what encoder to use, I decided to design two types of breakout board - both for the TLE5021B and the AS5048B.

First I decided on the shape of the breakout board in Fusion and exported the outlines as *.dxf.

Encoder dummy

Then I went into KiCAD and designed the different PCBs.

AS5048B

The AS5048B has a much smaller footprint then the TLE5012B and a lower resolution. It is configured to use the I2C interface.

Here is the circuit from the datasheet.

Circuit

This is the schematic I drew.

Schematic

Note

The A1 pin is connected, because it can be used to manipulate the I2C slave address, which is required for more then one sensor.

PCB

I made the PCB on the Roland Mill and soldered my tiniest footpriont yet (TSSOP14).

On the picture you can also see a plastic mount I designed and printed to attach the breakout board.

Breakout board in holder

TLE5012B

The TLE5012B I ordered is the preconfigured E1000 version, which uses the SSC protocol. Here is a screenshot from the datasheet about the protocol.

Circuit

I made the schematic accordingly.

Schematic

And created the PCB design with the outlines from Fusion.

PCB

Assembly

I continued assembling the last 3D printed parts of the zenith drive and attached the arm with the sphere.

Zenith drive preparation

Two side views of the almost complete mechanics. I should add a counterweight to balance the arm and reduce the required torque.

View 1

View 2