Skip to main content

Odd Motor Behavior with OpenMoco? HELP!!!

bdodds's picture
Posted in

Hello! I'm new here and new to all of this stuff.

I have been building my own TimeLapse dolly with the OpenMoco Engine on an Arduino and seam to have run into a problem.

I have an Arduino Duemilanove, 2 EasyDriver 4.3, a SparkFun NEMA 17 stepper motor and an Anaheim Automation 17YPG 14x1 planetary gear box stepper motor.

I hooked it all up and loaded very basic Arduino code to run the motors as a test and every thing seams to run fine and it's easy to see the SparkFun motor doesn't have nearly the torque of the 17YPG.

The problem I'm having comes when I use the OpenMoco Engine and Slim to control the motors, they move, but have almost NO torque at all. I can stop the motor rotation with my finger tips with almost no effort... With the basic code test I could stop the SparkFun motor with some effort, but the 17YPG had so much torque it would not stop at all with my fingers.

Being so new at all this stuff I can't quite figure out why this would be... Please Help!

One other odd thing I noticed when playing with the home command in Slim. The motors will ramp up to go home, but stall (no movement) and they just buzz...

What am I doing wrong? Is there a setting in the code someplace I need to change?
(sorry if this is in the wrong forum...)

You didn't have this problem

You didn't have this problem at all with just doing a step-based sketch in arduino? I'm concerned that your current limits may not be set well on the driver, and it's not allowing you to run the motors fast enough... I would suggest first adjusting the current limit, so that it can be pushed a little faster.

You are running them at 12V, right? For testing are you using mains power or a battery?

As far as Slim goes, I'd start with adjusting the 'minimum step delay period' - as it sounds like you're overrunning the step rate the motors can take. This usually happens when the current limit is too low, the voltage is too low, or the step rate is just too darned fast. Although, the default is tested with both the easydrivers (v3 and 4) and anaheim motors! Anyhow, try to increase the minimum and maximum step delay settings, and see if there's a point where they begin to behave again:

 # values are in uSec
stepper min_stp 800
stepper max_stp 3000

The above commands should slow the motors to 1/2 default speed.

!c

I contacted Brian Schmalz

bdodds's picture

I contacted Brian Schmalz about the Easydriver, because of these odd problems with it and he helped me come up with this basic code to test the current settings and also verified that I do have everything hooked up correctly.

int STEP = 4;        
int DIR = 8;          

void setup()
{  
  pinMode(STEP, OUTPUT);
  pinMode(DIR, OUTPUT);
}
void loop()
{
  digitalWrite(DIR, LOW);
  int i;
  for (i = 0; i<4000; i++)
  {
    digitalWrite(STEP, LOW);  
    digitalWrite(STEP, HIGH);
    delay(10);    
  }
}

When using this Basic sketch, I don't seam to have any problem with the torque of ether motor.(note I have always powered down before swapping motors because of the warning on the SparkFun product page...)
I am currently running the Easydriver/Motor off a 12v 1A power supply, but plan on using battery later.

I have also found this Tutorial by Dan Thompson, and it also doesn't work properly...

I'm beginning to think I may have a bad EasyDriver Board.
I have a 2nd EasyDriver that is still in the package that I'm going to open and add pins to, but I can't do this or any other tests like you suggested until later tonight when I get home from work.

Yes, that would be driving

Yes, that would be driving the motor at an extremely slow rate (100 steps/second), note that torque decreases at higher stepping rates, without alternative forms of compensation (gearing, voltage increase, etc.)

See your earlier comment:

Quote:The motors will ramp up to go home, but stall (no movement) and they just buzz...

That's a clear indicator that they aren't getting the torque they need at maximum speed. Your two options are to massively reduce the speed, or to increase the current being given them, or increase the voltage for the same amount of current.

The slim command I gave you earlier will slow it down, but I think it's better to not slow them down, but tune to so that they have enough torque to move at higher speeds, i.e. increase the current limit.

If it can't handle the step rate that Dan uses in his tutorial, you're going to be hurting in the real world - as Dan's rate was still pretty slow at the top-end =) at 1600, 800, 400, and 200uS. You want to get closer to 400 or 300uS.

Additionally, you're saying _neither_ of these motors work at the step rate? I presume you tuned them differently? They have _very different_ current utilization patterns.

!c

That is correct, neither of

bdodds's picture

That is correct, neither of the motors seam to work at any of the speeds in Dan's tutorial. I even tried adjusting the current limit pot on the Easydriver when playing with his tutorial, but it didn't solve the problem. I'm going to unpack the 2nd Easydriver I have and try it tonight. I'm thinking I may have a bad board.
If it proves I do have a bad board causing all my confusion, I hope Sparkfun will replace it.

I have a few other questions,
Is "Delay(10)" equal to 10,000uS?
Should I have the easydriver running at the default 1/8 steps or do I want to use 1/4, 1/2 or Full steps?

EDIT:
Oh and the motor specs are very close.

My SparkFun Motor is rated .33A at 12V DC
My 17YPG Motor is rated .28A at 12V DC

I didn't have time last

bdodds's picture

I didn't have time last night, but this morning I decided to give Dan's tutorial one more try with my 17YPG motor before I soldering up my 2nd EasyDriver and it worked!!! It also had more torque that I could stop with my fingers during the full cycle of Dan's code. I used the very same sketch I had used last time I tried Dan's tutorial and the Arduino and EasyDriver are still hooked up the same way as well... ???

Next, I decided to turn it all off and hook up my SparkFun motor to see what would happen and it also works today, but could still be stopped with my fingers fairly easily.
I'm totally confused now.

