Last edited · 143 revisions  



While not recommended as the first choice when building a Mega2560 based OnStep, the RAMPS series boards and earlier MKS Gen-L V1 are still commonly used so there are the Wiki pages covering those here RAMPS 1.4, 1.5, 1.6 and here MKS Gen-L V1.

Highly recommended is the MKS Gen-L V2.0 or v2.1, these boards are an integrated Arduino Mega2560 + Ramps1.4 on a low cost single board that has the important advantage of 24V support, not needing an RTC added to improve its tracking accuracy, and support for plugging in SPI configurable stepper drivers for micro-step mode switching support with minimal hassle.

There are several other similar options but the above has the most desirable features at a good price and is well tested.

OnStep can use different PINMAP designs and support for these RAMPS compatible models is in Config.h file.  They are called the MksGenL2, and MksGenL21 (using the beta branch OnStep, not release-3.16.)

Please read the MKS Gen-L Wiki for more information, especially about safety and limitations, and schematics that detail how the various pins are wired.

  • The Mega2560 is a slower (than other options) 16MHz 8-bit MCU and can sometimes limit slew speeds depending on drive design and stepper driver configuration.  Using the recommended TMC2130 stepper drivers and micro-step mode switching overcomes this limitation for nearly any user.
  • Lack of easy access to an I2C interface, but typically SPI works as a substitute.

The advantages:

  • Easy assembly with little or no soldering.
  • Runs RA(Azm), Dec(Alt), two Focusers, and a Rotator.
  • Ability to control Dew Heaters.
  • Long history, tried and true.


  • To wire up switches, sockets, etc. get a good quality set of jumper wires with 0.1" pin/socket headers pre-installed (I use the SparkFun ones.)  Quality is important, the cheap knockoff ones don't have heavy gauge wire nor can they even be soldered to (should you decide to.)


The board should be powered from the motor supply; the allowed input voltage range is 12VDC to 24VDC.

There are 2 ways power can be applied to these boards and one must take care if TMC stepper drivers are used (TMC2130, 5160, 2208, etc.) since they can NOT have logic/signal power present before the motor power supply comes up:

  • The main power connector on the MKS Gen-L (not the power connector for the heaters.)
  • The USB connector on the MKS Gen-L, etc. (see below.)

If using SSS TMC2130, TMC5160, etc. stepper drivers you should take steps to ensure +5V power from the USB port of the Mega2560 doesn't power up the stepper driver logic section without the stepper motor power supply present.  A special USB cable with the V+ wire cut or modify the Mega2560...


  • You can skip the TMC drivers and use LV8729's (or S109, A4988, etc.) and not worry about this.
  • There are TMC driver protection devices (that use Vio to power Vmot) which should avoid issues with this; available on aliexpress, eBay, etc.
  • You can make, and always use, a USB cable with the +5V wire disconnected (cut) and also use a single supply (with voltages within ratings for all devices and also sufficient for the stepper motors.).  This might sound complicated but when building the controller inside a small enclosure it's all perfectly possible to do in such a way that there will never be an issue.


The MKS Gen-L has a USB port that will be used to upload OnStep firmware to the device and often to allow control of the telescope mount once finished (provides a virtual serial port for control.)

Choice of Stepper driver:
The Stepper driver sockets are designed for compatibility with most StepStick (Pololu) style stepper driver modules. 

  • Axis1/2/3/4/5 (RA/Dec or Azm/Alt and Focusers/Rotator):
    • The FYSETC TMC2130 v1.2 or TMC2130 V3.0 SPI are the recommend drivers.  These are available on ebay (read about the TMC2130 before buying!)  Just configure the shunts under the stepper socket for SPI mode and plug them in.  Once this is done you'll be able to configure a variety of settings for these stepper drivers in OnStep's Config.h file including the micro-step mode, stealthChop or spreadCycle, separate power levels for standby, tracking, and goto.  These drivers also allow the use of micro-step mode switching which allows reaching very fast goto speeds (often limited by drive design only.)
    • The A4988 deserves special mention since it is the cheapest option. They can be perfectly acceptable drivers for tin-can permanent magnet stepper motors where the high tech SSS TMC2130 offers very little improvement in performance.  You can configure any supported micro-step mode using the shunts under the stepper driver.
    • Many other drivers can work too, there's a driver summary here.

ST4 interface:
This is enabled by using the ST4_INTERFACE ON_PULLUP setting in the configuration file.  If the hand-control option is used (enabled by default) additional capabilities become available, read the configuration file for more information.  These pins are preset on the EXP-1 header and are typically wired into an RJ12 jack (search eBay for "RJ12 breakout".)

Note: this configuration uses the Mega2560's built in pull-up resistors, if RFI/EMI noise on the ST4 leads is unacceptable add 2k pull-up resistors to each line.

Hardware SPI interface (and PPS to correct tracking rate drift):
The SPI interface is available on the EXP-2 connector and PPS (Pulse Per Second) is on the X+ End-Stop, Pin D2.

