<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>Megatronics 2.0 -&amp;gt; Connect servo for  z-axis probing</title>
        <description> Hi everyone!

I&#039;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</description>
        <link>https://reprap.org/forum/read.php?13,314234,314234#msg-314234</link>
        <lastBuildDate>Mon, 16 Mar 2026 11:15:48 -0400</lastBuildDate>
        <generator>Phorum 5.2.23</generator>
        <item>
            <guid>https://reprap.org/forum/read.php?13,314234,317727#msg-317727</guid>
            <title>Re: Megatronics 2.0 -&gt; Connect servo for  z-axis probing</title>
            <link>https://reprap.org/forum/read.php?13,314234,317727#msg-317727</link>
            <description><![CDATA[ Hi Rigor, thanks for you reply!<br />
<br />
I GOT IT WORKING! And thanks for the warning about the 5V bridge, I removed it before testing!<br />
<br />
Here are some details - for all who wish to add the automatic leveling by using the Megatronics 2.0:<br />
<br />
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. <br />
<br />
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.<br />
<br />
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<br />
<br />
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):<br />
<br />
  #ifdef NUM_SERVOS<br />
    #define SERVO0_PIN  44<br />
    #endif<br />
<br />
...saving, compiling, uploading and here we go!<br />
<br />
<div id="div_c0c170fc64b029a4a1e1c26a0455e801"
     class="mod_embed_images"
     >

  

    
      
    

    <div id="imagediv_c0c170fc64b029a4a1e1c26a0455e801" class="mod_embed_images_image"
         >

    
      

      

      

      

      

      

      <noscript>
      <div>
    

    <a href="http://www.df0fkw.datenoase.de/images/stories/projekte/3D-Bibliothek/auto_bed_leveling.jpg">
        <img src="https://reprap.org/forum/addon.php?13,module=embed_images,url=http%3A%2F%2Fwww.df0fkw.datenoase.de%2Fimages%2Fstories%2Fprojekte%2F3D-Bibliothek%2Fauto_bed_leveling.jpg"
             
             
             id="image_c0c170fc64b029a4a1e1c26a0455e801"
             alt="auto_bed_leveling.jpg"
             title="auto_bed_leveling.jpg"/>
    </a>

    
      </div>
      </noscript>
    

    </div>

    <div class="mod_embed_images_info " id="info_c0c170fc64b029a4a1e1c26a0455e801"
      >
      <a id="link_c0c170fc64b029a4a1e1c26a0455e801" href="http://www.df0fkw.datenoase.de/images/stories/projekte/3D-Bibliothek/auto_bed_leveling.jpg">auto_bed_leveling.jpg</a>
    </div>

  

 </div>


<script type="text/javascript">
mod_embed_images_loadimage('c0c170fc64b029a4a1e1c26a0455e801', 'https://reprap.org/forum/addon.php?13,module=embed_images,url=http%3A%2F%2Fwww.df0fkw.datenoase.de%2Fimages%2Fstories%2Fprojekte%2F3D-Bibliothek%2Fauto_bed_leveling.jpg', 'http://www.df0fkw.datenoase.de/images/stories/projekte/3D-Bibliothek/auto_bed_leveling.jpg', 'https://reprap.org/forum/addon.php?13,module=embed_images,check_scaling=1,url=http%3A%2F%2Fwww.df0fkw.datenoase.de%2Fimages%2Fstories%2Fprojekte%2F3D-Bibliothek%2Fauto_bed_leveling.jpg', '', 317727, 800, 400, 'Loading image ...', false);
</script>
<br/>]]></description>
            <dc:creator>lutjanus</dc:creator>
            <category>Controllers</category>
            <pubDate>Fri, 28 Feb 2014 16:19:16 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?13,314234,317672#msg-317672</guid>
            <title>Re: Megatronics 2.0 -&gt; Connect servo for  z-axis probing</title>
            <link>https://reprap.org/forum/read.php?13,314234,317672#msg-317672</link>
            <description><![CDATA[ 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 <br />
<br />
something along the lines of : SERVO0_PIN 46<br />
<br />
remember that the servo will use your usb port's +5V. <br />
<br />
*ALSO*<br />
<br />
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.<br />
<br />
I forgot to remove mine and it blew up in my face (the megatronics board) :-(<br />
<br />
Good luck]]></description>
            <dc:creator>Rigor_M</dc:creator>
            <category>Controllers</category>
            <pubDate>Fri, 28 Feb 2014 14:25:48 -0500</pubDate>
        </item>
        <item>
            <guid>https://reprap.org/forum/read.php?13,314234,314234#msg-314234</guid>
            <title>Megatronics 2.0 -&gt; Connect servo for  z-axis probing</title>
            <link>https://reprap.org/forum/read.php?13,314234,314234#msg-314234</link>
            <description><![CDATA[ Hi everyone!<br />
<br />
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?<br />
<br />
Thanks for your help!<br />
<br />
Lutjanus]]></description>
            <dc:creator>lutjanus</dc:creator>
            <category>Controllers</category>
            <pubDate>Fri, 21 Feb 2014 18:23:13 -0500</pubDate>
        </item>
    </channel>
</rss>
