Welcome! Log In Create A New Profile

Advanced

Servo not moving, Solved

Posted by Ralf 
Servo not moving, Solved
March 11, 2014 04:19AM
I am having a hard time getting bed autolevel to work, or more specific just getting a sign of life from my servo.

Latest Marlin (as of 3 days ago), Arduino 1.0.5-r2. It compiles and uploads just fine, in Configuration.h I have uncommented:

#define NUM_SERVOS 1

M280 P0 Sxxx
Gives absolutely no response on the servo pin, I would expect to see pulses of xxx mS on my oscilloscope.
uP is brand new, I have tried both pin 11 (PB4) and pin 27 (A4).

Am I missing something, or are there incompatabilities with other features or settings that I am overlooking, PWM maybe?

Edited 1 time(s). Last edit at 03/12/2014 06:24AM by Ralf.
Re: Servo not moving
March 11, 2014 06:57AM
sure there power to the servo
Re: Servo not moving
March 11, 2014 07:05AM
For now I'm testing with a oscilloscope, just looking for signs of life.

It looks like the pin is not initialized, as it goes high if I pull it up with a 10K resistor.
Re: Servo not moving
March 11, 2014 10:11AM
Hmm...

Seems like SERVO0_PIN isn't defined when servo_init() is called..

Skipping all the #if's and just calling 'servos[0].attach(27);' does magic, whereas if I do 'servos[0].attach(SERVO0_PIN);' I get badmouthed.

Will dig a bit deeper..
Re: Servo not moving
March 11, 2014 01:35PM
You also need to uncomment the next two servo defines.

#define SERVO_ENDSTOPS {-1, -1, 0} // Servo index for X, Y, Z. Disable with -1
#define SERVO_ENDSTOP_ANGLES {0,0, 0,0, 96, 180} // X,Y,Z Axis Extend and Retract angles

The 96,180 are my settings for the servo, yours will be different.
Re: Servo not moving
March 11, 2014 02:12PM
Already did that, and the ifdef in pins.h only checks for NUM_SERVOS:

#ifdef NUM_SERVOS
    #define SERVO0_PIN         28
...
...


Which means that the following should evaluate true:
#if (NUM_SERVOS >= 1) && defined(SERVO0_PIN) && (SERVO0_PIN > -1)
    servos[0].attach(SERVO0_PIN);
  #endif


But for some reason, it doesn't.. I don't get it.. confused smiley
Re: Servo not moving
March 12, 2014 06:23AM
Found it.. the servo pin definitions only gets defined when motherboard is set to Ramps and some other boards, not for Sanguinololu.

Wonder why noone have had this problem before me..
Re: Servo not moving
March 12, 2014 12:32PM
Quote
Ralf
Wonder why noone have had this problem before me..
Probably because you're the first one to try hooking up a servo to a Sanguinololu. Or, you're just the first person to post about it online.


Help improve the RepRap wiki!
Just click "Edit" in the top-right corner of the page and start typing.
Anyone can edit the wiki!
Sorry, only registered users may post in this forum.

Click here to login