Use TIME_LOCATION_SOURCE DS3234 in the configuration file to enable the DS3234 real time clock (and optionally PPS_SENSE ON for a signal to stabilize the tracking frequency.)  The DS3234 can operate and use signals at 3.3V or 5V.  The Mega2560 is a 5V device.

Use WEATHER BME280 to provides environmental conditions info. including temperature, pressure, and humidity.  This is tied into focusing, dew heaters, and atmospheric refraction calculations within OnStep.  The BME280 can operate and use signals at 3.3V only.  The Mega2560 is a 5V device.  For this reason a level conversion device is needed, these are readily available and most work with SPI interfaces.


  • Users have reported that hardware SPI does not work in combination with the TMC2130 and TMC5160 stepper drivers.  The latest beta branch OnStep has support for using software SPI to work around this limitation.

I2C Interface:
Not present on any of the MKS Gen-L versions.

Serial1 and Serial2 (Bluetooth, WiFi, or Ethernet):

OnStep on the Mega2560 has three serial ports always active.  One is attached to the Mega2560 USB port and the other two (Serial1 and Serial2) are available for other purposes. 

  • The Serial1 port (called SerialB in OnStep) is on the END STOP Z- (TX1, D18) and Z+ (RX1, D19) and has +5V power available nearby. 
  • The Serial2 port (called SerialC in OnStep, see Config.h to enable) is on the EXP-1 connector (called AUX-4 on a RAMPS) and the pins are designated (TX2, D16) and (RX2, D17.)

An Bluetooth module, the Wifi add-on, or Ethernet add-on can plug into this port.  For all options jumper wires will be needed to connect things but this is easily done.  RX on the module goes to TX1 on the RAMPS board (shown above.)  TX on the module goes to RX1 on the RAMPS board.  You also need +5V and Gnd connected to power the device.  If you have comms problems try the Serial2 pins instead.

  • For Bluetooth an HC05 or HC06 module will require level conversion circuitry going to its RX pin (google "HC05 voltage divider".)  Refer to the module's manual or hookup guide to be sure the device is in slave mode and operating at 9600 baud, but this is normally not required as they come pre-configured with these settings.
  • For Wifi, the "WeMos D1 Mini" ESP8266 WiFi module can be jumper-ed right in.  Setting up WiFi is covered in its own section of the Wiki.
  • For Ethernet, the Teensy3.2/W5500 module can be jumper-ed right in.  Setting up Ethernet is covered in its own section of the Wiki.


  • There are filtering capacitors and pull-up resistors on the Serial1 RX1/TX1 pins which will disrupt communications.  These can be removed to enable the port to function, but that requires careful use of a soldering iron.



Status LED's, are enabled with LED_STATUS ON and LED_STATUS2 ON in the configuration file.  These work by OnStep switching the Cathode "sink to ground" with the Anode always connected to 5V.  They also need a current limiting resistor of about 2K value, more or less, depending on how bright you want them.  These are on pins D11 and D6 on the SERVO header.

Reticle LED is enabled with LED_RETICLE n in the configuration file, where n = 0 to 255 for the brightness level.  Again, this works by OnStep switching the Cathode "sink to ground" with the Anode always connected to 5V and needs a current limiting resistor of about 2K value.  This is on pin D5 on the SERVO header but that has no associated PWM capability to regulate brightness so we also have an alternate on the SERVO header at D45 which does have PWM.  To enable using that, add the line "#define ReticlePin 45" to Config.h

Tone or Buzzer, is enabled with BUZZER ON (piezo type) or BUZZER 1000 (mini speaker type) in the configuration file.  I use the CEM-1203 mini-speaker (see the application note in its datasheet for a driver circuit.)  This is pin D4 on the SERVO header.

Limit Sense, to activate use LIMIT_SENSE ON_PULLUP in the configuration file.  This pin is located on the END STOP header at X-.  The three position connector has ground, 5V, and an input signal on the D3 Pin which is normally pulled HIGH (5V) by the Mega2560's internal pull-up.  A switch (or series of switches wired in parallel) can close (pulling Pin D3 LOW) to stop any slew and tracking.  This can be physical limit switches and/or a emergency stop button.  Note: this uses the Mega2560's built in pull-up resistors, if RFI/EMI noise on the Limit Sense leads is unacceptable add a 2k pull-up resistor to the line.

PEC, periodic error correction input.  See the SENSORS section of the configuration file to set this up, there are several options to suit different sensors (PEC_SENSE.)  This is on the AUX-1 connector.  The three position connector has ground, 5V power, and an input signal on Pin D57 (A3.)  This arrangement can be used with an optical encoder or hall-effect (magnetic) sensor with minimal or no additional circuitry.  Often the critical RA axis of the mount uses a worm-wheel gear.  The worm has machining errors that repeat once per cycle and a physical sensor makes sure OnStep always knows where the worm is in that cycle.