Large DC motor control

Hello,

I would greatly appreciate some helped as I have hit a block.

I am trying to include as many details as i can to give a full understanding of what i am trying to achieve. only the motors are set in stone, most of the rest of the system can be changed if there are better suited items. please feel free to make suggestions on replacing equipment.

My overall project requires me to run two large dc motors. The main motor runs at a relatively slow speed 50 - 100 rpm and is a geared DC motor on 130 VDC (see below for specs) the secondary motor needs to run in scale to the first. For example: if the setting is 4 to 1 the main motor is running at 60 rpm the follower is 240 rpm, if i then increase the main to 67 RPM the follower should automatically increase to 268 RPM.

The hardware:

Main motor (not changeable):
Bodine motor 24A2BEPM-D3
Volts: 130 VDC
A: 0.30
HP: 1/29
Ratio: 6:1
RPM: 417
Torque: 3.3 in*lb

Follower motor (not changeable):
Bodine motor 42A5BEPM
Volts: 130 VDC
A: 1.8
HP: 1/4
RPM: 2500

Each motor has a feedback device to make sure the RPM is where it should be. The main motor has a 2000 pulse per revolution optical encoder and the follower has a 32 pulse per revolution magnetic pickup. both of the feedback devices are working properly, although not pertinent to issue I am having)

The issue comes from driving the two motors. Typically i have used this to drive the motors:Minarik DC Motor Driver RG60U
Click HERE for data sheet

This driver works great if you want to control the motors by hand and drive them with a 10 KΩ pot. The driver uses a 10 VDC voltage from S2 pin to control the motors. If you supply S2 to S0 it stops, S2 to S1 it rotates one direction and S2 to S3 spins the other direction.

My first though was to control the S2 to S1 using a mosfet controlled by a Arduino UNO. The issue i found was that what is not sent to the motion pin (S1 or S3) needs to be sent to the S0 pin.

My next thought was to use a digital potentiometer chip to control the driver. I used a MCP4131-103 (10 KΩ) SPI chip. DataSheet HERE
The chip is wired with S2 on the greed wire, S0 on the Brown wire, and S1 on the purple wire (See attachment)

I used a simple code writing the SPI to 128 bytes for a half second and then wrote the SPI to 0 bytes for a half second and then looping.

#include <SPI.h>

byte address = 0x00;
int CS= 10;

void setup()
{
pinMode (CS, OUTPUT);
SPI.begin();
Serial.begin(9600);
}

void loop()
{
digitalPotWrite(0x00);
Serial.println(0);
delay(5000);

digitalPotWrite(128);
Serial.println(128);
delay(5000);
}

int digitalPotWrite(int value)
{
digitalWrite(CS, LOW);
SPI.transfer(address);
SPI.transfer(value);
digitalWrite(CS, HIGH);
}

The motor moves however it never comes to a complete stop and the maximum RPM is about half what it is through a 10 kΩ pot. I measure the resistance across the digit pot and i’m getting about 6 KΩ at max and 0.5 kΩ on the minimum.

Is there something i am wiring wrong? or is this in the nature of the electronic pot?

Also just to point out there is a provision for controlling the driver with a 10 VDC on page 16 of the RG60U driver manual. I applied a 10 VDC to the S2 and RB1 line and did not get any response from the motors. if anyone has any ideas i would greatly appreciate the feedback.

Regards,

Firstly a digital pot has to have a supply range equal or exceeding the analog voltages involved or you'll
risk frying it.

It seems to have a +/-10V differential analog control mode (page 16), which could be interfaced to
using a DAC and opamp to boost the ouput of the DAC to the +/-10V range (it seems that S1 and S3 may
be +/-10V supplies from what you describe).

It seems the controller doesn't have an opto isolated PWM control input, alas.

Two things. As MarkT mentioned, the MCP4131 has a limit of 5 volts applied to the pot terminals. Two, you have it wired wrong, it should be:

S0 (gnd)     -> POB (7)
S1 (+10 ref) -> POA (5)
S2 (spd ref) -> POW (6)

So long as you are only running the drive in one direction, you might be able to make the MCP4131 work but you'll probably need replacements as the one(s) you've used may be damaged.

The trick is to see if the drive will achieve the required speed with only 5 volts input. You can test that using the standard 10k pot that appears to come with the drive. Set it so you measure 5 volts on terminals S0 and S2. Then, see if you can get the drive to maximum speed required by increasing the drives max speed pot.

If so, insert a 10k resistor in series from S1 (+10v ref) to pin 5 (POA) of the MCP4121. This will limit the maximum voltage applied to the pot to 5 volts. That should allow it to work so long as you compensate for the 5 volt maximum input reference with the max speed pot of the drive.

