Welcome! Log In Create A New Profile

Advanced

Megatronics 2.0 -> Connect servo for z-axis probing

Posted by lutjanus 
Megatronics 2.0 -> Connect servo for z-axis probing
February 21, 2014 06:23PM
Hi everyone!

I'd like to implement an auto leveling function which requires to connect a servo to the electronics .Does somebody know where and how to connect the servo to the megatronics 2.0 board? Can it be done on one of the AUX ports?

Thanks for your help!

Lutjanus
Re: Megatronics 2.0 -> Connect servo for z-axis probing
February 28, 2014 02:25PM
Maybe its a bit late to answer but I did it on my megatronics board. use pin 46 (I forget the AUX number, you'll find it on the schematic) and you 'll need to define the servo pin in pins.h

something along the lines of : SERVO0_PIN 46

remember that the servo will use your usb port's +5V.

*ALSO*

If you have a LCD screen attached and a servo motor, I recommend that you remove the +5V_USB jumper because, you could have some trouble.

I forgot to remove mine and it blew up in my face (the megatronics board) :-(

Good luck

Edited 1 time(s). Last edit at 02/28/2014 02:26PM by Rigor_M.
Re: Megatronics 2.0 -> Connect servo for z-axis probing
February 28, 2014 04:19PM
Hi Rigor, thanks for you reply!

I GOT IT WORKING! And thanks for the warning about the 5V bridge, I removed it before testing!

Here are some details - for all who wish to add the automatic leveling by using the Megatronics 2.0:

Basically you need three things: +5V, GND and a Atmega port which is capable of PWM (pulsewidth modulation). According to the Atmega Datasheet on the 2560 for example the following port can do that : PORT L03 to PORT L05.

And a servo of course: I got one out of my old modelplane spare parts box. It is a Graupner C508 which is for 4,8V use, so 5V is not too much. But any similar type should do fine as well. The maximum current (when pressing against the holding torque is about 300mA - so you should use an adequate power source - just like Rigor mentioned). When testing I figured out that moving one of the steppers causes some oscilating motion on the servo. So I attached an open ferrite core on the servo cable which kills the stray voltage.

I decided to use the AUX4 port which is great for this job. Two of the needed pins are located at AUX4 (PORT L03 and PORT L04). I'm using PORT L03 which is called D44_AUX4_3 in the wiring diagram of the Megatronics 2.0

Besides the configuration in the configuration.h (enable "Auto Bed Leveling Support" and "R/C Servo Support") you have to add the following lines into the pins.h (within the chapter which is about the Megatronics 2.0, type 701):

#ifdef NUM_SERVOS
#define SERVO0_PIN 44
#endif

...saving, compiling, uploading and here we go!


Sorry, only registered users may post in this forum.

Click here to login