So now it was time to loaded up the Open Moco Engine and start up Slim for more testing.
I entered these commands:

[1] > port /dev/tty.usbserial-A800ewHg
[2] > connect
[3] > set_camera exposure 500
[4] > set_camera cycle 1
[5] > set_camera on
[6] > set_motor 0 enable
[7] > set_motor 0 steps 250
[8] > set_motor 0 home
[9] > start

Again I had no torque when I tested ether of the motors and sending them HOME still just buzzed...

So I did your min_stp and max_stp suggestion with the 17YPG hooked up, and the motor started moving faster than it did before and even has more torque, but sending the motor home is still odd... The ramp up seams to work, but the motor still stalls and buzzes when it gets to full speed then moves again when the ramp down starts...

Any more ideas?

I'm going to solder up my 2nd EasyDriver board now and test that next.

Sending a motor home just

Sending a motor home just makes it take a bunch of steps to a previously set position (home). Avoid complexity until you ascertain first that everything is working right. 250 steps alone may not be getting to full speed. Adjust your parameters with manual moves only at first, until everything works right... For example: avoid all of the above, simulate real movements:

 # move motor 0 10000 steps in '1' direction
move 0 1 10000

Adjust (increase) min_stp until this works. Try changing directions in the process (move 0 0 10000, etc.)

!c

So when I do this, move 0 1

bdodds's picture

So when I do this, move 0 1 10000 at first launch, I get about 1/4 turn then Buzzing.
When I tell it stepper min_stp 800 I get the same 1/4 but I think the buzzing lasts longer...
When I use min_stp 1000 I get the same results with a slower sounding buzzing.
At 1800 the ramp up is VERY SLOW, but also changes speeds randomly until it reaches what seams to be max speed, then the ramp down also changes speeds randomly till done...
I also get this error when running at 1800. [_openmoco_command] ERROR: Timeout Reading from engine.

I'm starting to get very discouraged... :'(

I was looking at the "Dolly

bdodds's picture

I was looking at the "Dolly prototype v1 details" and see that the motor listed is an Anaheim Automation 17YPG3, but it doesn't say if it's the 17YPG301S-LW4-R19 - 19.32 volt, .28A motor OR the 17YPG302S-LW4-R19 - 5.61 volt, .85A motor. It also doesn't say what power supply or stepper driver board was used...

I have the 17YPG101S-LW4-R14 - 12.04volt, .28A motor, and from what Anaheim Automation tells me, the main difference other than my slightly lower gear ratio (14x1 vs 19x1) is that my 17YPG1 motor has half the torque of a 17YPG3. I don't think that will be an issue though.

I believe that Milapse used

I believe that Milapse used the 17YPG302S. I think the issue you're running into is that both of you motors are badged at 12V, which would indicate you need to feed more voltage. Notice that the one (I think) Milapse used is rated at 5.61V, and we run it at 12V. 12V DC, easydriver was used for that version of the dolly. (I know this much... =)

The timeout is just because the motor is set to run so slow, it takes longer than the serial command timeout is configured in the perl library. No big deal, in this case.

That is very odd the results you got from the speed changes. I don't think your driver is at fault, but I do think you're running your voltage a little low. Do you have a 24V supply laying around somewhere? I'd try increasing the voltage first.

Also, are you microstepping, or full-stepping? I'd leave everything at full-stepping until you get it all working ok, and then move to microstepping.

My final thought is, does it do this when the motor is cold? I.e., if you just turn it on right away and go at it while the motor's still cold, does everything work?

I'm sorry that you're having these issues. This is the hardest part about steppers, is that slight variations can cause problems for people and figuring out what went wrong can be a real pain. One of the things I go by, is that I always choose a badge voltage _well below_ the actual drive voltage I'm using, as this allows me to push it much higher in voltage with a chopping driver (like the easydriver), and thus step faster. Additionally, you can usually adjust down the rated current equivalent to the increase in voltage. (Not always, but often enough =)

That being said, there should be no reason why we can't get these motors to work, we've had people using sparkfun-suppled motors before, and other ones that I haven't personally used without issue.

Have you tried your second easydriver yet? Additionally, are all connections soldered well?

!c

Ok, so it was an easydriver

bdodds's picture

Ok, so it was an easydriver used on the prototype and I will ignore that error I got. :)

I think I may have a 24v Power Supply someplace, I will try to dig it out tonight when I get home.

When running my simple test code, I have MS1 and MS1 set LOW for Full stepping.
When running the OpenMoco Engine, the easydriver is running at whatever the default is. Hmmmm, are there pins assignments in the Open Moco Engine for that or would I need to hardwire them?

My motors do the same thing if cold, warm or hot. (though never gets super hot.)

One of the big part in why I have been so confused about this is that I have read so much about others doing the same thing without the problem I'm having...

As for trying my other easydriver board, no, I have not tried it yet. I keep running out of time to solder it up. The one I am using does have all connections soldered well, that is one thing I know I can do well. :p

Thanks so much to putting up with my noob questions and frustrations! :) I wish there was something someplace written in everything I have read about doing this that would have said "always choose a badge voltage _well below_ the actual drive voltage" In my case as a noob, I have been looking for motors that matched the voltage I was planing to use.
I didn't know a chopping driver would let me push the voltage that much higher without damaging the motor!!! :( On the plus side, my 17YPG1 motor was in stock at Anaheim Automation (no long wait times) and they are walking distance form my house. :p hehe

Thanks for the new hope!