Last edited · 149 revisions  

 


RAMPS and MKS Gen-L

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.

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.



Features:

  • Performance: Uses the Mega2560 micro-controller, 8 bit and 16Mhz so it's the slowest OnStep supported option.
  • Non-volatile memory/EEPROM: Built-in, no external device required.  The Mega2560 has 4KB of true EEPROM which is nice for user catalog storage.
  • Easiest OnStep firmware upload/update compared to other options with a simple to configure software environment and an upload that doesn't require physical access to the controller.
  • WiFi device/upload, etc. is up to you (no socket.)  See below.
  • Little or no soldering needed.
  • Connections:
    • Mega2560 USB port provides a USB virtual serial port interface for connection from a PC.
    • Power in for stepper motors and heaters on two screw terminal jacks.
    • Stepper driver outputs on 0.1" pin-headers.
    • Dew-heaters (etc) on 3x screw terminals.

*** It's up to you to understand the design, connection, limitations, and use of this device and its components, I accept no responsibility. ***

You should read this entire page before starting the build...

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 OnStep release-4.24 or later.)

 

Misc:

  • 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.)

Power:

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... https://forum.arduino.cc/index.php?topic=146317.0

Solutions:

  • 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.

USB:

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 (RA/Azm "X" and Dec/Alt "Y"):
    • The TMC2130 (Watterott or Bigtree V3.0 SPI) or TMC5160 (Watterott V1.5 or Bigtree V1.2) are the recommend drivers.  These are available on ebay (read about the TMC2130 and TMC5160 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.
  • Axis3/4/5 (Rotator "Z", Focuser1 "E0", Focuser2 "E1"):
    • The The TMC2130 (Watterott or Bigtree 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.

Tip:

  • 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.


WiFi, Ethernet, and Bluetooth:

OnStep on the Mega2560 has three serial ports available.  One is attached to the Mega2560 USB port (SerialA) and the other two (SerialB and SerialC) are available for other purposes.  Only SerialA and SerialB are active in OnStep by default.

  • The SerialA port (called Serial1 in OnStep) is on the END STOP Z- (TX1, D18) and Z+ (RX1, D19) and has +5V power available nearby. 
  • The SerialB port (called Serial2 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 the WiFi and Ethernet devices follow these instructions to upload firmware.

  • WiFi uses either an ESP8266 WeMos D1 Mini or ESP32 WeMos D1 Mini (a "TTGO T7 V1.3" for example.)  A device with provision for external antenna is recommended, if using the standard aluminum case, i.e. a WeMos D1 Mini Pro.
  • Ethernet uses a Teensy3.2, W5500 module, and a custom PCB.  Once this module is assembled it plugs right into the WeMos D1 Mini socket and positions the Ethernet jack at the case edge where a cutout can be made to allow access to the RJ45 connector.
  • Bluetooth uses an HC05 and custom PCB.  Once this module is assembled it plugs right into the WeMos D1 Mini socket.  Experience so far has shown it works acceptably from within the case without an external antenna.
  • Tips:
    • The WeMos D1 Mini Pro needs to have a "0 Ohm" SMT resistor moved (soldered in alternate position) to disable the on-board antenna and enable external antenna connection.  This is a delicate process and requires moderate soldering skill.  I moved the resistor first to see how difficult that was, then removed it and bridged the correct SMT pads with solder (0 ohm so either way is fine.)  You can see info. about this process here.
    • There are filtering capacitors and pull-up resistors on the SerialC (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.

Misc:

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.