Thank you for pointing out the incorrect wiring. I discovered the same thing yesterday afternoon. With the correct wiring the top end is higher but still exhibits the slow rotation when the motor should be off.

Is there a chip that has the higher voltage rating? Is this a function of the chip being controlled by a 5.5V source? I saw some that say they can go to 16.5V but move to the 14 leg style chip. Something like the AD5291 Analog Devices DigiPots

My bigger issue is I need to be able to stop the motor. Any ideas on why it would not be stopping on the low end? After looking at the data sheet it looks like the wiper has a minimum resistance of 75Ω (while i was measuring last night about 100Ω) I am thinking this could be the cause of the small bleed off that is causing the motor to slowly rotate. Is there a solution to mitigate the minimum resistance from POW to POB?

Thank you for your help!

Turning the drives MIN SPD pot CCW should fix the low speed creep. If it doesn't, what voltage do you measure between S0 and S2 with drive running and the digital pot setting at zero?

Hey Fred,

I have the minimum speed trim pot set to max and it is just out of the adjustment range.

I'm getting 7.87 Vdc from S0 to S2 when it should be 10 vdc to come to a stop. I'm thinking if I add additional resistance to the S2 to S1 line it would send more to the brake (S0). The side effect is that the top speed would decrease.

I'm wondering if I go to a higher resistance overall pot like a 50 ohm would overcome the lower end resistance. It may reduce my resolution but it should get the motor to stop. and if I use a 256 byte SPI digital pot it would get some of the resolution back for the useable range.

Anyone know of a digital pot that works on a 5V supply, 256 byte, 20-50ohm resistance, that has a 10 vdc voltage cutoff?

Going lower in pot resistance makes the problem of end resistance worse, not better. In addition, most references top out at about 10ma of source current so a lower resistance pot is really not practical nor desired.

I’m getting 7.87 Vdc from S0 to S2 when it should be 10 vdc to come to a stop

That make no sense to me. Unidirectional convention is that zero volts is zero speed and +10 volts is max speed. What does 7.87 volts have to do with stopping or min speed?

I’m thinking if I add additional resistance to the S2 to S1 line it would send more to the brake (S0)

S0 is ground, it has nothing to do with a brake. Did you have this drive configuration running with analog pots first? If so, please post a drawing of how things are wired as this discussion is now at a stage where you statements are no longer matching up with the original description.

avr_fred:
Going lower in pot resistance makes the problem of end resistance worse, not better. In addition, most references top out at about 10ma of source current so a lower resistance pot is really not practical nor desired.

You are correct I was meaning 20k - 50K Ohm

avr_fred:
That make no sense to me. Unidirectional convention is that zero volts is zero speed and +10 volts is max speed. What does 7.87 volts have to do with stopping or min speed?

You asked what what voltage I had from S0 to S2 I’m getting 7.87v. my blabbering was more about I know I have 10v coming into the digipot if I have 7.87 going to S0 (ground) then the other 2.13v must be going to S1 possibly causing the motor to idle.

avr_fred:
S0 is ground, it has nothing to do with a brake. Did you have this drive configuration running with analog pots first? If so, please post a drawing of how things are wired as this discussion is now at a stage where you statements are no longer matching up with the original description.

When I wire the drive exactly as the datsheet illustrates using a 10K ohm potentiometer the motor works perfectly (see the attachement) turn the pot one way I get full speed, the other direction stops. my issue is I am trying to automate this 10K ohm pot. This may be the wrong way to do this, if there is a better way I am open to it.

Thank you for your help

Good to know it works with analog pots. You mind find that the MCP45HV51-103E will work but only if you can deal with a 14 pin TSSOP surface mount part. Solder it up on a dip adapter and you should be good to go. The downside is you might have to hack a library to make it work, I don't know if the software requirements are different than what you're using now. I can't imagine it's that difficult, it's a control word and a pot value.

https://www.digikey.com/product-detail/en/microchip-technology/MCP45HV51-103E-ST/MCP45HV51-103E-ST-ND/4902597

The other option (not as simple) is a rail-to-rail op amp that can use the +/-10 ref of the drive as a supply. PWM out of the Arduino into an RC filter and a X2 gain op amp. You could use any old op amp like the LM358 but you need a power supply higher than the output due to output stage losses. This is where the rail-to-rail devices help out but most are 5 volt supply, not as many +/-10V supply capable parts, almost all will be surface mount. The ADA4177 is one of many that should work but it's way over-spec'ed just to get to the supply voltage you need.

After looking at this project and the available driver boards. I am thinking of switching over to this:
RG60U-PCM

