MKS Gen-L & RAMPS1.4/+
Highly recommended is the MKS Gen-L V2.0, this is an Arduino Mega2560 + Ramps 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. Recently the MKS Gen-L V2.1 has become available. I've added a PINMAP for it and the only major change I see is that it uses D12 for the Focuser2 CS signal instead of D21, it should work fine but is new and less well tested.
There are several other similar options but the above has the most desirable features at a good price and is well tested. For reference, here are the schematics/wiring aids for the more dated RAMPS1.4 and MKS Gen-L V1.
OnStep can use different PINMAP designs and support for these Ramps1.4 compatible models is in Config.h file. They are called the Ramps14, MksGenL1, MksGenL2, and MksGenL21 (using the master branch OnStep, not release-3.16.)
Please read the RAMPS 1.4 WiKi and the MKS Gen-L Wiki for more information, especially about safety and limitations, and schematics that detail how the various pins are wired.
For the MKS Gen-L V1 and V2 keep in mind that the connectors while not positioned the same as a RAMPS1.4 are for the most part present.
The following recommendations are based on using the MKS Gen-L V2.0.
The disadvantages are:
- 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 nearly any user.
- Lack of easy access to an I2C interface, but typically SPI works as a substitute.
- VERY LOW COST.
- 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.)
- Status and reticle LED's work by OnStep switching the Cathode "sink to ground" with the Anode always connected to 5V. There are LED_STATUS, LED_STATUS2, and LED_RETICLE settings in the configuration file to enable these. They also need a current limiting resistor of about 2K value (depending on how bright you want them.) These are pins D11, D6, and D5 on the SERVO header.
- The Tone output 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.
The board should be powered from the motor supply. This is normally 12VDC (RAMPS) or up to 24VDC for the MKS Gen-L.
There are 3 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 power connector on the RAMPS1.4, MKS Gen-L, etc.
- The USB connector on the Mega2560, MKS Gen-L, etc. (see below.)
- The power connector on the Mega2560 (if used.)
If using SSS TMC2208, TMC2130, or TMC2100 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
- 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 Mega2560 or MKS Gen-L have 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.
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):
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.)
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 SPI interface is available on the EXP-2 (or AUX-3 for RAMPS) connector.
The wiring is shown below:
EXP-2 DS3234 BME280
GND ---- GND ---- GND
5V ---- VCC ---- VCC
SCK D52 ---- SCK ---- SCK
MISO D50 ---- MISO ---- MISO
MOSI D51 ---- MOSI ---- MOSI
SS D53 ---- SS
SS D49 ------------------- SS
END STOP X+
D2(PPS) ---- SQW
This is available on the RAMPS board near the "end stops" and is labeled I2C. It is not present on the MKS Gen-L. This connector provides an I2C connection with 5v power and with built-in pulls.
- The DS3231 RTC.
- The BME280 environmental sensor (temperature, barometric pressure, humidity.)
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.
Note: There are filtering capacitors and pull-up resistors on these pins which will disrupt comms (MKS Gen-L.) Serial1 RX1/TX1 does work with the standard RAMPS1.4 board but other variations might not (unless modified.)
- The Serial2 port (called SerialC in OnStep) is on the EXP-2 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, the Sparkfun Bluetooth Mate Silver (an RN42, setup like this) can be jumpered right in (no level conversion circuitry is necessary.) An HC05 or HC06 module can also work but will require level conversion circuitry going to its RX pin and I'll leave that to the user (google "hc05 voltage divider".) In both cases refer to the module's manual or hookup guide to be sure the device is in slave mode and operating at 9600 baud.
- 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.
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.