Options for a serial connection on a RAMPS board
The ATmega 2560 microcontroller on the Arduino MEGA 2560 most often used in combination with a RAMPS board provides 4 serial ports. Serial 0 is used for the USB port, so there are 3 ports remaining which can be used to wire up the MMU2.
- Serial1 on pins 18 (TX) and 19 (RX)
- Serial2 on pins 16 (TX) and 17 (RX)
- Serial3 on pins 14 (TX) and 15 (RX)
Unfortunately the pins for Serial1 and Serial3 on the RAMPS are used for Y and Z endstops. Therefore the best option would be Serial2 but pins 16 and 17 are located at the AUX4 connector which is often used to connect an LCD.
Serial1
The pins 18 and 19 for Serial1 by default are used for the Zmin and Zmax endstop connectors. In case your printer uses no more than 4 endstops, you can use Xmin, Xmax, Ymin, Ymax for your endstops leaving pins 18/19 free to use as a serial port. To do so you have to modify pinsRAMPS.h in the Marlin sources accordingly.
Let’s assume you have the common setup of three min endstops für X, Y, Z and you have connected them to Xmin (X), Ymin(Y), Ymax(Z). In that case the endstop pins in pinsRAMPS.h would be
#define X_MIN_PIN 3
#define X_MAX_PIN 2
#define Y_MIN_PIN 14
#define Y_MAX_PIN -1
#define Z_MIN_PIN 15
#define Z_MAX_PIN -1
Now you can connect the white wire from the MMU2 (RX) to the Zmin signal pin (pin 18/TX) and the green wire (TX) to Zmax (pin 19/RX). In the Marlin configuration you define port 1 for the MMU2 serial connection.
Serial2
If pins 16 and 17 are unused on your board you just have to connect the white wire from the MMU2 (RX) to the pin 16 (TX) and the green wire (TX) to pin 17 (RX). In the Marlin configuration you define port 2 for the MMU2 serial connection.
Serial3
This is simular to Serial1. The pins 14 and 15 for Serial3 by default are used for the Ymin and Ymax endstop connectors. In case your printer uses no more than 4 endstops, you can use Xmin, Xmax, Zmin, Zmax for your endstops leaving pins 14/14 free to use as a serial port. To do so you have to modify pinsRAMPS.h in the Marlin sources accordingly.
Let’s assume you have the common setup of three min endstops für X, Y, Z and you have connected them to Xmin (X), Xmax(Y), Zmin(Z). In that case the endstop pins in pinsRAMPS.h would be
#define X_MIN_PIN 3
#define X_MAX_PIN -1
#define Y_MIN_PIN 2
#define Y_MAX_PIN -1
#define Z_MIN_PIN 18
#define Z_MAX_PIN -1
Now you can connect the white wire from the MMU2 (RX) to the Ymin signal pin (pin 14/TX) and the green wire (TX) to Ymax (pin 15/RX). In the Marlin configuration you define port 3 for the MMU2 serial connection.