this allows for a non isolated 10 v analog signal. Would it be easier to generate this signal? I believe that is what MarkT was referring to in his post.

I'm thinking of using an OpAmp (I have never used one before) to amplify the voltage from 0-5v to 0-10v.

Fred or Mark any suggestions? thanks

Changing the drive is no help, it still needs a 10V speed reference.

I'd like to know, what's wrong with the high voltage digital potentiometer that I suggested? That will work and it is by far the simplest solution. Is the problem that you cannot handle the surface mount aspect of the part?

Abandoning the digital pot idea and doing this with op amps is easy so long as you have a 12 to 15 volt power supply. A simple LM358 with a gain of two and a low pass filter (one resistor and one capacitor) should suffice to convert the PWM to an analog output of 10 volts.

You'd only need about 50 ma of current. Using the drives +/-10 volt reference as the supply requires a high voltage rail-to-rail op amp and those don't come easy or cheap as I pointed out in post #8.

PS: Isolation is not a factor here, it's not required. MarkT's original comment was about the drive's lack of a PWM input which is the Arduino native analog output method. This is not a surprise in the motor drive world as +/-10 volts has been the standard for the speed command since drives became solid-state devices.

avr_fred:
Changing the drive is no help, it still needs a 10V speed reference.

I’d like to know, what’s wrong with the high voltage digital potentiometer that I suggested? That will work and it is by far the simplest solution. Is the problem that you cannot handle the surface mount aspect of the part?

I have ordered some, so i can try them out. I do not know yet where everything gets wired (thats why i got extras). From what i can tell so far:

(1) Vcl
(2) SCL → PinA4*
(3) A1
(4)SDA → PinA5*
(5) A0
(6)Vlat
(7)NC
(08)SHDN
(09)DGND → GND
(10)V- → GND
(11)Pa → S1 from drive
(12)Wiper → S2 From drive
(13)Pb → S0 from drive
(14)V+ → 5V+

*These pins use a 4.7KΩ pull up resistor to 5v
PinA4 goes high to indicate selected chip and PinA5 handles the communication

Is this everything? I also ordered a TSSOP to Din breakout board to handle the connections.

Abandoning the digital pot idea and doing this with op amps is easy so long as you have a 12 to 15 volt power supply. A simple LM358 with a gain of two and a low pass filter (one resistor and one capacitor) should suffice to convert the PWM to an analog output of 10 volts.

I am also looking at this as a possible solution as well since i do have an adequate power supply on this machine. I have LM358 OpAmps on the way. Do you have a diagram for the circuit i would have to build?

You’d only need about 50 ma of current. Using the drives +/-10 volt reference as the supply requires a high voltage rail-to-rail op amp and those don’t come easy or cheap as I pointed out in post #8.

PS: Isolation is not a factor here, it’s not required. MarkT’s original comment was about the drive’s lack of a PWM input which is the Arduino native analog output method. This is not a surprise in the motor drive world as +/-10 volts has been the standard for the speed command since drives became solid-state devices.

Got it, thanks

Uggh.

Due to a similar drive question that came up in this thread: http://forum.arduino.cc/index.php?topic=511067.0

I re-read the Minarik drive manual (this time on my pc, not an ipad) and see they do specifically call for an analog input that is isolated from ground. I apologize that I did not see this for what it really was - trouble for an Arduino.

The digital pot can withstand +/-18 volts to the same common as the pot’s digital common but the real problem is the Arduino. If the drive’s common terminal (RB1) isn’t grounded, and it’s clear from the manual it’s not, there is really no way to know what potential exists between earth ground and the drive common.

The problem will really appear when you plug a USB cable into the Arduino, especially on a desktop because the metal shell and the DC (-) of the USB connector is usually tied directly to case and then to earth through the standard three wire plug. It’s not as big an issue with a laptop since they usually have two wire cord sets but there’s no guarantee of that. Depending upon what voltage (and its source) are present on the drives’ common terminal, that voltage will be taken to ground through the USB cable or worse, through your body if you come into contact with it.

Since we don’t know what voltage may be lurking on the common of the drive, I think it would be far safer to use an opto-isolated pwm to analog convertor. The other thread had a reference to this design:

http://ardupiclab.blogspot.com/2016/09/an-isolated-analog-output-for-arduino.html

Which is an okay circuit, I’ve tested it and works fine with the exception that it inverts the signal. That’s easy to fix when you call the analogWrite routine with the map function. All that would be needed for your application would be few easy tweaks to make it 0 to 10 rather than 0 to 5 volts out per this changed version.

IsolatedAnalogOut_2X.GIF

The alternate drive I posted in #9 has an additional card giving the designation "PCM".

PCM OPTION: The -PCM is an isolation daughter card for receiving non-isolated speed reference voltages between -10V and +10V

if the voltage signal doesn't have to be isolated then would be back to what we were discussing previously in the thread? Either using the digital pots or the OpAmp?

You said you already have Minarik drive RG60U. You can convert that to the RG60U-PGM by adding the isolator card. From the manual:

"Minarik Drives offers a field installable isolation adder board, part number 200-0440, to convert a RG6xU into a RG6xU-PCM."

But, I can find zero information on the isolator. Specifically, it does not say it provides isolation for a potentiometer, it only says it provides isolation for an analog input. My concern is where does the +10 supply for the pot originate? Is that voltage isolated? Without being able to confirm that, I'm not willing to say the digital pots would work without a separate, isolated 10 volt source to feed the pots which then just output a 0 to 10 volt speed reference.

I way I see things, you have two options:

  1. Use the RG60U's as is and build/use two the isolated circuits shown in post #12.

  2. Buy two 200-0440 isolators and use two digital potentiometers and a separate, isolated +10 pot supply.

Number one is going to be significantly less costly with zero difference in performance.

89LTI:

If you are using an Uno, let me know and I can send you a shield with two of the circuits in post #12 already built. You can use the +15 volt output on the RG60U as the supply for the analog output so it will be self-contained as this is how they power their own isolator board.

Hey Fred i didn't notice this went to the second page when i was looking for any new comments.
I am definitely interested in that shield. Ill send you a message.

Thanks for your help

Update to this project

I received the new driver with the PCM board attached. I connected a non isolated 10vdc power supply with a standard 10K potentiometer and the motor functions well. So i belive i am back to the digital pot idea.

I got a few different options but most only allow for a 5vdc on the wiper side. I am using MCP45HV51-103E that avr_fred had suggested on page one since it will survive the 10v. This is my first experience with I²C communication and am not having any success in getting a response from the digi pot.

Chip data sheet: MCP45HVX1 Data sheet

My pin connections:

Pin (1) VL → 5 v from arduino
Pin (2) SCL → pin A5 from arduino with 4.7 K pull up resistor connected to 5v from arduino
Pin (3) A1 → ground (used for changed chip address)
Pin (4) SDA → pin A4 from arduino with 4.7 K pull up resistor connected to 5v from arduino
Pin (5) A0 → ground (used for changed chip address)
Pin (6) WLAT → ground
Pin (7) NC → nothing

Pin (8) SHDN → 5V from arduino
Pin (9) DGND → ground from arduino
Pin(10) V- → ground from 10v
Pin(11) PB0 → Ground from 10v
Pin(12) PW0 → To driver
Pin(13) PA0 → 10v supply
Pin(14) V+ → 10v supply

As a test of the digipot I reduced the 10v to 5.0 v and ran an LED from Pin(12) to a resistor to ground.

I used the I²C scanner and determined the address for the chip is 0x3C. and used this code just to get the digipot to do something.

#include<Wire.h>

// MCP45HV51 I2C address is 0x3C
#define Addr 0x3C

void setup()
{
  // Initialise I2C communication as Master
  Wire.begin();
  // Initialise serial communication, set baud rate = 9600
  Serial.begin(9600);
}

void loop()
{
  //write 0 speed
  // Start I2C transmission
      Wire.beginTransmission(Addr);
  // Select data register
      Wire.write(0);
  //print action on serial screen
        Serial.print("Wite Resistance to 0 ");
  // Stop I2C transmission
      if(Wire.endTransmission() ==0){
        Serial.println(" Success!");
      }else{
        Serial.println(" No");
      }
delay(1500);

  //write half speed
  // Start I2C transmission
      Wire.beginTransmission(Addr);
  // Select data register
      Wire.write(0x80);
  //print action on serial screen
        Serial.print("Wite Resistance to 128 ");
  // Stop I2C transmission
      if(Wire.endTransmission() ==0){
        Serial.println(" Success!");
      }else{
        Serial.println(" No");
      }
delay(1500);

   //write full speed
  // Start I2C transmission
      Wire.beginTransmission(Addr);
  // Select data register
      Wire.write(0x3F);
  //print action on serial screen
        Serial.print("Wite Resistance to 255 ");
  // Stop I2C transmission
      if(Wire.endTransmission() ==0){
        Serial.println(" Success!");
      }else{
        Serial.println(" No");
      }
delay(1500);

}

Just as a test, this code should turn the LED off, then half bright, then full bright. but i get nothing on the light. The feedback on the Wire.endTransmission gives me a success on the “0” write for off, then “No” on the half and full writes.

Any ideas where i could be going wrong?